using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using GZTW.AyaNova.BLL; public partial class WorkorderSelector : BaseThemePage { private Guid mclientID = Guid.Empty; private Guid CurrentClientID { get { if(mclientID==Guid.Empty) mclientID=new Guid(Request.QueryString["id"].ToString()); return mclientID; } } protected void Page_Load(object sender, EventArgs e) { if (Util.CurrentUser.IsClientOrHeadOfficeAccount || AyaBizUtils.Right("Object.WorkorderService") < (int)SecurityLevelTypes.ReadOnly) { Util.Denied(Context); } if (!IsPostBack) LoadCombo(); Util.Localize(this.Page); } private void LoadCombo() { WorkorderPickList PickList = WorkorderPickList.GetListByClient(CurrentClientID); foreach (WorkorderPickList.WorkorderPickListInfo pfo in PickList) { cbWorkorder.Items.Add(new Telerik.Web.UI.RadComboBoxItem( pfo.ServiceNumber + " - " + pfo.ServiceDate.ToString()+ " - " + pfo.Summary, pfo.ID.ToString())); } } //private RootObjectTypes mBaseObject = RootObjectTypes.Nothing; //private RootObjectTypes BaseObject //{ // get // { // if (mBaseObject == RootObjectTypes.Nothing) // { // //preset from maingrid, however we're here from somewhere else // //i.e. the schedule then default to service workorder // if (Session["ActiveObjectType"] == null) // return RootObjectTypes.WorkorderService; // mBaseObject = (RootObjectTypes)Session["ActiveObjectType"]; // } // return mBaseObject; // } //} protected void btnOK_Click(object sender, ImageClickEventArgs e) { Guid woid = Util.ComboValue(cbWorkorder); if (woid == Guid.Empty) return; ClientServiceRequest csr=(ClientServiceRequest)Session["ClientServiceRequest"]; if(csr==null) throw new ApplicationException("WorkorderSelector: Could not find client service request in session"); //Generate workorder Workorder w = csr.AcceptToWorkorder(woid); string toUrl = "WorkorderEdit.aspx?id=" + w.ID.ToString(); Response.Redirect(toUrl, true); } }