Example #1
0
        //(普通管理员)根据用户名更新
        public bool Update(Model.Admin model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update [admin] set");
            strSql.Append(" a_pass=@Password");
            strSql.Append(" where a_name=@UserName ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Password", SqlDbType.VarChar, 50),
                new SqlParameter("@UserName", SqlDbType.VarChar, 50)
            };
            parameters[0].Value = model.Pass;
            parameters[1].Value = model.Name;
            int rows = DbHelper.ExecuteNonQuery(strSql.ToString(), CommandType.Text, parameters);

            if (rows == 1)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #2
0
        //根据管理员编号,获取管理员信息
        public Model.Admin GetModel(string Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 a_id,a_name,a_pass ");
            strSql.Append("from admin where a_id=@Id ");
            SqlParameter[] parameters = { new SqlParameter("@Id", SqlDbType.Int, 4) };
            parameters[0].Value = Id;
            Model.Admin model = new Model.Admin();
            DataTable   dt    = DbHelper.ExecuteDataTable(strSql.ToString(), CommandType.Text, parameters);

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["a_id"] != null && dt.Rows[0]["a_id"].ToString() != "")
                {
                    model.Id = dt.Rows[0]["a_id"].ToString();
                }
                if (dt.Rows[0]["a_name"] != null && dt.Rows[0]["a_name"].ToString() != "")
                {
                    model.Name = dt.Rows[0]["a_name"].ToString();
                }
                if (dt.Rows[0]["a_pass"] != null && dt.Rows[0]["a_pass"].ToString() != "")
                {
                    model.Pass = dt.Rows[0]["a_pass"].ToString();
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #3
0
File: Admin.cs Project: ttrr1/Midea
        /// <summary>
        /// 更新当前登录的信息
        /// </summary>
        public int updateAdminInfo(Model.Admin model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@UserID",    SqlDbType.Int,        4),
                new SqlParameter("@RealName",  SqlDbType.NVarChar,  20),
                new SqlParameter("@JobTitle",  SqlDbType.VarChar),
                new SqlParameter("@JobDept",   SqlDbType.VarChar),
                new SqlParameter("@QQ",        SqlDbType.NVarChar),
                new SqlParameter("@MSN",       SqlDbType.VarChar),
                new SqlParameter("@Email",     SqlDbType.VarChar),
                new SqlParameter("@Mobile",    SqlDbType.VarChar),
                new SqlParameter("@HomeTel",   SqlDbType.VarChar),
                new SqlParameter("@OfficeTel", SqlDbType.VarChar)
            };
            parameters[0].Value = model.UserId;
            parameters[1].Value = model.RealName;
            parameters[2].Value = model.JobTitle;
            parameters[3].Value = model.JobDept;
            parameters[4].Value = model.QQ;
            parameters[5].Value = model.MSN;
            parameters[6].Value = model.Email;
            parameters[7].Value = model.Mobile;
            parameters[8].Value = model.HomeTel;
            parameters[9].Value = model.OfficeTel;
            return(DbHelperSQL.RunProcedure("Admin_UpdateInfo", parameters, out rowsAffected));
        }
