Basf_FCL/FCL/FineUIPro.Web/SES/SESReportEdit.aspx.cs

195 lines
12 KiB
C#

using BLL;
using System;
namespace FineUIPro.Web.SES
{
public partial class SESReportEdit : PageBase
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
string id = Request.Params["id"];
if (!string.IsNullOrEmpty(id))
{
Model.FC_SESReport report = BLL.SESReportService.GetSESReportById(id);
if (report != null)
{
this.txtSES_No.Text = report.SES_No;
this.txtShort_Descrption.Text = report.Short_Descrption;
if (report.Start_Date.HasValue)
{
this.txtStart_Date.Text = string.Format("{0:yyyy-MM-dd}", report.Start_Date);
}
if (report.End_Date.HasValue)
{
this.txtEnd_Date.Text = string.Format("{0:yyyy-MM-dd}", report.End_Date);
}
this.txtCreated_by.Text = report.Created_by;
if (report.Created_on.HasValue)
{
this.txtCreated_on.Text = string.Format("{0:yyyy-MM-dd}", report.Created_on);
}
if (report.TECO_Date.HasValue)
{
this.txtTECO_Date.Text = string.Format("{0:yyyy-MM-dd}", report.TECO_Date);
}
if (report.TECO_Format.HasValue)
{
this.txtTECO_Format.Text = string.Format("{0:yyyy-MM-dd}", report.TECO_Format);
}
this.txtRequisitioner.Text = report.Requisitioner;
this.txtFO.Text = report.FO;
this.txtItem.Text = report.Item.HasValue ? report.Item.Value.ToString("0.##") : "";
this.txtVendor_Name.Text = report.Vendor_Name;
this.txtDiscipline.Text = report.Discipline;
this.txtSSR_budget.Text = report.SSR_budget.HasValue ? report.SSR_budget.Value.ToString("0.##") : "";
this.txtCurrency.Text = report.Currency;
this.txtContractor_quotation.Text = report.Contractor_quotation.HasValue ? report.Contractor_quotation.Value.ToString("0.##") : "";
this.txtSSR_Actual_cost.Text = report.SSR_Actual_cost.HasValue ? report.SSR_Actual_cost.Value.ToString("0.##") : "";
this.txtCost_checker.Text = report.Cost_checker;
this.txtTax_rate.Text = report.Tax_rate.HasValue ? report.Tax_rate.Value.ToString("0.##") : "";
this.txtChanged_by.Text = report.Changed_by;
this.txtDeviation.Text = report.Deviation.HasValue ? report.Deviation.Value.ToString("0.##") : "";
this.txtDeviation_Percentage.Text = report.Deviation_Percentage.HasValue ? report.Deviation_Percentage.Value.ToString("0.##") : "";
this.txtOverrun.Text = report.Overrun;
this.txtLong_text.Text = report.Long_text;
this.txtWork_Order.Text = report.Work_Order.HasValue ? report.Work_Order.Value.ToString("0.##") : "";
this.txtFunction_location.Text = report.Function_location;
this.txtMain_work_center.Text = report.Main_work_center;
this.txtWork_Center.Text = report.Work_Center;
//this.txtDep.Text = report.Dep;
//this.txtSection.Text = report.Section;
this.txtCost_center.Text = report.Cost_center;
this.txtWBS.Text = report.WBS;
this.txtNetwork.Text = report.Network;
if (report.TODAY.HasValue)
{
this.txtTODAY.Text = string.Format("{0:yyyy-MM-dd}", report.TODAY);
}
if (report.Claim_sheets_receive.HasValue)
{
this.txtClaim_sheets_receive.Text = string.Format("{0:yyyy-MM-dd}", report.Claim_sheets_receive);
}
if (report.CS_REC_Format.HasValue)
{
this.txtCS_REC_Format.Text = string.Format("{0:yyyy-MM-dd}", report.CS_REC_Format);
}
this.txtNo_SUBM_To_today.Text = report.No_SUBM_To_today;
this.txtContractor_duration.Text = report.Contractor_duration.HasValue ? report.Contractor_duration.Value.ToString("0.##") : "";
if (report.Engineer_confirmed_o.HasValue)
{
this.txtEngineer_confirmed_o.Text = string.Format("{0:yyyy-MM-dd}", report.Engineer_confirmed_o);
}
if (report.ENG_CONF_Format.HasValue)
{
this.txtENG_CONF_Format.Text = string.Format("{0:yyyy-MM-dd}", report.ENG_CONF_Format);
}
this.txtNo_BoQ_CONF_to_today.Text = report.No_BoQ_CONF_to_today;
this.txtBoQ_confirmation_dur.Text = report.BoQ_confirmation_dur.HasValue ? report.BoQ_confirmation_dur.Value.ToString("0.##") : "";
if (report.SES_Confirmed_on.HasValue)
{
this.txtSES_Confirmed_on.Text = string.Format("{0:yyyy-MM-dd}", report.SES_Confirmed_on);
}
if (report.SES_CONF_Format.HasValue)
{
this.txtSES_CONF_Format.Text = string.Format("{0:yyyy-MM-dd}", report.SES_CONF_Format);
}
this.txtNo_SES_to_today.Text = report.No_SES_to_today;
this.txtSettlement_duration.Text = report.Settlement_duration.HasValue ? report.Settlement_duration.Value.ToString("0.##") : "";
if (report.Invoiced_on.HasValue)
{
this.txtInvoiced_on.Text = string.Format("{0:yyyy-MM-dd}", report.Invoiced_on);
}
this.txtInvoice_duration.Text = report.Invoice_duration.HasValue ? report.Invoice_duration.Value.ToString("0.##") : "";
if (report.Payment_made_on.HasValue)
{
this.txtPayment_made_on.Text = string.Format("{0:yyyy-MM-dd}", report.Payment_made_on);
}
this.txtPayment_duration.Text = report.Payment_duration.HasValue ? report.Payment_duration.Value.ToString("0.##") : "";
this.txtRemark.Text = report.Remark1;
this.txtAccepted.Text = report.Accepted;
this.txtBlocked.Text = report.Blocked;
this.txtDeleted.Text = report.Deleted;
}
}
}
}
/// <summary>
/// 保存
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSave_Click(object sender, EventArgs e)
{
string id = Request.Params["id"];
Model.FC_SESReport newSESReport = new Model.FC_SESReport();
newSESReport.SES_No = this.txtSES_No.Text.Trim();
newSESReport.Short_Descrption = this.txtShort_Descrption.Text.Trim();
newSESReport.Start_Date = Funs.GetNewDateTime(this.txtStart_Date.Text.Trim());
newSESReport.End_Date = Funs.GetNewDateTime(this.txtEnd_Date.Text.Trim());
newSESReport.Created_by = this.txtCreated_by.Text.Trim();
newSESReport.Created_on = Funs.GetNewDateTime(this.txtCreated_on.Text.Trim());
newSESReport.TECO_Date = Funs.GetNewDateTime(this.txtTECO_Date.Text.Trim());
newSESReport.TECO_Format = Funs.GetNewDateTime(this.txtTECO_Format.Text.Trim());
newSESReport.Requisitioner = this.txtRequisitioner.Text.Trim();
newSESReport.FO = this.txtFO.Text.Trim();
newSESReport.Item = int.Parse(this.txtItem.Text.Trim());
newSESReport.Vendor_Name = this.txtVendor_Name.Text.Trim();
newSESReport.Discipline = this.txtDiscipline.Text.Trim();
newSESReport.SSR_budget = decimal.Parse(this.txtSSR_budget.Text.Trim());
newSESReport.Currency = this.txtCurrency.Text.Trim();
newSESReport.Contractor_quotation = decimal.Parse(this.txtContractor_quotation.Text.Trim());
newSESReport.SSR_Actual_cost = decimal.Parse(this.txtSSR_Actual_cost.Text.Trim());
newSESReport.Cost_checker = this.txtCost_checker.Text.Trim();
newSESReport.Tax_rate = decimal.Parse(this.txtTax_rate.Text.Trim());
newSESReport.Changed_by = this.txtChanged_by.Text.Trim();
newSESReport.Deviation = decimal.Parse(this.txtDeviation.Text.Trim());
newSESReport.Deviation_Percentage = decimal.Parse(this.txtDeviation_Percentage.Text.Trim());
newSESReport.Overrun = this.txtOverrun.Text.Trim();
newSESReport.Long_text = this.txtLong_text.Text.Trim();
newSESReport.Work_Order = int.Parse(this.txtWork_Order.Text.Trim());
newSESReport.Function_location = this.txtFunction_location.Text.Trim();
newSESReport.Main_work_center = this.txtMain_work_center.Text.Trim();
newSESReport.Work_Center = this.txtWork_Center.Text.Trim();
//newSESReport.Dep = this.txtDep.Text.Trim();
//newSESReport.Section = this.txtSection.Text.Trim();
newSESReport.Cost_center = this.txtCost_center.Text.Trim();
newSESReport.WBS = this.txtWBS.Text.Trim();
newSESReport.Network = this.txtNetwork.Text.Trim();
newSESReport.TODAY = Funs.GetNewDateTime(this.txtTODAY.Text.Trim());
newSESReport.Claim_sheets_receive = Funs.GetNewDateTime(this.txtClaim_sheets_receive.Text.Trim());
newSESReport.CS_REC_Format = Funs.GetNewDateTime(this.txtCS_REC_Format.Text.Trim());
newSESReport.No_SUBM_To_today = this.txtNo_SUBM_To_today.Text.Trim();
newSESReport.Contractor_duration = int.Parse(this.txtContractor_duration.Text.Trim());
newSESReport.Engineer_confirmed_o = Funs.GetNewDateTime(this.txtEngineer_confirmed_o.Text.Trim());
newSESReport.ENG_CONF_Format = Funs.GetNewDateTime(this.txtENG_CONF_Format.Text.Trim());
newSESReport.No_BoQ_CONF_to_today = this.txtNo_BoQ_CONF_to_today.Text.Trim();
newSESReport.BoQ_confirmation_dur = decimal.Parse(this.txtBoQ_confirmation_dur.Text.Trim());
newSESReport.SES_Confirmed_on = Funs.GetNewDateTime(this.txtSES_Confirmed_on.Text.Trim());
newSESReport.SES_CONF_Format = Funs.GetNewDateTime(this.txtSES_CONF_Format.Text.Trim());
newSESReport.No_SES_to_today = this.txtNo_SES_to_today.Text.Trim();
newSESReport.Settlement_duration = decimal.Parse(this.txtSettlement_duration.Text.Trim());
newSESReport.Invoiced_on = Funs.GetNewDateTime(this.txtInvoiced_on.Text.Trim());
newSESReport.Invoice_duration = decimal.Parse(this.txtInvoice_duration.Text.Trim());
newSESReport.Payment_made_on = Funs.GetNewDateTime(this.txtPayment_made_on.Text.Trim());
newSESReport.Payment_duration = decimal.Parse(this.txtPayment_duration.Text.Trim());
newSESReport.Remark1 = this.txtRemark.Text.Trim();
newSESReport.Accepted = this.txtAccepted.Text.Trim();
newSESReport.Deleted = this.txtDeleted.Text.Trim();
newSESReport.Blocked = this.txtBlocked.Text.Trim();
if (!string.IsNullOrEmpty(id))
{
newSESReport.ID = Convert.ToInt32(id);
BLL.SESReportService.UpdateSESReport(newSESReport);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Modify SES Report!");
ShowNotify("Save successfully!", MessageBoxIcon.Success);
}
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
}
}
}