public HttpResponseBase LoadCondition() { string json = string.Empty; List<EdmListConditoinSubQuery> store = new List<EdmListConditoinSubQuery>(); EdmListConditoinSubQuery query = new EdmListConditoinSubQuery(); _edmlistsubMgr = new EdmListConditoinSubMgr(sqlConnectionString); try { if (!string.IsNullOrEmpty(Request.Params["conditionName"])) { query.elcm_name = Request.Params["conditionName"]; } store = _edmlistsubMgr.LoadCondition(query); if (store != null) { IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); timeConverter.DateTimeFormat = "yyyy-MM-dd"; json = "{success:true" + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}"; } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false,data:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase UpdateCondition() { string json = string.Empty; _edmlistmainMgr = new EdmListConditionMainMgr(sqlConnectionString); _edmlistsubMgr = new EdmListConditoinSubMgr(sqlConnectionString); EdmListConditoinSubQuery query = new EdmListConditoinSubQuery(); try { SetQueryValue(query); int i = _edmlistmainMgr.UpdateCondition(query); if (i > 0) { json = "{success:true}"; } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase SaveListInfo() { string json = string.Empty; _edmlistmainMgr = new EdmListConditionMainMgr(sqlConnectionString); _edmlistsubMgr = new EdmListConditoinSubMgr(sqlConnectionString); EdmListConditoinSubQuery query = new EdmListConditoinSubQuery(); int id = 0; int msg = 0; try { SetQueryValue(query); query.elcm_creator_id = Convert.ToInt32((System.Web.HttpContext.Current.Session["caller"] as Caller).user_id.ToString()); int i = _edmlistmainMgr.SaveListInfoName(query, out id, out msg); if (i > 0) { query.elcm_id = id; _edmlistsubMgr.SaveListInfoCondition(query); json = "{success:true}"; } else if (msg == 1) { json = "{success:false,msg:1}"; //篩選條件名稱已存在 } else { json = "{success:false,msg:0}"; //保存篩選條件名稱失敗 } } catch (Exception ex) { Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage(); logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message); logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name; log.Error(logMessage); json = "{success:false}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }