/// <summary> /// Process the page data. /// </summary> private void ProcessForm(int fabricID, bool isDelete) { try { using (TransactionScope ts = new TransactionScope()) { FabricCodeBO objFabricCode = new FabricCodeBO(this.ObjContext); if (fabricID > 0) { objFabricCode.ID = fabricID; objFabricCode.GetObject(); } if (isDelete) { objFabricCode.Delete(); } else { objFabricCode.Code = this.txtFabricCode.Text; objFabricCode.Name = this.txtCombinedName.Text; objFabricCode.NickName = (!String.IsNullOrEmpty(this.txtCombinedNickName.Text)) ? this.txtCombinedNickName.Text : string.Empty; objFabricCode.IsActive = (this.chkCombinedIsActive.Checked) ? true : false; objFabricCode.IsLiningFabric = false; objFabricCode.IsPure = false; objFabricCode.Country = 14; if (fabricID == 0) { objFabricCode.Add(); } } this.ObjContext.SaveChanges(); ts.Complete(); } } catch (Exception ex) { // Log the error IndicoLogging.log.Error("Error occured while Saving Fabric", ex); } }
private void ProcessForm(int fabricID, bool isDelete, bool isPure) { try { using (TransactionScope ts = new TransactionScope()) { FabricCodeBO objFabricCode = new FabricCodeBO(this.ObjContext); if (fabricID > 0) { objFabricCode.ID = fabricID; objFabricCode.GetObject(); } if (isDelete) { objFabricCode.Delete(); } else { //if (isPure) //{ objFabricCode.Code = this.txtCode.Text; objFabricCode.Name = this.txtName.Text; objFabricCode.NickName = (!String.IsNullOrEmpty(this.txtNickName.Text)) ? this.txtNickName.Text : string.Empty; objFabricCode.IsActive = (this.chbIsActive.Checked) ? true : false; objFabricCode.IsLiningFabric = (this.chkIsLining.Checked) ? true : false; objFabricCode.IsPure = (this.chbIsPure.Checked) ? true : false; objFabricCode.Supplier = int.Parse(this.ddlSupplier.SelectedValue); objFabricCode.Material = (!String.IsNullOrEmpty(this.txtMaterial.Text)) ? this.txtMaterial.Text : string.Empty; objFabricCode.GSM = (!String.IsNullOrEmpty(this.txtGsm.Text)) ? this.txtGsm.Text : string.Empty; objFabricCode.DenierCount = (!String.IsNullOrEmpty(this.txtDenierCount.Text)) ? this.txtDenierCount.Text : string.Empty; objFabricCode.Filaments = (!String.IsNullOrEmpty(this.txtFilaments.Text)) ? this.txtFilaments.Text : string.Empty; objFabricCode.SerialOrder = (!String.IsNullOrEmpty(this.txtSerialOrder.Text)) ? this.txtSerialOrder.Text : string.Empty; objFabricCode.FabricPrice = (!String.IsNullOrEmpty(this.txtFabricPrice.Text)) ? decimal.Parse(this.txtFabricPrice.Text) : decimal.Parse("0.0"); objFabricCode.Fabricwidth = (!String.IsNullOrEmpty(this.txtFabricWidth.Text)) ? this.txtFabricWidth.Text : string.Empty; objFabricCode.Unit = int.Parse(this.ddlUnit.SelectedValue); objFabricCode.FabricColor = int.Parse(this.ddlFabricColor.SelectedValue); objFabricCode.Country = int.Parse(this.ddlCountry.SelectedValue); if (int.Parse(this.ddlLandedCurrency.SelectedValue) > 0) { objFabricCode.LandedCurrency = int.Parse(this.ddlLandedCurrency.SelectedValue); } //} //else //{ // objFabricCode.Code = this.txtFabricCode.Text; // objFabricCode.Name = this.txtCombinedName.Text; // objFabricCode.NickName = (!String.IsNullOrEmpty(this.txtCombinedNickName.Text)) ? this.txtCombinedNickName.Text : string.Empty; // objFabricCode.IsActive = (this.chkCombinedIsActive.Checked) ? true : false; // objFabricCode.IsLiningFabric = (this.chkIsLining.Checked) ? true : false; // objFabricCode.IsPure = false; // objFabricCode.Country = 14; //} if (fabricID == 0) { objFabricCode.Add(); } } this.ObjContext.SaveChanges(); ts.Complete(); } } catch (Exception ex) { // Log the error IndicoLogging.log.Error("Error occured while Saving Fabric", ex); } }