Example #4
0
        //(超级管理员)更新账号
        public bool update(Model.Admin admin)
        {
            if (admin.Id == null || admin.Id == "" || admin.Name == null || admin.Name == "" || admin.Pass == null || admin.Pass == "")
            {
                Console.WriteLine("ID或用户名或密码为空");
                return(false);
            }

            string id           = admin.Id;
            string name         = admin.Name;
            string pass         = admin.Pass;
            string cmdQueryText = "select * from admin where a_id='" + id + "'";

            Object obj = DbHelper.ExecuteScalar(cmdQueryText);

            if (obj == null)
            {
                Console.WriteLine("用户不存在");
                return(false);
            }
            else
            {
                string cmdText = "update admin set a_name='" + name + "',a_pass='******' where a_id='" + id + "'";

                int i = DbHelper.ExecuteNonQuery(cmdText);
                if (i == 1)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        //[Role("恢复帐号权限", Description = "恢复帐号权限", IsAuthorize = true)]
        public ContentResult ReQX(string ids)
        {
            string output = "0";

            try
            {
                SqlTranEx.SqlTranExtensions _SqlTranExtensions = new SqlTranEx.SqlTranExtensions();
                if (IsPost)
                {
                    string[] _ids = ids.Split(',');
                    for (int i = 0; i < _ids.Length; i++)
                    {
                        int         id      = _ids[i].ToInt32();
                        Model.Admin m_Admin = Orm.EntityCore <Model.Admin> .GetModel(id);

                        if (m_Admin.IsNull)
                        {
                            output = "0"; break;
                        }
                        m_Admin.AdminPowerValues = m_Admin.AdminSort.AdminSortPowerValues;
                        Orm.EntityCore <Model.Admin> .Update(m_Admin, _SqlTranExtensions);
                    }
                }
                _SqlTranExtensions.ExecuteSqlTran();
                output = "1";
            }
            catch { }
            return(Content(output));
        }
Example #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        /// <param name="Uid">用户id</param>
        /// <returns>对象实体</returns>
        public Model.Admin GetModel(int Uid)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1  ");
            strSql.Append(" * ");
            strSql.Append(" from BBSUsers ");
            strSql.Append(" where Uid=" + Uid + "");
            Model.Admin model = new Model.Admin();
            DataSet     ds    = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.Uid       = int.Parse(ds.Tables[0].Rows[0][0].ToString());
                model.Uname     = ds.Tables[0].Rows[0][1].ToString();
                model.UPassword = ds.Tables[0].Rows[0][2].ToString();
                model.UEmail    = ds.Tables[0].Rows[0][3].ToString();
                model.UBirthday = ds.Tables[0].Rows[0][4].ToString();
                model.Usex      = true;
                if (ds.Tables[0].Rows[0][5].ToString() == "False")
                {
                    model.Usex = false;
                }
                model.UClass     = int.Parse(ds.Tables[0].Rows[0][6].ToString());
                model.UStatement = ds.Tables[0].Rows[0][7].ToString();
                model.UState     = int.Parse(ds.Tables[0].Rows[0][9].ToString());
                model.UPoint     = int.Parse(ds.Tables[0].Rows[0][10].ToString());

                return(model);
            }
            else
            {
                return(null);
            }
        }
Example #7
0
        /// <summary>
        /// 后台登陆页面
        /// </summary>
        /// <param name="username"></param>
        /// <param name="userpwd"></param>
        /// <param name="usercode"></param>
        /// <returns></returns>
        public ActionResult Index(string username, string userpwd, string usercode)
        {
            if (IsPost)
            {
                try
                {
                    string code = DealMvc.Common.Globals.getCode().ToString2();

                    if (code.ToLower() != usercode.ToLower())
                    {
                        throw new ExceptionEx.MyExceptionMessageBox("验证码不正确");
                    }
                    Model.Admin m_XShop_Admins = Model.Admin.GetModel(t => t.AdminID == username.Trim() && t.AdminPwd == userpwd.Jmd5());
                    if (m_XShop_Admins == null || m_XShop_Admins.IsNull)
                    {
                        throw new ExceptionEx.MyExceptionMessageBox("帐号或密码不正确");
                    }

                    //跟新帐号的登录时间
                    m_XShop_Admins.UpTime = DateTime.Now;
                    m_XShop_Admins.Update();

                    DealMvc.Common.Globals.setAdminName(m_XShop_Admins.AdminID);
                    return(RedirectToAction("do"));
                }
                catch (Exception ce)
                {
                    ExceptionEx.MyExceptionLog.WriteLog(this, ce);
                }
            }

            return(View());
        }
Example #8
0
        protected void Btn_Register_Click(object sender, EventArgs e)
        {
            Model.Admin admin = new Model.Admin();
            admin.adminName     = txbUserName.Text;
            admin.adminPassword = txbPassword1.Text;
            admin.department    = txbDepartment.Text;
            admin.job           = txbJob.Text;
            admin.permission    = "0";

            BLL.AdminManager admin1 = new BLL.AdminManager();
            bool             bo     = admin1.Add(admin);


            if (bo == true)
            {
                string  str = "adminname='" + txbUserName.Text.Trim() + "'";
                DataSet ds  = admin1.GetList(str);
                Session["NadminID"]   = ds.Tables[0].Rows[0]["adminID"].ToString();
                Session["NadminName"] = txbUserName.Text.Trim();
                Response.Redirect("~/N_Admin/Apply_Permission.aspx");
            }
            else
            {
                Response.Write("<script language=javascript>alert('申请失败!请重试')");
            }
        }
Example #9
0
        protected void BtnUpdate_Click(object sender, EventArgs e)
        {
            if (Request.QueryString["id"] != null)
            {
                int    id       = int.Parse(Request.QueryString["id"]);
                string username = txtUserName.Text.Trim();
                var    model    = bllAdmin.GetModel(p => p.ID != id && p.UserName.Equals(username));
                if (model != null)
                {
                    PageFunc.AjaxAlert(this.Page, "用户名已存在!");
                    return;
                }



                modelAdmin = bllAdmin.GetModel(int.Parse(Request.QueryString["id"]));

                modelAdmin.UserName = username;
                if (txtPwd.Text != "重新设置密码")
                {
                    modelAdmin.UserPwd = PageFunc.Encrypt(txtPwd.Text, 1);
                }
                modelAdmin.Enabled  = chbIsEnabled.Checked;
                modelAdmin.UserType = ddlUserType.SelectedValue;

                modelAdmin.Remark    = txtRemark.Text.Trim();
                modelAdmin.TbAccount = ddlAccount.SelectedValue;

                bllAdmin.Update(modelAdmin);
                Response.Write(PageFunc.ShowMsgJumpE("更新成功!", "AdminList.aspx"));
            }
        }
