private void DoSelect() { if (!string.IsNullOrEmpty(TripId)) { ent = LeaderTrip.Find(TripId); } else { ent = new LeaderTrip(); if (!string.IsNullOrEmpty(UserIds)) { ent.UserIds = UserIds; SysUser suEnt = SysUser.Find(UserIds); ent.UserNames = suEnt.Name; } if (!string.IsNullOrEmpty(ColumnId)) { string dt = ColumnId.Substring(0, ColumnId.Length - 2); ent.TripStartTime = Convert.ToDateTime(dt); ent.StartAMPM = ColumnId.Substring(ColumnId.Length - 2, 2); ent.TripEndTime = Convert.ToDateTime(dt); ent.CreateName = UserInfo.Name; ent.EndAMPM = "PM"; } else { ent.CreateName = UserInfo.Name; ent.TripStartTime = Convert.ToDateTime(DateTime.Now.ToShortDateString().Replace("/", "-")); ent.StartAMPM = "AM"; ent.TripEndTime = Convert.ToDateTime(DateTime.Now.ToShortDateString().Replace("/", "-")); ent.EndAMPM = "PM"; } //如果当前用户在领导信息清单中,直接将领导名称设置为当前登录人,否则 为空 IList <InstituteLeader> ilEnts = InstituteLeader.FindAllByProperty(InstituteLeader.Prop_UserId, UserInfo.UserID); if (ilEnts.Count > 0) { ent.UserIds = UserInfo.UserID; ent.UserNames = UserInfo.Name; } } SetFormData(ent); PageState.Add("FormData", ent); sql = "select * from BJKY_IntegratedManage..InstituteLeader order by SortIndex asc"; PageState.Add("LeaderData", DataHelper.QueryDictList(sql)); }
protected void Page_Load(object sender, EventArgs e) { string id = RequestData.Get <string>("id"); switch (RequestActionString) { case "delete": string leaderids = RequestData.Get <string>("leaderids"); sql = "delete from BJKY_IntegratedManage..InstituteLeader where '" + leaderids + "' like '%'+Id+'%'"; DataHelper.ExecSql(sql); break; case "downlevel": ilEnt1 = InstituteLeader.Find(id); //待降级的 sql = @"select top 1 Id from BJKY_IntegratedManage..InstituteLeader where SortIndex= (select min(SortIndex) from (select * from BJKY_IntegratedManage..InstituteLeader where SortIndex > {0}) t )"; sql = string.Format(sql, ilEnt1.SortIndex); dics = DataHelper.QueryDictList(sql); if (dics.Count > 0) //如果有比他靠后的领导 { ilEnt2 = InstituteLeader.Find(dics[0].Get <string>("Id")); int?temp = ilEnt2.SortIndex; ilEnt2.SortIndex = ilEnt1.SortIndex; ilEnt2.DoUpdate(); ilEnt1.SortIndex = temp; ilEnt1.DoUpdate(); } break; case "uplevel": ilEnt1 = InstituteLeader.Find(id); //待升级的 sql = @"select top 1 Id from BJKY_IntegratedManage..InstituteLeader where SortIndex= (select max(SortIndex) from (select * from BJKY_IntegratedManage..InstituteLeader where SortIndex <{0}) t )"; sql = string.Format(sql, ilEnt1.SortIndex); dics = DataHelper.QueryDictList(sql); if (dics.Count > 0) //如果有比他靠后的领导 { ilEnt2 = InstituteLeader.Find(dics[0].Get <string>("Id")); int?temp = ilEnt2.SortIndex; ilEnt2.SortIndex = ilEnt1.SortIndex; ilEnt2.DoUpdate(); ilEnt1.SortIndex = temp; ilEnt1.DoUpdate(); } break; case "AddLeader": string userIds = RequestData.Get <string>("userIds"); string[] idarray = userIds.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); IList <InstituteLeader> ilEnts = new List <InstituteLeader>(); sql = "select max(SortIndex) from BJKY_IntegratedManage..InstituteLeader"; int maxval = DataHelper.QueryValue <int>(sql); foreach (string userid in idarray) { InstituteLeader ilEnt = new InstituteLeader(); ilEnt.UserId = userid; ilEnt.UserName = SysUser.Find(userid).Name; maxval++; ilEnt.SortIndex = maxval; sql = @"select top 1 case [Type] when 3 then ParentDeptName when 2 then ChildDeptName end as DeptName, case [Type] when 3 then ParentId when 2 then DeptId end as DeptId from View_SysUserGroup where UserId='{0}'"; sql = string.Format(sql, userid); IList <EasyDictionary> deptDics = DataHelper.QueryDictList(sql); if (deptDics.Count > 0) { ilEnt.DeptId = deptDics[0].Get <string>("DeptId"); ilEnt.DeptName = deptDics[0].Get <string>("DeptName"); } ilEnt.DoCreate(); ilEnts.Add(ilEnt); } PageState.Add("ilEnts", ilEnts); break; default: DoSelect(); break; } }
protected void Page_Load(object sender, EventArgs e) { id = RequestData.Get <string>("id"); switch (RequestActionString) { case "update": ent = GetMergedData <IntegratedConfig>(); ent.DoUpdate(); break; case "create": ent = GetPostedData <IntegratedConfig>(); ent.DoCreate(); break; case "AddLeader": IList <string> userIds = RequestData.GetList <string>("UserIds"); IList <InstituteLeader> ilEnts = new List <InstituteLeader>(); foreach (string userId in userIds) { ilEnt = new InstituteLeader(); ilEnt.UserId = userId; ilEnt.UserName = SysUser.Find(userId).Name; string sql = @"select top 1 case [Type] when 3 then ParentDeptName when 2 then ChildDeptName end as DeptName, case [Type] when 3 then ParentId when 2 then DeptId end as DeptId from View_SysUserGroup where UserId='{0}'"; sql = string.Format(sql, userId); IList <EasyDictionary> deptDics = DataHelper.QueryDictList(sql); if (deptDics.Count > 0) { ilEnt.DeptId = deptDics[0].Get <string>("DeptId"); ilEnt.DeptName = deptDics[0].Get <string>("DeptName"); } ilEnt.DoCreate(); ilEnts.Add(ilEnt); } PageState.Add("ilEnts", ilEnts); break; case "UpdateSortIndex": ilEnt = InstituteLeader.Find(RequestData.Get <string>("InstituteLeaderId")); ilEnt.SortIndex = RequestData.Get <int>("SortIndex"); ilEnt.DoUpdate(); break; case "UpdateUser": suEnt = SysUser.Find(RequestData.Get <string>("UserId")); suEnt.Email = RequestData.Get <string>("Email"); suEnt.Phone = RequestData.Get <string>("Phone"); suEnt.DoUpdate(); break; case "delete": IList <string> instituteLeaderIds = RequestData.GetList <string>("InstituteLeaderIds"); foreach (string instituteLeaderId in instituteLeaderIds) { ilEnt = InstituteLeader.Find(instituteLeaderId); ilEnt.DoDelete(); } break; default: DoSelect(); break; } }