private bool SaveAsNewProduct() { bool result = true; #region prepare dbo.Product DAL.Product oProduct = new Product(); oProduct.ProductId = Guid.NewGuid(); oProduct.STKCODE = txtStkCode.Text.Trim(); oProduct.APPENDIX1 = cboAppendix1.Text.Trim(); oProduct.APPENDIX2 = cboAppendix2.Text.Trim(); oProduct.APPENDIX3 = cboAppendix3.Text.Trim(); oProduct.Status = (int)RT2020.DAL.Common.Enums.Status.Active; oProduct.CreatedBy = RT2020.DAL.Common.Config.CurrentUserId; oProduct.CreatedOn = DateTime.Now; oProduct.Save(); #endregion #region prepare dbo.ProductCode DAL.ProductCode oProductCode = new DAL.ProductCode(); oProductCode.ProductId = oProduct.ProductId; oProductCode.Appendix1Id = (Guid)cboAppendix1.SelectedValue; oProductCode.Appendix2Id = (Guid)cboAppendix2.SelectedValue; oProductCode.Appendix3Id = (Guid)cboAppendix3.SelectedValue; oProductCode.Save(); #endregion _ProductId = oProduct.ProductId; return(result); }
private void SaveProductCode(Guid productId) { string sql = "ProductId = '" + productId.ToString() + "'"; DAL.ProductCode oCode = DAL.ProductCode.LoadWhere(sql); if (oCode != null) { // Class System.Guid c1Id = (cboClass1.SelectedValue != null) ? new Guid(cboClass1.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c2Id = (cboClass2.SelectedValue != null) ? new Guid(cboClass2.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c3Id = (cboClass3.SelectedValue != null) ? new Guid(cboClass3.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c4Id = (cboClass4.SelectedValue != null) ? new Guid(cboClass4.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c5Id = (cboClass5.SelectedValue != null) ? new Guid(cboClass5.SelectedValue.ToString()) : System.Guid.Empty; System.Guid c6Id = (cboClass6.SelectedValue != null) ? new Guid(cboClass6.SelectedValue.ToString()) : System.Guid.Empty; oCode.Class1Id = c1Id; oCode.Class2Id = c2Id; oCode.Class3Id = c3Id; oCode.Class4Id = c4Id; oCode.Class5Id = c5Id; oCode.Class6Id = c6Id; oCode.Save(); } }