private bool IsStockCodeExist() { bool result = false; string sql = "STKCODE = '" + txtStkCode.Text + "'"; RT2020.DAL.Product oProd = RT2020.DAL.Product.LoadWhere(sql); if (oProd != null) { result = true; } sql += " AND APP1_COMBIN = '" + cboAppendix1.Text + "' AND APP2_COMBIN = '" + cboAppendix2.Text + "' AND APP3_COMBIN = '" + cboAppendix3.Text + "'"; RT2020.DAL.ProductBatch oProdB = RT2020.DAL.ProductBatch.LoadWhere(sql); if (oProdB != null) { result = true; } if (this.ProductBatchId != System.Guid.Empty) { result = false; } return(result); }
private void SaveProductBarcode(RT2020.DAL.Product oItem) { string stkcode = oItem.STKCODE; if (oItem.STKCODE.Length > 10) { stkcode = oItem.STKCODE.Remove(10); } string barcode = stkcode + oItem.APPENDIX1 + oItem.APPENDIX2 + oItem.APPENDIX3; string sql = "ProductId = '" + oItem.ProductId.ToString() + "' AND Barcode = '" + barcode + "'"; ProductBarcode oBarcode = ProductBarcode.LoadWhere(sql); if (oBarcode == null) { oBarcode = new ProductBarcode(); oBarcode.ProductId = oItem.ProductId; oBarcode.Barcode = barcode; oBarcode.BarcodeType = "INTER"; oBarcode.PrimaryBarcode = true; oBarcode.DownloadToPOS = general.chkRetailItem.Checked; oBarcode.DownloadToCounter = general.chkCounterItem.Checked; oBarcode.Save(); } }
private void ShowHeaderInfo() { RT2020.DAL.Product oItem = RT2020.DAL.Product.Load(_ProductId); if (oItem != null) { txtStkCode.Text = oItem.STKCODE; cboAppendix1.Text = oItem.APPENDIX1; cboAppendix2.Text = oItem.APPENDIX2; cboAppendix3.Text = oItem.APPENDIX3; } }
private void SaveQtyInfo() { RT2020.DAL.Product oItem = RT2020.DAL.Product.Load(this.ProductId); if (oItem != null) { oItem.MaxOnLoanQty = Convert.ToDecimal((quantity.txtMaxOLNQty.Text == string.Empty) ? "0" : quantity.txtMaxOLNQty.Text); oItem.ModifiedBy = RT2020.DAL.Common.Config.CurrentUserId; oItem.ModifiedOn = DateTime.Now; oItem.Save(); } }
/// <summary> /// Items the info. /// </summary> /// <param name="stkCode">The STK code.</param> /// <param name="appendix1">The appendix1.</param> /// <param name="appendix2">The appendix2.</param> /// <param name="appendix3">The appendix3.</param> private void ItemInfo(ref string stkCode, ref string appendix1, ref string appendix2, ref string appendix3) { RT2020.DAL.Product objProd = RT2020.DAL.Product.Load(new Guid(dgvDetailsList.Rows[dgvDetailsList.CurrentCell.RowIndex].Cells[8].Value.ToString())); if (objProd != null) { stkCode = objProd.STKCODE; appendix1 = objProd.APPENDIX1; appendix2 = objProd.APPENDIX2; appendix3 = objProd.APPENDIX3; this.ProductId = objProd.ProductId; } }
private void SaveOrderInfo() { RT2020.DAL.Product oItem = RT2020.DAL.Product.Load(this.ProductId); if (oItem != null) { oItem.AlternateItem = order.txtVendorItemNum.Text; // Vendor Item Number oItem.ReorderLevel = Convert.ToDecimal((order.txtReorderLevel.Text == string.Empty) ? "0" : order.txtReorderLevel.Text); oItem.ReorderQty = Convert.ToDecimal((order.txtReorderQuantity.Text == string.Empty) ? "0" : order.txtReorderQuantity.Text); oItem.ModifiedBy = RT2020.DAL.Common.Config.CurrentUserId; oItem.ModifiedOn = DateTime.Now; oItem.Save(); } }
private bool VerifyDuplicated() { string sql = "STKCODE = '" + txtStkCode.Text + "' AND APPENDIX1 = '" + cboAppendix1.Text + "' AND APPENDIX2 = '" + cboAppendix2.Text + "' AND APPENDIX3 = '" + cboAppendix3.Text + "'"; RT2020.DAL.Product oItem = RT2020.DAL.Product.LoadWhere(sql); if (oItem != null) { MessageBox.Show("Duplicated Code (Stock Code + Appendix 1 + Appendix 2 + Appendix 3)!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(true); } else { return(false); } }
private void LoadGeneralInfo() { RT2020.DAL.Product oItem = RT2020.DAL.Product.Load(this.ProductId); if (oItem != null) { txtStkCode.Text = oItem.STKCODE; cboAppendix1.Text = oItem.APPENDIX1; cboAppendix2.Text = oItem.APPENDIX2; cboAppendix3.Text = oItem.APPENDIX3; general.cboClass1.Text = oItem.CLASS1; general.cboClass2.Text = oItem.CLASS2; general.cboClass3.Text = oItem.CLASS3; general.cboClass4.Text = oItem.CLASS4; general.cboClass5.Text = oItem.CLASS5; general.cboClass6.Text = oItem.CLASS6; general.txtProductName.Text = oItem.ProductName; general.txtProductNameChs.Text = oItem.ProductName_Chs; general.txtProductNameCht.Text = oItem.ProductName_Cht; general.txtRemarks.Text = oItem.Remarks; general.txtRetailDiscount.Text = oItem.NormalDiscount.ToString("n2"); general.txtUnit.Text = oItem.UOM; general.cboNature.SelectedValue = oItem.NatureId; //discount.chkFixedPrice.Checked = oItem.FixedPriceItem; general.txtStatus_Counter.Text = ""; general.txtStatus_Office.Text = ""; general.txtCreatedOn.Text = DateTimeHelper.DateTimeToString(oItem.CreatedOn, false); general.txtModifiedOn.Text = DateTimeHelper.DateTimeToString(oItem.ModifiedOn, false); general.txtModifiedBy.Text = GetStaffName(oItem.ModifiedBy); // Quantity Info //quantity.txtMaxOLNQty.Text = oItem.MaxOnLoanQty.ToString("n0"); // Order Info //order.txtVendorItemNum.Text = oItem.AlternateItem; // Vendor Item Number //order.txtReorderLevel.Text = oItem.ReorderLevel.ToString("n0"); //order.txtReorderQuantity.Text = oItem.ReorderQty.ToString("n0"); // Product Price LoadProductPrice(); general.txtCurrentRetailPrice.Text = oItem.RetailPrice.ToString("n2"); } }
private void GenBarcode() { StringBuilder barcode = new StringBuilder(); RT2020.DAL.Product oItem = RT2020.DAL.Product.Load(this.ProductId); if (oItem != null) { barcode.Append(oItem.STKCODE); barcode.Append(oItem.APPENDIX1); barcode.Append(oItem.APPENDIX2); barcode.Append(oItem.APPENDIX3); } txtBarcode.Text = barcode.ToString(); cboBarcodeType.SelectedIndex = 0; chkPrimaryBarcode.CheckState = CheckState.Checked; }
public bool SaveRec(Guid productId) { bool result = false; RT2020.DAL.Product oProduct = RT2020.DAL.Product.Load(productId); if (oProduct != null) { oProduct.MaxOnLoanQty = Convert.ToDecimal((txtMaxOLNQty.Text == string.Empty) ? "0" : txtMaxOLNQty.Text); oProduct.ModifiedBy = RT2020.DAL.Common.Config.CurrentUserId; oProduct.ModifiedOn = DateTime.Now; oProduct.Save(); _ProductId = productId; result = true; } return(result); }
public bool SaveRec(Guid productId) { bool result = false; RT2020.DAL.Product oProduct = RT2020.DAL.Product.Load(productId); if (oProduct != null) { oProduct.AlternateItem = txtVendorItemNum.Text; // Vendor Item Number oProduct.ReorderLevel = Convert.ToDecimal((txtReorderLevel.Text == String.Empty) ? "0" : txtReorderLevel.Text); oProduct.ReorderQty = Convert.ToDecimal((txtReorderQuantity.Text == String.Empty) ? "0" : txtReorderQuantity.Text); oProduct.ModifiedBy = RT2020.DAL.Common.Config.CurrentUserId; oProduct.ModifiedOn = DateTime.Now; oProduct.Save(); _ProductId = productId; result = true; } return(result); }
private void Delete() { RT2020.DAL.Product oItem = RT2020.DAL.Product.Load(this.ProductId); if (oItem != null) { string sql = "ProductId = '" + oItem.ProductId.ToString() + "'"; DeleteRemarks(sql); DeleteWorkplace(sql); DeleteBarcode(sql); DeleteLineOfOperation(sql); DeleteSupplement(sql); DeletePrice(sql); DeleteProductCode(sql); oItem.Delete(); } else { MessageBox.Show("Please sure the product info you want to delete is valid!"); } }
public bool SaveRec(Guid productId) { bool result = false; RT2020.DAL.Product oProduct = RT2020.DAL.Product.Load(productId); if (oProduct != null) { string sql = "ProductId = '" + productId.ToString() + "'"; DAL.ProductRemarks oRemarks = DAL.ProductRemarks.LoadWhere(sql); if (oRemarks == null) { oRemarks = new DAL.ProductRemarks(); oRemarks.ProductId = productId; } oRemarks.Notes = txtMemo.Text; if (string.IsNullOrEmpty(oRemarks.Photo)) { oRemarks.Photo = txtPicFileName.Text; } else if (oRemarks.Photo != txtPicFileName.Text) { oRemarks.Photo5 = oRemarks.Photo4; oRemarks.Photo4 = oRemarks.Photo3; oRemarks.Photo3 = oRemarks.Photo2; oRemarks.Photo2 = oRemarks.Photo; oRemarks.Photo = txtPicFileName.Text; } oRemarks.Save(); _ProductId = productId; result = true; } return(result); }
private void CreateProducts(ListViewItem listItem) { if (Verify()) { string a1 = listItem.SubItems[1].Text; string a2 = listItem.SubItems[2].Text; string a3 = listItem.SubItems[3].Text; System.Guid a1Id = (DAL.Common.Utility.IsGUID(listItem.SubItems[4].Text)) ? new Guid(listItem.SubItems[4].Text) : System.Guid.Empty; System.Guid a2Id = (DAL.Common.Utility.IsGUID(listItem.SubItems[5].Text)) ? new Guid(listItem.SubItems[5].Text) : System.Guid.Empty; System.Guid a3Id = (DAL.Common.Utility.IsGUID(listItem.SubItems[6].Text)) ? new Guid(listItem.SubItems[6].Text) : System.Guid.Empty; string prodCode = txtStkCode.Text.Trim() + a1 + a2 + a3; if (prodCode.Length <= 22) { StringBuilder sql = new StringBuilder(); sql.Append(" STKCODE = '").Append(txtStkCode.Text.Trim()).Append("' "); sql.Append(" AND APPENDIX1 = '").Append(a1.Trim()).Append("' "); sql.Append(" AND APPENDIX2 = '").Append(a2.Trim()).Append("' "); sql.Append(" AND APPENDIX3 = '").Append(a3.Trim()).Append("' "); RT2020.DAL.Product oItem = RT2020.DAL.Product.LoadWhere(sql.ToString()); if (oItem == null) { oItem = new RT2020.DAL.Product(); oItem.STKCODE = txtStkCode.Text; oItem.APPENDIX1 = a1; oItem.APPENDIX2 = a2; oItem.APPENDIX3 = a3; if (cboItemStatus.Text == "HOLD") { oItem.Status = Convert.ToInt32(DAL.Common.Enums.Status.Draft.ToString("d")); } else if (cboItemStatus.Text == "POST") { oItem.Status = Convert.ToInt32(DAL.Common.Enums.Status.Active.ToString("d")); } oItem.CLASS1 = general.cboClass1.Text; oItem.CLASS2 = general.cboClass2.Text; oItem.CLASS3 = general.cboClass3.Text; oItem.CLASS4 = general.cboClass4.Text; oItem.CLASS5 = general.cboClass5.Text; oItem.CLASS6 = general.cboClass6.Text; oItem.ProductName = general.txtProductName.Text; oItem.ProductName_Chs = general.txtProductNameChs.Text; oItem.ProductName_Cht = general.txtProductNameCht.Text; oItem.Remarks = general.txtRemarks.Text; oItem.NormalDiscount = Convert.ToDecimal((general.txtRetailDiscount.Text == string.Empty) ? "0" : general.txtRetailDiscount.Text); oItem.UOM = general.txtUnit.Text; oItem.NatureId = new Guid(general.cboNature.SelectedValue.ToString()); oItem.FixedPriceItem = false; // Download Packets oItem.DownloadToPOS = general.chkRetailItem.Checked; oItem.DownloadToCounter = general.chkCounterItem.Checked; oItem.CreatedBy = DAL.Common.Config.CurrentUserId; oItem.CreatedOn = DateTime.Now; oItem.ModifiedBy = DAL.Common.Config.CurrentUserId; oItem.ModifiedOn = DateTime.Now; oItem.Save(); SaveProductBarcode(oItem.ProductId, prodCode); // Appendix / Class System.Guid c1Id = (general.cboClass1.SelectedValue != null) ? new Guid(general.cboClass1.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c2Id = (general.cboClass2.SelectedValue != null) ? new Guid(general.cboClass2.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c3Id = (general.cboClass3.SelectedValue != null) ? new Guid(general.cboClass3.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c4Id = (general.cboClass4.SelectedValue != null) ? new Guid(general.cboClass4.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c5Id = (general.cboClass5.SelectedValue != null) ? new Guid(general.cboClass5.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c6Id = (general.cboClass6.SelectedValue != null) ? new Guid(general.cboClass6.SelectedValue.ToString()) : System.Guid.Empty; SaveProductCode(oItem.ProductId, a1Id, a2Id, a3Id, c1Id, c2Id, c3Id, c4Id, c5Id, c6Id); // Product Price SaveProductSupplement(oItem.ProductId); SaveProductPrice(oItem.ProductId); // Remarks SaveProductRemarks(oItem.ProductId); SaveCurrentSummary(oItem.ProductId); } } } }
private Guid SaveGeneralInfo() { bool isNew = false; RT2020.DAL.Product oItem = RT2020.DAL.Product.Load(this.ProductId); if (oItem == null) { oItem = new RT2020.DAL.Product(); oItem.STKCODE = txtStkCode.Text.Trim(); oItem.APPENDIX1 = cboAppendix1.Text.Trim(); oItem.APPENDIX2 = cboAppendix2.Text.Trim(); oItem.APPENDIX3 = cboAppendix3.Text.Trim(); oItem.Status = (int)RT2020.DAL.Common.Enums.Status.Active; isNew = true; oItem.CreatedBy = RT2020.DAL.Common.Config.CurrentUserId; oItem.CreatedOn = DateTime.Now; if (VerifyDuplicated()) { return(System.Guid.Empty); } } oItem.CLASS1 = general.cboClass1.Text; oItem.CLASS2 = general.cboClass2.Text; oItem.CLASS3 = general.cboClass3.Text; oItem.CLASS4 = general.cboClass4.Text; oItem.CLASS5 = general.cboClass5.Text; oItem.CLASS6 = general.cboClass6.Text; oItem.ProductName = general.txtProductName.Text; oItem.ProductName_Chs = general.txtProductNameChs.Text; oItem.ProductName_Cht = general.txtProductNameCht.Text; oItem.Remarks = general.txtRemarks.Text; oItem.NormalDiscount = Convert.ToDecimal((general.txtRetailDiscount.Text == string.Empty) ? "0" : general.txtRetailDiscount.Text); oItem.UOM = general.txtUnit.Text; oItem.NatureId = new Guid(general.cboNature.SelectedValue.ToString()); oItem.FixedPriceItem = discount.chkFixedPrice.Checked; // Price oItem.RetailPrice = Convert.ToDecimal((general.txtCurrentRetailPrice.Text == string.Empty) ? "0" : general.txtCurrentRetailPrice.Text); oItem.WholesalePrice = Convert.ToDecimal((general.txtWholesalesPrice.Text == string.Empty) ? "0" : general.txtWholesalesPrice.Text); oItem.OriginalRetailPrice = Convert.ToDecimal((general.txtOriginalRetailPrice.Text == string.Empty) ? "0" : general.txtOriginalRetailPrice.Text); //oItem.Markup = Convert.ToDecimal((general.txtVendorPrice.Text == string.Empty) ? "0" : general.txtVendorPrice.Text); // Download Packets oItem.DownloadToPOS = general.chkRetailItem.Checked; oItem.DownloadToCounter = general.chkCounterItem.Checked; // If the item existed, change the status to Modified. if (!isNew) { oItem.Status = Convert.ToInt32(RT2020.DAL.Common.Enums.Status.Modified.ToString("d")); } oItem.ModifiedBy = RT2020.DAL.Common.Config.CurrentUserId; oItem.ModifiedOn = DateTime.Now; oItem.Save(); SaveProductBarcode(oItem); // Appendix / Class System.Guid a1Id = (cboAppendix1.SelectedValue != null) ? new Guid(cboAppendix1.SelectedValue.ToString()) : System.Guid.Empty; System.Guid a2Id = (cboAppendix2.SelectedValue != null) ? new Guid(cboAppendix2.SelectedValue.ToString()) : System.Guid.Empty; System.Guid a3Id = (cboAppendix3.SelectedValue != null) ? new Guid(cboAppendix3.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c1Id = (general.cboClass1.SelectedValue != null) ? new Guid(general.cboClass1.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c2Id = (general.cboClass2.SelectedValue != null) ? new Guid(general.cboClass2.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c3Id = (general.cboClass3.SelectedValue != null) ? new Guid(general.cboClass3.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c4Id = (general.cboClass4.SelectedValue != null) ? new Guid(general.cboClass4.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c5Id = (general.cboClass5.SelectedValue != null) ? new Guid(general.cboClass5.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c6Id = (general.cboClass6.SelectedValue != null) ? new Guid(general.cboClass6.SelectedValue.ToString()) : System.Guid.Empty; SaveProductCode(oItem.ProductId, a1Id, a2Id, a3Id, c1Id, c2Id, c3Id, c4Id, c5Id, c6Id); // Product Barcode barcode.AddBarcode(); // Product Price SaveProductSupplement(oItem.ProductId); SaveProductPrice(oItem.ProductId); // Remarks SaveProductRemarks(oItem.ProductId); return(oItem.ProductId); }