This commit is contained in:
132
source/MBI/labor.aspx.cs
Normal file
132
source/MBI/labor.aspx.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
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 labor : System.Web.UI.Page
|
||||
{
|
||||
|
||||
#region BizObject
|
||||
public GZTW.AyaNova.BLL.WorkorderItemLabor mLabor;
|
||||
protected GZTW.AyaNova.BLL.WorkorderItemLabor CurrentLabor
|
||||
{
|
||||
get
|
||||
{
|
||||
if (mLabor != null) return mLabor;
|
||||
|
||||
|
||||
//This form only edits workorder items that already exist and
|
||||
//there is no option to re-edit after initial edit, i.e. all buttons will close this
|
||||
//page and return so there is no need to cache anything
|
||||
|
||||
string idstring = Request.QueryString["id"];
|
||||
if (util.mt(idstring))
|
||||
throw new ApplicationException("labor - id not specified");
|
||||
Guid oID = new Guid(idstring);
|
||||
mWorkorder = Workorder.GetWorkorderByRelative(RootObjectTypes.WorkorderItemLabor, oID);
|
||||
mLabor = mWorkorder.WorkorderItems[mWorkorder.GetWorkorderItemIDFromDescendant(RootObjectTypes.WorkorderItemLabor, oID)].Labors[oID.ToString()];
|
||||
|
||||
return mLabor;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Workorder mWorkorder=null;
|
||||
protected Workorder CurrentWorkorder
|
||||
{
|
||||
|
||||
get
|
||||
{
|
||||
if (mWorkorder == null)
|
||||
CurrentLabor.ToString();//forces mworkorder to be set
|
||||
return mWorkorder;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
util.Localize(this);
|
||||
SetData();
|
||||
}
|
||||
|
||||
if (!CurrentWorkorder.IsEditable ||
|
||||
!CurrentWorkorder.IsWorkorderItemEditable ||
|
||||
AyaBizUtils.Right("Object.WorkorderItemLabor") < (int)SecurityLevelTypes.ReadWrite)
|
||||
{
|
||||
util.SetReadOnly(this);
|
||||
bcancel.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void SetData()
|
||||
{
|
||||
WorkorderItemLabor l=CurrentLabor;
|
||||
edstart.Text = l.ServiceStartDate.ToString();
|
||||
edstop.Text = l.ServiceStopDate.ToString();
|
||||
edquant.Text = l.ServiceRateQuantity.ToString("g29");
|
||||
ednc.Text = l.NoChargeQuantity.ToString("g29");
|
||||
eddetails.Text = l.ServiceDetails;
|
||||
|
||||
cbrate.DataSource = util.GetDataBiz("LaborRateList", l.ServiceRateID, true, CurrentWorkorder.ContractIDResolved(), CurrentWorkorder.ListOfLaborRatesSelected(), true);
|
||||
cbrate.DataTextField = "Display";
|
||||
cbrate.DataValueField = "Value";
|
||||
cbrate.SelectedValue = l.ServiceRateID.ToString();
|
||||
cbrate.DataBind();
|
||||
|
||||
cbtax.DataSource = util.GetDataBiz("TaxCode", l.TaxRateSaleID, true, Guid.Empty, null, false);
|
||||
cbtax.DataTextField = "Display";
|
||||
cbtax.DataValueField = "Value";
|
||||
cbtax.SelectedValue = l.TaxRateSaleID.ToString();
|
||||
cbtax.DataBind();
|
||||
|
||||
bok.Text = util.LocaleText("UI.Command.OK");
|
||||
}
|
||||
|
||||
private void GetData()
|
||||
{
|
||||
WorkorderItemLabor l = CurrentLabor;
|
||||
l.ServiceStartDate = util.ParseDateToDbValue(edstart);
|
||||
l.ServiceStopDate = util.ParseDateToDbValue(edstop);
|
||||
l.ServiceRateQuantity = util.ParseDecimal(edquant);
|
||||
l.NoChargeQuantity = util.ParseDecimal(ednc);
|
||||
l.ServiceRateID = util.ParseGuid(Request.Form["cbrate"]);
|
||||
l.TaxRateSaleID = util.ParseGuid(Request.Form["cbtax"]);
|
||||
l.ServiceDetails = eddetails.Text;
|
||||
|
||||
}
|
||||
|
||||
protected void bok_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (CurrentWorkorder.IsEditable)
|
||||
{
|
||||
GetData();
|
||||
CurrentWorkorder.Save();
|
||||
}
|
||||
util.Redirect(Session, Response, "schedule.aspx");
|
||||
}
|
||||
|
||||
protected void bcancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
util.Redirect(Session, Response, "schedule.aspx");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user