/// <summary> /// This method is used to save voucher (Booklet) /// </summary> /// <param name="voucherInfo"></param> /// <param name="userId"></param> public static void SaveVoucherBooklet(VoucherInfo voucherInfo, string userId) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_Voucher_CreateBooklet"; ParameterCollection.Add(new clsParameter("@vouchertypeID", voucherInfo.vouchertypeId)); ParameterCollection.Add(new clsParameter("@denomination", voucherInfo.voucherDenomination)); ParameterCollection.Add(new clsParameter("@quantity", voucherInfo.quantity)); ParameterCollection.Add(new clsParameter("@amountvalue", voucherInfo.priceAmount)); ParameterCollection.Add(new clsParameter("@leaf", voucherInfo.leafQuantity)); ParameterCollection.Add(new clsParameter("@userid", userId)); ParameterCollection.Add(new clsParameter("@voucherValidateDate", voucherInfo.VoucherValidity)); ParameterCollection.Add(new clsParameter("@isThirdparty", voucherInfo.isThirdparty)); ParameterCollection.Add(new clsParameter("@salesValidateDate", voucherInfo.SalesValidity)); ParameterCollection.Add(new clsParameter("@showDenomination", voucherInfo.showDenomination)); ParameterCollection.Add(new clsParameter("@redeemStore", voucherInfo.RedeemStores)); DataAccess.ExecuteNonQuerySp(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }
/// <summary> /// This method is used to save voucher. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { try { string UserId = Session["UserID"].ToString(); VoucherInfo voucherInfo = new VoucherInfo(); //Split Value string strValue = drpDiscountType.SelectedValue; string[] strArray = strValue.Split(':'); string split1 = strArray[0]; string split2 = strArray[1]; voucherInfo.vouchertypeId = Convert.ToInt32(split1); //int.Parse(drpDiscountType.SelectedValue); voucherInfo.voucherDenomination = int.Parse(txtVoucherdenomination.Text == "" ? "0" : txtVoucherdenomination.Text); voucherInfo.quantity = int.Parse(txtQuantity.Text == "" ? "0" : txtQuantity.Text); voucherInfo.isThirdparty = int.Parse(rdoBtnList.SelectedValue); voucherInfo.VoucherValidity = Convert.ToDateTime(txtValidity.Text).ToString("yyyy/MM/dd"); voucherInfo.SalesValidity = Convert.ToDateTime(txtSalesValidity.Text).ToString("yyyy/MM/dd"); voucherInfo.showDenomination = chkDenomination.Checked; voucherInfo.RedeemStores = getRedeemStore(); if (split2 != "1" && split2 != "4") voucherInfo.priceAmount = decimal.Parse(txtPrice.Text); if (TransactionId == string.Empty) { if (optDefalt.Checked) { BL_CreateVoucher.SaveVoucherDefault(voucherInfo, UserId); } else { voucherInfo.leafQuantity = int.Parse(txtLeafCount.Text); BL_CreateVoucher.SaveVoucherBooklet(voucherInfo, UserId); } } else { voucherInfo.leafQuantity = int.Parse(txtLeafCount.Text); BL_CreateVoucher.UpdateVoucherBooklet(voucherInfo, TransactionId, UserId); drpDiscountType.Enabled = true; optDefalt.Enabled = true; optBooklet.Enabled = true; txtVoucherdenomination.Enabled = true; txtPrice.Enabled = true; TransactionId = string.Empty; } txtSalesValidity.Text = string.Empty; txtValidity.Text = string.Empty; parentObject.GetVoucherDetails(); } catch (Exception error) { txtSalesValidity.Text = string.Empty; txtValidity.Text = string.Empty; AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(this, GetType(), "Check Scan", "alert('Error creating voucher/booklet numbers. Please try again after some time.');", true); } }
/// <summary> /// This method is used to update voucher (Default) /// </summary> /// <param name="voucherInfo"></param> /// <param name="transactionid"></param> /// <param name="userId"></param> public static void UpdateVoucherBooklet(VoucherInfo voucherInfo, string transactionid, string userId) { try { clsParameterCollection ParameterCollection = new clsParameterCollection(); ParameterCollection.ProcedureName = "BS_Voucher_EditBooklet"; ParameterCollection.Add(new clsParameter("@transactionID", transactionid)); ParameterCollection.Add(new clsParameter("@vouchertypeID", voucherInfo.vouchertypeId)); ParameterCollection.Add(new clsParameter("@denomination", voucherInfo.voucherDenomination)); ParameterCollection.Add(new clsParameter("@userid", userId)); ParameterCollection.Add(new clsParameter("@quantity", voucherInfo.quantity)); ParameterCollection.Add(new clsParameter("@amountvalue", voucherInfo.priceAmount)); ParameterCollection.Add(new clsParameter("@leaf", voucherInfo.leafQuantity)); ParameterCollection.Add(new clsParameter("@validitydays", voucherInfo.ValidateDays)); DataAccess.ExecuteNonQuerySp(ParameterCollection); } catch (Exception Ex) { if (!Ex.Message.Contains("User Define:")) BL_Exception.WriteLog(Ex); throw Ex; } }