public RouterRptObj(Part p, List<PartMaskLink> l, String Cust) { m_plist = new List<Part>(); m_plist.Add(p); m_mplinklist = l; customer = Cust; }
public bool AddItem(string PartNo) { if (PartExists(PartNo)) { return false; } else { Part p = new Part(PartNo); pList.Add(p); return true; } }
public static Part PopulatePartFromSqlDataReader(SqlDataReader dr) { Part part = new Part(); part.Id = Convert.ToInt32(dr["Id"]); part.PartNo = Convert.ToString(dr["PartNo"]); part.PartImage = Convert.ToString(dr["PartImage"]); part.PartDesc = Convert.ToString(dr["PartDesc"]); part.ColorName = Convert.ToString(dr["ColorName"]); part.PowderNumber = Convert.ToString(dr["PowderNumber"]); part.CureTemp = Convert.ToInt32(dr["CureTemp"]); part.Millage = Convert.ToInt32(dr["Millage"]); part.MinConvSpeed = Convert.ToInt32(dr["MinConvSpeed"]); part.MinPiecesPer = Convert.ToInt32(dr["MinPiecesPer"]); part.Feet = Convert.ToInt32(dr["Feet"]); part.MinPartsPerRack = Convert.ToInt32(dr["MinPartsPerRack"]); part.Kv1 = Convert.ToInt32(dr["Kv1"]); part.FlowRate1 = Convert.ToInt32(dr["FlowRate1"]); part.Atomizing1 = Convert.ToInt32(dr["Atomizing1"]); part.Receipe1 = Convert.ToString(dr["Receipe1"]); part.Kv2 = Convert.ToInt32(dr["Kv2"]); part.FlowRate2 = Convert.ToInt32(dr["FlowRate2"]); part.Atomizing2 = Convert.ToInt32(dr["Atomizing2"]); part.Receipe2 = Convert.ToString(dr["Receipe2"]); part.PlugsQty = Convert.ToInt32(dr["PlugsQty"]); part.DotsQty = Convert.ToInt32(dr["DotsQty"]); part.CapsQty = Convert.ToInt32(dr["CapsQty"]); part.SpotFace = Convert.ToString(dr["SpotFace"]); part.BlowExcessWater = Convert.ToString(dr["BlowExcessWater"]); part.SpecialNotes = Convert.ToString(dr["SpecialNotes"]); part.PreMask = Convert.ToString(dr["PREMask"]); part.MaskTime = Convert.ToDouble(dr["MASKTIME"]); part.SqFeet = Convert.ToDouble(dr["SQFEET"]); part.PaintTime = Convert.ToDouble(dr["PAINTTIME"]); part.PoundsPer = Convert.ToDouble(dr["POUNDSPER"]); part.Hanger = Convert.ToString(dr["HANGER"]); part.RackType = Convert.ToString(dr["RACKTYPE"]); return part; }
private void PartSaveButton_Click(object sender, EventArgs e) { if (PartNoCombo.Text != "") { if (PartsL.PartInDB(PartNoCombo.Text)) { Part p = PartsL.SearchPart(PartNoCombo.Text); int id = p.Id; p = Form2Object(); p.Id = id; PartsL.UpdatePart(p); } else { PartsL.AddPart(Form2Object()); } Part p2 = new Part(); p2 = PartsL.SearchPart(PartNoCombo.Text); //CustIDcombo.DataSource = CustList.ListCustomers(); if (p2.Id > 0) { PartsL.SavePartsCustLink(p2.Id, PartsCustAddList); } } }
private void PartDelButton_Click(object sender, EventArgs e) { //Delete Customer if (PartNoCombo.Text != "") { DialogResult result = MessageBox.Show("Are you sure you want to delete the current Part? " + "Doing so will also perminately delete the Part from the database.", "Part Customer?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly, false); if (result == DialogResult.Yes) { try { Part p1 = new Part(); p1 = PartsL.SearchPart(PartNoCombo.Text); PartsL.DeletePart(p1.Id); PartNoCombo.DataSource = PartsL.ListParts(); if (PartNoCombo.Items.Count == 0) { AA1TB.Text = ""; AA2TB.Text = ""; BlowCb.Checked = false; TotalCaplbl.Text = "0"; CureTempTB.Text = ""; PartDescTB.Text = ""; TotalDotlbl.Text= "0"; FeetCB.Text = ""; FR1TB.Text = ""; FR2TB.Text = ""; KV1TB.Text = ""; KV2TB.Text = ""; MaskTimeTB.Text = ""; MillageTB.Text = ""; MinConvCB.Text = ""; MinPartsPerTB.Text = ""; MinPiecesTB.Text = ""; PoundsTB.Text = "0"; PaintTimelbl.Text = ""; TotalPlugslbl.Text = "0"; powderlbl.Text = ""; PreMaskcb.Checked = false; REC1TB.Text = ""; REC2TB.Text = ""; SpecialNotesTB.Text = ""; // SpotFaceTB.Text = ""; SqFeetTB.Text = ""; FeetCB.DataSource = cFeet; MinConvCB.DataSource = cConvSpeed; PartsSelectedCustList.Items.Clear(); PartsUnSelectedCustList.Items.Clear(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
private void Object2Form(Part p) { PartMaskLinkList pmList; AA1TB.Text = p.Atomizing1.ToString(); AA2TB.Text = p.Atomizing2.ToString(); if (p.BlowExcessWater == "Y") { BlowCb.Checked = true; } else { BlowCb.Checked = false; } pmList = new PartMaskLinkList(p.Id); TotalCaplbl.Text = pmList.GetMaskTotal("Cap").ToString(); TotalPlugslbl.Text = pmList.GetMaskTotal("Plug").ToString(); TotalDotlbl.Text = pmList.GetMaskTotal("Dot").ToString(); int Index2 = PartColorCombo.FindString(p.ColorName); PartColorCombo.SelectedIndex = Index2; CureTempTB.Text = p.CureTemp.ToString(); PartDescTB.Text = p.PartDesc; FeetCB.Text = p.Feet.ToString(); FR1TB.Text = p.FlowRate1.ToString(); FR2TB.Text = p.FlowRate2.ToString(); KV1TB.Text = p.Kv1.ToString(); KV2TB.Text = p.Kv2.ToString(); MaskTimeTB.Text = p.MaskTime.ToString(); MillageTB.Text = p.Millage.ToString(); MinConvCB.Text = p.MinConvSpeed.ToString(); MinPartsPerTB.Text = p.MinPartsPerRack.ToString(); MinPiecesTB.Text = p.MinPiecesPer.ToString(); PaintTimelbl.Text = p.PaintTime.ToString(); int Index = PartNoCombo.FindString(p.PartNo); PartNoCombo.SelectedIndex = Index; PoundsTB.Text = p.PoundsPer.ToString(); powderlbl.Text = p.PowderNumber; if (p.PreMask == "Y") { PreMaskcb.Checked = true; } else { PreMaskcb.Checked = false; } REC1TB.Text = p.Receipe1; REC2TB.Text = p.Receipe2; SpecialNotesTB.Text = p.SpecialNotes; //SpotFaceTB.Text = p.SpotFace; SqFeetTB.Text = p.SqFeet.ToString(); // Load Parts Combos PartsSelectedCustList.Items.Clear(); PartsUnSelectedCustList.Items.Clear(); PartsCustAddList = PartsL.LoadAssignedCustomers(p.Id); PartsCustDelList = PartsL.LoadUnAssignedCustomers(p.Id); foreach (string sPart in PartsCustAddList) { PartsSelectedCustList.Items.Add(sPart); } foreach (string sPart in PartsCustDelList) { PartsUnSelectedCustList.Items.Add(sPart); } }
private Part Form2Object() { Part p = new Part(PartNoCombo.Text); p.Atomizing1 = Preformat(AA1TB.Text); p.Atomizing2 = Preformat(AA2TB.Text); if (BlowCb.Checked == true) { p.BlowExcessWater = "Y"; } else { p.BlowExcessWater = "N"; } p.CapsQty = Preformat(TotalCaplbl.Text); p.ColorName = PartColorCombo.Text; p.CureTemp = Preformat(CureTempTB.Text); p.PartDesc = PartDescTB.Text; p.DotsQty = Preformat(TotalDotlbl.Text); p.Feet = Preformat(FeetCB.Text); p.FlowRate1 = Preformat(FR1TB.Text); p.FlowRate2 = Preformat(FR2TB.Text); p.Kv1 = Preformat(KV1TB.Text); p.Kv2 = Preformat(KV2TB.Text); p.MaskTime = double.Parse(MaskTimeTB.Text); p.Millage = Preformat(MillageTB.Text); p.MinConvSpeed = Preformat(MinConvCB.Text); p.MinPartsPerRack = Preformat(MinPartsPerTB.Text); p.MinPiecesPer = Preformat(MinPiecesTB.Text); p.PaintTime = double.Parse(PaintTimelbl.Text); p.PoundsPer = double.Parse(PoundsTB.Text); p.PlugsQty = Preformat(TotalPlugslbl.Text); p.PowderNumber = powderlbl.Text; if (PreMaskcb.Checked) { p.PreMask = "Y"; } else { p.PreMask = "N"; } p.Receipe1 = REC1TB.Text; p.Receipe2 = REC2TB.Text; p.SpecialNotes = SpecialNotesTB.Text; //p.SpotFace = SpotFaceTB.Text; p.SqFeet = double.Parse(SqFeetTB.Text); return (p); }
public Object_Test(Part p, PartMaskLinkList pl, String Cust ) { InitializeComponent(); rr = new RouterRptObj(p, pl.GetPartMaskLink(), Cust); }
public void AddPart(Part Part) { // Initialize SPROC SqlConnection conn = new SqlConnection(ConnectionString); SqlCommand cmd = new SqlCommand("SPPartsInsert", conn); cmd.CommandType = CommandType.StoredProcedure; // Add Parameters cmd.Parameters.AddWithValue("@PartNo", Part.PartNo); cmd.Parameters.AddWithValue("@PartImage", Part.PartImage); cmd.Parameters.AddWithValue("@PartDesc", Part.PartDesc); cmd.Parameters.AddWithValue("@ColorName", Part.ColorName); cmd.Parameters.AddWithValue("@PowderNumber", Part.PowderNumber); cmd.Parameters.AddWithValue("@CureTemp", Part.CureTemp); cmd.Parameters.AddWithValue("@Millage", Part.Millage); cmd.Parameters.AddWithValue("@MinConvSpeed", Part.MinConvSpeed); cmd.Parameters.AddWithValue("@MinPiecesPer", Part.MinPiecesPer); cmd.Parameters.AddWithValue("@Feet", Part.Feet); cmd.Parameters.AddWithValue("@MinPartsPerRack", Part.MinPartsPerRack); cmd.Parameters.AddWithValue("@Kv1", Part.Kv1); cmd.Parameters.AddWithValue("@FlowRate1", Part.FlowRate1); cmd.Parameters.AddWithValue("@Atomizing1", Part.Atomizing1); cmd.Parameters.AddWithValue("@Receipe1", Part.Receipe1); cmd.Parameters.AddWithValue("@Kv2", Part.Kv2); cmd.Parameters.AddWithValue("@FlowRate2", Part.FlowRate2); cmd.Parameters.AddWithValue("@Atomizing2", Part.Atomizing2); cmd.Parameters.AddWithValue("@Receipe2", Part.Receipe2); cmd.Parameters.AddWithValue("@PlugsQty", Part.PlugsQty); cmd.Parameters.AddWithValue("@DotsQty", Part.DotsQty); cmd.Parameters.AddWithValue("@CapsQty", Part.CapsQty); cmd.Parameters.AddWithValue("@SpotFace", Part.SpotFace); cmd.Parameters.AddWithValue("@BlowExcessWater", Part.BlowExcessWater); cmd.Parameters.AddWithValue("@SpecialNotes", Part.SpecialNotes); cmd.Parameters.AddWithValue("@PreMask", Part.PreMask); cmd.Parameters.AddWithValue("@MaskTime", Part.MaskTime); cmd.Parameters.AddWithValue("@SqFeet", Part.SqFeet); cmd.Parameters.AddWithValue("@PaintTime", Part.PaintTime); cmd.Parameters.AddWithValue("@PoundsPer", Part.PoundsPer); cmd.Parameters.AddWithValue("@Hanger", Part.Hanger); cmd.Parameters.AddWithValue("@RackType", Part.RackType); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); reload(); }
public Part SearchPart(string PartNo) { foreach (Part part in pList) { if (part.PartNo == PartNo) { return (part); } } Part p = new Part(PartNo); return (p); }