Exemplo n.º 1
0
        public string GetNote()
        {
            string id = Request.QueryString["id"];
            Guid   gid;

            if (id.IsNullOrEmpty())
            {
                return("");
            }
            MyCreek.Platform.Organize borg  = new MyCreek.Platform.Organize();
            MyCreek.Platform.Users    buser = new MyCreek.Platform.Users();
            if (id.StartsWith(MyCreek.Platform.Users.PREFIX))
            {
                Guid uid = buser.RemovePrefix1(id).ToGuid();
                return(string.Concat(borg.GetAllParentNames(buser.GetMainStation(uid)), " / ", buser.GetName(uid)));
            }
            else if (id.StartsWith(MyCreek.Platform.WorkGroup.PREFIX))
            {
                return(new MyCreek.Platform.WorkGroup().GetUsersNames(MyCreek.Platform.WorkGroup.RemovePrefix(id).ToGuid(), '、'));
            }
            else if (id.IsGuid(out gid))
            {
                return(borg.GetAllParentNames(gid));
            }
            return("");
        }
Exemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string id = context.Request.QueryString["id"];
            Guid   gid;

            if (id.IsNullOrEmpty())
            {
                context.Response.Write("");
            }
            MyCreek.Platform.Organize borg  = new MyCreek.Platform.Organize();
            MyCreek.Platform.Users    buser = new MyCreek.Platform.Users();
            if (id.StartsWith(MyCreek.Platform.Users.PREFIX))
            {
                Guid uid = buser.RemovePrefix1(id).ToGuid();
                context.Response.Write(string.Concat(borg.GetAllParentNames(buser.GetMainStation(uid)), " / ", buser.GetName(uid)));
            }
            else if (id.StartsWith(MyCreek.Platform.WorkGroup.PREFIX))
            {
                context.Response.Write(new MyCreek.Platform.WorkGroup().GetUsersNames(MyCreek.Platform.WorkGroup.RemovePrefix(id).ToGuid(), '、'));
            }
            else if (id.IsGuid(out gid))
            {
                context.Response.Write(borg.GetAllParentNames(gid));
            }
            context.Response.Write("");
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                string taskid = Request.QueryString["taskid"];
                Guid   taskID;
                if (taskid.IsGuid(out taskID))
                {
                    string user     = Request.Form["user"];
                    string openerid = Request.QueryString["openerid"];

                    MyCreek.Platform.WorkFlowTask btask = new MyCreek.Platform.WorkFlowTask();
                    var users = new MyCreek.Platform.Organize().GetAllUsers(user);
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    foreach (var user1 in users)
                    {
                        btask.DesignateTask(taskID, user1);
                        MyCreek.Platform.Log.Add("管理员指派了流程任务", "将任务" + taskID + "指派给了:" + user1.Name + user1.ID, MyCreek.Platform.Log.Types.流程相关);

                        sb.Append(user1.Name);
                        sb.Append(",");
                    }
                    string userNames = sb.ToString().TrimEnd(',');
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('已成功指派给:" + userNames + "!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();", true);
                }
            }
        }
Exemplo n.º 4
0
        public ActionResult Designate(FormCollection collection)
        {
            string taskid = Request.QueryString["taskid"];
            Guid   taskID;

            if (taskid.IsGuid(out taskID))
            {
                string user     = Request.Form["user"];
                string openerid = Request.QueryString["openerid"];

                MyCreek.Platform.WorkFlowTask btask = new MyCreek.Platform.WorkFlowTask();
                var users = new MyCreek.Platform.Organize().GetAllUsers(user);
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                foreach (var user1 in users)
                {
                    btask.DesignateTask(taskID, user1);
                    MyCreek.Platform.Log.Add("管理员指派了流程任务", "将任务" + taskID + "指派给了:" + user1.Name + user1.ID, MyCreek.Platform.Log.Types.流程相关);

                    sb.Append(user1.Name);
                    sb.Append(",");
                }
                string userNames = sb.ToString().TrimEnd(',');
                ViewBag.Script = "alert('已成功指派给:" + userNames + "!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();";
            }
            return(View());
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Account.Attributes.Add("validate_url", "CheckAccount.ashx");
            MyCreek.Platform.Organize borganize = new MyCreek.Platform.Organize();
            MyCreek.Platform.Users    busers    = new MyCreek.Platform.Users();

            string id = Request.QueryString["id"];

            string name    = string.Empty;
            string account = string.Empty;
            string status  = string.Empty;
            string note    = string.Empty;
            Guid   parentID;

            if (IsPostBack && id.IsGuid(out parentID))
            {
                name    = Request.Form["Name"];
                account = Request.Form["Account"];
                status  = Request.Form["Status"];
                note    = Request.Form["Note"];

                Guid   userID  = Guid.NewGuid();
                string userXML = string.Empty;
                using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
                {
                    //添加人员
                    MyCreek.Data.Model.Users user = new MyCreek.Data.Model.Users();
                    user.Account  = account.Trim();
                    user.Name     = name.Trim();
                    user.Note     = note.IsNullOrEmpty() ? null : note;
                    user.Password = busers.GetUserEncryptionPassword(userID.ToString(), busers.GetInitPassword());
                    user.Sort     = 1;
                    user.Status   = status.IsInt() ? status.ToInt() : 0;
                    user.ID       = userID;
                    busers.Add(user);

                    //添加关系
                    MyCreek.Data.Model.UsersRelation userRelation = new MyCreek.Data.Model.UsersRelation();
                    userRelation.IsMain     = 1;
                    userRelation.OrganizeID = parentID;
                    userRelation.Sort       = new MyCreek.Platform.UsersRelation().GetMaxSort(parentID);
                    userRelation.UserID     = userID;
                    new MyCreek.Platform.UsersRelation().Add(userRelation);

                    //更新父级[ChildsLength]字段
                    borganize.UpdateChildsLength(parentID);

                    //更新角色
                    new MyCreek.Platform.UsersRole().UpdateByUserID(userID);

                    userXML = user.Serialize();
                    scope.Complete();
                }

                MyCreek.Platform.Log.Add("添加了人员", userXML, MyCreek.Platform.Log.Types.组织机构);
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!');parent.frames[0].reLoad('" + id + "');window.location=window.location;", true);
            }
            this.StatusRadios.Text = borganize.GetStatusRadio("Status", "0", "validate=\"radio\"");
        }
