private void simpleButton1_Click(object sender, EventArgs e) { //TODO: 1. Check whether the group name exists or not //2. if exist then do not allow to save with the same group name //3. Prompt user to change the group name as it already exists if (tbxName.Text.Equals(string.Empty)) { MessageBox.Show("Group Name can not be blank!"); return; } //} //if (accObj.IsGroupExists(tbxGroupName.Text.Trim())) //{ // MessageBox.Show("Group Name already Exists!", "SunSpeed", MessageBoxButtons.RetryCancel); // cbxUnderGrp.Focus(); // return; //} eSunSpeedDomain.BillSundryMasterModel objbsmod = new eSunSpeedDomain.BillSundryMasterModel(); objbsmod.Name = tbxName.Text; objbsmod.Alias = cbxalias.Text; objbsmod.BillSundryType = tbxbillsundrytype.Text; objbsmod.BillSundryNature = tbxbillsundrynarration.Text; objbsmod.DefaultValue = tbxdefaultvalue.Text; objbsmod.AffectstheCostofGoodsinStockTransfer = Convert.ToBoolean(tbxaffectsthecostofggodsinstoclktransfer.Text.Trim()); objbsmod.AffectstheCostofGoodsinSale = tbxaffectsthecostofgoodsinsle.Text; objbsmod.AffectstheCostofGoodsinPurchase = tbxaffectsthecostofgoodsinpurchase.Text; objbsmod.AffectstheCostofGoodsinMaterialIssue = tbxaffectsthecostoofgoodsinmaterialissue.Text; objbsmod.AffectstheCostofGoodsinMaterialIssue = tbxaffectsthecostoofgoodsinmaterialissue.Text; //objContGroup.Primary = cbxPrimarygroup.SelectedItem.ToString(); // objContGroup.UnderGroup = cbxUndergroup.SelectedItem.ToString(); objbsmod.CreatedBy = "Admin"; string message = string.Empty; // bool isSuccess = objcont.SaveContactGroup(objContGroup); bool isSuccess = objbsmod.SaveBSM(objbsmod); // if (isSuccess) { MessageBox.Show("Saved Successfully!"); } //List<eSunSpeedDomain.AccountGroupModel> lstGroups = accObj.GetListofAccountsGroups(); //dgvList.DataSource = lstGroups; //Dialogs.PopUPDialog d = new Dialogs.PopUPDialog("Saved Successfully!"); //d.ShowDialog(); }
//Save Bill Sundry public bool SaveBSM(eSunSpeedDomain.BillSundryMasterModel objBSM) { string Query = string.Empty; bool isSaved = true; try { DBParameterCollection paramCollection = new DBParameterCollection(); paramCollection.Add(new DBParameter("@Name", objBSM.Name)); paramCollection.Add(new DBParameter("@Alias", objBSM.Alias)); paramCollection.Add(new DBParameter("@PrintName", objBSM.PrintName)); paramCollection.Add(new DBParameter("@BillSundryType", objBSM.BillSundryType)); paramCollection.Add(new DBParameter("@BillSundryNature", objBSM.BillSundryNature)); paramCollection.Add(new DBParameter("@DefaultValue", objBSM.DefaultValue, System.Data.DbType.Decimal)); paramCollection.Add(new DBParameter("@Subtotalheading", objBSM.subtotalheading)); paramCollection.Add(new DBParameter("@AffectstheCostofGoodsinSale", objBSM.AffectstheCostofGoodsinSale, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@AffectstheCostofGoodsinPurchase", objBSM.AffectstheCostofGoodsinPurchase, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@AffectstheCostofGoodsinMaterialIssue", objBSM.AffectstheCostofGoodsinMaterialIssue, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@AffectstheCostofGoodsinMaterialReceipt", objBSM.AffectstheCostofGoodsinMaterialReceipt, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@AffectstheCostofGoodsinStockTransfer", objBSM.AffectstheCostofGoodsinStockTransfer, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@SaleAffectsAccounting", objBSM.SaleAffectsAccounting, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@SaleAdjustInSaleAmount", objBSM.SaleAdjustInSaleAmount, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@SaleSpecifyAccountHere", objBSM.SaleSpecifyAccountHere)); paramCollection.Add(new DBParameter("@SaleAccounttoHeadPost", objBSM.SaleAccounttoHeadPost)); paramCollection.Add(new DBParameter("@SaleAdjustInPartyAmount", objBSM.SaleAdjustInPartyAmount, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@SalePartSpecifyAccountHere", objBSM.SalePartSpecifyAccountHere)); paramCollection.Add(new DBParameter("@SaleAccounttoHeadPostParty", objBSM.SaleAccounttoHeadPostParty)); paramCollection.Add(new DBParameter("@SalePostOverandAbove", objBSM.SalePostOverandAbove, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@PurcAffectsAccounting", objBSM.PurcAffectsAccounting, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@PurcAdjustInPurcAmount", objBSM.PurcAdjustInPurcAmount, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@PurcSpecifyAccountHere", objBSM.PurcSpecifyAccountHere)); paramCollection.Add(new DBParameter("@PurcAccounttoHeadPost", objBSM.PurcAccounttoHeadPost)); paramCollection.Add(new DBParameter("@PurcParySpecifyAccountHere", objBSM.PurcParySpecifyAccountHere)); paramCollection.Add(new DBParameter("@PurcAdjustInPartyAmount", objBSM.PurcAdjustInPartyAmount, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@PurcAccounttoHeadPostParty", objBSM.PurcAccounttoHeadPostParty)); paramCollection.Add(new DBParameter("@PurcPostOverandAbove", objBSM.PurcPostOverandAbove, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@typeMaterialIssue", objBSM.typeMaterialIssue, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@typeMaterialReceipt", objBSM.typeMaterialReceipt, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@StockTransfer", objBSM.StockTransfer, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@AffectAccounting", objBSM.AffectAccounting, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@OtherSide", objBSM.OtherSide)); paramCollection.Add(new DBParameter("@Accountheadtopost", objBSM.Accountheadtopost)); paramCollection.Add(new DBParameter("@AdjustinMC", objBSM.AdjustinMC, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@Accountheadtopostparty", objBSM.AccountheadtopostParty)); paramCollection.Add(new DBParameter("@Postoverandabove", objBSM.postoverandabove, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@typeAbsoluteamount", objBSM.typeAbsoluteAmount, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@typePercentage", objBSM.typePercentage, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@typePerMainQty", objBSM.typePerMainQty, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@PerAltQty", objBSM.PerAltQty, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@Percentoff", objBSM.Percentoff)); paramCollection.Add(new DBParameter("@typeNetBillAmount", objBSM.typeNetBillAmount, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@SelectiveCalculation", objBSM.SelectiveCalculation, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@tyeItemsBasicAmt", objBSM.tyeItemsBasicAmt, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@IncludeFreeqty", objBSM.IncludeFreeQty, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@typeTotalMRPofItems", objBSM.typeTotalMRPofItems, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@typeTaxableAmount", objBSM.typeTaxableAmount, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@typePreviousBillSundryAmount", objBSM.typePreviousBillSundryAmount, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@typeOtherBillsundry", objBSM.typeOtherBillsundry, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@BSAmt", objBSM.BSAmt, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@BSAppOn", objBSM.BSAppOn, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@NoOfBillSundry", objBSM.NoOfBillSundry)); paramCollection.Add(new DBParameter("@ConsolidateBillSundriesAmount", objBSM.ConsolidateBillSundriesAmount, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@BillSundaryName", objBSM.BillSundaryName)); paramCollection.Add(new DBParameter("@AdjustSpecifyAccountLedger", objBSM.AdjustSpecifyAccountLedger)); paramCollection.Add(new DBParameter("@roundoffBillsundry", objBSM.roundoffBillsundry, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@RoundoffValues", objBSM.RoundoffValues)); paramCollection.Add(new DBParameter("@CreatedBy", "Admin")); paramCollection.Add(new DBParameter("@Createddate", DateTime.Now, System.Data.DbType.DateTime)); paramCollection.Add(new DBParameter("@ModifiedBy", "Admin")); paramCollection.Add(new DBParameter("@ModifiedDate", DateTime.Now, System.Data.DbType.DateTime)); System.Data.IDataReader dr = _dbHelper.ExecuteDataReader("spInsertBillsundaryMaster", _dbHelper.GetConnObject(), paramCollection, System.Data.CommandType.StoredProcedure); } catch (Exception ex) { isSaved = false; throw ex; } return(isSaved); }
//UPDATE public bool UpdateBSM(eSunSpeedDomain.BillSundryMasterModel objBSM) { string Query = string.Empty; bool isUpdated = true; try { DBParameterCollection paramCollection = new DBParameterCollection(); paramCollection.Add(new DBParameter("@Name", objBSM.Name)); paramCollection.Add(new DBParameter("@Alias", objBSM.Alias)); paramCollection.Add(new DBParameter("@PrintName", objBSM.PrintName)); paramCollection.Add(new DBParameter("@BillSundryType", objBSM.BillSundryType)); paramCollection.Add(new DBParameter("@BillSundryNature", objBSM.BillSundryNature)); paramCollection.Add(new DBParameter("@DefaultValue", objBSM.DefaultValue)); paramCollection.Add(new DBParameter("@AffectstheCostofGoodsinSale", objBSM.AffectstheCostofGoodsinSale, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@AffectstheCostofGoodsinPurchase", objBSM.AffectstheCostofGoodsinPurchase, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@AffectstheCostofGoodsinMaterialIssue", objBSM.AffectstheCostofGoodsinMaterialIssue, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@AffectstheCostofGoodsinMaterialReceipt", objBSM.AffectstheCostofGoodsinMaterialReceipt, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@AffectstheCostofGoodsinStockTransfer", objBSM.AffectstheCostofGoodsinStockTransfer, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@AffectsAccounting", objBSM.AffectsAccounting, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@AdjustInSaleAccount", objBSM.AdjustInSaleAccount, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@AccountHeadtoPost", objBSM.AccountHeadtoPost)); paramCollection.Add(new DBParameter("@AdjustInPartyAmount", objBSM.AdjustInPartyAmount, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@PostOverandAbove", objBSM.PostOverandAbove)); paramCollection.Add(new DBParameter("@AdjustInPurchaseAccount", objBSM.AdjustInPurchaseAccount, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@typeMaterialIssue", objBSM.typeMaterialIssue)); paramCollection.Add(new DBParameter("@typeMaterialReceipt", objBSM.typeMaterialReceipt)); paramCollection.Add(new DBParameter("@StockTransfer", objBSM.StockTransfer)); paramCollection.Add(new DBParameter("@AffectAccounting", objBSM.AffectAccounting)); paramCollection.Add(new DBParameter("@OtherSide", objBSM.OtherSide)); paramCollection.Add(new DBParameter("@AdjustinMC", objBSM.AdjustinMC)); paramCollection.Add(new DBParameter("@typeAbsoluteAmunt", objBSM.typeAbsoluteAmunt)); paramCollection.Add(new DBParameter("@typePercentage", objBSM.typePercentage)); paramCollection.Add(new DBParameter("@typePerMainQty", objBSM.typePerMainQty)); paramCollection.Add(new DBParameter("@Percentoff", objBSM.Percentoff)); paramCollection.Add(new DBParameter("@typeNetBillAmount", objBSM.typeNetBillAmount)); paramCollection.Add(new DBParameter("@SelectiveCalculation", objBSM.SelectiveCalculation, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@tyeItemsBasicAmt", objBSM.tyeItemsBasicAmt)); paramCollection.Add(new DBParameter("@typeTotalMRPofItems", objBSM.typeTotalMRPofItems)); paramCollection.Add(new DBParameter("@typeTaxableAmount", objBSM.typeTaxableAmount)); paramCollection.Add(new DBParameter("@typePreviousBillSundryAmount", objBSM.typePreviousBillSundryAmount)); paramCollection.Add(new DBParameter("@typeOtherBillsundry", objBSM.typeOtherBillsundry)); paramCollection.Add(new DBParameter("@RoundoffBillSundryAmount", objBSM.RBSAmt, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@typeBillSundryAmount", objBSM.BSAmt)); paramCollection.Add(new DBParameter("@typeBillSundryAppliedOn", objBSM.BSAppOn)); paramCollection.Add(new DBParameter("@TextBox", objBSM.TextBox)); paramCollection.Add(new DBParameter("@NoOfBillSundrys", objBSM.NoOfBillSundry)); paramCollection.Add(new DBParameter("@ConsolidateBillSundriesAmount", objBSM.ConsolidateBillSundriesAmount, System.Data.DbType.Boolean)); paramCollection.Add(new DBParameter("@ModifiedBy", "Admin")); paramCollection.Add(new DBParameter("@Id", objBSM.BS_Id)); Query = "UPDATE BillSundryMaster SET [Name]=@Name,[Alias]=@Alias,[PrintName]=@PrintName,[BillSundryType]=@BillSundryType,[BillSundryNature]=@BillSundryNature,[DefaultValue]=@DefaultValue," + "[AffectstheCostofGoodsinSale]=@AffectstheCostofGoodsinSale,[AffectstheCostofGoodsinPurchase]=@AffectstheCostofGoodsinPurchase,[AffectstheCostofGoodsinMaterialIssue]=@AffectstheCostofGoodsinMaterialIssue,[AffectstheCostofGoodsinMaterialReceipt]=@AffectstheCostofGoodsinMaterialReceipt," + "[AffectstheCostofGoodsinStockTransfer]=@AffectstheCostofGoodsinStockTransfer,[AffectsAccounting]=@AffectsAccounting,[AdjustInSaleAccount]=@AdjustInSaleAccount,[AccountHeadtoPost]=@AccountHeadtoPost,[AdjustInPartyAmount]=@AdjustInPartyAmount,[PostOverandAbove]=@PostOverandAbove," + "[AdjustInPurchaseAccount]=@AdjustInPurchaseAccount,[typeMaterialIssue]=@typeMaterialIssue,[typeMaterialReceipt]=@typeMaterialReceipt,[StockTransfer]=@StockTransfer," + "[AffectAccounting]=@AffectAccounting,[OtherSide]=@OtherSide,[AdjustinMC]=@AdjustinMC,[typeAbsoluteAmunt]=@typeAbsoluteAmunt,[typePercentage]=@typePercentage,[typePerMainQty]=@typePerMainQty,[Percentoff]=@Percentoff,[typeNetBillAmount]=@typeNetBillAmount," + "[SelectiveCalculation]=@SelectiveCalculation,[tyeItemsBasicAmt]=@tyeItemsBasicAmt,[typeTotalMRPofItems]=@typeTotalMRPofItems,[typeTaxableAmount]=@typeTaxableAmount,[typePreviousBillSundryAmount]=@typePreviousBillSundryAmount,[typeOtherBillsundry]=@typeOtherBillsundry," + "[RoundoffBillSundryAmount]=@RoundoffBillSundryAmount,[typeBillSundryAmount]=@typeBillSundryAmount,[typeBillSundryAppliedOn]=@typeBillSundryAppliedOn,[TextBox]=@TextBox,[NoOfBillSundrys]=@NoOfBillSundrys,[ConsolidateBillSundriesAmount]=@ConsolidateBillSundriesAmount,[ModifiedBy]=@ModifiedBy " + "WHERE BS_Id=@BS_Id"; if (_dbHelper.ExecuteNonQuery(Query, paramCollection) > 0) { isUpdated = true; } } catch (Exception ex) { isUpdated = false; throw ex; } return(isUpdated); }