string ICallbackEventHandler.GetCallbackResult()
    {
        if (string.IsNullOrEmpty(argCallback))
        {
            //正常情况下不该进入此处,除非恶意提交
            Log.WriteLog(99, "登录时传入了空参数,客户端IP:" + Request.UserHostAddress);
            return("err:用户名或密码错误!");
        }
        else
        {
            string[]      pwds      = argCallback.Split('`');
            DB.BLL.Person bllPerson = new DB.BLL.Person();
            DataSet       ds        = bllPerson.GetList("UserName = '******' and Password = '******'");
            if (ds == null || ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0)
            {
                return("err:旧密码错误!");
            }

            try
            {
                int id = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                bllPerson.Update(id, "Password", Maticsoft.DBUtility.DESEncrypt.Encrypt(pwds[1]));
            }
            catch (System.Exception ex)
            {
                Log.WriteLog("修改密码时出错,错误提示为:" + ex.Message);
                argCallback = "修改密码时出错";
            }
            return(argCallback);
        }
    }
Example #2
0
    private void Bind()
    {
        DB.BLL.Person bllPerson = new DB.BLL.Person();
        DataSet       ds        = bllPerson.GetList("view_person", "Status = 1");

        if (ds == null || ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0)
        {
            return;
        }
        dtPersons = ds.Tables[0];
        this.gvPersonInJob.DataSource = this.dtPersons.DefaultView;
        this.gvPersonInJob.DataBind();

        ds.Clear();
        ds = bllPerson.GetList("view_person", "Status = 2");
        if (ds == null || ds.Tables.Count <= 0 || ds.Tables[0].Rows.Count <= 0)
        {
            return;
        }
        dtPersons = ds.Tables[0];
        this.gvPersonLeave.DataSource = this.dtPersons.DefaultView;
        this.gvPersonLeave.DataBind();
    }
Example #3
0
    public static bool UpdateData(string editModelId, string editModelName, string editColName, string editValue, string colType)
    {
        DB.BLL.Person bllPerson = new DB.BLL.Person();
        int           id;

        if (editModelId != null && editModelId.Trim() != "")
        {
            id = int.Parse(editModelId);
        }
        else
        {
            return(false);
        }
        editColName = editColName.TrimStart('_');
        if (editColName.ToLower().Equals("username"))
        {
            bool result = bllPerson.Exists(id, editColName, editValue);
            if (result == true)
            {
                return(false);
            }
            if (string.IsNullOrEmpty(editValue.Trim()))
            {
                return(false);
            }
        }
        else if (editColName.ToLower().Equals("names"))
        {
            bool result = bllPerson.Exists(id, editColName, editValue);
            if (result == true)
            {
                return(false);
            }
            if (string.IsNullOrEmpty(editValue.Trim()))
            {
                return(false);
            }
        }
        if (colType.Equals("password"))
        {
            editValue = DESEncrypt.Encrypt(editValue);
        }

        if (editColName.ToLower().Equals("privilege"))
        {
            string val = string.Empty;
            switch (editValue)
            {
            case "1":
                val = "2";
                break;

            case "2":
                val = "1";
                break;

            case "3":
                val = "3";
                break;
            }
            return(bllPerson.Update(id, editColName, editValue) && bllPerson.Update(id, "Roles", val));
        }
        else
        {
            return(bllPerson.Update(id, editColName, editValue));
        }
    }