Exemplo n.º 6
0
        public ActionResult UserAdd(FormCollection collection)
        {
            MyCreek.Platform.Organize borganize = new MyCreek.Platform.Organize();
            MyCreek.Platform.Users    busers    = new MyCreek.Platform.Users();

            string id = Request.QueryString["id"];

            string name    = string.Empty;
            string account = string.Empty;
            string status  = string.Empty;
            string note    = string.Empty;
            Guid   parentID;

            if (collection != null && id.IsGuid(out parentID))
            {
                name    = Request.Form["Name"];
                account = Request.Form["Account"];
                status  = Request.Form["Status"];
                note    = Request.Form["Note"];

                Guid   userID  = Guid.NewGuid();
                string userXML = string.Empty;
                using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
                {
                    //添加人员
                    MyCreek.Data.Model.Users user = new MyCreek.Data.Model.Users();
                    user.Account  = account.Trim();
                    user.Name     = name.Trim();
                    user.Note     = note.IsNullOrEmpty() ? null : note;
                    user.Password = busers.GetUserEncryptionPassword(userID.ToString(), busers.GetInitPassword());
                    user.Sort     = 1;
                    user.Status   = status.IsInt() ? status.ToInt() : 0;
                    user.ID       = userID;
                    busers.Add(user);

                    //添加关系
                    MyCreek.Data.Model.UsersRelation userRelation = new MyCreek.Data.Model.UsersRelation();
                    userRelation.IsMain     = 1;
                    userRelation.OrganizeID = parentID;
                    userRelation.Sort       = new MyCreek.Platform.UsersRelation().GetMaxSort(parentID);
                    userRelation.UserID     = userID;
                    new MyCreek.Platform.UsersRelation().Add(userRelation);

                    //更新父级[ChildsLength]字段
                    borganize.UpdateChildsLength(parentID);

                    //更新角色
                    new MyCreek.Platform.UsersRole().UpdateByUserID(userID);

                    userXML = user.Serialize();
                    scope.Complete();
                }

                MyCreek.Platform.Log.Add("添加了人员", userXML, MyCreek.Platform.Log.Types.组织机构);
                ViewBag.Script = "alert('添加成功!');parent.frames[0].reLoad('" + id + "');window.location=window.location;";
            }
            ViewBag.StatusRadios = borganize.GetStatusRadio("Status", "0", "validate=\"radio\"");
            return(View());
        }
Exemplo n.º 7
0
        public ActionResult BodyAdd(FormCollection collection)
        {
            MyCreek.Platform.Organize   borganize = new MyCreek.Platform.Organize();
            MyCreek.Data.Model.Organize org       = null;
            string id     = Request.QueryString["id"];
            string name   = string.Empty;
            string type   = string.Empty;
            string status = string.Empty;
            string note   = string.Empty;

            Guid orgID;

            if (id.IsGuid(out orgID))
            {
                org = borganize.Get(orgID);
            }

            if (collection != null && org != null)
            {
                name   = Request.Form["Name"];
                type   = Request.Form["Type"];
                status = Request.Form["Status"];
                note   = Request.Form["note"];

                MyCreek.Data.Model.Organize org1 = new MyCreek.Data.Model.Organize();
                Guid org1ID = Guid.NewGuid();
                org1.ID       = org1ID;
                org1.Name     = name.Trim();
                org1.Note     = note.IsNullOrEmpty() ? null : note.Trim();
                org1.Number   = org.Number + "," + org1ID.ToString().ToLower();
                org1.ParentID = org.ID;
                org1.Sort     = borganize.GetMaxSort(org.ID);
                org1.Status   = status.IsInt() ? status.ToInt() : 0;
                org1.Type     = type.ToInt();
                org1.Depth    = org.Depth + 1;

                using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
                {
                    borganize.Add(org1);
                    //更新父级[ChildsLength]字段
                    borganize.UpdateChildsLength(org.ID);
                    scope.Complete();
                }

                MyCreek.Platform.Log.Add("添加了组织机构", org1.Serialize(), MyCreek.Platform.Log.Types.组织机构);
                ViewBag.Script = "alert('添加成功!');parent.frames[0].reLoad('" + id + "');window.location=window.location;";
            }
            ViewBag.TypeRadios   = borganize.GetTypeRadio("Type", type, "validate=\"radio\"");
            ViewBag.StatusRadios = borganize.GetStatusRadio("Status", "0", "validate=\"radio\"");
            return(View());
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MyCreek.Platform.Organize   borganize = new MyCreek.Platform.Organize();
            MyCreek.Data.Model.Organize org       = null;
            string id     = Request.QueryString["id"];
            string name   = string.Empty;
            string type   = string.Empty;
            string status = string.Empty;
            string note   = string.Empty;

            Guid orgID;

            if (id.IsGuid(out orgID))
            {
                org = borganize.Get(orgID);
            }

            if (IsPostBack && org != null)
            {
                name   = Request.Form["Name"];
                type   = Request.Form["Type"];
                status = Request.Form["Status"];
                note   = Request.Form["note"];

                MyCreek.Data.Model.Organize org1 = new MyCreek.Data.Model.Organize();
                Guid org1ID = Guid.NewGuid();
                org1.ID       = org1ID;
                org1.Name     = name.Trim();
                org1.Note     = note.IsNullOrEmpty() ? null : note.Trim();
                org1.Number   = org.Number + "," + org1ID.ToString().ToLower();
                org1.ParentID = org.ID;
                org1.Sort     = borganize.GetMaxSort(org.ID);
                org1.Status   = status.IsInt() ? status.ToInt() : 0;
                org1.Type     = type.ToInt();
                org1.Depth    = org.Depth + 1;

                using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
                {
                    borganize.Add(org1);
                    //更新父级[ChildsLength]字段
                    borganize.UpdateChildsLength(org.ID);
                    scope.Complete();
                }

                MyCreek.Platform.Log.Add("添加了组织机构", org1.Serialize(), MyCreek.Platform.Log.Types.组织机构);
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!');parent.frames[0].reLoad('" + id + "');window.location=window.location;", true);
            }

            this.TypeRadios.Text   = borganize.GetTypeRadio("Type", type, "validate=\"radio\"");
            this.StatusRadios.Text = borganize.GetStatusRadio("Status", "0", "validate=\"radio\"");
        }
Exemplo n.º 9
0
        /// <summary>
        /// 得到工作组下的人员名称字符串
        /// </summary>
        /// <param name="members">工作组成员字符串</param>
        /// <param name="split"></param>
        /// <returns></returns>
        public string GetUsersNames(string members, char split = ',')
        {
            if (members.IsNullOrEmpty())
            {
                return("");
            }
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            var users = new MyCreek.Platform.Organize().GetAllUsers(members);

            foreach (var user in users)
            {
                sb.Append(user.Name);
                sb.Append(split);
            }
            return(sb.ToString().TrimEnd(split));
        }
Exemplo n.º 10
0
        public ActionResult AddRole(FormCollection collection)
        {
            string name      = Request.Form["Name"];
            string note      = Request.Form["Note"];
            string useMember = Request.Form["UseMember"];

            MyCreek.Data.Model.Role role = new MyCreek.Data.Model.Role();
            if (collection != null)
            {
                using (System.Transactions.TransactionScope trans = new System.Transactions.TransactionScope())
                {
                    role.ID   = Guid.NewGuid();
                    role.Name = name.Trim();
                    if (!useMember.IsNullOrEmpty())
                    {
                        role.UseMember = useMember;
                        MyCreek.Platform.UsersRole busersRole = new MyCreek.Platform.UsersRole();
                        var users = new MyCreek.Platform.Organize().GetAllUsers(useMember);
                        foreach (var user in users)
                        {
                            MyCreek.Data.Model.UsersRole ur = new MyCreek.Data.Model.UsersRole();
                            ur.IsDefault = true;
                            ur.MemberID  = user.ID;
                            ur.RoleID    = role.ID;
                            busersRole.Add(ur);
                        }
                    }
                    if (!note.IsNullOrEmpty())
                    {
                        role.Note = note.Trim();
                    }
                    new MyCreek.Platform.Role().Add(role);

                    //添加一个根应用
                    MyCreek.Data.Model.RoleApp roleApp = new MyCreek.Data.Model.RoleApp();
                    roleApp.ID       = Guid.NewGuid();
                    roleApp.ParentID = Guid.Empty;
                    roleApp.RoleID   = role.ID;
                    roleApp.Sort     = 1;
                    roleApp.Title    = "管理目录";
                    new MyCreek.Platform.RoleApp().Add(roleApp);
                    trans.Complete();
                    ViewBag.Script = "alert('添加成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();";
                }
            }
            return(View(role));
        }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                string name                  = Request.Form["Name"];
                string note                  = Request.Form["Note"];
                string useMember             = Request.Form["UseMember"];
                MyCreek.Data.Model.Role role = new MyCreek.Data.Model.Role();
                using (System.Transactions.TransactionScope trans = new System.Transactions.TransactionScope())
                {
                    role.ID   = Guid.NewGuid();
                    role.Name = name.Trim();
                    if (!useMember.IsNullOrEmpty())
                    {
                        role.UseMember = useMember;
                        MyCreek.Platform.UsersRole busersRole = new MyCreek.Platform.UsersRole();
                        var users = new MyCreek.Platform.Organize().GetAllUsers(useMember);
                        foreach (var user in users)
                        {
                            MyCreek.Data.Model.UsersRole ur = new MyCreek.Data.Model.UsersRole();
                            ur.IsDefault = true;
                            ur.MemberID  = user.ID;
                            ur.RoleID    = role.ID;
                            busersRole.Add(ur);
                        }
                    }
                    if (!note.IsNullOrEmpty())
                    {
                        role.Note = note.Trim();
                    }
                    new MyCreek.Platform.Role().Add(role);

                    //添加一个根应用
                    MyCreek.Data.Model.RoleApp roleApp = new MyCreek.Data.Model.RoleApp();
                    roleApp.ID       = Guid.NewGuid();
                    roleApp.ParentID = Guid.Empty;
                    roleApp.RoleID   = role.ID;
                    roleApp.Sort     = 1;
                    roleApp.Title    = "管理目录";
                    new MyCreek.Platform.RoleApp().Add(roleApp);
                    trans.Complete();
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();", true);
                }
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// 得到一个用户所在部门
        /// </summary>
        /// <param name="userID"></param>
        /// <returns></returns>
        public MyCreek.Data.Model.Organize GetDeptByUserID(Guid userID)
        {
            Guid stationID = GetMainStation(userID);

            if (stationID == Guid.Empty)
            {
                return(null);
            }
            var parents = new MyCreek.Platform.Organize().GetAllParent(stationID);

            parents.Reverse();
            foreach (var parent in parents)
            {
                if (parent.Type == 2 || parent.Type == 1)
                {
                    return(parent);
                }
            }
            return(null);
        }
Exemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string parentid = Request.QueryString["parentid"];

            if (IsPostBack)
            {
                string   sort      = Request.Form["sort"] ?? "";
                string[] sortArray = sort.Split(',');
                MyCreek.Platform.Organize borganize = new MyCreek.Platform.Organize();
                for (int i = 0; i < sortArray.Length; i++)
                {
                    Guid gid;
                    if (!sortArray[i].IsGuid(out gid))
                    {
                        continue;
                    }
                    borganize.UpdateSort(gid, i + 1);
                }
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "parent.frames[0].reLoad('" + parentid + "');", true);
            }
            Orgs = new MyCreek.Platform.Organize().GetChilds(parentid.ToGuid());
        }
        public ActionResult Index(FormCollection collection)
        {
            MyCreek.Platform.WorkFlowComment bworkFlowComment = new MyCreek.Platform.WorkFlowComment();
            MyCreek.Platform.Organize        borganize        = new MyCreek.Platform.Organize();
            IEnumerable <MyCreek.Data.Model.WorkFlowComment> workFlowCommentList;

            if (collection != null)
            {
                if (!Request.Form["DeleteBut"].IsNullOrEmpty())
                {
                    string ids = Request.Form["checkbox_app"];
                    foreach (string id in ids.Split(','))
                    {
                        Guid bid;
                        if (!id.IsGuid(out bid))
                        {
                            continue;
                        }
                        var comment = bworkFlowComment.Get(bid);
                        if (comment != null)
                        {
                            bworkFlowComment.Delete(bid);
                            MyCreek.Platform.Log.Add("删除了流程意见", comment.Serialize(), MyCreek.Platform.Log.Types.流程相关);
                        }
                    }
                    bworkFlowComment.RefreshCache();
                }
            }

            workFlowCommentList = bworkFlowComment.GetAll();

            bool isOneSelf = "1" == Request.QueryString["isoneself"];

            if (isOneSelf)
            {
                workFlowCommentList = workFlowCommentList.Where(p => p.MemberID == MyCreek.Platform.Users.PREFIX + MyCreek.Platform.Users.CurrentUserID.ToString());
            }
            return(View(workFlowCommentList));
        }
Exemplo n.º 15
0
        public ActionResult SortUsers(FormCollection collection)
        {
            string parentID = Request.QueryString["parentid"];

            if (collection != null)
            {
                string   sort                 = Request.Form["sort"] ?? "";
                string[] sortArray            = sort.Split(',');
                MyCreek.Platform.Users busers = new MyCreek.Platform.Users();
                for (int i = 0; i < sortArray.Length; i++)
                {
                    Guid gid;
                    if (!sortArray[i].IsGuid(out gid))
                    {
                        continue;
                    }
                    busers.UpdateSort(gid, i + 1);
                }
                ViewBag.Script = "parent.frames[0].reLoad('" + parentID + "');";
            }
            var users = new MyCreek.Platform.Organize().GetAllUsers(parentID.ToGuid());

            return(View(users));
        }
Exemplo n.º 16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MyCreek.Platform.WorkFlowComment bworkFlowComment = new MyCreek.Platform.WorkFlowComment();
            MyCreek.Platform.Organize        borganize        = new MyCreek.Platform.Organize();
            query1 = string.Format("&appid={0}&tabid={1}&isoneself={2}", Request.QueryString["appid"], Request.QueryString["tabid"], Request.QueryString["isoneself"]);
            if (IsPostBack)
            {
                if (!Request.Form["DeleteBut"].IsNullOrEmpty())
                {
                    string ids = Request.Form["checkbox_app"];
                    foreach (string id in ids.Split(','))
                    {
                        Guid bid;
                        if (!id.IsGuid(out bid))
                        {
                            continue;
                        }
                        var comment = bworkFlowComment.Get(bid);
                        if (comment != null)
                        {
                            bworkFlowComment.Delete(bid);
                            MyCreek.Platform.Log.Add("删除了流程意见", comment.Serialize(), MyCreek.Platform.Log.Types.流程相关);
                        }
                    }
                    bworkFlowComment.RefreshCache();
                }
            }

            workFlowCommentList = bworkFlowComment.GetAll();

            isOneSelf = "1" == Request.QueryString["isoneself"];
            if (isOneSelf)
            {
                workFlowCommentList = workFlowCommentList.Where(p => p.MemberID == MyCreek.Platform.Users.PREFIX + MyCreek.Platform.Users.CurrentUserID.ToString());
            }
        }
Exemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            isoneself = "1" == Request.QueryString["isoneself"];
            if (isoneself)
            {
                this.S_UserID.Disabled = true;
                this.S_UserID.Value    = MyCreek.Platform.Users.PREFIX + MyCreek.Platform.Users.CurrentUserID.ToString();
            }
            MyCreek.Platform.WorkFlowDelegation bworkFlowDelegation = new MyCreek.Platform.WorkFlowDelegation();
            MyCreek.Platform.Organize           borganize           = new MyCreek.Platform.Organize();
            MyCreek.Platform.Users    busers    = new MyCreek.Platform.Users();
            MyCreek.Platform.WorkFlow bworkFlow = new MyCreek.Platform.WorkFlow();

            string startTime = string.Empty;
            string endTime   = string.Empty;
            string suserid   = string.Empty;
            string Query1    = string.Format("&appid={0}&tabid={1}&isoneself={2}", Request.QueryString["appid"],
                                             Request.QueryString["tabid"], Request.QueryString["isoneself"]);

            if (IsPostBack)
            {
                if (!Request.Form["DeleteBut"].IsNullOrEmpty())
                {
                    string ids = Request.Form["checkbox_app"];
                    foreach (string id in ids.Split(','))
                    {
                        Guid bid;
                        if (!id.IsGuid(out bid))
                        {
                            continue;
                        }
                        var comment = bworkFlowDelegation.Get(bid);
                        if (comment != null)
                        {
                            bworkFlowDelegation.Delete(bid);
                            MyCreek.Platform.Log.Add("删除了流程意见", comment.Serialize(), MyCreek.Platform.Log.Types.流程相关);
                        }
                    }
                    bworkFlowDelegation.RefreshCache();
                }
                startTime = Request.Form["S_StartTime"];
                endTime   = Request.Form["S_EndTime"];
                suserid   = Request.Form["S_UserID"];
            }
            else
            {
                startTime = Request.QueryString["S_StartTime"];
                endTime   = Request.QueryString["S_EndTime"];
                suserid   = Request.QueryString["S_UserID"];
            }
            Query1 += "&S_StartTime=" + startTime + "&S_EndTime=" + endTime + "&S_UserID=" + suserid;
            string pager;
            bool   isOneSelf = "1" == Request.QueryString["isoneself"];

            if (isOneSelf)
            {
                workFlowDelegationList = bworkFlowDelegation.GetPagerData(out pager, Query1, MyCreek.Platform.Users.CurrentUserID.ToString(), startTime, endTime);
            }
            else
            {
                workFlowDelegationList = bworkFlowDelegation.GetPagerData(out pager, Query1, MyCreek.Platform.Users.RemovePrefix(suserid), startTime, endTime);
            }
            this.Pager.Text = pager;
        }
Exemplo n.º 18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MyCreek.Platform.Organize      borganize     = new MyCreek.Platform.Organize();
            MyCreek.Platform.Users         busers        = new MyCreek.Platform.Users();
            MyCreek.Platform.UsersRelation buserRelation = new MyCreek.Platform.UsersRelation();
            MyCreek.Data.Model.Users       user          = null;
            MyCreek.Data.Model.Organize    organize      = null;
            string id       = Request.QueryString["id"];
            string parentID = Request.QueryString["parentid"];

            string parentString = string.Empty;

            this.Account.Attributes.Add("validate_url", "CheckAccount.ashx?id=" + id);
            Guid userID, organizeID;

            if (id.IsGuid(out userID))
            {
                user = busers.Get(userID);
                if (user != null)
                {
                    //所在组织字符串
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    var userRelations            = buserRelation.GetAllByUserID(user.ID).OrderByDescending(p => p.IsMain);
                    foreach (var userRelation in userRelations)
                    {
                        sb.Append("<div style='margin:3px 0;'>");
                        sb.Append(borganize.GetAllParentNames(userRelation.OrganizeID, true));
                        if (userRelation.IsMain == 0)
                        {
                            sb.Append("<span style='color:#999'> [兼职]</span>");
                        }
                        sb.Append("</div>");
                    }
                    this.ParentString.Text = sb.ToString();
                    var roles = new MyCreek.Platform.UsersRole().GetByUserIDFromCache(userID);
                    MyCreek.Platform.Role     brole  = new MyCreek.Platform.Role();
                    System.Text.StringBuilder rolesb = new System.Text.StringBuilder();
                    foreach (var role in roles)
                    {
                        var role1 = brole.Get(role.RoleID);
                        if (role1 == null)
                        {
                            continue;
                        }
                        rolesb.Append(role1.Name);
                        rolesb.Append(",");
                    }
                    this.RoleString.Text = rolesb.ToString().TrimEnd(',');
                }
            }
            if (parentID.IsGuid(out organizeID))
            {
                organize = borganize.Get(organizeID);
            }

            if (IsPostBack)
            {
                #region 保存
                if (!Request.Form["Save"].IsNullOrEmpty() && user != null)
                {
                    string name    = Request.Form["Name"];
                    string account = Request.Form["Account"];
                    string status  = Request.Form["Status"];
                    string note    = Request.Form["Note"];

                    string oldXML = user.Serialize();

                    user.Name    = name.Trim();
                    user.Account = account.Trim();
                    user.Status  = status.ToInt(1);
                    user.Note    = note.IsNullOrEmpty() ? null : note.Trim();

                    busers.Update(user);
                    MyCreek.Platform.Log.Add("修改了用户", "", MyCreek.Platform.Log.Types.组织机构, oldXML, user.Serialize());
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('保存成功!');parent.frames[0].reLoad('" + parentID + "');", true);
                }
                #endregion

                #region  除用户
                if (!Request.Form["DeleteBut"].IsNullOrEmpty() && user != null && organize != null)
                {
                    using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
                    {
                        var urs = buserRelation.GetAllByUserID(user.ID);
                        busers.Delete(user.ID);

                        buserRelation.DeleteByUserID(user.ID);

                        new MyCreek.Platform.UsersInfo().Delete(user.ID);
                        new MyCreek.Platform.UsersRole().DeleteByUserID(user.ID);

                        //更新父级[ChildsLength]字段
                        foreach (var ur in urs)
                        {
                            borganize.UpdateChildsLength(ur.OrganizeID);
                        }

                        scope.Complete();
                    }

                    string refreshID = parentID;
                    string url       = string.Empty;
                    var    users     = borganize.GetAllUsers(refreshID.ToGuid());
                    if (users.Count > 0)
                    {
                        url = "User.aspx?id=" + users.Last().ID + "&appid=" + Request.QueryString["appid"] + "&tabid=" + Request.QueryString["tabid"] + "&parentid=" + parentID;
                    }
                    else
                    {
                        refreshID = organize.ParentID == Guid.Empty ? organize.ID.ToString() : organize.ParentID.ToString();
                        url       = "Body.aspx?id=" + parentID + "&appid=" + Request.QueryString["appid"] + "&tabid=" + Request.QueryString["tabid"] + "&parentid=" + organize.ParentID;
                    }
                    MyCreek.Platform.Log.Add("删除了用户", user.Serialize(), MyCreek.Platform.Log.Types.组织机构);
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('删除成功');parent.frames[0].reLoad('" + refreshID + "');window.location='" + url + "'", true);
                    new MyCreek.Platform.AppLibrary().ClearUseMemberCache();
                }
                #endregion

                #region 初始化密码
                if (!Request.Form["InitPass"].IsNullOrEmpty() && user != null)
                {
                    string initpass = busers.GetInitPassword();
                    busers.InitPassword(user.ID);
                    MyCreek.Platform.Log.Add("初始化了用户密码", user.Serialize(), MyCreek.Platform.Log.Types.组织机构);
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('密码已初始化为:" + initpass + "');", true);
                }
                #endregion

                #region 调动
                if (!Request.Form["Move1"].IsNullOrEmpty() && user != null)
                {
                    string moveto          = Request.Form["movetostation"];
                    string movetostationjz = Request.Form["movetostationjz"];
                    Guid   moveToID;
                    if (moveto.IsGuid(out moveToID))
                    {
                        using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
                        {
                            var us = buserRelation.GetAllByUserID(user.ID);
                            if ("1" != movetostationjz)
                            {
                                buserRelation.DeleteByUserID(user.ID);
                            }

                            MyCreek.Data.Model.UsersRelation ur = new MyCreek.Data.Model.UsersRelation();
                            ur.UserID     = user.ID;
                            ur.OrganizeID = moveToID;
                            ur.IsMain     = "1" == movetostationjz ? 0 : 1;
                            ur.Sort       = buserRelation.GetMaxSort(moveToID);
                            buserRelation.Add(ur);

                            foreach (var u in us)
                            {
                                borganize.UpdateChildsLength(u.OrganizeID);
                            }

                            borganize.UpdateChildsLength(organizeID);
                            borganize.UpdateChildsLength(moveToID);

                            scope.Complete();
                            Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('调动成功!');parent.frames[0].reLoad('" + parentID + "');parent.frames[0].reLoad('" + moveto + "')", true);
                        }

                        MyCreek.Platform.Log.Add(("1" == movetostationjz ? "兼职" : "全职") + "调动了人员的岗位", "将人员调往岗位(" + moveto + ")", MyCreek.Platform.Log.Types.组织机构);
                        new MyCreek.Platform.AppLibrary().ClearUseMemberCache();
                    }
                }
                #endregion
            }
            if (user != null)
            {
                this.Name.Value    = user.Name;
                this.Account.Value = user.Account;
                this.Note.Value    = user.Note;
            }
            this.StatusRadios.Text = borganize.GetStatusRadio("Status", user != null ? user.Status.ToString() : "", "validate=\"radio\"");
        }
