Beispiel #1
0
 private void ShowInfo(string _order_no)
 {
     this.model              = new Rain.BLL.orders().GetModel(_order_no);
     this.adminModel         = this.GetAdminInfo();
     this.rptList.DataSource = (object)this.model.order_goods;
     this.rptList.DataBind();
 }
Beispiel #2
0
 private bool DoAdd()
 {
     Rain.Model.manager model   = new Rain.Model.manager();
     Rain.BLL.manager   manager = new Rain.BLL.manager();
     model.role_id   = int.Parse(this.ddlRoleId.SelectedValue);
     model.role_type = new Rain.BLL.manager_role().GetModel(model.role_id).role_type;
     model.is_lock   = !this.cbIsLock.Checked ? 1 : 0;
     if (manager.Exists(this.txtUserName.Text.Trim()))
     {
         return(false);
     }
     model.user_name = this.txtUserName.Text.Trim();
     model.salt      = Utils.GetCheckCode(6);
     model.password  = DESEncrypt.Encrypt(this.txtPassword.Text.Trim(), model.salt);
     model.real_name = this.txtRealName.Text.Trim();
     model.telephone = this.txtTelephone.Text.Trim();
     model.email     = this.txtEmail.Text.Trim();
     model.add_time  = DateTime.Now;
     if (manager.Add(model) <= 0)
     {
         return(false);
     }
     this.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加管理员:" + model.user_name);
     return(true);
 }
Beispiel #3
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     Rain.BLL.manager   manager   = new Rain.BLL.manager();
     Rain.Model.manager adminInfo = this.GetAdminInfo();
     if (DESEncrypt.Encrypt(this.txtOldPassword.Text.Trim(), adminInfo.salt) != adminInfo.password)
     {
         this.JscriptMsg("旧密码不正确!", "");
     }
     else if (this.txtPassword.Text.Trim() != this.txtPassword1.Text.Trim())
     {
         this.JscriptMsg("两次密码不一致!", "");
     }
     else
     {
         adminInfo.password  = DESEncrypt.Encrypt(this.txtPassword.Text.Trim(), adminInfo.salt);
         adminInfo.real_name = this.txtRealName.Text.Trim();
         adminInfo.telephone = this.txtTelephone.Text.Trim();
         adminInfo.email     = this.txtEmail.Text.Trim();
         if (!manager.Update(adminInfo))
         {
             this.JscriptMsg("保存过程中发生错误!", "");
         }
         else
         {
             this.Session["dt_session_admin_info"] = (object)null;
             this.JscriptMsg("密码修改成功!", "manager_pwd.aspx");
         }
     }
 }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     this.keywords = DTRequest.GetQueryString("keywords");
     this.pageSize = this.GetPageSize(10);
     if (this.Page.IsPostBack)
     {
         return;
     }
     this.ChkAdminLevel(nameof(manager_log), DTEnums.ActionEnum.View.ToString());
     this.model = this.GetAdminInfo();
     this.RptBind("id>0" + this.CombSqlTxt(this.keywords), "add_time desc,id desc");
 }