Example #10
0
        /// <summary>
        /// 读取管理员信息
        /// </summary>
        /// <returns></returns>
        public static AdminDAL GetAdmins()
        {
            AdminDAL admins;

            if (File.Exists(adminDocPath))
            {
                using (FileStream fs = new FileStream(adminDocPath, FileMode.Open, FileAccess.Read))
                {
                    BinaryFormatter bf = new BinaryFormatter();
                    admins = (AdminDAL)bf.Deserialize(fs);
                }
            }
            else
            {
                using (FileStream fs = new FileStream(adminDocPath, FileMode.CreateNew, FileAccess.Write))
                {
                    BinaryFormatter bf = new BinaryFormatter();
                    admins = new AdminDAL();
                    Model.Admin admin = new Model.Admin("A001", "管理员", "123");
                    admins.Add(admin);
                    bf.Serialize(fs, admins);
                }
            }
            return(admins);
        }
Example #11
0
        private void materialFlatButton1_Click(object sender, EventArgs e)
        {
            if (!VerifyTexts())
            {
                return;
            }
            if (_main == null && main != null)
            {
                Model.Calisan calisan = new Model.Calisan();

                calisan.ID = Database.Select.CalisanCekID(Session.KullaniciAdiAl());

                calisan.Ad    = txtAd.Text;
                calisan.Soyad = txtSoyad.Text;
                calisan.Mail  = txtMail.Text;
                calisan.Kadi  = txtKadi.Text;
                calisan.Sifre = MD5Sifreleme.MD5Sifrele(txtSifre.Text);

                Database.Update.CalisanGuncelle(calisan);
            }

            if (_main != null && main == null)
            {
                Model.Admin admin = new Model.Admin();

                admin.ID    = 1;
                admin.Ad    = txtAd.Text;
                admin.Soyad = txtSoyad.Text;
                admin.Kadi  = txtKadi.Text;
                admin.Sifre = txtSifre.Text;
                admin.Email = txtMail.Text;

                Database.Update.AdminGuncelle(admin);
            }
        }
Example #12
0
 public void Ad()
 {
     Model.Admin admin = new Model.Admin();
     admin.adname = Request.QueryString["name"].ToString();
     BLL.AdminBLL ub = new BLL.AdminBLL();
     ub.Login(admin);
 }
Example #13
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Model.Admin model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into Admin(");
            strSql.Append("ID,LoginName,Password,Power,NickName)");
            strSql.Append(" values (");
            strSql.Append("@ID,@LoginName,@Password,@Power,@NickName)");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@ID",        DbType.Int32,   8),
                new SQLiteParameter("@LoginName", DbType.String),
                new SQLiteParameter("@Password",  DbType.String),
                new SQLiteParameter("@Power",     DbType.String),
                new SQLiteParameter("@NickName",  DbType.String)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.LoginName;
            parameters[2].Value = model.Password;
            parameters[3].Value = model.Power;
            parameters[4].Value = model.NickName;

            int rows = DbHelperSQLite.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #14
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Model.Admin model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update Admin set ");
            strSql.Append("LoginName=@LoginName,");
            strSql.Append("Password=@Password,");
            strSql.Append("Power=@Power,");
            strSql.Append("NickName=@NickName");
            strSql.Append(" where ID=@ID ");
            SQLiteParameter[] parameters =
            {
                new SQLiteParameter("@LoginName", DbType.String),
                new SQLiteParameter("@Password",  DbType.String),
                new SQLiteParameter("@Power",     DbType.String),
                new SQLiteParameter("@NickName",  DbType.String),
                new SQLiteParameter("@ID",        DbType.Int32, 8)
            };
            parameters[0].Value = model.LoginName;
            parameters[1].Value = model.Password;
            parameters[2].Value = model.Power;
            parameters[3].Value = model.NickName;
            parameters[4].Value = model.ID;

            int rows = DbHelperSQLite.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #15
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.Admin DataRowToModel(DataRow row)
 {
     Model.Admin model = new Model.Admin();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["LoginName"] != null)
         {
             model.LoginName = row["LoginName"].ToString();
         }
         if (row["Password"] != null)
         {
             model.Password = row["Password"].ToString();
         }
         if (row["Power"] != null)
         {
             model.Power = row["Power"].ToString();
         }
         if (row["NickName"] != null)
         {
             model.NickName = row["NickName"].ToString();
         }
     }
     return(model);
 }