Exemplo n.º 19
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string rootid   = context.Request.QueryString["rootid"];
            string showtype = context.Request.QueryString["showtype"];

            MyCreek.Platform.Organize BOrganize = new MyCreek.Platform.Organize();
            System.Text.StringBuilder json      = new System.Text.StringBuilder("[", 1000);

            if ("1" == showtype)//显示工作组
            {
                MyCreek.Platform.WorkGroup BWorkGroup = new MyCreek.Platform.WorkGroup();
                var workGroups = BWorkGroup.GetAll();

                json.Append("{");
                json.AppendFormat("\"id\":\"{0}\",", Guid.Empty);
                json.AppendFormat("\"parentID\":\"{0}\",", Guid.Empty);
                json.AppendFormat("\"title\":\"{0}\",", "工作组");
                json.AppendFormat("\"ico\":\"{0}\",", Common.Tools.BaseUrl + "/images/ico/group.gif");
                json.AppendFormat("\"link\":\"{0}\",", "");
                json.AppendFormat("\"type\":\"{0}\",", 5);
                json.AppendFormat("\"hasChilds\":\"{0}\",", workGroups.Count);
                json.Append("\"childs\":[");

                int countwg = workGroups.Count;
                int iwg     = 0;
                foreach (var wg in workGroups)
                {
                    json.Append("{");
                    json.AppendFormat("\"id\":\"{0}\",", wg.ID);
                    json.AppendFormat("\"parentID\":\"{0}\",", Guid.Empty);
                    json.AppendFormat("\"title\":\"{0}\",", wg.Name);
                    json.AppendFormat("\"ico\":\"{0}\",", "");
                    json.AppendFormat("\"link\":\"{0}\",", "");
                    json.AppendFormat("\"type\":\"{0}\",", 5);
                    json.AppendFormat("\"hasChilds\":\"{0}\",", 0);
                    json.Append("\"childs\":[");
                    json.Append("]");
                    json.Append("}");
                    if (iwg++ < countwg - 1)
                    {
                        json.Append(",");
                    }
                }

                json.Append("]");
                json.Append("}");
                json.Append("]");
                context.Response.Write(json.ToString());
                context.Response.End();
            }


            Guid rootID;

            MyCreek.Data.Model.Organize root;
            if (rootid.IsGuid(out rootID))
            {
                root = BOrganize.Get(rootID);
            }
            else
            {
                root = BOrganize.GetRoot();
            }

            List <MyCreek.Data.Model.Users> users = new List <MyCreek.Data.Model.Users>();

            MyCreek.Platform.Users busers = new MyCreek.Platform.Users();
            users = busers.GetAllByOrganizeID(root.ID);

            json.Append("{");
            json.AppendFormat("\"id\":\"{0}\",", root.ID);
            json.AppendFormat("\"parentID\":\"{0}\",", root.ParentID);
            json.AppendFormat("\"title\":\"{0}\",", root.Name);
            json.AppendFormat("\"ico\":\"{0}\",", Common.Tools.BaseUrl + "/images/ico/icon_site.gif");
            json.AppendFormat("\"link\":\"{0}\",", "");
            json.AppendFormat("\"type\":\"{0}\",", root.Type);
            json.AppendFormat("\"hasChilds\":\"{0}\",", root.ChildsLength == 0 && users.Count == 0 ? "0" : "1");
            json.Append("\"childs\":[");

            var orgs  = BOrganize.GetChilds(root.ID);
            int count = orgs.Count;

            int i = 0;

            foreach (var org in orgs)
            {
                json.Append("{");
                json.AppendFormat("\"id\":\"{0}\",", org.ID);
                json.AppendFormat("\"parentID\":\"{0}\",", org.ParentID);
                json.AppendFormat("\"title\":\"{0}\",", org.Name);
                json.AppendFormat("\"ico\":\"{0}\",", "");
                json.AppendFormat("\"link\":\"{0}\",", "");
                json.AppendFormat("\"type\":\"{0}\",", org.Type);
                json.AppendFormat("\"hasChilds\":\"{0}\",", org.ChildsLength);
                json.Append("\"childs\":[");
                json.Append("]");
                json.Append("}");
                if (i++ < count - 1 || users.Count > 0)
                {
                    json.Append(",");
                }
            }

            if (users.Count > 0)
            {
                var userRelations = new MyCreek.Platform.UsersRelation().GetAllByOrganizeID(root.ID);
                int count1        = users.Count;
                int j             = 0;
                foreach (var user in users)
                {
                    var ur = userRelations.Find(p => p.UserID == user.ID);
                    json.Append("{");
                    json.AppendFormat("\"id\":\"{0}\",", user.ID);
                    json.AppendFormat("\"parentID\":\"{0}\",", root.ID);
                    json.AppendFormat("\"title\":\"{0}{1}\",", user.Name, ur != null && ur.IsMain == 0 ? "<span style='color:#999;'>[兼职]</span>" : "");
                    json.AppendFormat("\"ico\":\"{0}\",", "");
                    json.AppendFormat("\"link\":\"{0}\",", "");
                    json.AppendFormat("\"type\":\"{0}\",", "4");
                    json.AppendFormat("\"hasChilds\":\"{0}\",", "0");
                    json.Append("\"childs\":[");
                    json.Append("]");
                    json.Append("}");
                    if (j++ < count1 - 1)
                    {
                        json.Append(",");
                    }
                }
            }


            json.Append("]");
            json.Append("}");
            json.Append("]");

            context.Response.Write(json.ToString());
        }
