Beispiel #1
0
        /// <summary>
        /// btnLogin click event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            EyouSoft.Model.ComStructure.MPasswordInfo pwd = new EyouSoft.Model.ComStructure.MPasswordInfo();
            string username = EyouSoft.Common.Utils.GetFormValue("t_u");

            pwd.NoEncryptPassword = EyouSoft.Common.Utils.GetFormValue("t_p");

            if (string.IsNullOrEmpty(username))
            {
                this.RegisterAlertScript("Please enter your login information.");
            }

            if (string.IsNullOrEmpty(pwd.NoEncryptPassword))
            {
                this.RegisterAlertScript("Please enter a password.");
            }

            EyouSoft.Model.SSOStructure.MWebmasterInfo webmasterInfo = null;
            EyouSoft.Security.Membership.WebmasterProvider.Login(username, pwd, out webmasterInfo);

            if (webmasterInfo != null)
            {
                Response.Redirect("default.aspx");
            }

            this.RegisterAlertScript("Please enter the correct password.");
        }
Beispiel #2
0
        /// <summary>
        /// btnUpdate_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            EyouSoft.Model.SSOStructure.MWebmasterInfo webmasterInfo = EyouSoft.Security.Membership.WebmasterProvider.GetWebmasterInfo();

            if (webmasterInfo != null)
            {
                EyouSoft.Model.ComStructure.MPasswordInfo pwd = new EyouSoft.Model.ComStructure.MPasswordInfo();
                pwd.NoEncryptPassword = EyouSoft.Common.Utils.GetFormValue("t_p");


                if (string.IsNullOrEmpty(pwd.NoEncryptPassword))
                {
                    this.RegisterAlertAndRedirectScript("登录密码更新成功", "");
                    return;
                }

                EyouSoft.BLL.SysStructure.BSys bll = new EyouSoft.BLL.SysStructure.BSys();
                if (bll.SetWebmasterPwd(webmasterInfo.UserId, webmasterInfo.Username, pwd))
                {
                    this.RegisterAlertAndRedirectScript("登录密码更新成功", "");
                }
                else
                {
                    this.RegisterAlertAndRedirectScript("登录密码更新失败", "");
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// webmaster login
        /// </summary>
        /// <param name="username">username</param>
        /// <param name="pwdInfo">pwd</param>
        /// <param name="uInfo">webmaster info</param>
        /// <returns></returns>
        public static int Login(string username, EyouSoft.Model.ComStructure.MPasswordInfo pwdInfo, out EyouSoft.Model.SSOStructure.MWebmasterInfo uInfo)
        {
            IWebmasterLogin dal = new DWebmasterLogin();

            uInfo = null;

            if (string.IsNullOrEmpty(username))
            {
                return(0);
            }
            if (pwdInfo == null || string.IsNullOrEmpty(pwdInfo.NoEncryptPassword))
            {
                return(-1);
            }

            uInfo = dal.Login(username, pwdInfo);

            if (uInfo == null)
            {
                return(-3);
            }

            SetSession(uInfo);

            return(1);
        }
Beispiel #4
0
        /// <summary>
        /// 注册
        /// </summary>
        /// <returns></returns>
        protected string SavaReg()
        {
            string msg = "";
            int    re  = 0;

            #region model
            EyouSoft.Model.ComStructure.MPasswordInfo pwdInfo = new EyouSoft.Model.ComStructure.MPasswordInfo();
            pwdInfo.NoEncryptPassword = Utils.GetFormValue(txtPass1.UniqueID);
            string name  = Utils.GetFormValue(txtUserName.UniqueID);
            string email = Utils.GetFormValue(txtMail.UniqueID);

            MHuiYuanInfo model = new MHuiYuanInfo()
            {
                CompanyId   = YuMingInfo.CompanyId,
                Username    = name,
                MD5Password = pwdInfo.MD5Password,
                YouXiang    = email,
                ShengRi     = DateTime.Now,
                LeiXing     = EyouSoft.Model.EnumType.YlStructure.HuiYuanLeiXing.注册会员
            };
            #endregion

            #region check
            if (string.IsNullOrEmpty(model.Username))
            {
                return(UtilsCommons.AjaxReturnJson("0", "请填写用户名!"));
            }
            if (string.IsNullOrEmpty(model.YouXiang))
            {
                return(UtilsCommons.AjaxReturnJson("0", "请填写常用邮箱!"));
            }
            if (model.MD5Password == null && string.IsNullOrEmpty(model.MD5Password))
            {
                return(UtilsCommons.AjaxReturnJson("0", "密码不能为空且两次输入必须一致!"));
            }
            #endregion
            EyouSoft.Model.SSOStructure.MYlHuiYuanInfo userInfo = null;
            BHuiYuan Hui = new BHuiYuan();
            re = Hui.InsertHuiYuan(model);
            if (re > 0)
            {
                EyouSoft.Security.Membership.YlHuiYuanProvider.Login(model.CompanyId, model.Username, pwdInfo, out userInfo, 0);
            }
            switch (re)
            {
            case -98:
                msg = "邮箱已被注册,请换一个常用邮箱!";
                break;

            case -99:
                msg = "用户名已存在!";
                break;

            default:
                msg = string.Format("注册{0}", re > 0 ? "成功,正在跳转页面,请稍后……" : "失败!");
                break;
            }
            return(UtilsCommons.AjaxReturnJson(re > 0 ? "1" : "0", msg));
        }
Beispiel #5
0
        /// <summary>
        /// set webmaster pwd
        /// </summary>
        /// <param name="webmasterId">webmaster id</param>
        /// <param name="username">webmaster username</param>
        /// <param name="pwd">webmaster pwd info</param>
        /// <returns></returns>
        public bool SetWebmasterPwd(int webmasterId, string username, EyouSoft.Model.ComStructure.MPasswordInfo pwd)
        {
            if (webmasterId < 1 || string.IsNullOrEmpty(username) || pwd == null || string.IsNullOrEmpty(pwd.NoEncryptPassword))
            {
                return(false);
            }

            return(dal.SetWebmasterPwd(webmasterId, username, pwd));
        }
Beispiel #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string u        = Utils.InputText(Request.QueryString["u"]);
            string p        = Utils.InputText(Request.QueryString["p"]);
            string pmd      = Utils.InputText(Request.QueryString["pmd"]);
            string vc       = Utils.InputText(Request.QueryString["vc"]);
            string callback = Utils.InputText(Request.QueryString["callback"]);
            var    ischeck  = false;

            if (Request.QueryString["is"] == "true")
            {
                ischeck = true;
            }

            var YuMingInfo = EyouSoft.Security.Membership.YlHuiYuanProvider.GetYuMingInfo();

            if (YuMingInfo == null || string.IsNullOrEmpty(YuMingInfo.CompanyId))
            {
                Response.Clear();
                Response.Write(";" + callback + "({m:'系统域名配置错误'});");
                Response.End();
            }

            string companyId = YuMingInfo.CompanyId;

            int            isUserValid = 0;
            MYlHuiYuanInfo userInfo    = null;

            var pwdInfo = new EyouSoft.Model.ComStructure.MPasswordInfo();

            pwdInfo.SetMD5Pwd(pmd);

            int expires_lx = 0;

            if (ischeck)
            {
                expires_lx = 1;
            }

            isUserValid = EyouSoft.Security.Membership.YlHuiYuanProvider.Login(companyId, u, pwdInfo, out userInfo, expires_lx);

            if (isUserValid == 1)
            {
                string html = "1";
                Response.Clear();
                Response.Write(";" + callback + "({h:" + html + "});");
                Response.End();
            }
            else
            {
                Response.Clear();
                Response.Write(";" + callback + "({m:'用户名或密码不正确'});");
                Response.End();
            }
        }
Beispiel #7
0
        /// <summary>
        /// btnMD5Encrypt_Click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnMD5Encrypt_Click(object sender, EventArgs e)
        {
            string s = EyouSoft.Common.Utils.GetFormValue("t_s");

            if (string.IsNullOrEmpty(s))
            {
                this.RegisterAlertAndRedirectScript("输入不能为空!", "");
                return;
            }

            EyouSoft.Model.ComStructure.MPasswordInfo p = new EyouSoft.Model.ComStructure.MPasswordInfo();
            p.NoEncryptPassword = s;

            this.RegisterAlertAndRedirectScript(p.MD5Password, "");
        }
Beispiel #8
0
        void BaoCun()
        {
            string yonghuming = Utils.GetFormValue(txtYongHuMing.UniqueID);
            string mima       = Utils.GetFormValue(txtMiMa.UniqueID);

            if (string.IsNullOrEmpty(yonghuming))
            {
                Utils.RCWE(UtilsCommons.AjaxReturnJson("0", "用户名不能为空"));
            }
            if (yonghuming.Length > 50)
            {
                Utils.RCWE(UtilsCommons.AjaxReturnJson("0", "异常请求"));
            }
            if (!string.IsNullOrEmpty(mima) && mima.Length > 50)
            {
                Utils.RCWE(UtilsCommons.AjaxReturnJson("0", "异常请求"));
            }
            if (string.IsNullOrEmpty(EditId))
            {
                Utils.RCWE(UtilsCommons.AjaxReturnJson("0", "异常请求"));
            }

            int bllRetCode = new EyouSoft.BLL.YlStructure.BHuiYuan().SetHuiYuanUsername(EditId, yonghuming);

            if (bllRetCode == 1)
            {
                if (!string.IsNullOrEmpty(mima))
                {
                    var pwd = new EyouSoft.Model.ComStructure.MPasswordInfo();
                    pwd.NoEncryptPassword = mima;

                    new EyouSoft.BLL.YlStructure.BHuiYuan().SetHuiYuanMiMa(EditId, pwd.MD5Password);
                }
            }

            if (bllRetCode == 1)
            {
                Utils.RCWE(UtilsCommons.AjaxReturnJson("1", "操作成功"));
            }
            else if (bllRetCode == -98)
            {
                Utils.RCWE(UtilsCommons.AjaxReturnJson("0", "操作失败:用户名已存在"));
            }
            else
            {
                Utils.RCWE(UtilsCommons.AjaxReturnJson("0", "操作失败"));
            }
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                string u           = Utils.GetFormValue("u");
                string p           = Utils.GetFormValue("p");
                string companyId   = string.Empty;
                int    isUserValid = 0;

                if (u.Trim() != "" && p.Trim() != "")
                {
                    EyouSoft.Model.SysStructure.MSysDomain sysDomain = EyouSoft.Security.Membership.UserProvider.GetDomain();
                    if (sysDomain != null)
                    {
                        companyId = sysDomain.CompanyId;
                    }

                    EyouSoft.Model.SSOStructure.MUserInfo userInfo = null;

                    EyouSoft.Model.ComStructure.MPasswordInfo pwdInfo = new EyouSoft.Model.ComStructure.MPasswordInfo();
                    pwdInfo.NoEncryptPassword = p;
                    isUserValid = EyouSoft.Security.Membership.UserProvider.Login(companyId, u, pwdInfo, out userInfo);

                    if (isUserValid == 1)
                    {
                        Response.Redirect("/m/Index.aspx?sl=" + ((int)EyouSoft.Model.EnumType.PrivsStructure.Privs.导游中心_导游报账_栏目).ToString());
                    }
                    else if (isUserValid == -4)
                    {
                        this.lblMsg.Text = "用户名或密码不正确";
                    }
                    else if (isUserValid == -7)
                    {
                        this.lblMsg.Text = "您的账户已停用或已过期,请联系管理员";
                    }
                    else
                    {
                        this.lblMsg.Text = "登录异常,请联系管理员";
                    }
                }
                else
                {
                    this.lblMsg.Text = "请输入用户名和密码!";
                }
            }
        }