Example #16
0
        protected void UpdateFeedback(object sender, EventArgs e)
        {
            Model.Distribution      distribution = new Model.Distribution();
            BLL.DistributionManager manager      = new DistributionManager();

            BLL.AdminManager adminManager1 = new BLL.AdminManager();
            Model.Admin      admin1        = adminManager1.GetModel1(Session["SadminID"].ToString());
            string           handlers      = DropDownList_Distribution.SelectedItem.Text;


            Model.Feedback      feedback = new Model.Feedback();
            BLL.FeedbackManager Fmanager = new FeedbackManager();

            feedback.feedbackID = Convert.ToInt32(Labeltest.Text.Trim());
            feedback.handler    = handlers;
            string Str1 = "handler='" + handlers + "'";
            string Str2 = "feedbackID='" + Labeltest.Text.Trim() + "'";
            bool   bo2  = Fmanager.UpdateHandler(Str1, Str2);

            if (bo2 == true)
            {
                Response.Write("<script language=javascript>alert('修改成功!')</script>");
                BindY();
                BindN();
            }
        }
Example #17
0
        protected void Btn_Distribution_Click(object sender, EventArgs e)
        {
            Model.Distribution      distribution  = new Model.Distribution();
            BLL.DistributionManager manager       = new DistributionManager();
            BLL.AdminManager        adminManager1 = new BLL.AdminManager();
            Model.Admin             admin1        = adminManager1.GetModel1(Session["SadminID"].ToString());
            int s = Convert.ToInt32(admin1.adminID);



            distribution.feedbackID  = Convert.ToInt32(Labeltest.Text);
            distribution.description = txtDistribution.Text.Trim();
            distribution.adminID     = Convert.ToInt32(DropDownList_Distribution.SelectedValue.ToString());
            distribution.assignerID  = s;
            distribution.state       = "待处理";
            bool bo = manager.Add(distribution);

            if (bo == true)
            {
                Response.Write("<script language=javascript>alert('分配成功!')</script>");
                txtDistribution.Text = "";
                DropDownList_Distribution.SelectedIndex = 0;
                UpdateFeedback(sender, e);
                BindY();
                BindN();
            }
            else
            {
                Response.Write("<script language=javascript>alert('分配失败!请重试')");
            }
        }
Example #18
0
        protected void BntReply_Click(object sender, EventArgs e)
        {
            Model.Reply      reply        = new Model.Reply();
            BLL.ReplyManager replyManager = new ReplyManager();

            Model.Reply      reply1        = new Model.Reply();
            BLL.ReplyManager replyManager1 = new ReplyManager();
            string           str           = "replyID='" + Labeltest.Text + "'";
            string           id            = replyManager1.GetUserID(str);

            string str1    = "replyID='" + Labeltest.Text + "'";
            string replyFB = replyManager1.GetFBID(str);

            BLL.AdminManager adminManager1 = new BLL.AdminManager();
            Model.Admin      admin1        = adminManager1.GetModel1(Session["SadminID"].ToString());
            int s = Convert.ToInt32(admin1.adminID);

            reply.feedbackID = Convert.ToInt32(replyFB);
            reply.text       = txtReply.Text;
            reply.replierID  = s;
            reply.receiverID = Convert.ToInt32(id);
            bool bo = replyManager.Add(reply);

            if (bo == true)
            {
                Response.Write("<script language=javascript>alert('回复成功!')</script>");
            }
            else
            {
                Response.Write("<script language=javascript>alert('回复失败!请重试')");
            }
        }
Example #19
0
        protected void GetLoginName()
        {
            BLL.AdminManager adminManager1 = new BLL.AdminManager();
            Model.Admin      admin1        = adminManager1.GetModel1(Session["NadminID"].ToString());

            LabelUser.Text = admin1.adminName;
        }
Example #20
0
 protected void Bind()
 {
     Model.Admin      admin1 = new Model.Admin();
     BLL.AdminManager admin2 = new BLL.AdminManager();
     GridView1.DataSource = admin2.GetList();
     GridView1.DataBind();
 }
