/// <summary>
        /// This method is used to Scan vouchers through scanner machine.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void txtVID_TextChanged(object sender, EventArgs e)
        {
            if (ddlStoreName.SelectedValue == "0")
            {
                lblStoreNameError.Visible = true;
                txtVID.Text = string.Empty;
                ddlStoreName.Focus();
            }
            else
            {
                try
                {
                    AllocationToStoreInfo Info = new AllocationToStoreInfo();
                    Info.FromStoreCode = Session["StoreCode"] != null ? Session["StoreCode"].ToString() : "0";
                    Info.ToStoreCode = ddlStoreCode.SelectedValue;
                    Info.FirstID = txtVID.Text;
                    userID = Session["UserID"] != null ? Session["UserID"].ToString() : "";
                    BL_AllocationToStore.ScanVouhcer(Info, (ddlVoucherBooklet.SelectedValue == "1"), userID);

                    txtVID.Text = string.Empty;
                    BindGrid();
                    ModalPopUp.Show();
                    txtVID.Focus();
                }
                catch (Exception Ex)
                {
                    txtVID.Text = string.Empty;
                    ModalPopUp.Show();
                    if (Ex.Message.Contains("User Define:"))
                    {
                        string ErrorMessage = "alert('" + Ex.Message.Replace("User Define:", string.Empty).Replace("\r", "").Replace("\n", "") + "');";
                        AjaxControlToolkit.ToolkitScriptManager.RegisterStartupScript(this, GetType(), "checkValide", ErrorMessage, true);

                    }
                    txtVID.Focus();
                }
            }
            ModalPopUp.Show();
        }
Пример #2
0
        /// <summary>
        /// This method is used to scan vouchers.
        /// </summary>
        /// <param name="Info"></param>
        /// <param name="Type"></param>
        public static void ScanVouhcer(AllocationToStoreInfo Info, bool isBooklet, string UserID)
        {
            try
            {
                clsParameterCollection ParameterCollection = new clsParameterCollection();
                if (isBooklet)
                    ParameterCollection.ProcedureName = "BS_StoreAllocation_ScanBooklet";
                else
                    ParameterCollection.ProcedureName = "BS_StoreAllocation_ScanVoucher";

                ParameterCollection.Add(new clsParameter("@FromStorecode", Info.FromStoreCode.ToString()));
                ParameterCollection.Add(new clsParameter("@ToStoreCode", Info.ToStoreCode.ToString()));
                ParameterCollection.Add(new clsParameter("@VoucherNo", Info.FirstID));
                //ParameterCollection.Add(new clsParameter("@LastVoucher", Info.LastID));
                ParameterCollection.Add(new clsParameter("@UserID", UserID));

                DataAccess.ExecuteNonQuerySp(ParameterCollection);
            }
            catch (Exception Ex)
            {
                if (!Ex.Message.Contains("User Define:"))
                    BL_Exception.WriteLog(Ex);

                throw Ex;
            }
        }