Beispiel #1
0
        public int DeleteAndAllChilds(Guid orgID)
        {
            int num = 0;

            using (TransactionScope transactionScope = new TransactionScope())
            {
                UsersRelation usersRelation = new UsersRelation();
                Users         users         = new Users();
                List <RoadFlow.Data.Model.Organize> allChilds = GetAllChilds(orgID);
                List <string> list = new List <string>();
                List <RoadFlow.Data.Model.Organize> list2 = new List <RoadFlow.Data.Model.Organize>();
                foreach (RoadFlow.Data.Model.Organize item in allChilds)
                {
                    foreach (RoadFlow.Data.Model.UsersRelation item2 in usersRelation.GetAllByOrganizeID(item.ID).FindAll((RoadFlow.Data.Model.UsersRelation p) => p.IsMain == 1))
                    {
                        RoadFlow.Data.Model.Users users2 = users.Get(item2.UserID);
                        usersRelation.Delete(item2.UserID, item2.OrganizeID);
                        num += users.Delete(item2.UserID);
                        if (users2 != null)
                        {
                            list.Add(users2.Account);
                        }
                    }
                    num += Delete(item.ID);
                    list2.Add(item);
                }
                foreach (RoadFlow.Data.Model.UsersRelation item3 in usersRelation.GetAllByOrganizeID(orgID).FindAll((RoadFlow.Data.Model.UsersRelation p) => p.IsMain == 1))
                {
                    usersRelation.Delete(item3.UserID, item3.OrganizeID);
                    num += users.Delete(item3.UserID);
                    RoadFlow.Data.Model.Users users3 = users.Get(item3.UserID);
                    if (users3 != null)
                    {
                        list.Add(users3.Account);
                    }
                }
                num += Delete(orgID);
                RoadFlow.Data.Model.Organize organize = Get(orgID);
                if (organize != null)
                {
                    list2.Add(organize);
                }
                if (RoadFlow.Platform.WeiXin.Config.IsUse)
                {
                    RoadFlow.Platform.WeiXin.Organize organize2 = new RoadFlow.Platform.WeiXin.Organize();
                    if (list.Count > 0)
                    {
                        organize2.DeleteUserAsync(list.ToArray());
                    }
                    foreach (RoadFlow.Data.Model.Organize item4 in list2)
                    {
                        organize2.DeleteDeptAsync(item4.IntID);
                    }
                }
                transactionScope.Complete();
                return(num);
            }
        }
Beispiel #2
0
        public void GetUserAccount()
        {
            string text = base.Request.QueryString["code"];

            if (text.IsNullOrEmpty())
            {
                base.Response.Write("身份验证失败");
                base.Response.End();
            }
            else
            {
                string userAccountByCode = new RoadFlow.Platform.WeiXin.Organize().GetUserAccountByCode(text);
                if (userAccountByCode.IsNullOrEmpty())
                {
                    base.Response.Write("身份验证失败");
                    base.Response.End();
                }
                else
                {
                    RoadFlow.Data.Model.Users byAccount = new RoadFlow.Platform.Users().GetByAccount(userAccountByCode);
                    if (byAccount == null)
                    {
                        base.Response.Write("未找到帐号对应的人员");
                        base.Response.End();
                    }
                    else
                    {
                        System.Web.HttpContext.Current.Response.Cookies.Add(new HttpCookie("weixin_userid", byAccount.ID.ToString())
                        {
                            Expires = DateTimeNew.Now.AddYears(10)
                        });
                        System.Web.HttpContext.Current.Session.Add(0.ToString(), byAccount.ID.ToString());
                        HttpCookie httpCookie = base.Request.Cookies.Get("LastURL");
                        string     text2      = (httpCookie == null) ? "" : httpCookie.Value;
                        if (!text2.IsNullOrEmpty())
                        {
                            base.Response.Redirect(text2);
                        }
                    }
                }
            }
        }