Beispiel #10
0
        /// <summary>
        /// set webmaster pwd
        /// </summary>
        /// <param name="webmasterId">webmaster id</param>
        /// <param name="username">webmaster username</param>
        /// <param name="pwd">webmaster pwd info</param>
        /// <returns></returns>
        public bool SetWebmasterPwd(int webmasterId, string username, EyouSoft.Model.ComStructure.MPasswordInfo pwd)
        {
            if (webmasterId <= 0 || string.IsNullOrEmpty(username) || pwd == null)
            {
                return(false);
            }

            var strSql = new StringBuilder();

            strSql.Append(" update tbl_SysWebmaster set [Password] = @Password,MD5Password = @MD5Password where [Id] = @Id and [Username] = @Username ");
            DbCommand dc = _db.GetSqlStringCommand(strSql.ToString());

            _db.AddInParameter(dc, "Password", DbType.String, pwd.NoEncryptPassword);
            _db.AddInParameter(dc, "MD5Password", DbType.String, pwd.MD5Password);
            _db.AddInParameter(dc, "Id", DbType.Int32, webmasterId);
            _db.AddInParameter(dc, "Username", DbType.String, username);

            return(DbHelper.ExecuteSql(dc, _db) > 0 ? true : false);
        }
Beispiel #11
0
        /// <summary>
        /// 设置客户单位用户信息
        /// </summary>
        void SetCrmUser()
        {
            string crmId    = Utils.GetFormValue("crmid");
            string lxrId    = Utils.GetFormValue("lxrid");
            string username = Utils.GetFormValue("username");
            var    pwd      = new EyouSoft.Model.ComStructure.MPasswordInfo()
            {
                NoEncryptPassword = Utils.GetFormValue("pwd")
            };

            int bllRetCode = new EyouSoft.BLL.CrmStructure.BCrm().SetCrmUser(CurrentUserCompanyID, SiteUserInfo.UserId, crmId, lxrId, username, pwd);

            if (bllRetCode == 1)
            {
                AjaxResponse(UtilsCommons.AjaxReturnJson("1"));
            }
            else if (bllRetCode == -1)
            {
                AjaxResponse(UtilsCommons.AjaxReturnJson("-1"));
            }

            AjaxResponse(UtilsCommons.AjaxReturnJson("0"));
        }
