public MCSSDashborad(SessionInfo _session = null, MCSS model = null) { InitializeComponent(); this._repo = new McssRepo(); this.McssList = new List<MCSS>(); this.McssNum = ""; epiSession = _session; }
private void mnuEditFind_Click(object sender, EventArgs e) { dgvList.Rows.Clear(); MCSS model = new MCSS(); model.Plant = epiSession.PlantID; if (txtMCSSNum.Text != null) { model.McssNum = txtMCSSNum.Text.Trim(); } var list = _repo.GetByFilter(dtpDataFrom.Value, dtpDateTo.Value, model, chkStatus.Checked).ToList(); ListToGrid(list); }
public McssMaster(MCSS model = null, SessionInfo _session = null) { InitializeComponent(); this._repo = new McssRepo(); this._repoCustomer = new CustomerRepo(); this._repoCoating = new CoatingRepo(); this._repoSpec = new SpecRepo(); this._repoCommodity = new Commodity(); this._repoSupplier = new SupplierRepo(); this._repoBT = new BussinessTypeRepo(); this._repoMaker = new MakerRepo(); this._repoMill = new MillRepo(); this._repoCatg = new CategoryGroupRepo(); specialRef = new Dictionary<int, string>(); #region Dashboard if (model == null) { this.McssContent = new MCSS(); this.ModelClone = new MCSS(); this.Initail = new InitialModel(); } else { this.McssContent = model; ModelClone = (MCSS)model.Clone(); } epiSession = _session; #endregion #region Direct form //epiSession = new SessionInfo(); //if (epiSession.SessionID == null) //{ // Login frm = new Login(); // frm.ShowDialog(); //} //else if (epiSession.SessionID == "x") //{ // Application.Exit(); //} //else //{ // this.Text = epiSession.CompanyName; //} #endregion }
public bool GetNewPart(MCSS model, Models.SessionInfo epiSession, out bool IsSucces, out string msgError) { try { Session currSession = new Session(epiSession.UserID, epiSession.UserPassword, epiSession.AppServer, Session.LicenseType.Default); Part myPart = new Part(currSession.ConnectionPool); bool partExst = false; string whereClausePart = string.Format(@"Part.PartNum='{0}'", model.McssNum); //whereClausePart.Replace("=\"",""); PartDataSet dsPart = new PartDataSet(); if (myPart.PartExists(model.McssNum)) { dsPart = myPart.GetRows(whereClausePart, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", 0, 1, out partExst); } else { myPart.GetNewPart(dsPart); } DataRow drPart = dsPart.Tables[0].Rows[0]; drPart.BeginEdit(); drPart["PartNum"] = model.McssNum; drPart["PartDescription"] = model.McssNum; drPart["UOMClassID"] = "UCC"; drPart["TypeCode"] = "P"; drPart["IUM"] = (model.Length > 0) ? "PCS" : "KG"; //Our UOM drPart["PUM"] = (model.Length > 0) ? "PCS" : "KG"; ; //Purchasing UOM drPart["TypeCode"] = "M"; drPart["SalesUM"] = (model.Length > 0) ? "PCS" : "KG"; ; //Sale UOM drPart["Character02"] = ""; //NCR No. drPart["Character08"] = string.IsNullOrEmpty(model.CustID) ? "" : model.CustID; drPart["Character10"] = ""; //Pack No. drPart["ShortChar01"] = string.IsNullOrEmpty(model.CommodityCode) ? "" : model.CommodityCode; drPart["ShortChar02"] = string.IsNullOrEmpty(model.MatSpec1) ? "" : model.MatSpec1; drPart["ShortChar07"] = ""; //Old Stock No. drPart["ShortChar09"] = string.IsNullOrEmpty(model.Coating1) ? "" : model.Coating1; drPart["ShortChar10"] = "6"; //PartStatus = MCSS drPart["Number01"] = model.Thick; drPart["Number02"] = model.Width; drPart["Number03"] = model.Length; drPart["TrackLots"] = 1; drPart["Number11"] = 1; drPart["Number12"] = model.Pocession.GetInt(); drPart["Character10"] = "N"; drPart["NetWeight"] = model.WeightPerCoilMin.GetDecimal(); drPart.EndEdit(); myPart.Update(dsPart); currSession.Dispose(); IsSucces = true; msgError = ""; } catch (Exception ex) { IsSucces = false; msgError = ex.Message; } return IsSucces; }
public void SaveUD34(MCSS model, Models.SessionInfo epiSession, out bool IsSucces, out string msgError) { try { Session currSession = new Session(epiSession.UserID, epiSession.UserPassword, epiSession.AppServer, Session.LicenseType.Default); UD34 myUD34 = new UD34(currSession.ConnectionPool); UD34DataSet dsUD34 = new UD34DataSet(); string whereClause = string.Format(@"UD34.Key1 ='{0}' AND UD34.Key5 = '{1}'", model.McssNum, epiSession.PlantID); bool morePages = false; bool dataExisting = false; try { UD34DataSet ds = myUD34.GetByID(model.McssNum, "", "", "", epiSession.PlantID); dataExisting = true; } catch (Exception ex) { if (ex.Message == "Record not found.") dataExisting = false; } if (dataExisting) { dsUD34 = myUD34.GetRows(whereClause, "", 0, 1, out morePages); } else { myUD34.GetaNewUD34(dsUD34); } DataRow drUD34 = dsUD34.Tables[0].Rows[0]; drUD34.BeginEdit(); drUD34["Key1"] = model.McssNum; drUD34["ShortChar08"] = model.MCSSID; //drUD34["Key4"] = epiSession.UserID; drUD34["Key5"] = epiSession.PlantID; drUD34["Character01"] = String.IsNullOrEmpty(model.IDCoil.ToString()) ? "" : model.IDCoil.ToString(); drUD34["Character02"] = String.IsNullOrEmpty(model.BaseMaterial) ? "" : model.BaseMaterial; drUD34["Character03"] = String.IsNullOrEmpty(model.CenterWaveRemark) ? "" : model.CenterWaveRemark; drUD34["Character04"] = String.IsNullOrEmpty(model.EdgeWaveRemark) ? "" : model.EdgeWaveRemark; drUD34["Character05"] = String.IsNullOrEmpty(model.OtherRemark) ? "" : model.OtherRemark; drUD34["Character06"] = String.IsNullOrEmpty(model.ODCoil.ToString()) ? "" : model.ODCoil.ToString(); ; drUD34["Character07"] = String.IsNullOrEmpty(model.ChemPersentRemark) ? "" : model.ChemPersentRemark; ; drUD34["Character08"] = String.IsNullOrEmpty(model.CategoryGroup3) ? "" : model.CategoryGroup3; drUD34["Character09"] = String.IsNullOrEmpty(model.CategoryGroup2) ? "" : model.CategoryGroup2; drUD34["Character10"] = String.IsNullOrEmpty(model.CategoryGroup1) ? "" : model.CategoryGroup1; drUD34["Number01"] = model.ChemPersent.GetInt(); drUD34["Number02"] = model.Yield.GetInt(); drUD34["Number03"] = model.Tensile.GetInt(); drUD34["Number04"] = model.Elongation.GetInt(); drUD34["Number06"] = model.CoreLoss.GetInt(); drUD34["Number07"] = model.Magnatic.GetInt(); drUD34["Number08"] = model.Oriented.GetInt(); drUD34["Number12"] = model.EdgeWave.GetDecimal(); drUD34["Number13"] = model.WeightPerCoilMin.GetDecimal(); drUD34["Number14"] = model.WeightPerCoilMax.GetDecimal(); drUD34["Number15"] = model.PackingStyle.GetInt(); drUD34["Number16"] = model.CenterWave.GetInt(); drUD34["Number17"] = model.Stainless.GetInt(); drUD34["Number18"] = model.DistGI.GetInt(); drUD34["Number19"] = model.DistHR.GetInt(); drUD34["Number20"] = model.DistCR.GetInt(); drUD34["CheckBox01"] = Convert.ToInt32(model.Welding); drUD34["CheckBox02"] = Convert.ToInt32(model.Painting); drUD34["CheckBox03"] = Convert.ToInt32(model.Degreasing); drUD34["CheckBox04"] = Convert.ToInt32(model.Blanking); drUD34["CheckBox05"] = Convert.ToInt32(model.ProcessOther); drUD34["CheckBox06"] = Convert.ToInt32(model.Commercial); drUD34["CheckBox07"] = Convert.ToInt32(model.Drawing); drUD34["CheckBox08"] = Convert.ToInt32(model.DeepDrawing); drUD34["CheckBox09"] = Convert.ToInt32(model.ExtraDeep); drUD34["CheckBox10"] = Convert.ToInt32(model.Folding); drUD34["CheckBox11"] = Convert.ToInt32(model.FormingOther); drUD34["CheckBox12"] = Convert.ToInt32(model.RoHS); drUD34["CheckBox13"] = Convert.ToInt32(model.PFOS); drUD34["CheckBox14"] = Convert.ToInt32(model.SOC); drUD34["CheckBox15"] = Convert.ToInt32(model.ELV); drUD34["CheckBox16"] = Convert.ToInt32(model.REACH); drUD34["CheckBox17"] = Convert.ToInt32(model.Other); drUD34["ShortChar01"] = string.IsNullOrEmpty(model.DistCRRemark) ? "" : model.DistCRRemark; drUD34["ShortChar02"] = string.IsNullOrEmpty(model.DistHRRemark) ? "" : model.DistHRRemark; drUD34["ShortChar03"] = string.IsNullOrEmpty(model.DistGIRemark) ? "" : model.DistGIRemark; drUD34["ShortChar04"] = string.IsNullOrEmpty(model.StainlessRemark) ? "" : model.StainlessRemark; drUD34["ShortChar05"] = string.IsNullOrEmpty(model.Hardness.GetString()) ? "" : model.Hardness.GetString(); //ChemPersentRemark drUD34["ShortChar06"] = string.IsNullOrEmpty(model.YieldRemark) ? "" : model.YieldRemark; drUD34["ShortChar07"] = string.IsNullOrEmpty(model.TensileRemark) ? "" : model.TensileRemark; drUD34["ShortChar08"] = string.IsNullOrEmpty(model.ElongationRemark) ? "" : model.ElongationRemark; drUD34["ShortChar09"] = string.IsNullOrEmpty(model.HardnessRemark) ? "" : model.HardnessRemark; drUD34["ShortChar10"] = string.IsNullOrEmpty(model.CoreLossRemark) ? "" : model.CoreLossRemark; drUD34["ShortChar11"] = string.IsNullOrEmpty(model.MagnaticRemark) ? "" : model.MagnaticRemark; drUD34["ShortChar12"] = string.IsNullOrEmpty(model.ProcessOtherRemark) ? "" : model.ProcessOtherRemark; drUD34["ShortChar13"] = string.IsNullOrEmpty(model.FormingOtherRemark) ? "" : model.FormingOtherRemark; drUD34["ShortChar14"] = string.IsNullOrEmpty(model.PartName) ? "" : model.PartName; drUD34["ShortChar15"] = string.IsNullOrEmpty(model.ProductName) ? "" : model.ProductName; drUD34["ShortChar16"] = string.IsNullOrEmpty(model.CusProcessRemark) ? "" : model.CusProcessRemark; drUD34["ShortChar17"] = string.IsNullOrEmpty(model.EndUser1) ? "" : model.EndUser1; drUD34["ShortChar18"] = string.IsNullOrEmpty(model.EndUser2) ? "" : model.EndUser2; drUD34["ShortChar19"] = string.IsNullOrEmpty(model.EndUser3) ? "" : model.EndUser3; drUD34["ShortChar20"] = string.IsNullOrEmpty(model.EndUser4) ? "" : model.EndUser4; drUD34.EndEdit(); myUD34.Update(dsUD34); currSession.Dispose(); IsSucces = true; msgError = ""; } catch (Exception ex) { IsSucces = false; msgError = ex.Message; } }
public void SaveUD15(MCSS model, Models.SessionInfo epiSession, out bool IsSucces, out string msgError) { try { Session currSession = new Session(epiSession.UserID, epiSession.UserPassword, epiSession.AppServer, Session.LicenseType.Default); UD15 myUD15 = new UD15(currSession.ConnectionPool); UD15DataSet dsUD15 = new UD15DataSet(); string whereClause = string.Format(@"UD15.Key1 ='{0}' AND UD15.Key5 = '{1}'", model.McssNum, epiSession.PlantID); bool morePages = false; bool dataExisting = false; try { UD15DataSet ds = myUD15.GetByID(model.McssNum, "", "", "", epiSession.PlantID); dataExisting = true; } catch (Exception ex) { if (ex.Message == "Record not found.") dataExisting = false; } if (dataExisting) { dsUD15 = myUD15.GetRows(whereClause, "", 0, 1, out morePages); } else { myUD15.GetaNewUD15(dsUD15); } DataRow drUD15 = dsUD15.Tables[0].Rows[0]; drUD15.BeginEdit(); drUD15["Key1"] = string.IsNullOrEmpty(model.McssNum) ? "1" : model.McssNum; //drUD15["Key2"] = "1"; drUD15["ShortChar08"] = model.MCSSID; drUD15["ShortChar20"] = epiSession.UserID; drUD15["Key5"] = epiSession.PlantID; drUD15["Character01"] = String.IsNullOrEmpty(model.BussinessTypeName) ? "" : model.BussinessTypeName; drUD15["Character02"] = ""; drUD15["Character03"] = string.IsNullOrEmpty(model.Name) ? "" : model.Name; drUD15["Character04"] = string.IsNullOrEmpty(model.TISINo) ? "" : model.TISINo; drUD15["Character05"] = string.IsNullOrEmpty(model.LicenseNo) ? "" : model.LicenseNo; drUD15["Character06"] = ""; drUD15["Character07"] = model.OillingVal.GetDecimal(); drUD15["Character08"] = string.IsNullOrEmpty(model.BusinessRoute) ? "" : model.BusinessRoute; drUD15["Character09"] = string.IsNullOrEmpty(model.BusinessRemark) ? "" : model.BusinessRemark; drUD15["Character10"] = string.IsNullOrEmpty(model.Remark) ? "" : model.Remark; drUD15["Number01"] = model.Thick.GetDecimal(); drUD15["Number02"] = model.Width.GetDecimal(); drUD15["Number03"] = model.Length.GetDecimal(); drUD15["Number04"] = model.CoatingWeight1.GetDecimal(); drUD15["Number05"] = model.CoatingWeight2.GetDecimal(); drUD15["Number06"] = model.POAllowance.GetDecimal(); drUD15["Number07"] = model.QuantityPerMonth.GetDecimal(); drUD15["Number08"] = model.StandardRef.GetInt(); drUD15["Number09"] = model.ThicknessTolerance.GetInt(); drUD15["Number10"] = model.Pocession.GetInt(); drUD15["Number11"] = model.WidthStandard.GetInt(); drUD15["Number12"] = model.Oilling.GetInt(); drUD15["Number15"] = model.QuantityPerPlant.GetDecimal(); drUD15["Number17"] = model.ThicknessTolerValPos.GetDecimal(); drUD15["Number18"] = model.ThicknessTolerValNeg.GetDecimal(); drUD15["Number19"] = model.WidthStdPos.GetDecimal(); drUD15["Number20"] = model.WidthStdNeg.GetDecimal(); drUD15["Date01"] = DateTime.Now.ToLongDateString(); drUD15["CheckBox01"] = Convert.ToInt32(model.TISIFlag); drUD15["ShortChar01"] = string.IsNullOrEmpty(model.MakerCode) ? "" : model.MakerCode; drUD15["ShortChar02"] = string.IsNullOrEmpty(model.MillCode) ? "" : model.MillCode; drUD15["ShortChar03"] = string.IsNullOrEmpty(model.SupplierCode) ? "" : model.SupplierCode; drUD15["ShortChar04"] = string.IsNullOrEmpty(model.CustID) ? "" : model.CustID; drUD15["ShortChar05"] = string.IsNullOrEmpty(model.CategoryGroupHead1) ? "" : model.CategoryGroupHead1; drUD15["ShortChar06"] = string.IsNullOrEmpty(model.CommodityCode) ? "" : model.CommodityCode; drUD15["ShortChar07"] = string.IsNullOrEmpty(model.CustomerTypeRemark) ? "" : model.CustomerTypeRemark; drUD15["ShortChar09"] = string.IsNullOrEmpty(model.Coating1) ? "" : model.Coating1; drUD15["ShortChar10"] = string.IsNullOrEmpty(model.CustomerType.ToString()) ? "" : model.CustomerType.ToString(); drUD15["ShortChar11"] = string.IsNullOrEmpty(model.MatSpec1) ? "" : model.MatSpec1; drUD15["ShortChar13"] = string.IsNullOrEmpty(model.BussinessType) ? "" : model.BussinessType; drUD15["ShortChar14"] = string.IsNullOrEmpty(model.StandardRefRemark) ? "" : model.StandardRefRemark; drUD15["ShortChar15"] = string.IsNullOrEmpty(model.Number) ? "" : model.Number; drUD15.EndEdit(); myUD15.Update(dsUD15); currSession.Dispose(); IsSucces = true; msgError = ""; } catch (Exception ex) { IsSucces = false; msgError = ex.Message; } }
public MCSS Save(MCSS model, Models.SessionInfo epiSession, out bool IsSucces, out string msgError) { MCSS result = new MCSS(); bool ud15Success = false; string ud15msg = ""; bool ud34Success = false; string ud34msg = ""; if (model.InsertState == true) { model.MCSSID = GenerateMcssID().ToString(); } model.RequestDate = DateTime.Now; SaveUD15(model, epiSession, out ud15Success, out ud15msg); if (ud15Success) { model.McssNum = GetMCSSNum(model.MCSSID); SaveUD34(model, epiSession, out ud34Success, out ud34msg); } //if (model.InsertState == true) { GetNewPart(model, epiSession, out ud15Success, out ud15msg); } GetNewPart(model, epiSession, out ud15Success, out ud15msg); IsSucces = ud15Success && ud34Success; msgError = "Message UD34 : " + ud15msg + " Message UD34 : " + ud34msg; if (IsSucces) { result = this.Get(epiSession.PlantID, model.McssNum); } else { result = null; } return result; }
public IEnumerable<MCSS> GetByFilter(DateTime DateFrom, DateTime DateTo, MCSS model, bool TISIFlag) { IEnumerable<MCSS> query = GetAll(model.Plant); if (model.Thick == 0) { query = query.Where(p => p.RequestDate.Date >= DateFrom.Date.Date && p.RequestDate.Date <= DateTo.Date.Date); } if (model.McssNum != null) { query = query.Where(p => p.McssNum.Contains(model.McssNum)); } if (TISIFlag == true) { query = query.Where(p => p.TISIFlag.Equals(true)); } if (model.Thick != 0) { query = query.Where(p => p.Thick.Equals(model.Thick)); } if (model.Width != 0) { query = query.Where(p => p.Width.Equals(model.Width)); } if (model.Length != 0) { query = query.Where(p => p.Length.Equals(model.Length)); } return query.ToList(); }
private void tlbSave_Click(object sender, EventArgs e) { bool IsSucces = false; string msg = ""; MCSS model = new MCSS(); //model.McssNum = txtMcssNum.Text.Trim(); model.Thick = Convert.ToDecimal(txtThick.Text); model.Width = Convert.ToDecimal(txtWidth.Text); model.Length = Convert.ToDecimal(txtLength.Text); McssContent.Pocession = (rdoPocession0.Checked) ? 0 : 1; var dupRecord = _repo.GetByFilter(DateTime.Now, DateTime.Now, model, false); int i = 1; if (dupRecord.ToList().Count > 0) { foreach (var p in dupRecord) { if (p.McssNum != txtMcssNum.Text.Trim()) { msg += i + ". " + p.McssNum + "\t (" + p.CommodityCode + " : " + p.CommodityName + ") \t" + p.Size + Environment.NewLine; i++; } } if (i > 1) { if (MessageBox.Show("Already exists Spec in table." + Environment.NewLine + msg + "Do you want to save?", "Information", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No) { return; } } } if (ValidatingContent(out msg) == false) { var result = _repo.Save(McssContent, epiSession, out IsSucces, out msg); if (IsSucces) { SpecialRef modelRef = new SpecialRef(); modelRef.McssNum = McssContent.McssNum; result.SpecialRefs = _repo.SaveSpecailRef(modelRef, epiSession, specialRef); McssContent = result; specialRef.Clear(); SetContent(McssContent); } else { MessageBox.Show(msg, "Warnning.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } else { MessageBox.Show("List of invalid field." + Environment.NewLine + msg, "Invalid field.", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void SetMode(InitialModel model) { McssContent = new MCSS(); McssContent.SpecialRefs = new List<SpecialRef>(); McssContent.InsertState = true; McssContent.Thick = model.Thick; McssContent.Width = model.Width; McssContent.Length = model.Length; McssContent.SupplierCode = model.SupplierCode; McssContent.SupplierName = model.SupplierName; McssContent.CustID = model.CustID; McssContent.CustomerName = model.CustomerName; McssContent.MakerCode = model.MakerCode; McssContent.MakerName = model.MakerName; McssContent.MillCode = model.MillCode; McssContent.MillName = model.MillName; McssContent.CommodityCode = model.CommodityCode; McssContent.CommodityName = model.CommodityName; McssContent.MatSpec1 = model.MatSpec1; McssContent.MatSpec2 = model.MatSpec2; SetContent(McssContent); ModelClone = (MCSS)McssContent.Clone(); _repo.ClearInitial(model.Key1); }
private void SetContent(MCSS model) { txtMcssNum.DataBindings.Clear(); txtMcssNum.DataBindings.Add("Text", model, "McssNum", false, DataSourceUpdateMode.OnPropertyChanged); txtRevision.DataBindings.Clear(); txtRevision.DataBindings.Add("Text", model, "Revision", false, DataSourceUpdateMode.OnPropertyChanged); if (model.Pocession == 0) { rdoPocession0.Checked = true; } else { rdoPocession1.Checked = true; } txtSupplierCode.DataBindings.Clear(); txtSupplierCode.DataBindings.Add("Text", model, "SupplierCode", false, DataSourceUpdateMode.OnPropertyChanged); txtSupplierName.DataBindings.Clear(); txtSupplierName.DataBindings.Add("Text", model, "SupplierName", false, DataSourceUpdateMode.OnPropertyChanged); txtCustID.DataBindings.Clear(); txtCustID.DataBindings.Add("Text", model, "CustID", false, DataSourceUpdateMode.OnPropertyChanged); txtCustomerName.DataBindings.Clear(); txtCustomerName.DataBindings.Add("Text", model, "CustomerName", false, DataSourceUpdateMode.OnPropertyChanged); txtMakerCode.DataBindings.Clear(); txtMakerCode.DataBindings.Add("Text", model, "MakerCode", false, DataSourceUpdateMode.OnPropertyChanged); txtMakerName.DataBindings.Clear(); txtMakerName.DataBindings.Add("Text", model, "MakerName", false, DataSourceUpdateMode.OnPropertyChanged); txtMillCode.DataBindings.Clear(); txtMillCode.DataBindings.Add("Text", model, "MillCode", false, DataSourceUpdateMode.OnPropertyChanged); txtMillName.DataBindings.Clear(); txtMillName.DataBindings.Add("Text", model, "MillName", false, DataSourceUpdateMode.OnPropertyChanged); txtPOAllowance.DataBindings.Clear(); txtPOAllowance.DataBindings.Add("Text", model, "POAllowance", true, DataSourceUpdateMode.OnPropertyChanged, 0, "#,##0.###"); txtCommodityCode.DataBindings.Clear(); txtCommodityCode.DataBindings.Add("Text", model, "CommodityCode", false, DataSourceUpdateMode.OnPropertyChanged); txtCommodityName.DataBindings.Clear(); txtCommodityName.DataBindings.Add("Text", model, "CommodityName", false, DataSourceUpdateMode.OnPropertyChanged); txtMatSpec1.DataBindings.Clear(); txtMatSpec1.DataBindings.Add("Text", model, "MatSpec1", false, DataSourceUpdateMode.OnPropertyChanged); txtMatSpec2.DataBindings.Clear(); txtMatSpec2.DataBindings.Add("Text", model, "MatSpec2", false, DataSourceUpdateMode.OnPropertyChanged); txtCoating1.DataBindings.Clear(); txtCoating1.DataBindings.Add("Text", model, "Coating1", false, DataSourceUpdateMode.OnPropertyChanged); txtCoating2.DataBindings.Clear(); txtCoating2.DataBindings.Add("Text", model, "Coating2", false, DataSourceUpdateMode.OnPropertyChanged); txtCoatingWeight1.DataBindings.Clear(); txtCoatingWeight1.DataBindings.Add("Text", model, "CoatingWeight1", true, DataSourceUpdateMode.OnPropertyChanged, 0, "#,##0.###"); txtCoatingWeight2.DataBindings.Clear(); txtCoatingWeight2.DataBindings.Add("Text", model, "CoatingWeight2", true, DataSourceUpdateMode.OnPropertyChanged, 0, "#,##0.###"); txtCategoryGroupHead1.DataBindings.Clear(); txtCategoryGroupHead1.DataBindings.Add("Text", model, "CategoryGroupHead1", false, DataSourceUpdateMode.OnPropertyChanged); txtCategoryGroupHead2.DataBindings.Clear(); txtCategoryGroupHead2.DataBindings.Add("Text", model, "CategoryGroupHead2", false, DataSourceUpdateMode.OnPropertyChanged); txtThick.DataBindings.Clear(); txtThick.DataBindings.Add("Text", model, "Thick", true, DataSourceUpdateMode.OnPropertyChanged, 0, "#,##0.000"); txtWidth.DataBindings.Clear(); txtWidth.DataBindings.Add("Text", model, "Width", true, DataSourceUpdateMode.OnPropertyChanged, 0, "#,##0.000"); txtLength.DataBindings.Clear(); txtLength.DataBindings.Add("Text", model, "Length", true, DataSourceUpdateMode.OnPropertyChanged, 0, "#,##0.000"); if (model.CustomerType == 0) { rdoCustomerType0.Checked = true; txtCustomerTypeRemark.Enabled = false; } else if (model.CustomerType == 1) { rdoCustomerType1.Checked = true; txtCustomerTypeRemark.Enabled = false; } else { rdoCustomerType2.Checked = true; txtCustomerTypeRemark.Enabled = true; } txtTISINo.DataBindings.Clear(); txtTISINo.DataBindings.Add("Text", model, "TISINo", false, DataSourceUpdateMode.OnPropertyChanged); txtLicenseNo.DataBindings.Clear(); txtLicenseNo.DataBindings.Add("Text", model, "LicenseNo", false, DataSourceUpdateMode.OnPropertyChanged); //Condition Tab txtCustomerTypeRemark.DataBindings.Clear(); txtCustomerTypeRemark.DataBindings.Add("Text", model, "CustomerTypeRemark", false, DataSourceUpdateMode.OnPropertyChanged); //txtCustomerTypeRemark.DataBindings.Add("Text", model, "CustomerTypeRemark", false, DataSourceUpdateMode.OnPropertyChanged); txtBussinessType.DataBindings.Clear(); txtBussinessType.DataBindings.Add("Text", model, "BussinessType", false, DataSourceUpdateMode.OnPropertyChanged); txtBussinessTypeName.DataBindings.Clear(); txtBussinessTypeName.DataBindings.Add("Text", model, "BussinessTypeName", false, DataSourceUpdateMode.OnPropertyChanged); txtQuantityPerMonth.DataBindings.Clear(); txtQuantityPerMonth.DataBindings.Add("Text", model, "QuantityPerMonth", true, DataSourceUpdateMode.OnPropertyChanged, 0, "#,##0.###"); if (model.QuantityPerPlant == 0) { rdoQuantityPerPlant0.Checked = true; } else if (model.QuantityPerPlant == 1) { rdoQuantityPerPlant1.Checked = true; } else { rdoQuantityPerPlant2.Checked = true; } txtBusinessRoute.DataBindings.Clear(); txtBusinessRoute.DataBindings.Add("Text", model, "BusinessRoute", false, DataSourceUpdateMode.OnPropertyChanged); txtBusinessRemark.DataBindings.Clear(); txtBusinessRemark.DataBindings.Add("Text", model, "BusinessRemark", false, DataSourceUpdateMode.OnPropertyChanged); if (model.StandardRef == 0) { rdoStandardRef0.Checked = true; txtStandardRefRemark.Enabled = false; } else if (model.StandardRef == 1) { rdoStandardRef1.Checked = true; txtStandardRefRemark.Enabled = false; } else { rdoStandardRef2.Checked = true; txtStandardRefRemark.Enabled = true; } txtStandardRefRemark.DataBindings.Clear(); txtStandardRefRemark.DataBindings.Add("Text", model, "StandardRefRemark", false, DataSourceUpdateMode.OnPropertyChanged); txtNumber.DataBindings.Clear(); txtNumber.DataBindings.Add("Text", model, "Number", false, DataSourceUpdateMode.OnPropertyChanged); txtName.DataBindings.Clear(); txtName.DataBindings.Add("Text", model, "Name", false, DataSourceUpdateMode.OnPropertyChanged); if (model.ThicknessTolerance == 0) { rdoThicknessTolerance0.Checked = true; txtThicknessTolerValPos.Enabled = false; txtThicknessTolerValNeg.Enabled = false; } else if (model.ThicknessTolerance == 1) { rdoThicknessTolerance1.Checked = true; txtThicknessTolerValPos.Enabled = false; txtThicknessTolerValNeg.Enabled = false; } else if (model.ThicknessTolerance == 2) { rdoThicknessTolerance2.Checked = true; txtThicknessTolerValPos.Enabled = false; txtThicknessTolerValNeg.Enabled = false; } else if (model.ThicknessTolerance == 3) { rdoThicknessTolerance3.Checked = true; txtThicknessTolerValPos.Enabled = false; txtThicknessTolerValNeg.Enabled = false; } else { rdoThicknessTolerance4.Checked = true; txtThicknessTolerValPos.Enabled = true; txtThicknessTolerValNeg.Enabled = true; } txtThicknessTolerValPos.DataBindings.Clear(); txtThicknessTolerValPos.DataBindings.Add("Text", model, "ThicknessTolerValPos", true, DataSourceUpdateMode.OnPropertyChanged, 0, "#,##0.###"); txtThicknessTolerValNeg.DataBindings.Clear(); txtThicknessTolerValNeg.DataBindings.Add("Text", model, "ThicknessTolerValNeg", true, DataSourceUpdateMode.OnPropertyChanged, 0, "#,##0.###"); if (model.WidthStandard == 0) { rdoWidthStandard0.Checked = true; txtWidthStdPos.Enabled = true; txtWidthStdNeg.Enabled = true; } else { rdoWidthStandard1.Checked = true; txtWidthStdPos.Enabled = false; txtWidthStdNeg.Enabled = false; } txtWidthStdPos.DataBindings.Clear(); txtWidthStdPos.DataBindings.Add("Text", model, "WidthStdPos", true, DataSourceUpdateMode.OnPropertyChanged, 0, "#,##0.###"); txtWidthStdNeg.DataBindings.Clear(); txtWidthStdNeg.DataBindings.Add("Text", model, "WidthStdNeg", true, DataSourceUpdateMode.OnPropertyChanged, 0, "#,##0.###"); if (model.Oilling == 0) { rdoOilling0.Checked = true; txtOillingVal.Enabled = false; } else { rdoOilling1.Checked = true; txtOillingVal.Enabled = true; } txtOillingVal.DataBindings.Clear(); txtOillingVal.DataBindings.Add("Text", model, "OillingVal", false, DataSourceUpdateMode.OnPropertyChanged); txtBaseMaterial.DataBindings.Clear(); txtBaseMaterial.DataBindings.Add("Text", model, "BaseMaterial", false, DataSourceUpdateMode.OnPropertyChanged); txtCountry.DataBindings.Clear(); txtCountry.DataBindings.Add("Text", model, "Country", false, DataSourceUpdateMode.OnPropertyChanged); txtRemark.DataBindings.Clear(); txtRemark.DataBindings.Add("Text", model, "Remark", false, DataSourceUpdateMode.OnPropertyChanged); //Chemical, Mechanical, Critiria Tab if (model.DistCR == 0) { rdoDistCR0.Checked = true; txtDistCRRemark.Enabled = false; } else if (model.DistCR == 1) { rdoDistCR1.Checked = true; txtDistCRRemark.Enabled = false; } else if (model.DistCR == 2) { rdoDistCR2.Checked = true; txtDistCRRemark.Enabled = false; } else { rdoDistCR3.Checked = true; txtDistCRRemark.Enabled = true; } txtDistCRRemark.DataBindings.Clear(); txtDistCRRemark.DataBindings.Add("Text", model, "DistCRRemark", false, DataSourceUpdateMode.OnPropertyChanged); if (model.DistHR == 0) { rdoDistHR0.Checked = true; txtDistHRRemark.Enabled = false; } else if (model.DistHR == 1) { rdoDistHR1.Checked = true; txtDistHRRemark.Enabled = false; } else if (model.DistHR == 2) { rdoDistHR2.Checked = true; txtDistHRRemark.Enabled = false; } else { rdoDistHR3.Checked = true; txtDistHRRemark.Enabled = true; } txtDistHRRemark.DataBindings.Clear(); txtDistHRRemark.DataBindings.Add("Text", model, "DistHRRemark", false, DataSourceUpdateMode.OnPropertyChanged); if (model.DistGI == 0) { rdoDistGI0.Checked = true; txtDistGIRemark.Enabled = false; } else if (model.DistGI == 1) { rdoDistGI1.Checked = true; txtDistGIRemark.Enabled = false; } else if (model.DistGI == 2) { rdoDistGI2.Checked = true; txtDistGIRemark.Enabled = false; } else if (model.DistGI == 3) { rdoDistGI3.Checked = true; txtDistGIRemark.Enabled = false; } else { rdoDistGI4.Checked = true; txtDistGIRemark.Enabled = true; } txtDistGIRemark.DataBindings.Clear(); txtDistGIRemark.DataBindings.Add("Text", model, "DistGIRemark", false, DataSourceUpdateMode.OnPropertyChanged); txtStainless.DataBindings.Clear(); txtStainless.DataBindings.Add("Text", model, "Stainless", false, DataSourceUpdateMode.OnPropertyChanged); if (model.ChemPersent == 0) { rdoChemPersent0.Checked = true; txtChemPersentRemark.Enabled = false; } else if (model.ChemPersent == 1) { rdoChemPersent1.Checked = true; txtChemPersentRemark.Enabled = false; } else { rdoChemPersent2.Checked = true; txtChemPersentRemark.Enabled = true; } txtChemPersentRemark.DataBindings.Clear(); txtChemPersentRemark.DataBindings.Add("Text", model, "ChemPersentRemark", false, DataSourceUpdateMode.OnPropertyChanged); if (model.Yield == 0) { rdoYield0.Checked = true; txtYieldRemark.Enabled = false; } else if (model.Yield == 1) { rdoYield1.Checked = true; txtYieldRemark.Enabled = false; } else { rdoYield2.Checked = true; txtYieldRemark.Enabled = true; } txtYieldRemark.DataBindings.Clear(); txtYieldRemark.DataBindings.Add("Text", model, "YieldRemark", false, DataSourceUpdateMode.OnPropertyChanged); if (model.Tensile == 0) { rdoTensile0.Checked = true; txtTensileRemark.Enabled = false; } else if (model.Tensile == 1) { rdoTensile1.Checked = true; txtTensileRemark.Enabled = false; } else { rdoTensile2.Checked = true; txtTensileRemark.Enabled = true; } txtTensileRemark.DataBindings.Clear(); txtTensileRemark.DataBindings.Add("Text", model, "TensileRemark", false, DataSourceUpdateMode.OnPropertyChanged); if (model.Elongation == 0) { rdoElongation0.Checked = true; txtElongationRemark.Enabled = false; } else if (model.Elongation == 1) { rdoElongation1.Checked = true; txtElongationRemark.Enabled = false; } else { rdoElongation2.Checked = true; txtElongationRemark.Enabled = true; } txtElongationRemark.DataBindings.Clear(); txtElongationRemark.DataBindings.Add("Text", model, "ElongationRemark", false, DataSourceUpdateMode.OnPropertyChanged); if (model.Hardness == 0) { rdoHardness0.Checked = true; txtHardnessRemark.Enabled = false; } else if (model.Hardness == 1) { rdoHardness1.Checked = true; txtHardnessRemark.Enabled = false; } else { rdoHardness2.Checked = true; txtHardnessRemark.Enabled = true; } txtHardnessRemark.DataBindings.Clear(); txtHardnessRemark.DataBindings.Add("Text", model, "HardnessRemark", false, DataSourceUpdateMode.OnPropertyChanged); if (model.CoreLoss == 0) { rdoCoreLoss0.Checked = true; txtCoreLossRemark.Enabled = false; } else if (model.CoreLoss == 1) { rdoCoreLoss1.Checked = true; txtCoreLossRemark.Enabled = false; } else { rdoCoreLoss2.Checked = true; txtCoreLossRemark.Enabled = true; } txtCoreLossRemark.DataBindings.Clear(); txtCoreLossRemark.DataBindings.Add("Text", model, "CoreLossRemark", false, DataSourceUpdateMode.OnPropertyChanged); if (model.Magnatic == 0) { rdoMagnatic0.Checked = true; txtMagnaticRemark.Enabled = false; } else if (model.Magnatic == 1) { rdoMagnatic1.Checked = true; txtMagnaticRemark.Enabled = false; } else { rdoMagnatic2.Checked = true; txtMagnaticRemark.Enabled = true; } txtMagnaticRemark.DataBindings.Clear(); txtMagnaticRemark.DataBindings.Add("Text", model, "MagnaticRemark", false, DataSourceUpdateMode.OnPropertyChanged); if (model.Oriented == 0) { rdoOriented0.Checked = true; } else if (model.Oriented == 1) { rdoOriented1.Checked = true; } else { rdoOriented2.Checked = true; } //Cust Process Tab if (model.Welding == true) { chkWelding.Checked = true; } else { chkWelding.Checked = false; } if (model.Painting == true) { chkPainting.Checked = true; } else { chkPainting.Checked = false; } if (model.ProcessOther == true) { chkProcessOther.Checked = true; txtProcessOtherRemark.Enabled = true; } else { chkProcessOther.Checked = false; txtProcessOtherRemark.Enabled = false; } txtProcessOtherRemark.DataBindings.Clear(); txtProcessOtherRemark.DataBindings.Add("Text", model, "ProcessOtherRemark", false, DataSourceUpdateMode.OnPropertyChanged); if (model.Degreasing == true) { chkDegreasing.Checked = true; } else { chkDegreasing.Checked = false; } if (model.Blanking == true) { chkBlanking.Checked = true; } else { chkBlanking.Checked = false; } if (model.Commercial == true) { chkCommercial.Checked = true; } else { chkCommercial.Checked = false; } if (model.Drawing == true) { chkDrawing.Checked = true; } else { chkDrawing.Checked = false; } if (model.DeepDrawing == true) { chkDeepDrawing.Checked = true; } else { chkDeepDrawing.Checked = false; } if (model.ExtraDeep == true) { chkExtraDeep.Checked = true; } else { chkExtraDeep.Checked = false; } if (model.Folding == true) { chkFolding.Checked = true; } else { chkFolding.Checked = false; } if (model.FormingOther == true) { chkFormingOther.Checked = true; txtFormingOtherRemark.Enabled = true; } else { chkFormingOther.Checked = false; txtFormingOtherRemark.Enabled = false; } txtFormingOtherRemark.DataBindings.Clear(); txtFormingOtherRemark.DataBindings.Add("Text", model, "FormingOtherRemark", false, DataSourceUpdateMode.OnPropertyChanged); txtPartName.DataBindings.Clear(); txtPartName.DataBindings.Add("Text", model, "PartName", false, DataSourceUpdateMode.OnPropertyChanged); txtProductName.DataBindings.Clear(); txtProductName.DataBindings.Add("Text", model, "ProductName", false, DataSourceUpdateMode.OnPropertyChanged); txtCusProcessRemark.DataBindings.Clear(); txtCusProcessRemark.DataBindings.Add("Text", model, "CusProcessRemark", false, DataSourceUpdateMode.OnPropertyChanged); txtEndUser1.DataBindings.Clear(); txtEndUser1.DataBindings.Add("Text", model, "EndUser1", false, DataSourceUpdateMode.OnPropertyChanged); txtEndUser2.DataBindings.Clear(); txtEndUser2.DataBindings.Add("Text", model, "EndUser2", false, DataSourceUpdateMode.OnPropertyChanged); txtEndUser3.DataBindings.Clear(); txtEndUser3.DataBindings.Add("Text", model, "EndUser3", false, DataSourceUpdateMode.OnPropertyChanged); txtEndUser4.DataBindings.Clear(); txtEndUser4.DataBindings.Add("Text", model, "EndUser4", false, DataSourceUpdateMode.OnPropertyChanged); txtCategoryGroup1.DataBindings.Clear(); txtCategoryGroup1.DataBindings.Add("Text", model, "CategoryGroup1", false, DataSourceUpdateMode.OnPropertyChanged); txtCategoryGroup2.DataBindings.Clear(); txtCategoryGroup2.DataBindings.Add("Text", model, "CategoryGroup2", false, DataSourceUpdateMode.OnPropertyChanged); txtCategoryGroup3.DataBindings.Clear(); txtCategoryGroup3.DataBindings.Add("Text", model, "CategoryGroup3", false, DataSourceUpdateMode.OnPropertyChanged); txtCategoryGroup4.DataBindings.Clear(); txtCategoryGroup4.DataBindings.Add("Text", model, "CategoryGroup4", false, DataSourceUpdateMode.OnPropertyChanged); //Hardous substance, Packing, Flatness Tab if (model.EdgeWave == 0) { rdoEdgeWave0.Checked = true; txtEdgeWaveRemark.Enabled = false; } else { rdoEdgeWave1.Checked = true; txtEdgeWaveRemark.Enabled = true; } txtEdgeWaveRemark.DataBindings.Clear(); txtEdgeWaveRemark.DataBindings.Add("Text", model, "EdgeWaveRemark", false, DataSourceUpdateMode.OnPropertyChanged); if (model.CenterWave == 0) { rdoCenterWave0.Checked = true; txtCenterWaveRemark.Enabled = false; } else { rdoCenterWave1.Checked = true; txtCenterWaveRemark.Enabled = true; } txtCenterWaveRemark.DataBindings.Clear(); txtCenterWaveRemark.DataBindings.Add("Text", model, "CenterWaveRemark", false, DataSourceUpdateMode.OnPropertyChanged); if (model.PackingStyle == 0) { rdoPackingStyle0.Checked = true; } else { rdoPackingStyle1.Checked = true; } txtWeightPerCoilMin.DataBindings.Clear(); txtWeightPerCoilMin.DataBindings.Add("Text", model, "WeightPerCoilMin", true, DataSourceUpdateMode.OnPropertyChanged, 0, "#,##0.###"); txtWeightPerCoilMin.Refresh(); txtWeightPerCoilMax.DataBindings.Clear(); txtWeightPerCoilMax.DataBindings.Add("Text", model, "WeightPerCoilMax", true, DataSourceUpdateMode.OnPropertyChanged, 0, "#,##0.###"); txtIDCoil.DataBindings.Clear(); txtIDCoil.DataBindings.Add("Text", model, "IDCoil", false, DataSourceUpdateMode.OnPropertyChanged); txtODCoil.DataBindings.Clear(); txtODCoil.DataBindings.Add("Text", model, "ODCoil", false, DataSourceUpdateMode.OnPropertyChanged); if (model.RoHS == true) { chkRoHS.Checked = true; } else { chkRoHS.Checked = false; } if (model.PFOS == true) { chkPFOS.Checked = true; } else { chkPFOS.Checked = false; } if (model.SOC == true) { chkSOC.Checked = true; } else { chkSOC.Checked = false; } if (model.ELV == true) { chkELV.Checked = true; } else { chkELV.Checked = false; } if (model.REACH == true) { chkREACH.Checked = true; } else { chkREACH.Checked = false; } if (model.Other == true) { chkOther.Checked = true; txtOtherRemark.Enabled = true; } else { chkOther.Checked = false; txtOtherRemark.Enabled = false; } txtOtherRemark.DataBindings.Clear(); txtOtherRemark.DataBindings.Add("Text", model, "OtherRemark", false, DataSourceUpdateMode.OnPropertyChanged); if (model.InsertState == false) { txtSupplierCode.ReadOnly = true; txtCustID.ReadOnly = true; txtMakerCode.ReadOnly = true; txtMillCode.ReadOnly = true; txtCommodityCode.ReadOnly = true; txtMatSpec1.ReadOnly = true; butSupplier.Enabled = false; butCustomer.Enabled = false; butMaker.Enabled = false; butMill.Enabled = false; butCommodity.Enabled = false; butSpec.Enabled = false; } else { txtSupplierCode.ReadOnly = false; txtCustID.ReadOnly = false; txtMakerCode.ReadOnly = false; txtMillCode.ReadOnly = false; txtCommodityCode.ReadOnly = false; txtMatSpec1.ReadOnly = false; butSupplier.Enabled = true; butCustomer.Enabled = true; butMaker.Enabled = true; butMill.Enabled = true; butCommodity.Enabled = true; butSpec.Enabled = true; } if (!McssContent.CmdtRequireCoating) { butCoating.Enabled = false; txtCoating1.Enabled = false; } else { butCoating.Enabled = true; txtCoating1.Enabled = true; } SetGrid(model.SpecialRefs); }
private void tlbNew_Click(object sender, EventArgs e) { MCSS model = new MCSS(); model.SpecialRefs = new List<SpecialRef>(); model.InsertState = true; McssMaster frm = new McssMaster(model, epiSession); frm.Show(); }