Example #21
0
        //保存
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (this.tbPassWord.Text == this.tbAdminPassWordOK.Text)
            {
                Model.Admin ai = new Model.Admin();
                ai.TbAdminID = this.tbAdminID.Text;
                if (rbAdmin.Checked == true)
                {
                    ai.AdminType = 1;
                }
                if (rbSuperAdmin.Checked == true)
                {
                    ai.AdminType = 2;
                }
                ai.TbAdminPassWordOK = this.tbAdminPassWordOK.Text;
                if (cbDisable.Checked == true)
                {
                    ai.CbDisable = "是";
                }
                if (cbDisable.Checked == false)
                {
                    ai.CbDisable = "否";
                }

                string a = BLL.AdminBLL.sysAdmin(2, ai);
                MessageBox.Show(a, "提示");
                //委托
                AdminEvent(null);
                this.Close();
            }
            else
            {
                MessageBox.Show("密码不一致!", "提示");
            }
        }
Example #22
0
 private void btAdminConfirm_Click(object sender, EventArgs e)
 {
     if (tbAdminID.Text.Trim() == "" || tbAdminProPasswd.Text.Trim() == "" || (tbAdminName.Text.Trim() == "" & tbAdminNewPasswd.Text.Trim() == ""))
     {
         MessageBox.Show("输入信息不完整!", "修改失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         flag = 1;
     }
     if (flag == 0)
     {
         Maticsoft.BLL.Admin adm = new BLL.Admin();
         string string1          = string.Format("userID = '{0}' and passwd = '{1}'", tbAdminID.Text.Trim(), tbAdminProPasswd.Text.Trim());
         if (adm.GetRecordCount(string1) == 1)
         {
             Model.Admin adminmodel = new Model.Admin();
             adminmodel.userID   = tbAdminID.Text.Trim();
             adminmodel.userName = tbAdminName.Text.Trim();
             adminmodel.passwd   = tbAdminNewPasswd.Text.Trim();
             if (adm.Update(adminmodel) == true)
             {
                 MessageBox.Show("修改成功!");
                 ((Main_Admin)this.Owner).dgvAdmin_Load();
                 this.Close();
             }
             else
             {
                 MessageBox.Show("修改失败!");
             }
         }
         else
         {
             MessageBox.Show("身份验证错误!", "修改出错", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         }
     }
 }
Example #23
0
        public frmUpdateAdmin(Model.Admin ai)
        {
            InitializeComponent();

            #region 修改传值

            this.tbAdminID.Text         = ai.TbAdminID;
            this.tbAdminPassWordOK.Text = ai.TbAdminPassWordOK;
            this.tbPassWord.Text        = ai.TbAdminPassWordOK;
            if (ai.AdminType == 1)
            {
                this.rbAdmin.Checked = true;
            }
            if (ai.AdminType == 2)
            {
                this.rbSuperAdmin.Checked = true;
            }
            if (ai.CbDisable == "是")
            {
                this.cbDisable.Checked = true;
            }
            if (ai.CbDisable == "否")
            {
                this.cbDisable.Checked = false;
            }

            #endregion
        }
Example #24
0
 public InsertActorPage(Admin admin)
 {
     this.admin = admin;
     cn         = Connection.GetConnectionAdmin(admin.password);
     InitializeComponent();
     BindComboBoxCountry(Country);
 }
Example #25
0
 public CinemaEditPage(Admin admin)
 {
     this.admin = admin;
     cn         = Connection.GetConnectionAdmin(admin.password);
     InitializeComponent();
     BindComboBoxRows(Name);
 }
        //修改密码
        private void button_save_Click(object sender, EventArgs e)
        {
            if (txtOldPwd.Text.Trim() != AdminHelper.pass)
            {
                MessageBox.Show("原始密码错误!", "错误提示");
                txtOldPwd.Focus();
                return;
            }
            if (txtNewPwd.Text.Trim() == "")
            {
                MessageBox.Show("新密码不能为空,请输入", "错误提示");
                txtNewPwd.Focus();
                return;
            }
            if (txtNewPwdAgain.Text.Trim() != txtNewPwd.Text.Trim())
            {
                MessageBox.Show("俩次输入的密码不一致,请重新输入!", "错误提示");
                txtNewPwdAgain.Focus();
                return;
            }
            Model.Admin model = new Model.Admin();
            model.Name = AdminHelper.name;
            model.Pass = txtNewPwd.Text.Trim();//新密码
            BLL.Admin bll = new BLL.Admin();

            if (bll.Update(model))
            {
                AdminHelper.pass = model.Pass;
                MessageBox.Show("密码更新成功!");
            }
            else
            {
                MessageBox.Show("密码修改失败!", "错误");
            }
        }
Example #27
0
        protected void BntReply_Click(object sender, EventArgs e)
        {
            Model.Reply      reply        = new Model.Reply();
            BLL.ReplyManager replyManager = new ReplyManager();


            BLL.AdminManager adminManager1 = new BLL.AdminManager();
            Model.Admin      admin1        = adminManager1.GetModel1(Session["SadminID"].ToString());
            int s = Convert.ToInt32(admin1.adminID);

            reply.feedbackID = Convert.ToInt32(Labeltest.Text);
            reply.text       = txtReply.Text;
            reply.replierID  = s;
            reply.remark     = "1";
            reply.receiverID = Convert.ToInt32(LabelName.Text.Trim());
            bool bo = replyManager.Add(reply);

            if (bo == true)
            {
                Response.Write("<script language=javascript>alert('回复成功!')</script>");
                txtReply.Text = "";
            }
            else
            {
                Response.Write("<script language=javascript>alert('回复失败!请重试')");
            }
        }
Example #28
0
        /// <summary>
        /// 添加管理员方法
        /// </summary>
        /// <param name="i">1代表插入数据</param>
        /// <returns></returns>
        public static string sysAdmin(int i, Model.Admin ai)
        {
            string str = "proc_AdminSave";

            SqlParameter[] Parameter =
            {
                new SqlParameter("@num",       SqlDbType.TinyInt),
                new SqlParameter("@学号工号",      SqlDbType.NVarChar),
                new SqlParameter("@权限级别",      SqlDbType.TinyInt),
                new SqlParameter("@密码",        SqlDbType.NVarChar),
                new SqlParameter("@是否停用",      SqlDbType.NVarChar),
                new SqlParameter("@BackValue", SqlDbType.NVarChar, 20)
            };

            Parameter[0].Value     = i;
            Parameter[1].Value     = ai.TbAdminID;
            Parameter[2].Value     = ai.AdminType;
            Parameter[3].Value     = ai.TbAdminPassWordOK;
            Parameter[4].Value     = ai.CbDisable;
            Parameter[5].Direction = ParameterDirection.Output;

            SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, str, Parameter);

            return(Convert.ToString(Parameter[5].Value.ToString()));
        }
Example #29
0
        protected void Btn_Solve_Click(object sender, EventArgs e)
        {
            string state  = "1";
            string idList = GetSelIDList();

            if (idList.Trim().Length == 0)
            {
                return;
            }
            BLL.DistributionManager manager = new BLL.DistributionManager();
            manager.UpdateList(state, idList);
            Response.Write("<script language=javascript>alert('标记成功!')</script>");
            NewBind();
            HisBind();


            Model.Feedback      feedback = new Model.Feedback();
            BLL.FeedbackManager Fmanager = new FeedbackManager();


            BLL.AdminManager adminManager1 = new BLL.AdminManager();
            Model.Admin      admin1        = adminManager1.GetModel1(Session["GadminID"].ToString());
            int ID = Convert.ToInt32(admin1.adminID);

            string Str1 = "solutionState='" + state + "'";
            string Str2 = "adminID='" + ID + "' and  state =  '" + state + "'";

            Fmanager.UpdateSolution(Str1, Str2);
        }
Example #30
0
 public bool Update(Model.Admin model)
 {
     using (var connection = ConnectionFactory.GetOpenConnection(ConnStr))
     {
         int res = connection.Execute(@"UPDATE [Admin] SET [UserName] = @Username,[Password] = @Password,[Remark] = @Remark  WHERE Id = @Id", model);
         return(res > 0);
     }
 }
Example #31
0
        public bool IsUserExists(string UserName)
        {
            Hashtable ht = new Hashtable();
            ht.Add("UserName", UserName);

            Model.Admin model = new Model.Admin();

            return model.IsExist(ht);
        }
Example #32
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         int id = Convert.ToInt32(Request.QueryString["id"].ToString());
         user = Model.UserHelper.GetUser(id);
     }
     catch
     {
     }
 }