Beispiel #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string u        = Utils.InputText(Request.QueryString["u"]);
            string p        = Utils.InputText(Request.QueryString["p"]);
            string pmd      = Utils.InputText(Request.QueryString["pmd"]);
            string vc       = Utils.InputText(Request.QueryString["vc"]);
            string callback = Utils.InputText(Request.QueryString["callback"]);

            var domain = EyouSoft.Security.Membership.UserProvider.GetDomain();

            if (domain == null || string.IsNullOrEmpty(domain.CompanyId))
            {
                Response.Clear();
                Response.Write(";" + callback + "({m:'系统域名配置错误'});");
                Response.End();
            }

            string weiHuXiaoXi;

            if (EyouSoft.Security.Membership.UserProvider.IsSysWeiHu(out weiHuXiaoXi))
            {
                Response.Clear();
                Response.Write(";" + callback + "({m:'" + weiHuXiaoXi + "'});");
                Response.End();
            }

            string companyId = domain.CompanyId;

            int isUserValid = 0;

            EyouSoft.Model.SSOStructure.MUserInfo userInfo = null;

            EyouSoft.Model.ComStructure.MPasswordInfo pwdInfo = new EyouSoft.Model.ComStructure.MPasswordInfo();
            pwdInfo.NoEncryptPassword = p;
            isUserValid = EyouSoft.Security.Membership.UserProvider.Login(companyId, u, pwdInfo, out userInfo);

            if (isUserValid == 1)
            {
                string html = "";
                if (userInfo.UserType == EyouSoft.Model.EnumType.ComStructure.UserType.组团社)
                {
                    html = "1";
                }
                else if (userInfo.UserType == EyouSoft.Model.EnumType.ComStructure.UserType.内部员工 ||
                         userInfo.UserType == EyouSoft.Model.EnumType.ComStructure.UserType.导游)
                {
                    html = "2";
                }
                else if (userInfo.UserType == EyouSoft.Model.EnumType.ComStructure.UserType.供应商)
                {
                    html = "3";
                }
                else
                {
                    Response.Clear();
                    Response.Write(";" + callback + "({m:'错误的用户类型'});");
                    Response.End();
                }

                Response.Clear();
                Response.Write(";" + callback + "({h:" + html + "});");
                Response.End();
            }
            else if (isUserValid == -4)
            {
                Response.Clear();
                Response.Write(";" + callback + "({m:'用户名或密码不正确'});");
                Response.End();
            }
            else if (isUserValid == -7)
            {
                Response.Clear();
                Response.Write(";" + callback + "({m:'您的账户已停用或已过期,请联系管理员'});");
                Response.End();
            }
            else if (isUserValid == -8)
            {
                Response.Clear();
                Response.Write(";" + callback + "({m:'您的账户已登录,不能重复登录'});");
                Response.End();
            }
            else
            {
                Response.Clear();
                Response.Write(";" + callback + "({m:'登录异常,请联系管理员'});");
                Response.End();
            }
        }
