コード例 #1
0
ファイル: SysOrgStruct.aspx.cs プロジェクト: daowzq/MyFrame
 public string RemoveUser(string OrgID, string Ids)
 {
     string[] idList = JsonConvert.DeserializeObject <string[]>(Ids);
     if (idList != null && idList.Length > 0)
     {
         SysOrgUser.DoBatchDelete(OrgID, idList);
     }
     return("1");
 }
コード例 #2
0
ファイル: SysOrgStruct.aspx.cs プロジェクト: daowzq/MyFrame
        protected void RefreshData(object sender, StoreReadDataEventArgs e)
        {
            int start    = e.Start;
            int pageSize = e.Limit;
            int total    = 0;

            //查询条件
            string Where = " 1=1 ";
            string Name  = Request["UserQuery"] + "";

            Name = Name.Replace("输入姓名简拼", "");
            if (!string.IsNullOrEmpty(Name))
            {
                Where += " and UserName like '%" + Name + "%' or (" + GetPinyinWhereString("UserName", Name) + ")  ";
            }

            if (e.Parameters.GetParameter("PID") != null)
            {
                var PID = e.Parameters.GetParameter("PID").Value;
                if (PID == "root")
                {
                    SysUser[] UserEnts = DataHelper.GetPageList <SysUser>(start, pageSize, new Order[] { new Order("CreateTime", false) }, out total, Expression.Sql(Where));
                    e.Total        = total;
                    UserStore.Data = UserEnts;
                    UserStore.DataBind();
                }
                else
                {
                    Where += " and OrgID='" + PID + "' ";
                    SysOrgUser[] SysOUserEnt = DataHelper.GetPageList <SysOrgUser>(start, pageSize, new Order[] { new Order("CreateTime", false) }, out total, Expression.Sql(Where));
                    e.Total = total;
                    IList <SysUser> UserList = SysOrgUser.GetUsersByEnts(SysOUserEnt);
                    foreach (var item in SysOUserEnt)
                    {
                        var ent = UserList.Where(ten => ten.ID == item.UserID).First();
                        if (ent != null)
                        {
                            UserList.Add(ent);
                        }
                    }
                    UserStore.Data = UserList;
                    UserStore.DataBind();
                    return;
                }
            }
            //默认情况
            SysUser[] Arr = DataHelper.GetPageList <SysUser>(start, pageSize, new Order[] { new Order("CreateTime", false) }, out total, Expression.Sql(Where));
            e.Total        = total;
            UserStore.Data = Arr;
            UserStore.DataBind();
        }
コード例 #3
0
ファイル: SysOrgStruct.aspx.cs プロジェクト: daowzq/MyFrame
        public string DeleteData(string ID)
        {
            var Ent = SysOrganization.Find(ID);
            //删除相关联的人员
            var RefEnts = SysOrgUser.FindAllByProperties(SysOrgUser.Prop_OrgID, Ent.ID);

            if (RefEnts.Length > 0)
            {
                foreach (var item in RefEnts)
                {
                    item.DoDelete();
                }
            }
            Ent.DoDelete();
            return("1");
        }
コード例 #4
0
ファイル: SysOrgStruct.aspx.cs プロジェクト: daowzq/MyFrame
        public string RefUserToOrg(string Json, string PID)
        {
            var OrgEnt = SysOrganization.Find(PID);
            var Ents   = JSON.Deserialize <SysUser[]>(Json);

            foreach (var item in Ents)
            {
                //去除重复
                int a = SysOrgUser.GetCount(Expression.Sql("UserID='" + item.ID + "' and OrgID='" + OrgEnt.ID + "'"));
                if (a > 0)
                {
                    continue;
                }

                SysOrgUser OrgUsr = new SysOrgUser();
                OrgUsr.OrgID    = OrgEnt.ID;
                OrgUsr.OrgName  = OrgEnt.Name;
                OrgUsr.UserID   = item.ID;
                OrgUsr.UserName = item.Name;
                OrgUsr.DoCreate();
            }
            return("1");
        }