Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            long queId = 0; long resDepId;

            if (!string.IsNullOrEmpty(Request.QueryString["queId"]))
            {
                if (long.TryParse(Request.QueryString["queId"], out queId))
                {
                    queue = depBll.GetQueue(queId);
                }
            }

            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                if (long.TryParse(Request.QueryString["id"], out resDepId))
                {
                    resDep = new DAL.sys_resource_department_dal().FindById(resDepId);
                }
            }
            if (resDep != null)
            {
                isAdd = false;
                queue = depBll.GetQueue(resDep.department_id);
            }

            if (queue == null)
            {
                Response.Write("<script>alert('未获取到相关队列信息');window.close();</script>");
            }
        }
Beispiel #2
0
        /// <summary>
        /// 删除队列
        /// </summary>
        public bool DeleteQueue(long queId, long userId, ref string faileReason)
        {
            sys_department thisQue = _dal.FindNoDeleteById(queId);

            if (thisQue == null)
            {
                return(true);
            }
            if (thisQue.is_system == 1)
            {
                faileReason = "系统队列,不能删除";
                return(false);
            }
            List <sys_resource_department> resDepList = GetResDepList(queId);

            if (resDepList != null && resDepList.Count > 0)
            {
                faileReason = "队列下有多个联系人,不能删除";
                return(false);
            }

            List <sdk_task> ticketList = _dal.FindListBySql <sdk_task>("SELECT * from sdk_task where delete_time =0 and type_id = 1809 and department_id = " + queId.ToString());

            if (ticketList != null && ticketList.Count > 0)
            {
                faileReason = "队列被多个工单引用,不能删除";
                return(false);
            }
            _dal.SoftDelete(thisQue, userId);
            OperLogBLL.OperLogDelete <sys_department>(thisQue, thisQue.id, userId, OPER_LOG_OBJ_CATE.DEPARTMENT, "");
            return(true);
        }
 public dynamic DeleteDepart(sys_department department)
 {
     if (departmentFactory.CreatService().DeleteDepart(department))
     {
         return "OK";
     }
     return "FAIL";
 }
        public ActionResult Save(sys_department dto)
        {
            var user = RequestHelper.AdminInfo();

            dto.insert_id   = user.Id;
            dto.insert_time = DateTime.Now;
            _deptApp.SaveDepartment(dto);
            return(Success("保存成功"));
        }
Beispiel #5
0
 /// <summary>
 /// 新增队列
 /// </summary>
 public bool AddQueue(sys_department queue, long userId)
 {
     queue.id             = _dal.GetNextIdCom();
     queue.create_time    = queue.update_time = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
     queue.create_user_id = queue.update_user_id = userId;
     _dal.Insert(queue);
     OperLogBLL.OperLogAdd <sys_department>(queue, queue.id, userId, OPER_LOG_OBJ_CATE.DEPARTMENT, "");
     return(true);
 }
        public dynamic EditDepart(sys_department department)
        {
            if (departmentFactory.CreatService().EditDepart(department))
            {
                return "OK";
            }
            return "FAIL";

            // return new RedirectResult("/user/index");

            //return "<script>alert('123')</script>";
            ;
        }
Beispiel #7
0
        /// <summary>
        /// 编辑队列
        /// </summary>
        public bool EditQueue(sys_department queue, long userId)
        {
            var oldQueue = _dal.FindNoDeleteById(queue.id);

            if (oldQueue == null)
            {
                return(false);
            }
            queue.update_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            queue.update_user_id = userId;
            _dal.Update(queue);
            OperLogBLL.OperLogUpdate <sys_department>(queue, oldQueue, queue.id, userId, OPER_LOG_OBJ_CATE.DEPARTMENT, "");
            return(true);
        }
Beispiel #8
0
        protected void save_close_Click(object sender, EventArgs e)
        {
            sys_department pageQueue = AssembleModel <sys_department>();

            if (!string.IsNullOrEmpty(Request.Form["isActive"]) && Request.Form["isActive"] == "on")
            {
                pageQueue.is_active = 1;
            }
            else
            {
                pageQueue.is_active = 0;
            }
            if (!string.IsNullOrEmpty(Request.Form["isShow"]) && Request.Form["isShow"] == "on")
            {
                pageQueue.is_show = 1;
            }
            else
            {
                pageQueue.is_show = 0;
            }
            pageQueue.cate_id = (int)DTO.DicEnum.DEPARTMENT_CATE.SERVICE_QUEUE;
            if (!isAdd)
            {
                queue.name         = pageQueue.name;
                queue.location_id  = pageQueue.location_id;
                queue.no           = pageQueue.no;
                queue.description  = pageQueue.description;
                queue.is_active    = pageQueue.is_active;
                queue.is_show      = pageQueue.is_show;
                queue.other_email  = pageQueue.other_email;
                queue.other_email2 = pageQueue.other_email2;
                queue.other_email3 = pageQueue.other_email3;
                queue.other_email4 = pageQueue.other_email4;
            }
            var result = false;

            if (isAdd)
            {
                result = depBll.AddQueue(pageQueue, LoginUserId);
            }
            else
            {
                result = depBll.EditQueue(queue, LoginUserId);
            }

            ClientScript.RegisterStartupScript(this.GetType(), "提示信息", $"<script>alert('保存{(result ? "成功" : "失败")}!');window.close();</script>");
        }
Beispiel #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            locationDic = depBll.GetDownList();
            long id = 0;

            if (!string.IsNullOrEmpty(Request.QueryString["id"]))
            {
                if (long.TryParse(Request.QueryString["id"], out id))
                {
                    queue = depBll.GetQueue(id);
                }
            }
            if (queue != null)
            {
                isAdd = false; resDepList = depBll.GetResDepList(queue.id);
            }
        }