Example #33
0
        protected void submit_Click(object sender, EventArgs e)
        {
            AdminAuth = (db.Admin.Where(u => u.Username == invoiceNum.Text && u.Password == pin.Text).Count() > 0) ? db.Admin.FirstOrDefault(u => u.Username == invoiceNum.Text && u.Password == pin.Text) : null;

            if (AdminAuth == null)
            {
                errorDisplay.Text = "Username or Password is incorrect";
            }
            else
            {
                string parameter = "grab=" + AdminAuth.AdminID;
                Response.Redirect("Profile.aspx?" + parameter);
            }
        }
Example #34
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     Model.Admin admin = new Model.Admin();
     admin.UpdateModel();
     CNVP.UI.AdminPage adminpage = new AdminPage();
     if (adminpage.IsUserExists(admin.UserName))
     {
         MessageBox.ShowMessage("此用户名已存在", "ManagerAdd.aspx");
     }
     else
     {
         admin.UserPass = Encrypt.Md5(admin.UserPass);
         admin.CreateTime = DateTime.Now;
         admin.Insert();
         MessageBox.ShowMessage("用户添加成功", "ManagerList.aspx");
     }
 }
 public JsonResult UpdateAdmin(Models.AdminModel model)
 {
     if (ModelState.IsValid) {
         IDAL.IAdminRepository adminRepository = EnterRepository.GetRepositoryEnter().GetAdminRepository;
         //判断权限名称是否已存在
         var result = adminRepository.LoadEntities(m => m.Mobile == model.Mobile.Trim()).FirstOrDefault();
         if (result != null && result.Id != model.Id) {
             return Json(new {
                 state = "error",
                 message = "手机号码已经存在了"
             });
         }
         else {
             Model.Admin admin = new Model.Admin() {
                 AuthoryId = model.AuthoryId,
                 IsLogin = model.IsLogin,
                 AdminName=model.AdminName,
                 Mobile = model.Mobile,
                 Id = model.Id
             };
             //清楚context中result对象
             adminRepository.Get(m => m.Id == model.Id);
             adminRepository.EditEntity(admin, new string[] { "AuthoryId", "IsLogin", "Mobile", "AdminName" });
             PublicFunction.AddOperation(1, string.Format("修改管理员"), string.Format("修改管理员=={0}==成功", model.Mobile));
             if (EnterRepository.GetRepositoryEnter().SaveChange() > 0) {
                 return Json(new {
                     state = "success",
                     message = "修改管理员成功"
                 });
             }
             else {
                 PublicFunction.AddOperation(1, string.Format("修改管理员"), string.Format("修改管理员=={0}==失败", model.Mobile));
                 EnterRepository.GetRepositoryEnter().SaveChange();
                 return Json(new {
                     state = "error",
                     message = "修改管理员失败"
                 });
             }
         }
     }
     else {
         return Json(new { state = "error", message = "信息不完整" });
     }
 }
 public JsonResult Login(Models.LoginModel model)
 {
     if (ModelState.IsValid) {
         //首先判断下验证码是否正确
         if (Session["ValidateImgCode"] != null && string.Equals(Session["ValidateImgCode"].ToString(),
             model.ValidateCode, StringComparison.OrdinalIgnoreCase)) {
             Model.Admin adminModel = new Model.Admin();
             if (new Regex("1[3|5|7|8|][0-9]{9}").IsMatch(model.UserName)) {//匹配手机号码
                 adminModel = EnterRepository.GetRepositoryEnter().GetAdminRepository.LoadEntities(m => m.Mobile == model.UserName && m.IsLogin == 1).FirstOrDefault();
             }
             else if (new Regex(@"[A-Za-z0-9.%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}").IsMatch(model.UserName)) {//匹配邮箱
                 adminModel = EnterRepository.GetRepositoryEnter().GetAdminRepository.LoadEntities(m => m.Email == model.UserName && m.IsLogin == 1).FirstOrDefault();
             }
             else {//匹配用户名
                 adminModel = EnterRepository.GetRepositoryEnter().GetAdminRepository.LoadEntities(m => m.AdminName == model.UserName&&m.IsLogin==1).FirstOrDefault();
             }
             if (adminModel == null) {
                 return Json(new {
                     state = "error",
                     message = "用户名不存在"
                 });
             }
             else {
                 //判断密码是否正确
                 if (adminModel.Password == MD5Helper.CreatePasswordMd5(model.Password, adminModel.Salt)) {
                     adminModel.LastLoginTime = DateTime.Now;
                     adminModel.LastLoginIp = IpHelper.GetRealIP();
                     adminModel.LastLoginAddress = IpHelper.GetAdrByIp(adminModel.LastLoginIp);
                     adminModel.LastLoginInfo = IpHelper.GetBrowerVersion();
                     //添加登录日志并修改上次登录信息
                     EnterRepository.GetRepositoryEnter().GetAdminLoginLogRepository.AddEntity(new Model.AdminLoginLog() {
                         AdminId = adminModel.Id,
                         AdminLoginAddress = adminModel.LastLoginAddress,
                         AdminLoginIP = adminModel.LastLoginIp,
                         AdminLoginTime = adminModel.LastLoginTime,
                         AdminLoginInfo = adminModel.LastLoginInfo
                     });
                     if (EnterRepository.GetRepositoryEnter().SaveChange() > 0) {
                         //先清除原来的cookie
                         WebCookieHelper.AdminLoginOut();
                         //登录成功,保存cookie
                         WebCookieHelper.SetCookie(adminModel.Id, model.UserName, adminModel.LastLoginTime, adminModel.LastLoginIp, adminModel.LastLoginAddress, adminModel.IsSuperAdmin, adminModel.AuthoryId, (model.IsRemind!=null&&model.IsRemind )? 15 : 0);
                         return Json(new {
                             state = "success",
                             message = "登录成功"
                         });
                     }
                     else {
                         return Json(new {
                             state = "success",
                             message = "服务器泡妞去了"
                         });
                     }
                 }
                 else {
                     return Json(new {
                         state = "error",
                         message = "密码错误"
                     });
                 }
             }
         }
         else {
             return Json(new {
                 state = "error",
                 message = "验证码错误"
             });
         }
     }
     else {
         return Json(new {
             state = "error",
             message = "输入信息不完整"
         });
     }
 }