Beispiel #13
0
        /// <summary>
        /// 设置客户单位联系人账号信息,已经分配过账号的做密码修改操作,返回1成功
        /// </summary>
        /// <param name="companyId">公司编号</param>
        /// <param name="operatroId">操作人编号</param>
        /// <param name="crmId">客户单位编号</param>
        /// <param name="lxrId">联系人编号</param>
        /// <param name="username">用户名</param>
        /// <param name="pwd">用户密码</param>
        /// <returns></returns>
        public int SetCrmUser(string companyId, string operatroId, string crmId, string lxrId, string username, EyouSoft.Model.ComStructure.MPasswordInfo pwd)
        {
            if (string.IsNullOrEmpty(companyId) || string.IsNullOrEmpty(crmId) || string.IsNullOrEmpty(lxrId) || string.IsNullOrEmpty(username))
            {
                return(0);
            }
            if (pwd == null || string.IsNullOrEmpty(pwd.NoEncryptPassword))
            {
                return(0);
            }

            if (dal.SetCrmUser(companyId, operatroId, crmId, lxrId, username, pwd) == 1)
            {
                SysStructure.BSysLogHandle.Insert("设置客户单位用户账号,联系人编号:" + lxrId + ",用户名:" + username + "。");
            }

            return(1);
        }