Beispiel #5
0
 public bool AddAdminLog(string action_type, string remark)
 {
     if (this.siteConfig.logstatus > 0)
     {
         Rain.Model.manager adminInfo = this.GetAdminInfo();
         if (new Rain.BLL.manager_log().Add(adminInfo.id, adminInfo.user_name, action_type, remark) > 0)
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #6
0
 public Rain.Model.manager GetAdminInfo()
 {
     if (this.IsAdminLogin())
     {
         Rain.Model.manager manager = this.Session["dt_session_admin_info"] as Rain.Model.manager;
         if (manager != null)
         {
             return(manager);
         }
     }
     return((Rain.Model.manager)null);
 }
Beispiel #7
0
        public int Add(Rain.Model.manager model)
        {
            int maxId;

            using (OleDbConnection oleDbConnection = new OleDbConnection(DbHelperOleDb.connectionString))
            {
                oleDbConnection.Open();
                using (OleDbTransaction trans = oleDbConnection.BeginTransaction())
                {
                    try
                    {
                        StringBuilder stringBuilder = new StringBuilder();
                        stringBuilder.Append("insert into " + this.databaseprefix + "manager(");
                        stringBuilder.Append("role_id,role_type,user_name,[password],salt,real_name,telephone,email,is_lock,add_time)");
                        stringBuilder.Append(" values (");
                        stringBuilder.Append("@role_id,@role_type,@user_name,@password,@salt,@real_name,@telephone,@email,@is_lock,@add_time)");
                        OleDbParameter[] oleDbParameterArray = new OleDbParameter[10]
                        {
                            new OleDbParameter("@role_id", OleDbType.Integer, 4),
                            new OleDbParameter("@role_type", OleDbType.Integer, 4),
                            new OleDbParameter("@user_name", OleDbType.VarChar, 100),
                            new OleDbParameter("@password", OleDbType.VarChar, 100),
                            new OleDbParameter("@salt", OleDbType.VarChar, 20),
                            new OleDbParameter("@real_name", OleDbType.VarChar, 50),
                            new OleDbParameter("@telephone", OleDbType.VarChar, 30),
                            new OleDbParameter("@email", OleDbType.VarChar, 30),
                            new OleDbParameter("@is_lock", OleDbType.Integer, 4),
                            new OleDbParameter("@add_time", OleDbType.Date)
                        };
                        oleDbParameterArray[0].Value = (object)model.role_id;
                        oleDbParameterArray[1].Value = (object)model.role_type;
                        oleDbParameterArray[2].Value = (object)model.user_name;
                        oleDbParameterArray[3].Value = (object)model.password;
                        oleDbParameterArray[4].Value = (object)model.salt;
                        oleDbParameterArray[5].Value = (object)model.real_name;
                        oleDbParameterArray[6].Value = (object)model.telephone;
                        oleDbParameterArray[7].Value = (object)model.email;
                        oleDbParameterArray[8].Value = (object)model.is_lock;
                        oleDbParameterArray[9].Value = (object)model.add_time;
                        DbHelperOleDb.ExecuteSql(oleDbConnection, trans, stringBuilder.ToString(), oleDbParameterArray);
                        maxId = this.GetMaxId(oleDbConnection, trans);
                        trans.Commit();
                    }
                    catch
                    {
                        trans.Rollback();
                        return(-1);
                    }
                }
            }
            return(maxId);
        }
Beispiel #8
0
        public Rain.Model.manager GetModel(int id)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select  top 1 id,role_id,role_type,user_name,[password],salt,real_name,telephone,email,is_lock,add_time from " + this.databaseprefix + "manager ");
            stringBuilder.Append(" where id=@id");
            OleDbParameter[] oleDbParameterArray = new OleDbParameter[1]
            {
                new OleDbParameter("@id", OleDbType.Integer, 4)
            };
            oleDbParameterArray[0].Value = (object)id;
            Rain.Model.manager manager = new Rain.Model.manager();
            DataSet            dataSet = DbHelperOleDb.Query(stringBuilder.ToString(), oleDbParameterArray);

            if (dataSet.Tables[0].Rows.Count <= 0)
            {
                return((Rain.Model.manager)null);
            }
            if (dataSet.Tables[0].Rows[0][nameof(id)].ToString() != "")
            {
                manager.id = int.Parse(dataSet.Tables[0].Rows[0][nameof(id)].ToString());
            }
            if (dataSet.Tables[0].Rows[0]["role_id"].ToString() != "")
            {
                manager.role_id = int.Parse(dataSet.Tables[0].Rows[0]["role_id"].ToString());
            }
            if (dataSet.Tables[0].Rows[0]["role_type"].ToString() != "")
            {
                manager.role_type = int.Parse(dataSet.Tables[0].Rows[0]["role_type"].ToString());
            }
            manager.user_name = dataSet.Tables[0].Rows[0]["user_name"].ToString();
            manager.password  = dataSet.Tables[0].Rows[0]["password"].ToString();
            manager.salt      = dataSet.Tables[0].Rows[0]["salt"].ToString();
            manager.real_name = dataSet.Tables[0].Rows[0]["real_name"].ToString();
            manager.telephone = dataSet.Tables[0].Rows[0]["telephone"].ToString();
            manager.email     = dataSet.Tables[0].Rows[0]["email"].ToString();
            if (dataSet.Tables[0].Rows[0]["is_lock"].ToString() != "")
            {
                manager.is_lock = int.Parse(dataSet.Tables[0].Rows[0]["is_lock"].ToString());
            }
            if (dataSet.Tables[0].Rows[0]["add_time"].ToString() != "")
            {
                manager.add_time = DateTime.Parse(dataSet.Tables[0].Rows[0]["add_time"].ToString());
            }
            return(manager);
        }
Beispiel #9
0
        public bool Update(Rain.Model.manager model)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("update " + this.databaseprefix + "manager set ");
            stringBuilder.Append("role_id=@role_id,");
            stringBuilder.Append("role_type=@role_type,");
            stringBuilder.Append("user_name=@user_name,");
            stringBuilder.Append("[password]=@password,");
            stringBuilder.Append("real_name=@real_name,");
            stringBuilder.Append("telephone=@telephone,");
            stringBuilder.Append("email=@email,");
            stringBuilder.Append("is_lock=@is_lock,");
            stringBuilder.Append("add_time=@add_time");
            stringBuilder.Append(" where id=@id");
            OleDbParameter[] oleDbParameterArray = new OleDbParameter[10]
            {
                new OleDbParameter("@role_id", OleDbType.Integer, 4),
                new OleDbParameter("@role_type", OleDbType.Integer, 4),
                new OleDbParameter("@user_name", OleDbType.VarChar, 100),
                new OleDbParameter("@password", OleDbType.VarChar, 100),
                new OleDbParameter("@real_name", OleDbType.VarChar, 50),
                new OleDbParameter("@telephone", OleDbType.VarChar, 30),
                new OleDbParameter("@email", OleDbType.VarChar, 30),
                new OleDbParameter("@is_lock", OleDbType.Integer, 4),
                new OleDbParameter("@add_time", OleDbType.Date),
                new OleDbParameter("@id", OleDbType.Integer, 4)
            };
            oleDbParameterArray[0].Value = (object)model.role_id;
            oleDbParameterArray[1].Value = (object)model.role_type;
            oleDbParameterArray[2].Value = (object)model.user_name;
            oleDbParameterArray[3].Value = (object)model.password;
            oleDbParameterArray[4].Value = (object)model.real_name;
            oleDbParameterArray[5].Value = (object)model.telephone;
            oleDbParameterArray[6].Value = (object)model.email;
            oleDbParameterArray[7].Value = (object)model.is_lock;
            oleDbParameterArray[8].Value = (object)model.add_time;
            oleDbParameterArray[9].Value = (object)model.id;
            return(DbHelperOleDb.ExecuteSql(stringBuilder.ToString(), oleDbParameterArray) > 0);
        }
