This commit is contained in:
87
source/MBI/status.aspx.cs
Normal file
87
source/MBI/status.aspx.cs
Normal file
@@ -0,0 +1,87 @@
|
||||
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;
|
||||
|
||||
namespace AyaNovaMBI
|
||||
{
|
||||
public partial class status : System.Web.UI.Page
|
||||
{
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
Guid woitemid = util.GetIDFromRequest(Request);
|
||||
//case 1153 added a hidden label field to temporarily hold the workorderitem id number
|
||||
//because on Joyce's two test machines and the haveabyte demo machine it was losing the url id= parameter
|
||||
//on postback but not on my dev machine and not anywhere in any other pages in MBI that rely on the
|
||||
//same mechanism. Tried everything and examined it all ways and could find nothing out of the ordinary and
|
||||
//no search online revealed this to be a known problem of any kind
|
||||
//very weird and even weirder that it initially has no problem on first page load, just on postback
|
||||
|
||||
//anyway the hidden label field fixes the problem so workaround it is.
|
||||
|
||||
if (woitemid == Guid.Empty)
|
||||
{
|
||||
if (string.IsNullOrEmpty(lblid.Text))
|
||||
throw new System.ApplicationException("Error in status - unable to determine workorder item id.");
|
||||
woitemid = new Guid(lblid.Text);
|
||||
}
|
||||
else
|
||||
{
|
||||
lblid.Text = woitemid.ToString();
|
||||
}
|
||||
Workorder w = null;
|
||||
WorkorderItem wi = null;
|
||||
|
||||
w = Workorder.GetWorkorderByRelativeNoMRU(RootObjectTypes.WorkorderItem, woitemid);
|
||||
wi = w.WorkorderItems[woitemid];
|
||||
|
||||
if (IsPostBack)
|
||||
{
|
||||
//Get selected value from form variables
|
||||
//because when viewstate is off controlstate doesn't handle selected value in
|
||||
//dropdownlists (while it *does* for text boxes etc which makes no sense)
|
||||
if (!util.mt(Request.Form["stat"]))
|
||||
wi.WorkorderStatusID = new Guid(Request.Form["stat"]);
|
||||
if (w.IsDirty)
|
||||
w = (Workorder)w.Save();
|
||||
if (!util.mt(Session["ret"]))
|
||||
{
|
||||
Response.Redirect(Session["ret"].ToString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
WorkorderStatusPickList p = WorkorderStatusPickList.GetList();
|
||||
foreach (WorkorderStatusPickList.WorkorderStatusPickListInfo i in p)
|
||||
{
|
||||
//case 1916 weed out inactive statuses unless preselected
|
||||
if (i.Active || i.ID == wi.WorkorderStatusID)
|
||||
{
|
||||
ListItem li = new ListItem(i.Name, i.ID.ToString());
|
||||
if (i.ID == wi.WorkorderStatusID)
|
||||
li.Selected = true;
|
||||
|
||||
stat.Items.Add(li);
|
||||
}
|
||||
}
|
||||
|
||||
btn.Text = util.LocaleText("UI.Command.OK");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//---------------------------------------
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user