Beispiel #14
0
        /// <summary>
        /// 会员登录,根据系统公司编号、用户名、用户密码获取用户信息
        /// </summary>
        /// <param name="companyId">系统公司编号</param>
        /// <param name="username">登录账号</param>
        /// <param name="pwd">登录密码</param>
        /// <returns></returns>
        public EyouSoft.Model.SSOStructure.MYlHuiYuanInfo Login(string companyId, string username, EyouSoft.Model.ComStructure.MPasswordInfo pwd)
        {
            DbCommand cmd = _db.GetSqlStringCommand(SQL_SELECT_Login);

            _db.AddInParameter(cmd, "CompanyId", DbType.AnsiStringFixedLength, companyId);
            _db.AddInParameter(cmd, "Username", DbType.String, username);
            _db.AddInParameter(cmd, "MD5Password", DbType.String, pwd.MD5Password);

            return(ReadHuiYuanInfo(cmd));
        }
        /// <summary>
        /// get feihuiyun
        /// </summary>
        /// <returns></returns>
        MFeiHuiYuanInfo GetFeiHuiYuanInfo()
        {
            MYlHuiYuanInfo m       = null;
            var            isLogin = EyouSoft.Security.Membership.YlHuiYuanProvider.IsLogin(out m);

            if (isLogin)
            {
                return new MFeiHuiYuanInfo()
                       {
                           id = m.HuiYuanId
                       }
            }
            ;

            MFeiHuiYuanInfo info = new MFeiHuiYuanInfo();
            string          s    = Utils.GetFormValue("txtFeiHuiYuanInfo");

            if (string.IsNullOrEmpty(s))
            {
                return(info);
            }

            info = Newtonsoft.Json.JsonConvert.DeserializeObject <MFeiHuiYuanInfo>(s);

            info = info ?? new MFeiHuiYuanInfo();

            if (!string.IsNullOrEmpty(info.id))
            {
                return(info);
            }

            //if (string.IsNullOrEmpty(info.sj) || string.IsNullOrEmpty(info.xm)) return info;

            string guid = Guid.NewGuid().ToString();
            var    pwd  = new EyouSoft.Model.ComStructure.MPasswordInfo();

            pwd.NoEncryptPassword = guid;

            MHuiYuanInfo huiYuanInfo = new MHuiYuanInfo();

            huiYuanInfo.CompanyId   = YuMingInfo.CompanyId;
            huiYuanInfo.Username    = guid;
            huiYuanInfo.MD5Password = pwd.MD5Password;
            huiYuanInfo.YouXiang    = "";
            huiYuanInfo.ShengRi     = DateTime.Now;
            huiYuanInfo.LeiXing     = EyouSoft.Model.EnumType.YlStructure.HuiYuanLeiXing.直接预订;
            huiYuanInfo.XingMing    = info.xm;
            huiYuanInfo.ShouJi      = info.sj;

            int bllRetCode = new EyouSoft.BLL.YlStructure.BHuiYuan().InsertHuiYuan(huiYuanInfo);

            if (bllRetCode == 1)
            {
                info.id = huiYuanInfo.HuiYuanId;

                MYlHuiYuanInfo outuserinfo = null;
                EyouSoft.Security.Membership.YlHuiYuanProvider.Login(huiYuanInfo.CompanyId, huiYuanInfo.Username, pwd, out outuserinfo, 2);
            }

            return(info);
        }

        void GetDiZhi()
        {
            string s = GetDiZhiHtml();

            Utils.RCWE(UtilsCommons.AjaxReturnJson("1", "", s));
        }

        string getSR(string hm)
        {
            if (hm.Length == 18)
            {
                return(hm.Substring(6, 4) + "-" + hm.Substring(10, 2) + "-" + hm.Substring(12, 2));
            }

            if (hm.Length == 15)
            {
                return("19" + hm.Substring(6, 2) + "-" + hm.Substring(8, 2) + "-" + hm.Substring(10, 2));
            }

            return(string.Empty);
        }

        string getXB(string hm)
        {
            string s = string.Empty;
            string v = string.Empty;

            if (hm.Length == 18)
            {
                s = hm.Substring(14, 3);
            }
            if (hm.Length == 15)
            {
                s = hm.Substring(12, 3);
            }

            if (!string.IsNullOrEmpty(s))
            {
                if (Utils.GetInt(s) % 2 == 0)
                {
                    v = "1";
                }
                else
                {
                    v = "0";
                }
            }

            return(v);
        }

        string GetFaPiaoMXLX(string lx)
        {
            string s = string.Empty;

            switch (lx)
            {
            case "1": s = "旅游业-船票"; break;

            case "2": s = "旅游业-综合服务费"; break;

            case "3": s = "旅游业-旅游费"; break;
            }
            return(s);
        }
    }