Beispiel #10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (this.Page.IsPostBack)
     {
         return;
     }
     Rain.Model.manager adminInfo = this.GetAdminInfo();
     if (adminInfo != null)
     {
         Rain.BLL.manager_log   managerLog = new Rain.BLL.manager_log();
         Rain.Model.manager_log model1     = managerLog.GetModel(adminInfo.user_name, 1, DTEnums.ActionEnum.Login.ToString());
         if (model1 != null)
         {
             this.litIP.Text = model1.user_ip;
         }
         Rain.Model.manager_log model2 = managerLog.GetModel(adminInfo.user_name, 2, DTEnums.ActionEnum.Login.ToString());
         if (model2 != null)
         {
             this.litBackIP.Text   = model2.user_ip;
             this.litBackTime.Text = model2.add_time.ToString();
         }
     }
 }
Beispiel #11
0
        private bool DoEdit(int _id)
        {
            bool flag = false;

            Rain.BLL.manager   manager = new Rain.BLL.manager();
            Rain.Model.manager model   = manager.GetModel(_id);
            model.role_id   = int.Parse(this.ddlRoleId.SelectedValue);
            model.role_type = new Rain.BLL.manager_role().GetModel(model.role_id).role_type;
            model.is_lock   = !this.cbIsLock.Checked ? 1 : 0;
            if (this.txtPassword.Text.Trim() != this.defaultpassword)
            {
                model.password = DESEncrypt.Encrypt(this.txtPassword.Text.Trim(), model.salt);
            }
            model.real_name = this.txtRealName.Text.Trim();
            model.telephone = this.txtTelephone.Text.Trim();
            model.email     = this.txtEmail.Text.Trim();
            if (manager.Update(model))
            {
                this.AddAdminLog(DTEnums.ActionEnum.Edit.ToString(), "修改管理员:" + model.user_name);
                flag = true;
            }
            return(flag);
        }
Beispiel #12
0
 public bool Update(Rain.Model.manager model)
 {
     return(this.dal.Update(model));
 }
Beispiel #13
0
 public int Add(Rain.Model.manager model)
 {
     return(this.dal.Add(model));
 }