Ejemplo n.º 1
0
        /// <summary>
        /// This method is used to add voucher type.
        /// </summary>
        /// <param name="VoucherTypeInfo"></param>
        public static void SaveVoucherType(VoucherTypeInfo VoucherTypeInfo)
        {
            try
            {
                clsParameterCollection ParameterCollection = new clsParameterCollection();
                ParameterCollection.ProcedureName = "BS_VoucherType_AddVoucherType";
                ParameterCollection.Add(new clsParameter("@VoucherTypeID", VoucherTypeInfo.VouchertypeId));
                ParameterCollection.Add(new clsParameter("@VoucherType", VoucherTypeInfo.VoucherType));
                ParameterCollection.Add(new clsParameter("@Description", VoucherTypeInfo.Description));
                ParameterCollection.Add(new clsParameter("@IsActive", VoucherTypeInfo.IsActive));
                ParameterCollection.Add(new clsParameter("@UserID", VoucherTypeInfo.UserId));
                ParameterCollection.Add(new clsParameter("@BeforeEdit", VoucherTypeInfo.BeforeEdit));
                DataAccess.ExecuteNonQuerySp(ParameterCollection);
            }
            catch (Exception Ex)
            {
                if (!Ex.Message.Contains("User Define:"))
                    BL_Exception.WriteLog(Ex);

                throw Ex;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This method is used to save voucher type.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                VoucherTypeInfo VoucherTypeInfo = new VoucherTypeInfo();
                //VoucherTypeInfo.VoucherType = txt_VoucherType.Text;
                VoucherTypeInfo.VoucherType = ddlVoucherType.SelectedItem.Value;
                VoucherTypeInfo.Description = txt_Description.Value.Trim();
                VoucherTypeInfo.IsActive = chk_active.Checked == true ? "1" : "0";
                VoucherTypeInfo.VouchertypeId = currentVoucherTypeid.Value == string.Empty ? 0 : int.Parse(currentVoucherTypeid.Value);
                VoucherTypeInfo.UserId = Session["UserID"].ToString();
                VoucherTypeInfo.BeforeEdit = Convert.ToInt32(hdnBeforeEdit.Value);

                BL_VoucherHierarchy.SaveVoucherType(VoucherTypeInfo);
                parentObject.GetVoucherTypes();
            }
            catch (Exception ex)
            {
                if (ex.Message.Contains("User Define:"))
                {
                    AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(this, GetType(), "Show Error", "alert('"+ex.Message.Replace("User Define:","").Replace("\n","").Replace("\r","")+"')", true);
                }
            }
        }