Exemplo n.º 20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MyCreek.Data.Model.Organize org       = null;
            MyCreek.Platform.Organize   borganize = new MyCreek.Platform.Organize();
            string id = Request.QueryString["id"];

            if (id.IsGuid())
            {
                org = borganize.Get(id.ToGuid());
            }

            if (IsPostBack)
            {
                //保存
                if (!Request.Form["Save"].IsNullOrEmpty() && org != null)
                {
                    string name         = Request.Form["Name"];
                    string type         = Request.Form["Type"];
                    string status       = Request.Form["Status"];
                    string chargeLeader = Request.Form["ChargeLeader"];
                    string leader       = Request.Form["Leader"];
                    string note         = Request.Form["note"];
                    string oldXML       = org.Serialize();
                    org.Name         = name.Trim();
                    org.Type         = type.ToInt(1);
                    org.Status       = status.ToInt(0);
                    org.ChargeLeader = chargeLeader;
                    org.Leader       = leader;
                    org.Note         = note.IsNullOrEmpty() ? null : note.Trim();

                    borganize.Update(org);
                    MyCreek.Platform.Log.Add("修改了组织机构", "", MyCreek.Platform.Log.Types.组织机构, oldXML, org.Serialize());
                    string rid = org.ParentID == Guid.Empty ? org.ID.ToString() : org.ParentID.ToString();
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('保存成功!');parent.frames[0].reLoad('" + rid + "');", true);
                }

                //移动
                if (!Request.Form["Move1"].IsNullOrEmpty() && org != null)
                {
                    string toOrgID = Request.Form["deptmove"];
                    Guid   toID;
                    if (toOrgID.IsGuid(out toID) && borganize.Move(org.ID, toID))
                    {
                        MyCreek.Platform.Log.Add("移动了组织机构", "将机构:" + org.ID + "移动到了:" + toID, MyCreek.Platform.Log.Types.组织机构);
                        string refreshID = org.ParentID == Guid.Empty ? org.ID.ToString() : org.ParentID.ToString();
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('移动成功!');parent.frames[0].reLoad('" + refreshID + "');parent.frames[0].reLoad('" + toOrgID + "')", true);
                    }
                    else
                    {
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('移动失败!');", true);
                    }
                }

                //删除
                if (!Request.Form["Delete"].IsNullOrEmpty())
                {
                    int i = borganize.DeleteAndAllChilds(org.ID);
                    MyCreek.Platform.Log.Add("删除了组织机构及其所有下级共" + i.ToString() + "项", org.Serialize(), MyCreek.Platform.Log.Types.组织机构);
                    string refreshID = org.ParentID == Guid.Empty ? org.ID.ToString() : org.ParentID.ToString();
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('共删除了" + i.ToString() + "项!');parent.frames[0].reLoad('" + refreshID + "');", true);
                }
            }



            if (org != null)
            {
                this.Name.Value         = org.Name;
                this.TypeRadios.Text    = borganize.GetTypeRadio("Type", org.Type.ToString(), "validate=\"radio\"");
                this.StatusRadios.Text  = borganize.GetStatusRadio("Status", org.Status.ToString(), "validate=\"radio\"");
                this.ChargeLeader.Value = org.ChargeLeader;
                this.Leader.Value       = org.Leader;
                this.Note.Value         = org.Note;
            }
            else
            {
                this.TypeRadios.Text   = borganize.GetTypeRadio("Type", "", "validate=\"radio\"");
                this.StatusRadios.Text = borganize.GetStatusRadio("Status", "", "validate=\"radio\"");
            }
        }
        public ActionResult Index(FormCollection collection)
        {
            MyCreek.Platform.WorkFlowDelegation bworkFlowDelegation = new MyCreek.Platform.WorkFlowDelegation();
            MyCreek.Platform.Organize           borganize           = new MyCreek.Platform.Organize();
            MyCreek.Platform.Users    busers    = new MyCreek.Platform.Users();
            MyCreek.Platform.WorkFlow bworkFlow = new MyCreek.Platform.WorkFlow();
            IEnumerable <MyCreek.Data.Model.WorkFlowDelegation> workFlowDelegationList;

            string startTime = string.Empty;
            string endTime   = string.Empty;
            string suserid   = string.Empty;
            string query1    = string.Format("&appid={0}&tabid={1}&isoneself={2}", Request.QueryString["appid"], Request.QueryString["tabid"], Request.QueryString["isoneself"]);

            if (collection != null)
            {
                if (!Request.Form["DeleteBut"].IsNullOrEmpty())
                {
                    string ids = Request.Form["checkbox_app"];
                    foreach (string id in ids.Split(','))
                    {
                        Guid bid;
                        if (!id.IsGuid(out bid))
                        {
                            continue;
                        }
                        var comment = bworkFlowDelegation.Get(bid);
                        if (comment != null)
                        {
                            bworkFlowDelegation.Delete(bid);
                            MyCreek.Platform.Log.Add("删除了流程意见", comment.Serialize(), MyCreek.Platform.Log.Types.流程相关);
                        }
                    }
                    bworkFlowDelegation.RefreshCache();
                }
                startTime = Request.Form["S_StartTime"];
                endTime   = Request.Form["S_EndTime"];
                suserid   = Request.Form["S_UserID"];
            }
            else
            {
                startTime = Request.QueryString["S_StartTime"];
                endTime   = Request.QueryString["S_EndTime"];
                suserid   = Request.QueryString["S_UserID"];
            }
            query1 += "&S_StartTime=" + startTime + "&S_EndTime=" + endTime + "&S_UserID=" + suserid;
            string pager;
            bool   isOneSelf = "1" == Request.QueryString["isoneself"];

            if (isOneSelf)
            {
                workFlowDelegationList = bworkFlowDelegation.GetPagerData(out pager, query1, MyCreek.Platform.Users.CurrentUserID.ToString(), startTime, endTime);
            }
            else
            {
                workFlowDelegationList = bworkFlowDelegation.GetPagerData(out pager, query1, MyCreek.Platform.Users.RemovePrefix(suserid), startTime, endTime);
            }
            ViewBag.Query1    = query1;
            ViewBag.startTime = startTime;
            ViewBag.endTime   = endTime;
            ViewBag.suserid   = suserid;
            return(View(workFlowDelegationList));
        }
