using BLL; using System; using System.Collections; using System.Collections.Generic; using System.Data; using System.Linq; using System.Threading.Tasks; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; namespace FineUIPro.Web.CQMS.ManageReport { public partial class QualityGoalEdit : PageBase { #region 公共字段 /// /// 主键 /// public string ReportId { get { return (string)ViewState["ReportId"]; } set { ViewState["ReportId"] = value; } } /// /// 办理类型 /// public string State { get { return (string)ViewState["State"]; } set { ViewState["State"] = value; } } #endregion protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ReportId = Request.Params["ReportId"]; var qualityGoal = Funs.DB.Report_QualityGoal.FirstOrDefault(x=>x.ReportId==ReportId); if (qualityGoal != null) { txtProTotal.Text = qualityGoal.Pro_Total.Value.ToString("0.##"); txtProPass.Text = qualityGoal.Pro_Pass.Value.ToString("0.##"); txtProNoPassRectify.Text = qualityGoal.Pro_NoPassRectify.Value.ToString("0.##"); txtSupTotal.Text = qualityGoal.Sup_Total.Value.ToString("0.##"); txtSupRectify.Text = qualityGoal.Sup_Rectify.Value.ToString("0.##"); txtSubTotal.Text = qualityGoal.Sub_Total.Value.ToString("0.##"); txtSubPass.Text = qualityGoal.Sub_Pass.Value.ToString("0.##"); txtWorkAreaTotal.Text = qualityGoal.WorkArea_Total.Value.ToString("0.##"); txtWorkAreaPass.Text = qualityGoal.WorkArea_Pass.Value.ToString("0.##"); txtKeyProTotal.Text = qualityGoal.KeyPro_Total.Value.ToString("0.##"); txtKeyProPass.Text = qualityGoal.KeyPro_Pass.Value.ToString("0.##"); txtWeldTotal.Text = qualityGoal.Weld_Total.Value.ToString("0.##"); txtWeldPass.Text = qualityGoal.Weld_Pass.Value.ToString("0.##"); txtDeviceWeldTotal.Text = qualityGoal.DeviceWeld_Total.Value.ToString("0.##"); txtDeviceWeldPass.Text = qualityGoal.DeviceWeld_Pass.Value.ToString("0.##"); txtSafetyInstructionTotal.Text = qualityGoal.SafetyInstruction_Total.Value.ToString("0.##"); txtSafetyInstructionPass.Text = qualityGoal.SafetyInstruction_Pass.Value.ToString("0.##"); txtManName.Text = qualityGoal.ManName; txtManOcpu.Text = qualityGoal.ManOcpu; txtRemark.Text = qualityGoal.Remark; if (qualityGoal.Date.HasValue) { dpDate.Text = qualityGoal.Date.Value.ToString("yyyy-MM-dd"); } if (qualityGoal.IsSample.HasValue) { if (qualityGoal.IsSample.Value) { rbButton.SelectedIndex = 0; } else { rbButton.SelectedIndex = 1; } } } } } protected void btnSave_Click(object sender, EventArgs e) { //string projectId, string userId, string menuId, string buttonName) if (BLL.CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.CheckListMenuId, BLL.Const.BtnSave)) { Model.Report_QualityGoal qualityGoal = new Model.Report_QualityGoal(); if (string.IsNullOrEmpty(ReportId)) { qualityGoal.ReportId = Guid.NewGuid().ToString(); } else { qualityGoal = Funs.DB.Report_QualityGoal.FirstOrDefault(x => x.ReportId == ReportId); } qualityGoal.ProjectId = CurrUser.LoginProjectId; qualityGoal.Pro_Total = decimal.Parse( txtProTotal.Text); qualityGoal.Pro_Pass = decimal.Parse(txtProPass.Text); qualityGoal.Pro_NoPassRectify = decimal.Parse(txtProNoPassRectify.Text); qualityGoal.Sup_Total = decimal.Parse(txtSupTotal.Text); qualityGoal.Sup_Rectify = decimal.Parse(txtSupRectify.Text); qualityGoal.Sub_Total = decimal.Parse(txtSubTotal.Text); qualityGoal.Sub_Pass = decimal.Parse(txtSubPass.Text); qualityGoal.WorkArea_Total = decimal.Parse(txtWorkAreaTotal.Text); qualityGoal.WorkArea_Pass = decimal.Parse(txtWorkAreaPass.Text); qualityGoal.KeyPro_Total = decimal.Parse(txtKeyProTotal.Text); qualityGoal.KeyPro_Pass = decimal.Parse(txtKeyProPass.Text); qualityGoal.Weld_Total = decimal.Parse(txtWeldTotal.Text); qualityGoal.Weld_Pass = decimal.Parse(txtWeldPass.Text); qualityGoal.DeviceWeld_Total = decimal.Parse(txtDeviceWeldTotal.Text); qualityGoal.DeviceWeld_Pass = decimal.Parse(txtDeviceWeldPass.Text); qualityGoal.SafetyInstruction_Total = decimal.Parse(txtSafetyInstructionTotal.Text); qualityGoal.SafetyInstruction_Pass = decimal.Parse(txtSafetyInstructionPass.Text); qualityGoal.ManName = txtManName.Text; qualityGoal.ManOcpu = txtManOcpu.Text; qualityGoal.Remark = txtRemark.Text; if (rbButton.SelectedIndex == 0) { qualityGoal.IsSample = true; } else { qualityGoal.IsSample = false; } qualityGoal.Date = dpDate.SelectedDate; if (string.IsNullOrEmpty(ReportId)) { Funs.DB.Report_QualityGoal.InsertOnSubmit(qualityGoal); } Funs.DB.SubmitChanges(); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } else { Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning); } } } }