public bool AddItem(string AddName, string AddType) { if (BillShipExists(AddName,AddType)) { return false; } else { CustBillShip c = new CustBillShip(cID); c.AddressName = AddName; c.AddressType = AddType; cList.Add(c); return true; } }
public static CustBillShip PopulateCustBillShipsFromSqlDataReader(SqlDataReader dr) { CustBillShip custBS = new CustBillShip(); custBS.ID = Convert.ToInt32(dr["ID"]); custBS.CustomerID = Convert.ToInt32(dr["CUSTOMERID"]); custBS.AddressName = Convert.ToString(dr["ADDRESSNAME"]); custBS.AddressType = Convert.ToString(dr["ADDRESSTYPE"]); custBS.Address1 = Convert.ToString(dr["ADDRESS1"]); custBS.Address2 = Convert.ToString(dr["ADDRESS2"]); custBS.City = Convert.ToString(dr["CITY"]); custBS.State = Convert.ToString(dr["STATE"]); custBS.Zip = Convert.ToString(dr["ZIP"]); return custBS; }
private void button27_Click(object sender, EventArgs e) { //Save or Update BillShipList cBSList = new BillShipList(cID); if (FormMode == "NEW") { cBSList.AddCustBillShip(Form2Object()); } else if (FormMode == "EDIT") { CustBillShip c = new CustBillShip(); c = Form2Object(); c.ID = ShipID; cBSList.UpdateCustBillShip(c); } this.Hide(); }
public void AddCustBillShip(CustBillShip CustBS) { // Initialize SPROC SqlConnection conn = new SqlConnection(ConnectionString); SqlCommand cmd = new SqlCommand("SPBillShipInsert", conn); cmd.CommandType = CommandType.StoredProcedure; // Add Parameters cmd.Parameters.AddWithValue("@ADDRESSNAME", CustBS.AddressName); cmd.Parameters.AddWithValue("@ADDRESSTYPE", CustBS.AddressType); cmd.Parameters.AddWithValue("@ADDRESS1", CustBS.Address1); cmd.Parameters.AddWithValue("@ADDRESS2", CustBS.Address2); cmd.Parameters.AddWithValue("@CITY", CustBS.City); cmd.Parameters.AddWithValue("@STATE", CustBS.State); cmd.Parameters.AddWithValue("@ZIP", CustBS.Zip); cmd.Parameters.AddWithValue("@CUSTOMERID", CustBS.CustomerID); conn.Open(); cmd.ExecuteNonQuery(); conn.Close(); reload(); }
public BillShipAddrForm(ref CustBillShip CustBS, String Mode) { string[] AddrType ={ "Shipping", "Billing" }; InitializeComponent(); FormMode = Mode.ToUpper(); cID = CustBS.CustomerID; if (FormMode == "NEW") { AddrType[0] = "Shipping"; AddrType[1] = "Billing"; button27.Text = "Save"; comboBox1.DataSource = AddrType; comboBox19.DataSource = cStates; } else { ShipID = CustBS.ID; comboBox19.DataSource = cStates; Object2Form(CustBS); FormMode = "EDIT"; button27.Text = "Modify"; } }
private void Object2Form(CustBillShip c) { string[] AddrType ={ "Shipping", "Billing" }; if (c.AddressType.ToUpper() == "SHIPPING") { AddrType[0] = "Shipping"; AddrType[1] = "Billing"; } else { AddrType[0] = "Billing"; AddrType[1] = "Shipping"; } comboBox1.DataSource = AddrType; /*0 ID 1 Name 2 Type 3 Address1 4 Address2 5 City 6 State 7 ZIP*/ textBox26.Text = c.Address1; textBox1.Text = c.Address2; textBox25.Text = c.AddressName; textBox27.Text = c.City; int Index = comboBox19.FindString(c.State); comboBox19.SelectedIndex = Index; textBox28.Text = c.Zip; }
private CustBillShip Form2Object() { CustBillShip c = new CustBillShip(0,textBox25.Text,comboBox1.Text,textBox26.Text,textBox1.Text,textBox27.Text,comboBox19.Text,textBox28.Text,cID); return c; }
private void UpdatePOShip(int QTS,int ONH) { string DataGrid_PO = ""; string DataGrid_POStat; int DataGrid_Inv = 0; int DataGrid_OnHand = 0; int DataGrid_ShipQuan = 0; int totalavqty = 0; int POID = 0; Shippers shipr = new Shippers(); CustBillShip bill = new CustBillShip(); CustBillShip ship = new CustBillShip(); /* item.Cells[0].Value = po.PoNumber; item.Cells[1].Value = po.ReceiveDate; item.Cells[2].Value = po.InitialQty; item.Cells[3].Value = po.FabRejectQty; item.Cells[4].Value = po.PaintRejectQty; item.Cells[5].Value = po.InventoryQty; item.Cells[6].Value = po.ShippedQty; item.Cells[7].Value = po.Status; item.Cells[8].Value = po.Id; */ int j = 0; while (j < InvPOGrid.RowCount) { if (QTS != 0) { POID = int.Parse(InvPOGrid.Rows[j].Cells[8].Value.ToString()); DataGrid_POStat = InvPOGrid.Rows[j].Cells[7].Value.ToString(); DataGrid_PO = InvPOGrid.Rows[j].Cells[0].Value.ToString(); DataGrid_Inv = int.Parse(InvPOGrid.Rows[j].Cells[5].Value.ToString()); DataGrid_OnHand = int.Parse(InvPOGrid.Rows[j].Cells[9].Value.ToString()); DataGrid_ShipQuan = int.Parse(InvPOGrid.Rows[j].Cells[6].Value.ToString()); if (DataGrid_Inv <= QTS) { DataGrid_ShipQuan = DataGrid_ShipQuan + DataGrid_Inv; QTS = QTS - DataGrid_Inv; DataGrid_Inv = 0; DataGrid_OnHand = DataGrid_OnHand - DataGrid_ShipQuan; if (DataGrid_POStat != "OPEN_INV") { DataGrid_POStat = "SHIPPED"; } } else { DataGrid_ShipQuan = DataGrid_ShipQuan + QTS; DataGrid_Inv = DataGrid_Inv - QTS; DataGrid_OnHand = DataGrid_OnHand - QTS; QTS = 0; } int CustID; Customer TCust = CustList.SearchCustomer(CustCombo.Text); CustID = TCust.ID; BillShipList BSList; BSList = new BillShipList(TCust.ID); InvPOGrid.Rows[j].Cells[6].Value = DataGrid_ShipQuan.ToString(); InvPOGrid.Rows[j].Cells[5].Value = DataGrid_Inv.ToString(); string RcvDate = InvPOGrid.Rows[j].Cells[1].Value.ToString(); shipr = Shippers.SearchShipper(ShipViaCombo.Text); bill = BSList.SearchBillShip(BillToCombo.Text, "Billing"); ship = BSList.SearchBillShip(BillToCombo.Text, "Shipping"); if (bill.AddressName == "") { bill.ID = 0; } if (ship.AddressName == "") { ship.ID = 0; } if (bill.ID == 0) { bill.ID = ship.ID; } if (ship.ID == 0) { ship.ID = bill.ID; } shipList.ShipPO(DataGrid_PO, CustID, PartCombo.Text, RcvDate, TrackingTB.Text, shipComment, DataGrid_ShipQuan, ship.ID, DataGrid_Inv, DataGrid_OnHand, DataGrid_POStat,bill.ID); shipList.CreateShipmentRecord(CustID, PartCombo.Text, DataGrid_ShipQuan, POID, TrackingTB.Text, ship.ID, bill.ID, shipr.ID); //Update Database } j++; totalavqty = totalavqty + DataGrid_Inv; } }
public CustBillShip SearchBillShip(string AddName, string AddType) { foreach (CustBillShip custBS in cList) { if ((custBS.AddressName == AddName) && (custBS.AddressType == AddType)) { return (custBS); } } CustBillShip c = new CustBillShip(cID); return (c); }
//ADD NEW Shipping Address private void button68_Click(object sender, EventArgs e) { //Add A New Shipping or Billing Address //Saves Current Customer button27_Click(sender, e); //Creates a new BillShip calls the form2 to edit further Customer c1 = CustList.SearchCustomer(CustIDcombo.Text); CustBillShip cBS = new CustBillShip(c1.ID); //Add Address form BillShipAddrForm f = new BillShipAddrForm(ref cBS, "NEW"); f.ShowDialog(); LoadBillShip(c1.ID); //poplist(); }