Example #1
0
        /// <summary>
        /// 获取快开厅员工
        /// <param name="staffId">员工编号</param>
        /// </summary>
        /// <returns>快开厅员工对象</returns>
        public TBStaff Get(string staffId)
        {
            TBStaff tbStaff = null;

            try
            {
                string strSQL = "select * from TBStaff where staffId=:staffId";
                Param  param  = new Param();
                param.Clear();
                param.Add(":staffId", staffId);
                db.Open();
                ComDataReader dr = db.ExecuteReader(CommandType.Text, strSQL, param);
                if (dr.Read())
                {
                    tbStaff = ReadData(dr);
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            finally
            {
                db.Close();
            }
            return(tbStaff);
        }
Example #2
0
        /// <summary>
        /// 修改快开厅员工
        /// <param name="tbStaff">快开厅员工</param>
        /// </summary>
        public void Edit(TBStaff tbStaff, TSAgentUser tsAgentUser)
        {
            TSAgentUserDAO tsAgentUserDAO = new TSAgentUserDAO();

            tsAgentUser.userId = tbStaff.staffId;
            //判断是否帐号重复
            List <TSAgentUser> list = tsAgentUserDAO.GetList("userCode", tsAgentUser.userCode);

            if (list.Count > 0 && !tsAgentUser.userId.Equals(list[0].userId))
            {
                Message.error(context, "帐号重复请重新输入!");
                return;
            }
            try
            {
                tbStaff.status = tbStaff.status == null ? "0" : "1";
                tbStaffDAO.EditTrans(tbStaff, tsAgentUser);
                Message.success(context, "快开厅员工修改成功");
                loginSession.Log(tbStaff.staffName + "快开厅员工修改成功");
            }
            catch (Exception e)
            {
                Message.error(context, "快开厅员工修改失败");
                loginSession.Log(e.Message);
            }
        }
Example #3
0
        /// <summary>
        /// 获取指定快开厅员工
        /// <param name="staffId">员工编号</param>
        /// </summary>
        public TBStaff Get(string staffId)
        {
            TBStaff tbStaff = new TBStaff();

            try
            {
                tbStaff = tbStaffDAO.Get(staffId);
            }
            catch (Exception e)
            {
                Message.error(context, e.Message);
            }
            return(tbStaff);
        }
Example #4
0
        /// <summary>
        /// 读取快开厅员工信息
        /// <param name="dr">记录指针</param>
        /// </summary>
        /// <returns>快开厅员工对象</returns>
        private TBStaff ReadData(ComDataReader dr)
        {
            TBStaff tbStaff = new TBStaff();

            tbStaff.staffId   = dr["staffId"].ToString();   //员工编号
            tbStaff.siteId    = dr["siteId"].ToString();    //快开厅编号
            tbStaff.agentId   = dr["agentId"].ToString();   //代理商编号
            tbStaff.staffName = dr["staffName"].ToString(); //员工姓名
            tbStaff.status    = dr["status"].ToString();    //使用状态
            tbStaff.telephone = dr["telephone"].ToString(); //手机号码
            tbStaff.IDNumber  = dr["IDNumber"].ToString();  //身份证号
            tbStaff.address   = dr["address"].ToString();   //住址
            tbStaff.remark    = dr["remark"].ToString();    //备注
            return(tbStaff);
        }
Example #5
0
 /// <summary>
 /// 修改快开厅员工
 /// <param name="tbStaff">快开厅员工</param>
 /// </summary>
 public void Edit(TBStaff tbStaff)
 {
     try
     {
         db.Open();
         Edit(db, tbStaff);
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         db.Close();
     }
 }
Example #6
0
        /// <summary>
        /// 修改快开厅员工
        /// <param name="data">数据库连接</param>
        /// <param name="tbStaff">快开厅员工</param>
        /// </summary>
        public void Edit(DataAccess data, TBStaff tbStaff)
        {
            string strSQL = "update TBStaff set siteId=:siteId,staffName=:staffName,status=:status,telephone=:telephone,IDNumber=:IDNumber,address=:address,remark=:remark where staffId=:staffId";
            Param  param  = new Param();

            param.Clear();
            param.Add(":siteId", tbStaff.siteId);       //快开厅编号
            param.Add(":staffName", tbStaff.staffName); //员工姓名
            param.Add(":status", tbStaff.status);       //使用状态
            param.Add(":telephone", tbStaff.telephone); //手机号码
            param.Add(":IDNumber", tbStaff.IDNumber);   //身份证号
            param.Add(":address", tbStaff.address);     //住址
            param.Add(":remark", tbStaff.remark);       //备注
            param.Add(":staffId", tbStaff.staffId);     //员工编号
            data.ExecuteNonQuery(CommandType.Text, strSQL, param);
        }
Example #7
0
 /// <summary>
 /// 增加门店员工
 /// </summary>
 /// <param name="tbStaff">门店员工</param>
 public virtual void Add(TBStaff tbStaff)
 {
     try
     {
         db.Open();
         Add(db, tbStaff);
     }
     catch (Exception e)
     {
         throw e;
     }
     finally
     {
         db.Close();
     }
 }
Example #8
0
        /// <summary>
        /// 增加快开厅员工
        /// <param name="data">数据库连接</param>
        /// <param name="tbStaff">快开厅员工</param>
        /// </summary>
        public void Add(DataAccess data, TBStaff tbStaff)
        {
            string strSQL = "insert into TBStaff (staffId,siteId,agentId,staffName,status,telephone,IDNumber,address,remark) values (:staffId,:siteId,:agentId,:staffName,:status,:telephone,:IDNumber,:address,:remark)";
            Param  param  = new Param();

            param.Clear();
            param.Add(":staffId", tbStaff.staffId);     //员工编号
            param.Add(":siteId", tbStaff.siteId);       //快开厅编号
            param.Add(":agentId", tbStaff.agentId);     //代理商编号
            param.Add(":staffName", tbStaff.staffName); //员工姓名
            param.Add(":status", tbStaff.status);       //使用状态
            param.Add(":telephone", tbStaff.telephone); //手机号码
            param.Add(":IDNumber", tbStaff.IDNumber);   //身份证号
            param.Add(":address", tbStaff.address);     //住址
            param.Add(":remark", tbStaff.remark);       //备注
            data.ExecuteNonQuery(CommandType.Text, strSQL, param);
        }
Example #9
0
        /// <summary>
        /// 修改门店员工
        /// </summary>
        /// <param name="data">数据库连接</param>
        /// <param name="tbStaff">门店员工</param>
        public virtual void Edit(DataAccess data, TBStaff tbStaff)
        {
            string strSQL = "update TBStaff set siteId=@siteId,agentId=@agentId,staffName=@staffName,status=@status,telephone=@telephone,IDNumber=@IDNumber,address=@address,remark=@remark where staffId=@staffId";
            Param  param  = new Param();

            param.Clear();
            param.Add("@siteId", tbStaff.siteId);       //门店编号
            param.Add("@agentId", tbStaff.agentId);     //代理商编号
            param.Add("@staffName", tbStaff.staffName); //员工姓名
            param.Add("@status", tbStaff.status);       //使用状态
            param.Add("@telephone", tbStaff.telephone); //手机号码
            param.Add("@IDNumber", tbStaff.IDNumber);   //身份证号
            param.Add("@address", tbStaff.address);     //住址
            param.Add("@remark", tbStaff.remark);       //备注
            param.Add("@staffId", tbStaff.staffId);     //员工编号
            data.ExecuteNonQuery(CommandType.Text, strSQL, param);
        }
Example #10
0
        /// <summary>
        /// 事务修改快开厅员工
        /// <param name="tbStaff">快开厅员工</param>
        /// </summary>
        public void EditTrans(TBStaff tbStaff, TSAgentUser tsAgentUser)
        {
            ComTransaction trans = null;

            try
            {
                db.Open();
                trans = db.BeginTransaction();
                new TSAgentUserDAO().Edit(db, tsAgentUser, "1");//1为门店员工
                Edit(db, tbStaff);
                trans.Commit();
            }
            catch (Exception e)
            {
                trans.Rollback();
                throw e;
            }
            finally
            {
                db.Close();
            }
        }
Example #11
0
        /// <summary>
        /// 增加快开厅员工
        /// <param name="tbStaff">快开厅员工</param>
        /// </summary>
        public void Add(TBStaff tbStaff, TSAgentUser tsAgentUser)
        {
            TSAgentUserDAO tsAgentUserDAO = new TSAgentUserDAO();

            //判断是否帐号重复
            if (tsAgentUserDAO.Exist("userCode", tsAgentUser.userCode))
            {
                Message.error(context, "用户帐号重复请重新输入!");
                return;
            }
            try
            {
                tbStaff.staffId = commonDao.GetMaxNo("TBStaff", "", 6);
                tbStaff.status  = tbStaff.status == null ? "0" : "1";
                tbStaffDAO.AddTrans(tbStaff, tsAgentUser);
                Message.success(context, "快开厅员工增加成功,默认密码为帐号,登录后建议修改!");
                loginSession.Log(tbStaff.staffName + "快开厅员工增加成功");
            }
            catch (Exception e)
            {
                Message.error(context, "快开厅员工增加失败");
                loginSession.Log(e.Message);
            }
        }
Example #12
0
        private DataAccess db = new DataAccess(DataAccess.DBConn);//数据库连接

        /// <summary>
        /// 事务增加快开厅员工
        /// <param name="tbStaff">快开厅员工</param>
        /// </summary>
        public void AddTrans(TBStaff tbStaff, TSAgentUser tsAgentUser)
        {
            ComTransaction trans = null;

            try
            {
                db.Open();
                trans = db.BeginTransaction();
                Add(db, tbStaff);
                tsAgentUser.userId  = tbStaff.staffId;
                tsAgentUser.userPwd = Encrypt.ConvertPwd(tsAgentUser.userId, tsAgentUser.userPwd);
                new TSAgentUserDAO().Add(db, tsAgentUser);
                trans.Commit();
            }
            catch (Exception e)
            {
                trans.Rollback();
                throw e;
            }
            finally
            {
                db.Close();
            }
        }
Example #13
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                LoginAgentUser loginAgentUser = new LoginAgentUser(context, "Staff");
                StaffBLL       bll            = new StaffBLL(context, loginAgentUser);
                AgentRoleBLL   agentRoleBLL   = new AgentRoleBLL(context, loginAgentUser);
                if (!loginAgentUser.Pass)//权限验证
                {
                    return;
                }
                string roleType = agentRoleBLL.GetRoleType(loginAgentUser.RoleIds);
                //加载DataGrid
                if (context.Request["action"] == "gridLoad")
                {
                    int page = int.Parse(context.Request["page"]);
                    int rows = int.Parse(context.Request["rows"]);
                    if (roleType == "0")
                    {
                        bll.LoadGrid(page, rows, roleType, loginAgentUser.UserId);
                    }
                    else
                    {
                        bll.LoadGrid(page, rows, roleType, bll.Get(loginAgentUser.UserId).siteId);
                    }
                    return;
                }
                //加载门店
                if (context.Request["action"] == "siteListLoad")
                {
                    bll.SiteCombobox(loginAgentUser.UserId, roleType);
                    return;
                }
                //加载角色
                if (context.Request["action"] == "roleListLoad")
                {
                    bll.RoleCombobox();
                    return;
                }
                //加载信息
                if (context.Request["action"] == "load")
                {
                    string staffId = context.Request["staffId"];//员工编号
                    bll.Load(staffId);
                    return;
                }

                //增加
                if (context.Request["action"] == "add")
                {
                    TBStaff     tbStaff     = new TBStaff();
                    TSAgentUser tsAgentUser = new TSAgentUser();
                    tbStaff.staffId   = context.Request["staffId"];   //员工编号
                    tbStaff.siteId    = context.Request["siteId"];    //门店编号
                    tbStaff.staffName = context.Request["staffName"]; //员工姓名
                    tbStaff.status    = context.Request["status"];    //使用状态
                    tbStaff.telephone = context.Request["telephone"]; //手机号码
                    tbStaff.IDNumber  = context.Request["IDNumber"];  //身份证号
                    if (roleType == "0")                              //角色类型0:代理商 1:门店员工
                    {
                        tbStaff.agentId = loginAgentUser.UserId;
                    }
                    else
                    {
                        tbStaff.agentId = bll.Get(loginAgentUser.UserId).agentId;
                    }
                    tbStaff.address = context.Request["address"];        //住址
                    tbStaff.remark  = context.Request["remark"];         //备注
                    //添加到代理门店用户表
                    tsAgentUser.roleId   = context.Request["roleId"];    //角色;
                    tsAgentUser.userCode = context.Request["staffCode"]; //员工帐号
                    tsAgentUser.userPwd  = tsAgentUser.userCode;         //帐号密码 默认和帐号一致
                    bll.Add(tbStaff, tsAgentUser);
                    return;
                }

                //修改
                if (context.Request["action"] == "edit")
                {
                    TBStaff     tbStaff     = new TBStaff();
                    TSAgentUser tsAgentUser = new TSAgentUser();
                    tbStaff.staffId   = context.Request["staffId"];   //员工编号
                    tbStaff.siteId    = context.Request["siteId"];    //门店编号
                    tbStaff.staffName = context.Request["staffName"]; //员工姓名
                    tbStaff.status    = context.Request["status"];    //使用状态
                    tbStaff.telephone = context.Request["telephone"]; //手机号码
                    tbStaff.IDNumber  = context.Request["IDNumber"];  //身份证号
                    if (roleType == "0")                              //角色类型0:代理商 1:门店员工
                    {
                        tbStaff.agentId = loginAgentUser.UserId;
                    }
                    else
                    {
                        tbStaff.agentId = bll.Get(loginAgentUser.UserId).agentId;
                    }
                    tbStaff.address = context.Request["address"];        //住址
                    tbStaff.remark  = context.Request["remark"];         //备注
                    //添加到代理门店用户表
                    tsAgentUser.roleId   = context.Request["roleId"];    //角色;
                    tsAgentUser.userCode = context.Request["staffCode"]; //员工帐号
                    bll.Edit(tbStaff, tsAgentUser);
                    return;
                }

                //删除
                if (context.Request["action"] == "delete")
                {
                    string staffId = context.Request["staffId"];//员工编号
                    bll.Delete(staffId);
                    return;
                }
            }
            catch (Exception e)
            {
                Message.error(context, e.Message);
            }
        }