Example #37
0
 private void ResetManagerPass()
 {
     string Id = Public.FilterSql(Request.Params["Id"]);
     string userPass = Request.Params["UserPass"];
     Model.Admin user = new Model.Admin();
     user.Id = Convert.ToInt32(Id);
     user.UserPass = Encrypt.Md5(userPass);
     if (user.Update() == 1)
     {
         Response.Write("{\"returnval\":\"1\"}");
     }
     else
     {
         Response.Write("{\"returnval\":\"0\"}");
     }
     Response.End();
 }
Example #38
0
 private void UpdateManager()
 {
     string Id = Public.FilterSql(Request.Params["Id"]);
     string UserEmail = Request.Params["UserEmail"];
     string TrueName = Request.Params["TrueName"];
     string UserTel = Request.Params["UserTel"];
     string UserUnit = Request.Params["UserUnit"];
     Model.Admin user = new Model.Admin();
     user.Id = Convert.ToInt32(Id);
     user.UserEmail = UserEmail;
     user.TrueName = TrueName;
     user.UserTel = UserTel;
     user.UserUnit = UserUnit;
     if (user.Update() == 1)
     {
         Response.Write("{\"returnval\":\"1\"}");
     }
     else
     {
         Response.Write("{\"returnval\":\"0\"}");
     }
     Response.End();
 }
