private object GetEditObject() { if (this.ValidateInput()) { if (_spcFacade == null) { _spcFacade = new FacadeFactory(base.DataProvider).CreateSPCFacade(); } SPCItemSpec obj = this._spcFacade.CreateNewSPCItemSpec(); obj.ItemCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.txtItemCodeEdit.Text, 40)); obj.ObjectCode = FormatHelper.PKCapitalFormat(FormatHelper.CleanString(this.drpObjectCodeEdit.SelectedValue)); obj.GroupSeq = Convert.ToInt32(FormatHelper.CleanString(this.txtGroupSeqEdit.Text)); obj.ConditionName = FormatHelper.CleanString(this.txtConditionEdit.Text, 40); obj.Memo = FormatHelper.CleanString(this.txtMemoEdit.Text, 100); obj.AutoCL = this.chbAutoCLEdit.Checked ? FormatHelper.TRUE_STRING : FormatHelper.FALSE_STRING; obj.LimitLowOnly = this.chbLowEdit.Checked ? FormatHelper.TRUE_STRING : FormatHelper.FALSE_STRING; obj.LimitUpOnly = this.chbUpEdit.Checked ? FormatHelper.TRUE_STRING : FormatHelper.FALSE_STRING; obj.LCL = FormatHelper.CleanString(this.txtLCLEdit.Text) == string.Empty ? 0 : Convert.ToDecimal(FormatHelper.CleanString(this.txtLCLEdit.Text)); obj.UCL = FormatHelper.CleanString(this.txtUCLEdit.Text) == string.Empty ? 0 : Convert.ToDecimal(FormatHelper.CleanString(this.txtUCLEdit.Text)); obj.LSL = FormatHelper.CleanString(this.txtLSLEdit.Text) == string.Empty ? 0 : Convert.ToDecimal(FormatHelper.CleanString(this.txtLSLEdit.Text)); obj.USL = FormatHelper.CleanString(this.txtUSLEdit.Text) == string.Empty ? 0 : Convert.ToDecimal(FormatHelper.CleanString(this.txtUSLEdit.Text)); obj.MaintainUser = this.GetUserCode(); return(obj); } else { return(null); } }
private void UpdateItem2Dimention(SPCItemSpec spcItemSpec, string maxParam, string minParam, bool delete) { ItemFacade facade = new FacadeFactory(base.DataProvider).CreateItemFacade(); object obj = null; obj = facade.GetItem2Dimention(spcItemSpec.ItemCode, maxParam, GlobalVariables.CurrentOrganizations.First().OrganizationID); if (obj != null) { if (delete == false) { (obj as Item2Dimention).ParamValue = spcItemSpec.USL; (obj as Item2Dimention).MaintainUser = this.GetUserCode(); facade.UpdateItem2Dimention(obj as Item2Dimention); } else { facade.DeleteItem2Dimention(obj as Item2Dimention); } } else if (delete == false) { obj = facade.CreateNewItem2Dimention(); (obj as Item2Dimention).ItemCode = spcItemSpec.ItemCode; (obj as Item2Dimention).ParamName = maxParam; (obj as Item2Dimention).ParamValue = spcItemSpec.USL; (obj as Item2Dimention).MaintainUser = this.GetUserCode(); (obj as Item2Dimention).OrganizationID = GlobalVariables.CurrentOrganizations.First().OrganizationID; facade.AddItem2Dimention(obj as Item2Dimention); } obj = facade.GetItem2Dimention(spcItemSpec.ItemCode, minParam, GlobalVariables.CurrentOrganizations.First().OrganizationID); if (obj != null) { if (delete == false) { (obj as Item2Dimention).ParamValue = spcItemSpec.LSL; (obj as Item2Dimention).MaintainUser = this.GetUserCode(); facade.UpdateItem2Dimention(obj as Item2Dimention); } else { facade.DeleteItem2Dimention(obj as Item2Dimention); } } else if (delete == false) { obj = facade.CreateNewItem2Dimention(); (obj as Item2Dimention).ItemCode = spcItemSpec.ItemCode; (obj as Item2Dimention).ParamName = minParam; (obj as Item2Dimention).ParamValue = spcItemSpec.LSL; (obj as Item2Dimention).MaintainUser = this.GetUserCode(); (obj as Item2Dimention).OrganizationID = GlobalVariables.CurrentOrganizations.First().OrganizationID; facade.AddItem2Dimention(obj as Item2Dimention); } }
private void SetEditObject(object obj) { if (obj == null) { this.txtItemCodeEdit.Text = string.Empty; this.drpObjectCodeEdit.SelectedIndex = -1; this.txtGroupSeqEdit.SelectedIndex = -1; this.txtConditionEdit.Text = string.Empty; this.txtColumnNamedit.Text = "0"; this.txtMemoEdit.Text = string.Empty; this.txtTestCount.Text = string.Empty; this.chbAutoCLEdit.Checked = false; this.chbUpEdit.Checked = false; this.chbLowEdit.Checked = false; this.txtUCLEdit.Text = string.Empty; this.txtLCLEdit.Text = string.Empty; this.txtUSLEdit.Text = string.Empty; this.txtLSLEdit.Text = string.Empty; return; } SPCItemSpec spcObj = obj as SPCItemSpec; this.txtItemCodeEdit.Text = spcObj.ItemCode.ToString(); //this.drpObjectCodeEdit.SelectedValue = spcObj.ObjectCode.ToString(); if (this.drpObjectCodeEdit.Items.FindByValue(spcObj.ObjectCode) != null) { this.drpObjectCodeEdit.SelectedIndex = this.drpObjectCodeEdit.Items.IndexOf(this.drpObjectCodeEdit.Items.FindByValue(spcObj.ObjectCode)); SetGroupSeqEdit(); this.txtGroupSeqEdit.Text = spcObj.GroupSeq.ToString("#0.##"); } else { this.drpObjectCodeEdit.SelectedIndex = -1; this.txtGroupSeqEdit.SelectedIndex = -1; } this.txtConditionEdit.Text = spcObj.ConditionName.ToString(); this.txtMemoEdit.Text = spcObj.Memo.ToString(); //this.txtTestCount.Text = spcObj.TestDataCount; this.chbAutoCLEdit.Checked = string.Compare(spcObj.AutoCL.ToString(), FormatHelper.TRUE_STRING, true) == 0 ? true : false; this.chbUpEdit.Checked = string.Compare(spcObj.LimitUpOnly.ToString(), FormatHelper.TRUE_STRING, true) == 0 ? true : false; this.chbLowEdit.Checked = string.Compare(spcObj.LimitLowOnly.ToString(), FormatHelper.TRUE_STRING, true) == 0 ? true : false; this.txtUCLEdit.Text = spcObj.UCL.ToString("##.##"); this.txtLCLEdit.Text = spcObj.LCL.ToString("##.##"); this.txtUSLEdit.Text = spcObj.USL.ToString("##.##"); this.txtLSLEdit.Text = spcObj.LSL.ToString("##.##"); }
protected DataRow GetGridRow(object obj) { SPCItemSpec spcObj = obj as SPCItemSpec; // return new Infragistics.WebUI.UltraWebGrid.UltraGridRow( // new object[]{ // false, // spcObj.ItemCode.ToString(), // this.drpObjectCodeQuery.Items.FindByValue(spcObj.ObjectCode.ToString()).Text, // spcObj.GroupSeq.ToString(), // spcObj.ConditionName.ToString(), //// spcObj.StoreColumn.ToString(), // //spcObj.TestDataCount, // this.languageComponent1.GetString(spcObj.AutoCL.ToString()), // this.languageComponent1.GetString(spcObj.LimitUpOnly.ToString()), // this.languageComponent1.GetString(spcObj.LimitLowOnly.ToString()), // spcObj.UCL.ToString("##.##"), // spcObj.LCL.ToString("##.##"), // spcObj.USL.ToString("##.##"), // spcObj.LSL.ToString("##.##"), // spcObj.Memo.ToString(), // spcObj.MaintainUser.ToString(), // FormatHelper.ToDateString(spcObj.MaintainDate), // FormatHelper.ToTimeString(spcObj.MaintainTime), // spcObj.ObjectCode.ToString(), // "" // }); DataRow row = this.DtSource.NewRow(); row["ItemCode"] = spcObj.ItemCode.ToString(); row["ObjectName"] = this.drpObjectCodeQuery.Items.FindByValue(spcObj.ObjectCode.ToString()).Text; row["GroupSeq"] = spcObj.GroupSeq.ToString(); row["TestCondition"] = spcObj.ConditionName.ToString(); row["AutoCL"] = this.languageComponent1.GetString(spcObj.AutoCL.ToString()); row["LimitUp"] = this.languageComponent1.GetString(spcObj.LimitUpOnly.ToString()); row["LimitLow"] = this.languageComponent1.GetString(spcObj.LimitLowOnly.ToString()); row["UCL"] = spcObj.UCL.ToString("##.##"); row["LCL"] = spcObj.LCL.ToString("##.##"); row["USL"] = spcObj.USL.ToString("##.##"); row["LSL"] = spcObj.LSL.ToString("##.##"); row["Memo"] = spcObj.Memo.ToString(); row["MUSER"] = spcObj.MaintainUser.ToString(); row["MDATE"] = FormatHelper.ToDateString(spcObj.MaintainDate); row["MTIME"] = FormatHelper.ToTimeString(spcObj.MaintainTime); row["ObjectCode"] = spcObj.ObjectCode.ToString(); return(row); }
private string[] FormatExportRecord(object obj) { SPCItemSpec spcObj = obj as SPCItemSpec; return(new string[] { spcObj.ItemCode.ToString(), this.drpObjectCodeQuery.Items.FindByValue(spcObj.ObjectCode.ToString()).Text, spcObj.GroupSeq.ToString(), spcObj.ConditionName.ToString(), // spcObj.StoreColumn.ToString(), this.languageComponent1.GetString(spcObj.AutoCL.ToString()), this.languageComponent1.GetString(spcObj.LimitUpOnly.ToString()), this.languageComponent1.GetString(spcObj.LimitLowOnly.ToString()), spcObj.UCL.ToString("##.##"), spcObj.LCL.ToString("##.##"), spcObj.USL.ToString("##.##"), spcObj.LSL.ToString("##.##"), spcObj.Memo.ToString(), spcObj.MaintainUser.ToString(), FormatHelper.ToDateString(spcObj.MaintainDate), FormatHelper.ToTimeString(spcObj.MaintainTime) }); }
private void UpdateTestCondion(SPCItemSpec spcItemSpec, bool delete) { if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.PT_ELECTRIC, true) == 0) { ItemFacade facade = new FacadeFactory(base.DataProvider).CreateItemFacade(); object obj = facade.GetItem(spcItemSpec.ItemCode, GlobalVariables.CurrentOrganizations.First().OrganizationID); if (obj != null) { (obj as Item).ElectricCurrentMaxValue = spcItemSpec.USL; (obj as Item).ElectricCurrentMinValue = spcItemSpec.LSL; (obj as Item).MaintainUser = this.GetUserCode(); facade.UpdateItem(obj as Item); } } else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DUTY_RATO, true) == 0) { OQCFacade facade = new FacadeFactory(base.DataProvider).CreateOQCFacade(); object obj = facade.GetOQCFuncTest(spcItemSpec.ItemCode); if (obj != null) { if (delete == false) { (obj as OQCFuncTest).MinDutyRatoMax = spcItemSpec.USL; (obj as OQCFuncTest).MinDutyRatoMin = spcItemSpec.LSL; (obj as OQCFuncTest).MaintainUser = this.GetUserCode(); facade.UpdateOQCFuncTest(obj as OQCFuncTest); } else { (obj as OQCFuncTest).MinDutyRatoMax = 0; (obj as OQCFuncTest).MinDutyRatoMin = 0; (obj as OQCFuncTest).MaintainUser = this.GetUserCode(); facade.UpdateOQCFuncTest(obj as OQCFuncTest); } } else if (delete == false) { obj = facade.CreateNewOQCFuncTest(); (obj as OQCFuncTest).ItemCode = spcItemSpec.ItemCode; (obj as OQCFuncTest).MinDutyRatoMax = spcItemSpec.USL; (obj as OQCFuncTest).MinDutyRatoMin = spcItemSpec.LSL; (obj as OQCFuncTest).MaintainUser = this.GetUserCode(); facade.AddOQCFuncTest(obj as OQCFuncTest); } } else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_BURST_MD, true) == 0) { OQCFacade facade = new FacadeFactory(base.DataProvider).CreateOQCFacade(); object obj = facade.GetOQCFuncTest(spcItemSpec.ItemCode); if (obj != null) { if (delete == false) { (obj as OQCFuncTest).BurstMdFreMax = spcItemSpec.USL; (obj as OQCFuncTest).BurstMdFreMin = spcItemSpec.LSL; (obj as OQCFuncTest).MaintainUser = this.GetUserCode(); facade.UpdateOQCFuncTest(obj as OQCFuncTest); } else { (obj as OQCFuncTest).BurstMdFreMax = 0; (obj as OQCFuncTest).BurstMdFreMin = 0; (obj as OQCFuncTest).MaintainUser = this.GetUserCode(); facade.UpdateOQCFuncTest(obj as OQCFuncTest); } } else if (delete == false) { obj = facade.CreateNewOQCFuncTest(); (obj as OQCFuncTest).ItemCode = spcItemSpec.ItemCode; (obj as OQCFuncTest).BurstMdFreMax = spcItemSpec.USL; (obj as OQCFuncTest).BurstMdFreMin = spcItemSpec.LSL; (obj as OQCFuncTest).MaintainUser = this.GetUserCode(); facade.AddOQCFuncTest(obj as OQCFuncTest); } } else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_FT_FREQUENCY, true) == 0) { OQCFacade facade = new FacadeFactory(base.DataProvider).CreateOQCFacade(); object obj = facade.GetOQCFuncTestSpec(spcItemSpec.ItemCode, spcItemSpec.GroupSeq); if (obj != null) { if (delete == false) { (obj as OQCFuncTestSpec).FreMax = spcItemSpec.USL; (obj as OQCFuncTestSpec).FreMin = spcItemSpec.LSL; (obj as OQCFuncTestSpec).MaintainUser = this.GetUserCode(); facade.UpdateOQCFuncTestSpec(obj as OQCFuncTestSpec); } else { object objTmp = this._spcFacade.GetSPCItemSpec(spcItemSpec.ItemCode, spcItemSpec.GroupSeq, SPCObjectList.OQC_FT_ELECTRIC); if (objTmp == null) { facade.DeleteOQCFuncTestSpec(obj as OQCFuncTestSpec); } else { (obj as OQCFuncTestSpec).FreMax = 0; (obj as OQCFuncTestSpec).FreMin = 0; (obj as OQCFuncTestSpec).MaintainUser = this.GetUserCode(); facade.UpdateOQCFuncTestSpec(obj as OQCFuncTestSpec); } } } else if (delete == false) { obj = facade.CreateNewOQCFuncTestSpec(); (obj as OQCFuncTestSpec).ItemCode = spcItemSpec.ItemCode; (obj as OQCFuncTestSpec).GroupSequence = spcItemSpec.GroupSeq; (obj as OQCFuncTestSpec).FreMax = spcItemSpec.USL; (obj as OQCFuncTestSpec).FreMin = spcItemSpec.LSL; (obj as OQCFuncTestSpec).MaintainUser = this.GetUserCode(); facade.AddOQCFuncTestSpec(obj as OQCFuncTestSpec); } } else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_FT_ELECTRIC, true) == 0) { OQCFacade facade = new FacadeFactory(base.DataProvider).CreateOQCFacade(); object obj = facade.GetOQCFuncTestSpec(spcItemSpec.ItemCode, spcItemSpec.GroupSeq); if (obj != null) { if (delete == false) { (obj as OQCFuncTestSpec).ElectricMax = spcItemSpec.USL; (obj as OQCFuncTestSpec).ElectricMin = spcItemSpec.LSL; (obj as OQCFuncTestSpec).MaintainUser = this.GetUserCode(); facade.UpdateOQCFuncTestSpec(obj as OQCFuncTestSpec); } else { object objTmp = this._spcFacade.GetSPCItemSpec(spcItemSpec.ItemCode, spcItemSpec.GroupSeq, SPCObjectList.OQC_FT_FREQUENCY); if (objTmp == null) { facade.DeleteOQCFuncTestSpec(obj as OQCFuncTestSpec); } else { (obj as OQCFuncTestSpec).ElectricMax = 0; (obj as OQCFuncTestSpec).ElectricMin = 0; (obj as OQCFuncTestSpec).MaintainUser = this.GetUserCode(); facade.UpdateOQCFuncTestSpec(obj as OQCFuncTestSpec); } } } else if (delete == false) { obj = facade.CreateNewOQCFuncTestSpec(); (obj as OQCFuncTestSpec).ItemCode = spcItemSpec.ItemCode; (obj as OQCFuncTestSpec).GroupSequence = spcItemSpec.GroupSeq; (obj as OQCFuncTestSpec).ElectricMax = spcItemSpec.USL; (obj as OQCFuncTestSpec).ElectricMin = spcItemSpec.LSL; (obj as OQCFuncTestSpec).MaintainUser = this.GetUserCode(); facade.AddOQCFuncTestSpec(obj as OQCFuncTestSpec); } } else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_LENGTH, true) == 0) { UpdateItem2Dimention(spcItemSpec, "LengthMax", "LengthMin", delete); } else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_WIDTH, true) == 0) { UpdateItem2Dimention(spcItemSpec, "WidthMax", "WidthMin", delete); } else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_BOARDHEIGHT, true) == 0) { UpdateItem2Dimention(spcItemSpec, "BoardHeightMax", "BoardHeightMin", delete); } else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_HEIGHT, true) == 0) { UpdateItem2Dimention(spcItemSpec, "HeightMax", "HeightMin", delete); } else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_ALLHEIGHT, true) == 0) { UpdateItem2Dimention(spcItemSpec, "AllHeightMax", "AllHeightMin", delete); } else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_LEFT2RIGHT, true) == 0) { UpdateItem2Dimention(spcItemSpec, "Left2RightMax", "Left2RightMin", delete); } else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_LEFT2MIDDLE, true) == 0) { UpdateItem2Dimention(spcItemSpec, "Left2MiddleMax", "Left2MiddleMin", delete); } else if (string.Compare(spcItemSpec.ObjectCode, SPCObjectList.OQC_DIM_RIGHT2MIDDLE, true) == 0) { UpdateItem2Dimention(spcItemSpec, "Right2MiddleMax", "Right2MiddleMin", delete); } }
public void DeleteSPCItemSpec(SPCItemSpec sPCItemSpec) { this._helper.DeleteDomainObject(sPCItemSpec); }
public void UpdateSPCItemSpec(SPCItemSpec sPCItemSpec) { this._helper.UpdateDomainObject(sPCItemSpec); }
public void AddSPCItemSpec(SPCItemSpec sPCItemSpec) { this._helper.AddDomainObject(sPCItemSpec); }