/// <summary> /// Insert Vendor Discount Details /// </summary> private void fnInsertVendorDiscount() { VendorDiscountInfo VDiscount = new VendorDiscountInfo(); VDiscount.VendorId = Convert.ToInt32(ddlVendor.SelectedItem.Value); VDiscount.Amount = Convert.ToInt32(txtAmount.Text.Trim()); VDiscount.CreatedBy= Session["UserID"].ToString(); BL_VendorDiscount.AddUpdateVendorDiscount(VDiscount); Reset(); }
/// <summary> /// This method is used to add Vendor Discount. /// </summary> /// <param name="Store"></param> public static void AddUpdateVendorDiscount(VendorDiscountInfo VDiscount) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "GV_InsertVendorDiscount"; ParameterCollection.Add(new clsParameter("@VendorId", VDiscount.VendorId)); ParameterCollection.Add(new clsParameter("@Amount", VDiscount.Amount)); ParameterCollection.Add(new clsParameter("@CreatedBy", VDiscount.CreatedBy)); DataAccess.ExecuteNonQuerySp(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
/// <summary> /// Get Vendor Discount Amount /// </summary> /// <param name="VDiscount"></param> /// <returns></returns> public static string GetVendorAmount(VendorDiscountInfo VDiscount) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_GetVendorDiscountByVendorId"; ParameterCollection.Add(new clsParameter("@VendorId", VDiscount.VendorId)); return DataAccess.ExecuteScalarSp(ParameterCollection).ToString(); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
/// <summary> /// DDL Selected Index Changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ddlVendor_SelectedIndexChanged(object sender, EventArgs e) { if (ddlVendor.SelectedIndex > 0) { VendorDiscountInfo VDiscount = new VendorDiscountInfo(); VDiscount.VendorId = Convert.ToInt32(ddlVendor.SelectedItem.Value); string Amount = BL_VendorDiscount.GetVendorAmount(VDiscount); if (Amount != "0") { btnSave.Text = "Update"; txtAmount.Text = Convert.ToString(Amount); } else { btnSave.Text = "Save"; txtAmount.Text = string.Empty; } } }