Example #39
0
 private void DeleteManager()
 {
     string Id = Public.FilterSql(Request.Params["Id"]);
     Model.Admin user = new Model.Admin();
     user.Id = Convert.ToInt32(Id);
     if (user.Delete(Id) == 1)
     {
         Response.Write("{\"returnval\":\"1\"}");
     }
     else
     {
         Response.Write("{\"returnval\":\"0\"}");
     }
     Response.End();
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if(IsPostBack)
            {
                AjaxResult response = null;

                var txtLgName = Request.Form["txtLgName"];
                var txtPwd = Request.Form["txtPwd"];
                var txtName = Request.Form["txtName"];
                var txtEmail = Request.Form["txtMail"];
                var txtQQ = Request.Form["txtQQ"];
                var txtMob = Request.Form["txtMob"];
                var txtRemark = Request.Form["txtRemark"];

                if (string.IsNullOrEmpty(txtLgName))
                {
                    response = new AjaxResult() {Success = 0, Message = "登录名不能为空。"};
                    this.Response.Write(common.Common.GetJSMsgBox(response.Message));
                    return;
                }

                if (string.IsNullOrEmpty(txtPwd))
                {
                    response = new AjaxResult() { Success = 0, Message = "密码不能为空。" };
                    this.Response.Write(common.Common.GetJSMsgBox(response.Message));
                    return;
                }

                if (string.IsNullOrEmpty(txtName))
                {
                    response = new AjaxResult() { Success = 0, Message = "用户名不能为空。" };
                    this.Response.Write(common.Common.GetJSMsgBox(response.Message));
                    return;
                }

                var dt = new Model.Admin()
                             {
                                 CreateDate = DateTime.Now,
                                 Email = txtEmail,
                                 LoginName = txtLgName,
                                 ModifyDate = DateTime.Now,
                                 Name = txtName,
                                 Password = PubFunc.Md5(txtPwd),
                                 QQ = txtQQ,
                                 Mob = txtMob,
                                 Remark = txtRemark
                             };

                DataContext dc=new DataContext();

                dc.BeginTransaction();
                try
                {
                    var bll = new BLL.BLLBase();
                    var id = bll.Add(dc, dt);

                    dc.CommitTransaction();

                    response = new AjaxResult() {Success = 1, Message = "操作成功", Data = id};
                }
                catch(Exception exception)
                {
                    dc.RollBackTransaction();
                    response = new AjaxResult() { Success = 0, Message = "操作失败:"+exception.Message, Data = 0 };
                }
                finally
                {
                    dc.CloseConnection();
                }

                this.Response.Write(common.Common.GetJSMsgBox(response.Message));
            }
        }