private void Update() { string obj = Request["data"]; string ProfessionType = Request["ProfessionType"]; string MajorName = Request["MajorName"]; ent = JsonHelper.GetObject <Expert>(obj); Expert ori_Ent = Expert.Find(ent.Id); EasyDictionary dic = JsonHelper.GetObject <EasyDictionary>(obj); ent = DataHelper.MergeData <Expert>(ori_Ent, ent, dic.Keys); ent.MajorCode = MajorName; ent.MajorName = MajorName; ent.ProfessionType = ProfessionType; ent.DoUpdate(); }
protected void Page_Load(object sender, EventArgs e) { try { Aim.Portal.Web.WebPortalService.CheckLogon(); } catch { Response.Write("<script> window.parent.location.href = '/Login.aspx';</script>"); Response.End(); } string action = Request["action"]; switch (action) { case "DoSelect": DoSelect(); break; case "Delete": Delete(); break; case "loadmajor": sql = "select name from NCRL_Portal..SysEnumeration where ParentID = 'b640c40c-e2a9-41a8-bd28-d8ff9d71ff94' order by sortindex asc"; dt = DataHelper.QueryDataTable(sql); string str = JsonHelper.GetJsonString(dt); Response.Write("{rows:" + str + "}"); Response.End(); break; case "upsortindex": expertEnt = JsonHelper.GetObject <Expert>(Request["expert"]); sql = @"select top 1 Id from NCRL_SP..Expert where SortIndex= (select max(SortIndex) from (select * from NCRL_SP..Expert where SortIndex <{0}) t )"; sql = string.Format(sql, expertEnt.SortIndex); dics = DataHelper.QueryDictList(sql); if (dics.Count > 0) //如果有比他靠前的领导 2比3靠前 { Expert tempEnt = Expert.Find(dics[0].Get <string>("Id")); int? temp = tempEnt.SortIndex; tempEnt.SortIndex = expertEnt.SortIndex; tempEnt.DoUpdate(); expertEnt.SortIndex = temp; expertEnt.DoUpdate(); } break; case "downsortindex": expertEnt = JsonHelper.GetObject <Expert>(Request["expert"]); sql = @"select top 1 Id from NCRL_SP..Expert where SortIndex= (select min(SortIndex) from (select * from NCRL_SP..Expert where SortIndex >{0}) t )"; sql = string.Format(sql, expertEnt.SortIndex); dics = DataHelper.QueryDictList(sql); if (dics.Count > 0) { Expert tempEnt = Expert.Find(dics[0].Get <string>("Id")); int? temp = tempEnt.SortIndex; tempEnt.SortIndex = expertEnt.SortIndex; tempEnt.DoUpdate(); expertEnt.SortIndex = temp; expertEnt.DoUpdate(); } break; case "updatesortindex": expertEnt = Expert.Find(Request["id"]); expertEnt.SortIndex = Convert.ToInt32(Request["sortindex"]); expertEnt.DoUpdate(); break; } }