Exemplo n.º 22
0
        public string TreeRefresh()
        {
            string id       = Request.QueryString["refreshid"];
            string showtype = Request.QueryString["showtype"];

            System.Text.StringBuilder json = new System.Text.StringBuilder("[", 1000);

            if ("1" == showtype)//显示工作组
            {
                MyCreek.Platform.WorkGroup BWorkGroup = new MyCreek.Platform.WorkGroup();
                var workGroups = BWorkGroup.GetAll();

                int countwg = workGroups.Count;
                int iwg     = 0;
                foreach (var wg in workGroups)
                {
                    json.Append("{");
                    json.AppendFormat("\"id\":\"{0}\",", wg.ID);
                    json.AppendFormat("\"parentID\":\"{0}\",", Guid.Empty);
                    json.AppendFormat("\"title\":\"{0}\",", wg.Name);
                    json.AppendFormat("\"ico\":\"{0}\",", "");
                    json.AppendFormat("\"link\":\"{0}\",", "");
                    json.AppendFormat("\"type\":\"{0}\",", 5);
                    json.AppendFormat("\"hasChilds\":\"{0}\",", 0);
                    json.Append("\"childs\":[");
                    json.Append("]");
                    json.Append("}");
                    if (iwg++ < countwg - 1)
                    {
                        json.Append(",");
                    }
                }

                json.Append("]");
                json.Append("}");
                Response.Write(json.ToString());
                Response.End();
            }


            Guid orgID;

            if (!id.IsGuid(out orgID))
            {
                json.Append("]");
                Response.Write(json.ToString());
            }

            MyCreek.Platform.Organize BOrganize = new MyCreek.Platform.Organize();
            var childOrgs = BOrganize.GetChilds(orgID);

            int count = childOrgs.Count;
            int i     = 0;

            foreach (var org in childOrgs)
            {
                json.Append("{");
                json.AppendFormat("\"id\":\"{0}\",", org.ID);
                json.AppendFormat("\"parentID\":\"{0}\",", id);
                json.AppendFormat("\"title\":\"{0}\",", org.Name);
                json.AppendFormat("\"ico\":\"{0}\",", "");
                json.AppendFormat("\"link\":\"{0}\",", "");
                json.AppendFormat("\"type\":\"{0}\",", org.Type);
                json.AppendFormat("\"hasChilds\":\"{0}\",", org.ChildsLength);
                json.Append("\"childs\":[");
                json.Append("]");
                json.Append("}");
                if (i++ < count - 1)
                {
                    json.Append(",");
                }
            }

            var userRelations = new MyCreek.Platform.UsersRelation().GetAllByOrganizeID(orgID);
            var users         = new MyCreek.Platform.Users().GetAllByOrganizeID(orgID);
            int count1        = users.Count;

            if (count1 > 0 && count > 0)
            {
                json.Append(",");
            }
            int j = 0;

            foreach (var user in users)
            {
                var ur = userRelations.Find(p => p.UserID == user.ID);
                json.Append("{");
                json.AppendFormat("\"id\":\"{0}\",", user.ID);
                json.AppendFormat("\"parentID\":\"{0}\",", id);
                json.AppendFormat("\"title\":\"{0}{1}\",", user.Name, ur != null && ur.IsMain == 0 ? "<span style='color:#999;'>[兼职]</span>" : "");
                json.AppendFormat("\"ico\":\"{0}\",", Url.Content("~/images/ico/contact_grey.png"));
                json.AppendFormat("\"link\":\"{0}\",", "");
                json.AppendFormat("\"type\":\"{0}\",", "4");
                json.AppendFormat("\"hasChilds\":\"{0}\",", "0");
                json.Append("\"childs\":[");
                json.Append("]");
                json.Append("}");
                if (j++ < count1 - 1)
                {
                    json.Append(",");
                }
            }
            json.Append("]");
            return(json.ToString());
        }
Exemplo n.º 23
0
        public ActionResult Body(FormCollection collection)
        {
            MyCreek.Data.Model.Organize org       = null;
            MyCreek.Platform.Organize   borganize = new MyCreek.Platform.Organize();
            string id = Request.QueryString["id"];

            if (id.IsGuid())
            {
                org = borganize.Get(id.ToGuid());
            }

            //保存
            if (!Request.Form["Save"].IsNullOrEmpty() && org != null)
            {
                string name         = Request.Form["Name"];
                string type         = Request.Form["Type"];
                string status       = Request.Form["Status"];
                string chargeLeader = Request.Form["ChargeLeader"];
                string leader       = Request.Form["Leader"];
                string note         = Request.Form["note"];
                string oldXML       = org.Serialize();
                org.Name         = name.Trim();
                org.Type         = type.ToInt(1);
                org.Status       = status.ToInt(0);
                org.ChargeLeader = chargeLeader;
                org.Leader       = leader;
                org.Note         = note.IsNullOrEmpty() ? null : note.Trim();

                borganize.Update(org);
                MyCreek.Platform.Log.Add("修改了组织机构", "", MyCreek.Platform.Log.Types.组织机构, oldXML, org.Serialize());
                string rid = org.ParentID == Guid.Empty ? org.ID.ToString() : org.ParentID.ToString();
                ViewBag.Script = "alert('保存成功!');parent.frames[0].reLoad('" + rid + "');";
            }

            //移动
            if (!Request.Form["Move1"].IsNullOrEmpty() && org != null)
            {
                string toOrgID = Request.Form["deptmove"];
                Guid   toID;
                if (toOrgID.IsGuid(out toID) && borganize.Move(org.ID, toID))
                {
                    MyCreek.Platform.Log.Add("移动了组织机构", "将机构:" + org.ID + "移动到了:" + toID, MyCreek.Platform.Log.Types.组织机构);
                    string refreshID = org.ParentID == Guid.Empty ? org.ID.ToString() : org.ParentID.ToString();
                    ViewBag.Script = "alert('移动成功!');parent.frames[0].reLoad('" + refreshID + "');parent.frames[0].reLoad('" + toOrgID + "')";
                }
                else
                {
                    ViewBag.Script = "alert('移动失败!');";
                }
            }

            //删除
            if (!Request.Form["Delete"].IsNullOrEmpty())
            {
                int i = borganize.DeleteAndAllChilds(org.ID);
                MyCreek.Platform.Log.Add("删除了组织机构及其所有下级共" + i.ToString() + "项", org.Serialize(), MyCreek.Platform.Log.Types.组织机构);
                string refreshID = org.ParentID == Guid.Empty ? org.ID.ToString() : org.ParentID.ToString();
                ViewBag.Script = "alert('共删除了" + i.ToString() + "项!');parent.frames[0].reLoad('" + refreshID + "');";
            }

            if (org == null)
            {
                org = new MyCreek.Data.Model.Organize();
            }
            ViewBag.TypeRadios   = borganize.GetTypeRadio("Type", org.Type.ToString(), "validate=\"radio\"");
            ViewBag.StatusRadios = borganize.GetStatusRadio("Status", org.Status.ToString(), "validate=\"radio\"");

            return(View(org));
        }