Beispiel #10
0
        /// <summary>
        /// 激活/失活 队列
        /// </summary>
        public bool ActiveQueue(long queId, long userId, bool isActive)
        {
            sys_department thisQue = _dal.FindNoDeleteById(queId);

            if (thisQue == null)
            {
                return(false);
            }
            sbyte active = (sbyte)(isActive?1:0);

            if (thisQue.is_active != active)
            {
                thisQue.is_active = active;
                return(EditQueue(thisQue, userId));
            }
            return(true);
        }
 public void SaveDepartment(sys_department dto)
 {
     if (dto.parent_id == 0)
     {
         dto.department_level = 1;
     }
     else
     {
         dto.department_level = Sqldb.Select <sys_department>().Where(s => s.id == dto.parent_id).First(s => s.parent_id) + 1;
     }
     if (dto.id == 0)
     {
         Sqldb.Insert(dto).ExecuteAffrows();
     }
     else
     {
         Sqldb.Update <sys_department>().SetSource(dto).IgnoreColumns(s => new { s.insert_id, s.insert_time })
         .Where(s => s.id == dto.id).ExecuteAffrows();
     }
 }
Beispiel #12
0
        public ERROR_CODE Update(sys_department sd, long user_id)
        {
            var user = UserInfoBLL.GetUserInfo(user_id);

            if (user == null)
            {   // 查询不到用户,用户丢失
                return(ERROR_CODE.USER_NOT_FIND);
            }
            var de  = _dal.FindSignleBySql <sys_department>($"select * from  sys_department where name='{sd.name}' and delete_time=0");
            var old = _dal.FindSignleBySql <sys_department>($"select * from  sys_department where id={sd.id} and delete_time=0");

            if (de != null && de.id != sd.id)
            {
                return(ERROR_CODE.EXIST);
            }
            sd.update_time    = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now);
            sd.update_user_id = user_id;
            sd.cate_id        = (int)DEPARTMENT_CATE.DEPARTMENT;

            var add_account_log = new sys_oper_log()
            {
                user_cate           = "用户",
                user_id             = (int)user.id,
                name                = user.name,
                phone               = user.mobile == null ? "" : user.mobile,
                oper_time           = Tools.Date.DateHelper.ToUniversalTimeStamp(DateTime.Now),
                oper_object_cate_id = (int)OPER_LOG_OBJ_CATE.DEPARTMENT, //部门
                oper_object_id      = sd.id,                             // 操作对象id
                oper_type_id        = (int)OPER_LOG_TYPE.UPDATE,
                oper_description    = _dal.CompareValue(old, sd),
                remark              = "修改部门信息"
            };                                              // 创建日志

            new sys_oper_log_dal().Insert(add_account_log); // 插入日志
            if (!_dal.Update(sd))
            {
                return(ERROR_CODE.ERROR);
            }
            return(ERROR_CODE.SUCCESS);
        }
Beispiel #13
0
 protected void Page_Load(object sender, EventArgs e)
 {
     id = Convert.ToInt32(Request.QueryString["id"]);
     //id = 875;
     if (!IsPostBack)
     {
         DepartmentBLL sqbll = new DepartmentBLL();
         this.location.DataTextField  = "value";
         this.location.DataValueField = "key";
         this.location.DataSource     = sqbll.GetDownList();
         this.location.DataBind();
         this.location.Items.Insert(0, new ListItem()
         {
             Value = "0", Text = "   ", Selected = true
         });
         if (id > 0)
         {//打开修改模式
             sd = sqbll.GetOne(id);
             this.department_name.Text = sd.name;
             if (sd.no != null && !string.IsNullOrEmpty(sd.no.ToString()))
             {
                 this.department_no.Text = sd.no.ToString();
             }
             if (sd.description != null && !string.IsNullOrEmpty(sd.description.ToString()))
             {
                 this.Description.Text = sd.description.ToString();
             }
             if (sd.location_id != null && !string.IsNullOrEmpty(sd.location_id.ToString()))
             {
                 this.location.SelectedValue = sd.location_id.ToString();
                 this.location_name.Text     = this.location.SelectedItem.Text.ToString();
                 //获取时区
                 //this.time_zone.Text =sqbll.GetTime_zone(Convert.ToInt32(sd.location_id.ToString()));
             }
             table     = sqbll.resourcelist(id);
             worktable = sqbll.worklist(id);
         }
     }
 }
Beispiel #14
0
        /// <summary>
        /// 编辑部门
        /// </summary>
        /// <param name="user"></param>
        /// <returns></returns>
        public dynamic EditDepart(sys_department department)
        {
            try
            {
                db.BeginTransaction();
                var sql = String.Format(@"update sys_department
             set DepartmentName=@0 ,Description=@1
             where DepartmentID=@2 ");
                //  int result = (int)db.Insert("sys_role", "role.RoleName,", role.RoleName, role.Description);
                db.Execute(sql, department.DepartmentName, department.Description, department.DepartmentID);

                db.CompleteTransaction();
                return true;

            }
            catch (Exception)
            {

                return false;
            }

            return false;
        }
Beispiel #15
0
        public dynamic AddDepart(sys_department department)
        {
            try
            {
                department.IsEnable = true;
                department.CreateDate = DateTime.Now;
                db.BeginTransaction();
                // var sql = String.Format(@"insert sys_role(RoleName,Description) values (@0,@1)  ");
                //  int result = (int)db.Insert("sys_role", "role.RoleName,", role.RoleName, role.Description);
                var result = (int)db.Insert(department);

                db.CompleteTransaction();
                return true;

            }
            catch (Exception)
            {

                return false;
            }

            return false;
        }