string type = String.Empty; // 对象类型 #endregion #region ASP.NET 事件 protected void Page_Load(object sender, EventArgs e) { op = RequestData.Get <string>("op"); id = RequestData.Get <string>("id"); type = RequestData.Get <string>("type"); ShenChaReport ent = null; switch (this.RequestAction) { case RequestActionEnum.Update: ent = this.GetMergedData <ShenChaReport>(); ent.DoUpdate(); this.SetMessage("修改成功!"); break; case RequestActionEnum.Insert: case RequestActionEnum.Create: ent = this.GetPostedData <ShenChaReport>(); ent.DoCreate(); this.SetMessage("新建成功!"); break; case RequestActionEnum.Delete: ent = this.GetTargetData <ShenChaReport>(); ent.DoDelete(); this.SetMessage("删除成功!"); return; } DataTable dt = DataHelper.QueryDataTable("select * from NCRL_SP..Project where id='" + id + "'"); this.PageState.Add("pro", dt); if (op != "c" && op != "cs") { dt = DataHelper.QueryDataTable("select Id from NCRL_SP..ShenChaReport where ProjectId='" + id + "'"); if (dt.Rows.Count != 0) { string sid = dt.Rows[0]["Id"].ToString(); if (!String.IsNullOrEmpty(sid)) { ent = ShenChaReport.Find(sid); } this.SetFormData(ent); } } }
protected void Page_Load(object sender, EventArgs e) { string action = Request["action"]; ProjectId = Request["ProjectId"]; string obj = ""; if (!string.IsNullOrEmpty(action)) { switch (action) { case "SelectEdit": sql = @"select P.ProjectName ,P.Investment,P.DetailLocation,P.EngineeringLevel,P.Height, P.UpperLayers,P.DownLayers,P.BuildingArea,P.JianSheUnit,P.JianSheUnitHead,P.KanChaUnit, P.KanChaUnitHead,P.KanChaZZLevel,P.KanChaUnitZSNo, P.SheJiUnit, P.SheJiUnitHead, P.SheJiUnitGrade, P.SheJiUnitZSNo, P.IfChaoGao,P.GongChenLiang, S.Id, S.ShenChaNo,S.ProjectId,S.Opinion1 ,S.Opinion1ShenChaName,S.Opinion1CreateTime, S.Opinion2, S.Opinion2ShenChaName,S.Opinion2CreateTime, S.Opinion3, S.Opinion3ShenChaName,S.Opinion3CreateTime, S.Opinion4, S.Opinion4ShenChaName,S.Opinion4CreateTime,S.Opinion5, S.Opinion5ShenChaName,S.Opinion5CreateTime, S.Opinion6, S.Opinion6ShenChaName,S.Opinion6CreateTime,S.Opinion7, S.Opinion7ShenChaName,S.Opinion7CreateTime from NCRL_SP..Project as P left join NCRL_SP..ShenChaReport as S on P.ID =S.ProjectId where P.Id='" + ProjectId + "'"; IList <EasyDictionary> dics = DataHelper.QueryDictList(sql); if (!string.IsNullOrEmpty(dics[0].Get <string>("Opinion1CreateTime"))) { dics[0].Set("Opinion1CreateTime", dics[0].Get <DateTime>("Opinion1CreateTime").ToString("yyyy-MM-dd")); } if (!string.IsNullOrEmpty(dics[0].Get <string>("Opinion2CreateTime"))) { dics[0].Set("Opinion2CreateTime", dics[0].Get <DateTime>("Opinion2CreateTime").ToString("yyyy-MM-dd")); } if (!string.IsNullOrEmpty(dics[0].Get <string>("Opinion3CreateTime"))) { dics[0].Set("Opinion3CreateTime", dics[0].Get <DateTime>("Opinion3CreateTime").ToString("yyyy-MM-dd")); } if (!string.IsNullOrEmpty(dics[0].Get <string>("Opinion4CreateTime"))) { dics[0].Set("Opinion4CreateTime", dics[0].Get <DateTime>("Opinion4CreateTime").ToString("yyyy-MM-dd")); } if (!string.IsNullOrEmpty(dics[0].Get <string>("Opinion5CreateTime"))) { dics[0].Set("Opinion5CreateTime", dics[0].Get <DateTime>("Opinion5CreateTime").ToString("yyyy-MM-dd")); } if (!string.IsNullOrEmpty(dics[0].Get <string>("Opinion6CreateTime"))) { dics[0].Set("Opinion6CreateTime", dics[0].Get <DateTime>("Opinion6CreateTime").ToString("yyyy-MM-dd")); } if (!string.IsNullOrEmpty(dics[0].Get <string>("Opinion7CreateTime"))) { dics[0].Set("Opinion7CreateTime", dics[0].Get <DateTime>("Opinion7CreateTime").ToString("yyyy-MM-dd")); } Response.Write("{success: true,data:" + JsonHelper.GetJsonString(dics[0]) + "}"); Response.End(); break; case "Create": obj = Request["json"]; ent = JsonHelper.GetObject <ShenChaReport>(obj); ent.ProjectId = ProjectId; ent.CreateId = WebPortalService.CurrentUserInfo.UserID; ent.CreateName = WebPortalService.CurrentUserInfo.Name; ent.CreateTime = DateTime.Now; ent.DoCreate(); Response.Write("{ShenChaId:'" + ent.Id + "'}"); Response.End(); break; case "Update": obj = Request["json"]; ent = JsonHelper.GetObject <ShenChaReport>(obj); ShenChaReport Oent = ShenChaReport.Find(ent.Id); EasyDictionary dic = JsonHelper.GetObject <EasyDictionary>(obj); ent = DataHelper.MergeData <ShenChaReport>(Oent, ent, dic.Keys); ent.DoUpdate(); Response.Write("{ShenChaId:'" + ent.Id + "'}"); Response.End(); break; case "check": DoCheck(); break; } } }