Exemplo n.º 24
0
        public ActionResult EditRole(FormCollection collection)
        {
            MyCreek.Platform.Role   brole = new MyCreek.Platform.Role();
            MyCreek.Data.Model.Role role  = null;
            string roleID = Request.QueryString["roleid"];
            Guid   roleGID;
            string name      = string.Empty;
            string useMember = string.Empty;
            string note      = string.Empty;

            if (roleID.IsGuid(out roleGID))
            {
                role = brole.Get(roleGID);
            }

            if (!Request.Form["Copy"].IsNullOrEmpty())
            {
                string tpl = Request.Form["ToTpl"];
                if (tpl.IsGuid())
                {
                    new MyCreek.Platform.RoleApp().CopyRoleApp(roleGID, tpl.ToGuid());
                    MyCreek.Platform.Log.Add("复制了模板应用", "源:" + roleID + "复制给:" + tpl, MyCreek.Platform.Log.Types.角色应用);
                    ViewBag.Script = "alert('复制成功!');";
                }
            }

            if (!Request.Form["Save"].IsNullOrEmpty() && role != null)
            {
                MyCreek.Platform.UsersRole busersRole = new MyCreek.Platform.UsersRole();
                using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
                {
                    name      = Request.Form["Name"];
                    useMember = Request.Form["UseMember"];
                    note      = Request.Form["Note"];

                    role.Name      = name.Trim();
                    role.Note      = note.IsNullOrEmpty() ? null : note.Trim();
                    role.UseMember = useMember.IsNullOrEmpty() ? null : useMember;
                    brole.Update(role);
                    busersRole.DeleteByRoleID(role.ID);
                    if (!useMember.IsNullOrEmpty())
                    {
                        busersRole.DeleteByRoleID(role.ID);
                        var users = new MyCreek.Platform.Organize().GetAllUsers(useMember);
                        foreach (var user in users)
                        {
                            MyCreek.Data.Model.UsersRole ur = new MyCreek.Data.Model.UsersRole();
                            ur.IsDefault = true;
                            ur.MemberID  = user.ID;
                            ur.RoleID    = role.ID;
                            busersRole.Add(ur);
                        }
                    }
                    scope.Complete();
                }
                ViewBag.Script = "alert('保存成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();";
            }

            if (!Request.Form["Delete"].IsNullOrEmpty())
            {
                using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
                {
                    brole.Delete(roleGID);
                    new MyCreek.Platform.RoleApp().DeleteByRoleID(roleGID);
                    new MyCreek.Platform.UsersRole().DeleteByRoleID(roleGID);
                    scope.Complete();
                }
                MyCreek.Platform.Log.Add("删除的角色其及相关数据", roleID, MyCreek.Platform.Log.Types.角色应用);
                ViewBag.Script = "new RoadUI.Window().reloadOpener();new RoadUI.Window().close();";
            }
            ViewBag.RoleOptions = brole.GetRoleOptions("", roleID);
            return(View(role));
        }
Exemplo n.º 25
0
        protected void Page_Load(object sender, EventArgs e)
        {
            MyCreek.Platform.Role   brole = new MyCreek.Platform.Role();
            MyCreek.Data.Model.Role role  = null;
            string roleID = Request.QueryString["roleid"];
            Guid   roleGID;
            string name      = string.Empty;
            string useMember = string.Empty;
            string note      = string.Empty;

            if (roleID.IsGuid(out roleGID))
            {
                role = brole.Get(roleGID);
            }

            if (IsPostBack)
            {
                if (!Request.Form["Copy"].IsNullOrEmpty())
                {
                    string tpl = Request.Form["ToTpl"];
                    if (tpl.IsGuid())
                    {
                        new MyCreek.Platform.RoleApp().CopyRoleApp(roleGID, tpl.ToGuid());
                        MyCreek.Platform.Log.Add("复制了模板应用", "源:" + roleID + "复制给:" + tpl, MyCreek.Platform.Log.Types.角色应用);
                        Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('复制成功!');", true);
                    }
                }

                if (!Request.Form["Save"].IsNullOrEmpty() && role != null)
                {
                    MyCreek.Platform.UsersRole busersRole = new MyCreek.Platform.UsersRole();
                    using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
                    {
                        name      = Request.Form["Name"];
                        useMember = Request.Form["UseMember"];
                        note      = Request.Form["Note"];

                        role.Name      = name.Trim();
                        role.Note      = note.IsNullOrEmpty() ? null : note.Trim();
                        role.UseMember = useMember.IsNullOrEmpty() ? null : useMember;
                        brole.Update(role);
                        busersRole.DeleteByRoleID(role.ID);
                        if (!useMember.IsNullOrEmpty())
                        {
                            busersRole.DeleteByRoleID(role.ID);
                            var users = new MyCreek.Platform.Organize().GetAllUsers(useMember);
                            foreach (var user in users)
                            {
                                MyCreek.Data.Model.UsersRole ur = new MyCreek.Data.Model.UsersRole();
                                ur.IsDefault = true;
                                ur.MemberID  = user.ID;
                                ur.RoleID    = role.ID;
                                busersRole.Add(ur);
                            }
                        }
                        scope.Complete();
                    }
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('保存成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();", true);
                }

                if (!Request.Form["Delete"].IsNullOrEmpty())
                {
                    using (System.Transactions.TransactionScope scope = new System.Transactions.TransactionScope())
                    {
                        brole.Delete(roleGID);
                        new MyCreek.Platform.RoleApp().DeleteByRoleID(roleGID);
                        new MyCreek.Platform.UsersRole().DeleteByRoleID(roleGID);
                        scope.Complete();
                    }
                    MyCreek.Platform.Log.Add("删除的角色其及相关数据", roleID, MyCreek.Platform.Log.Types.角色应用);
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "new RoadUI.Window().reloadOpener();new RoadUI.Window().close();", true);
                }
            }
            if (role != null)
            {
                this.Name.Value      = role.Name;
                this.UseMember.Value = role.UseMember;
                this.Note.Value      = role.Note;
            }
            this.RoleOptions.Text = brole.GetRoleOptions("", roleID);
        }