Beispiel #16
0
        /// <summary>
        /// 设置客户单位联系人账号信息,已经分配过账号的做密码修改操作,返回1成功
        /// </summary>
        /// <param name="companyId">公司编号</param>
        /// <param name="operatorId">操作人编号</param>
        /// <param name="crmId">客户单位编号</param>
        /// <param name="lxrId">联系人编号</param>
        /// <param name="username">用户名</param>
        /// <param name="pwd">用户密码</param>
        /// <returns></returns>
        public int SetCrmUser(string companyId, string operatorId, string crmId, string lxrId, string username, EyouSoft.Model.ComStructure.MPasswordInfo pwd)
        {
            DbCommand cmd = _db.GetStoredProcCommand("proc_Crm_SetCrmUser");

            _db.AddOutParameter(cmd, "RetCode", DbType.Int32, 4);
            _db.AddInParameter(cmd, "CompanyId", DbType.AnsiStringFixedLength, companyId);
            _db.AddInParameter(cmd, "CrmId", DbType.AnsiStringFixedLength, crmId);
            _db.AddInParameter(cmd, "LxrId", DbType.AnsiStringFixedLength, lxrId);
            _db.AddInParameter(cmd, "Username", DbType.String, username);
            _db.AddInParameter(cmd, "NoEncryptPassword", DbType.String, pwd.NoEncryptPassword);
            _db.AddInParameter(cmd, "MD5Password", DbType.String, pwd.MD5Password);
            _db.AddInParameter(cmd, "UserType", DbType.Byte, EyouSoft.Model.EnumType.ComStructure.UserType.组团社);
            _db.AddInParameter(cmd, "OperatorId", DbType.AnsiStringFixedLength, operatorId);

            int sqlExceptionCode = 0;

            try
            {
                DbHelper.RunProcedure(cmd, _db);
            }
            catch (System.Data.SqlClient.SqlException e)
            {
                sqlExceptionCode = 0 - e.Number;
            }

            if (sqlExceptionCode < 0)
            {
                return(sqlExceptionCode);
            }
            else
            {
                return(Convert.ToInt32(_db.GetParameterValue(cmd, "RetCode")));
            }
        }