private void buttoneRBill_Click(object sender, EventArgs e) { dataGridViewCurrentShipment.Focus(); if (!Main.CheckUserPermission(Properties.Settings.Default.WsirConnectionString, Properties.Settings.Default.UsuarioNombre, "SolViewShipment", true)) { return; } if (dataGridViewCurrentShipment.SelectedRows.Count < 1) { MessageBox.Show("Please select a Shipment to tramsmit", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } RBillNumber = dataGridViewCurrentShipment.SelectedRows[0].Cells[0].Value.ToString(); string status = dataGridViewCurrentShipment.SelectedRows[0].Cells[3].Value.ToString(); if (status.ToLower() != "s") { MessageBox.Show("Only Shipments marked as Shipped please", "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (sol_Shipment_Sp == null) { sol_Shipment_Sp = new Sol_Shipment_Sp(Properties.Settings.Default.WsirDbConnectionString); } sol_Shipment = sol_Shipment_Sp.SelectByRBillNumber(RBillNumber); if (sol_Shipment == null) { MessageBox.Show(String.Format("Invalid RBill Number: {0}, please verify it!", RBillNumber), "", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (sol_Shipment.ERBillTransmitted) { //MessageBox.Show("Shipment already transmitted!"); //return; DialogResult result = MessageBox.Show("This R-Bill has already been submitted. Are you sure you want to send it again?", "", MessageBoxButtons.YesNoCancel); //.YesNo); if (result != System.Windows.Forms.DialogResult.Yes) { return; } } if (sol_Agencie_Sp == null) { sol_Agencie_Sp = new Sol_Agencie_Sp(Properties.Settings.Default.WsirDbConnectionString); } sol_Agencie = sol_Agencie_Sp.Select(sol_Shipment.AgencyID); if (sol_Agencie.Name.ToLower().Trim() != "abcrc") { MessageBox.Show("Shipment's agency is not ABCRC!"); return; } ShippingShipments.eRBill(sol_Shipment, sol_Shipment_Sp); }
/// <summary> /// Selects all records from the sol_Agencies table. /// </summary> public virtual List <Sol_Agencie> SelectAll() { using (SqlDataReader dataReader = SqlClientUtility.ExecuteReader(connectionStringName, CommandType.StoredProcedure, "sol_Agencies_SelectAll")) { List <Sol_Agencie> sol_AgencieList = new List <Sol_Agencie>(); while (dataReader.Read()) { Sol_Agencie sol_Agencie = MakeSol_Agencie(dataReader); sol_AgencieList.Add(sol_Agencie); } return(sol_AgencieList); } }
/// <summary> /// Creates a new instance of the sol_Agencies class and populates it with data from the specified SqlDataReader. /// </summary> protected virtual Sol_Agencie MakeSol_Agencie(SqlDataReader dataReader) { Sol_Agencie sol_Agencie = new Sol_Agencie(); sol_Agencie.AgencyID = SqlClientUtility.GetInt32(dataReader, "AgencyID", 0); sol_Agencie.Name = SqlClientUtility.GetString(dataReader, "Name", String.Empty); sol_Agencie.Description = SqlClientUtility.GetString(dataReader, "Description", String.Empty); sol_Agencie.Address1 = SqlClientUtility.GetString(dataReader, "Address1", String.Empty); sol_Agencie.Address2 = SqlClientUtility.GetString(dataReader, "Address2", String.Empty); sol_Agencie.City = SqlClientUtility.GetString(dataReader, "City", String.Empty); sol_Agencie.Province = SqlClientUtility.GetString(dataReader, "Province", String.Empty); sol_Agencie.Country = SqlClientUtility.GetString(dataReader, "Country", String.Empty); sol_Agencie.PostalCode = SqlClientUtility.GetString(dataReader, "PostalCode", String.Empty); sol_Agencie.VendorID = SqlClientUtility.GetString(dataReader, "VendorID", String.Empty); sol_Agencie.AutoGenerateTagNumber = SqlClientUtility.GetBoolean(dataReader, "AutoGenerateTagNumber", false); sol_Agencie.AutoGenerateRBillNumber = SqlClientUtility.GetBoolean(dataReader, "AutoGenerateRBillNumber", false); return(sol_Agencie); }
/// <summary> /// Saves a record to the sol_Agencies table. /// </summary> public virtual void Insert(Sol_Agencie sol_Agencie) { ValidationUtility.ValidateArgument("sol_Agencie", sol_Agencie); SqlParameter[] parameters = new SqlParameter[] { new SqlParameter("@Name", sol_Agencie.Name), new SqlParameter("@Description", sol_Agencie.Description), new SqlParameter("@Address1", sol_Agencie.Address1), new SqlParameter("@Address2", sol_Agencie.Address2), new SqlParameter("@City", sol_Agencie.City), new SqlParameter("@Province", sol_Agencie.Province), new SqlParameter("@Country", sol_Agencie.Country), new SqlParameter("@PostalCode", sol_Agencie.PostalCode), new SqlParameter("@VendorID", sol_Agencie.VendorID), new SqlParameter("@AutoGenerateTagNumber", sol_Agencie.AutoGenerateTagNumber), new SqlParameter("@AutoGenerateRBillNumber", sol_Agencie.AutoGenerateRBillNumber) }; sol_Agencie.AgencyID = (int)SqlClientUtility.ExecuteScalar(connectionStringName, CommandType.StoredProcedure, "sol_Agencies_Insert", parameters); }
private void ClearForm() { //textBoxStageID.Text = ""; textBoxUserName.Text = ""; textBoxDate.Text = ""; textBoxTagNumber.Text = ""; comboBoxContainers.SelectedValue = -1; comboBoxContainers.Text = ""; comboBoxProducts.SelectedValue = -1; comboBoxProducts.Text = ""; textBoxQuantity.Text = ""; textBoxDozen.Text = ""; textBoxDefaultDozen.Text = ""; textBoxRemarks.Text = ""; controlWithFocus = null; //for upon exit flagChange = false; sol_Agency = null; }
private void buttonPrintLabel_Click(object sender, EventArgs e) { //commands /* * {barCode} * {vendorId} * {productCode} * {quantity} * {tag} * {depotName} * {description} of the product * {dozen} * {date} * {stageId} */ string barCode = String.Empty; string vendorId = String.Empty; string productCode = String.Empty; string quantity = String.Empty; string tag = String.Empty; int intValue = 0; //sending raw directly to lp2844 UpcLabel label = new UpcLabel(""); string labelCommands = Properties.Settings.Default.SettingsWsLabelCommands; //open table connection if (sol_Agency_Sp == null) { sol_Agency_Sp = new Sol_Agencie_Sp(Properties.Settings.Default.WsirDbConnectionString); } if (sol_Product_Sp == null) { sol_Product_Sp = new Sol_Product_Sp(Properties.Settings.Default.WsirDbConnectionString); } //search for product sol_Product = sol_Product_Sp.Select(sol_Stage.ProductID); if (sol_Product != null) { intValue = 0; Int32.TryParse(sol_Product.ProductCode, out intValue); productCode = intValue.ToString("0000"); sol_Agency = sol_Agency_Sp.Select(sol_Product.AgencyID); if (sol_Agency != null) { intValue = 0; Int32.TryParse(sol_Agency.VendorID, out intValue); vendorId = intValue.ToString("0000"); } } intValue = 0; Int32.TryParse(textBoxDozen.Text, out intValue); string c = String.Format("{0}", intValue); labelCommands = labelCommands.Replace("{dozen}", c); int intQuantity = intValue * 12; c = String.Format("{0}", intQuantity); labelCommands = labelCommands.Replace("{quantity}", c); quantity = intQuantity.ToString("00000"); intValue = 0; Int32.TryParse(textBoxTagNumber.Text, out intValue); tag = intValue.ToString("0000000"); barCode = vendorId + productCode + quantity + tag; labelCommands = labelCommands.Replace("{barCode}", barCode); labelCommands = labelCommands.Replace("{vendorId}", sol_Agency.VendorID.Trim()); labelCommands = labelCommands.Replace("{productCode}", sol_Product.ProductCode.Trim()); labelCommands = labelCommands.Replace("{quantity}", sol_Stage.Quantity.ToString().Trim()); labelCommands = labelCommands.Replace("{tag}", textBoxTagNumber.Text.Trim()); labelCommands = labelCommands.Replace("{depotName}", Main.Sol_ControlInfo.BusinessName.Trim()); labelCommands = labelCommands.Replace("{description}", sol_Product.ProDescription.Trim()); //labelCommands = labelCommands.Replace("{dozen}", textBoxTagNumber.Text.Trim()); //labelCommands = labelCommands.Replace("{date}", textBoxTagNumber.Text.Trim()); //labelCommands = labelCommands.Replace("{stageId}", textBoxTagNumber.Text.Trim()); ////MessageBox.Show(labelCommands); //labelCommands = labelCommands.Replace("{tag}", textBoxTagNumber.Text.Trim()); ////labelCommands = labelCommands.Replace("{agency}", textBoxTagNumber.Text.Trim()); //labelCommands = labelCommands.Replace("{description}", comboBoxProducts.Text.Trim()); DateTime dt = Main.rc.FechaActual; // ; try { dt = DateTime.Parse(textBoxDate.Text); } catch { } labelCommands = labelCommands.Replace("{date}", dt.ToString("dd-MMM-yyyy")); labelCommands = labelCommands.Replace("{stageId}", sol_Stage.StageID.ToString()); try { //quitar (uncomment) label.Print(Properties.Settings.Default.SettingsWsLabelPrinter, labelCommands); //quitar (comment) //MessageBox.Show(labelCommands); } catch { MessageBox.Show("Label printer not found!"); } }
private void comboBoxProducts_SelectedIndexChanged(object sender, EventArgs e) { int Id = -1; try { Id = (int)comboBoxProducts.SelectedValue; } catch { return; } //delete row if it was new if (sol_Agency != null) { if (sol_Agency.AutoGenerateTagNumber) { if (buttonClicked == "&New") { DeleteStagedRow(); } } } //Sol_Product sol_Product = new Sol_Product(); if (sol_Product_Sp == null) { sol_Product_Sp = new Sol_Product_Sp(Properties.Settings.Default.WsirDbConnectionString); } sol_Product = sol_Product_Sp.Select(Id); comboBoxContainers.SelectedValue = sol_Product.ContainerID; //open table connection if (sol_Agency_Sp == null) { sol_Agency_Sp = new Sol_Agencie_Sp(Properties.Settings.Default.WsirDbConnectionString); } sol_Agency = sol_Agency_Sp.Select(sol_Product.AgencyID); //if (sol_Agency != null) //{ // Int32.TryParse(sol_Agency.VendorID, out intValue); // vendorId = intValue.ToString("0000"); //} if (sol_Agency.AutoGenerateTagNumber) { //add row if (AddStagedRow()) { textBoxTagNumber.Text = sol_Stage.TagNumber; textBoxTagNumber.ReadOnly = true; comboBoxContainers.Focus(); comboBoxProducts.Enabled = false; } else { buttonCancel.PerformClick(); } } else { textBoxTagNumber.ReadOnly = false; //textBoxTagNumber.Focus(); } //Sol_StandardDozen_Sp sol_StandardDozen_Sp = new Sol_StandardDozen_Sp(Properties.Settings.Default.WsirDbConnectionString); //Sol_StandardDozen sol_StandardDozen = sol_StandardDozen_Sp.Select(sol_Product.StandardDozenID); //textBoxDefaultDozen.Text = sol_StandardDozen.Quantity.ToString(); textBoxQuantity.Text = sol_Product.TargetQuantity.ToString(); textBoxDozen.Text = SolFunctions.Quantity2Dozen(sol_Product.TargetQuantity); }
private void buttonClose_Click(object sender, EventArgs e) { if (comboBoxProducts.SelectedIndex < 0) { MessageBox.Show("Please enter a Product"); comboBoxProducts.Focus(); return; } if (String.IsNullOrEmpty(textBoxTagNumber.Text)) { MessageBox.Show("Please enter a Tag number"); textBoxTagNumber.Focus(); controlWithFocus = textBoxTagNumber; return; } if (comboBoxContainers.SelectedIndex < 0) { MessageBox.Show("Please enter a Container Type"); comboBoxContainers.Focus(); return; } int quantity = 0; try { quantity = Int32.Parse(textBoxQuantity.Text); } catch { MessageBox.Show("Please enter a valid quantity."); textBoxQuantity.Focus(); return; } if (String.IsNullOrEmpty(textBoxDozen.Text)) { MessageBox.Show("Please enter number of dozens"); textBoxDozen.Focus(); return; } decimal dozen = 0; try { dozen = decimal.Parse(textBoxDozen.Text); } catch { MessageBox.Show("Please enter a valid number of dozens."); textBoxDozen.Focus(); return; } //add if (sol_Agency != null && sol_Agency.AutoGenerateTagNumber && buttonClicked == "&New" ) { //update UpdateStagedContainer(); } else { if (buttonClicked == "&New") { /* I-InProgress; P-Picked S-Shipped D -Void "" = any */ sol_Stage = sol_Stage_Sp._SelectByTagNumberStatus(textBoxTagNumber.Text, ""); //I"); if (sol_Stage != null) { MessageBox.Show("Tag number already exists, try another one please."); textBoxTagNumber.Focus(); controlWithFocus = textBoxTagNumber; return; } AddStagedContanier(); } else { //update UpdateStagedContainer(); } } //view state EnableControls(false); EnableButtons("close"); //for upon exit flagChange = false; sol_Agency = null; }