public HttpResponseBase GetVipLevel() { DataTable _dt = new DataTable(); string json = string.Empty; try { _memberMgr = new MemberLevelMgr(mySqlConnectionString); _dt = _memberMgr.GetLevel(); VipUserGroup Dmodel = new VipUserGroup(); json = "{success:true,data:" + JsonConvert.SerializeObject(_dt) + "}";//返回json數據 } 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:true,totalCount:0,data:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase MemberLevelList() { MemberLevelQuery query = new MemberLevelQuery(); List<MemberLevelQuery> store = new List<MemberLevelQuery>(); string json = string.Empty; int totalCount = 0; try { query.Start = Convert.ToInt32(Request.Params["start"] ?? "0"); query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25"); if (!string.IsNullOrEmpty(Request.Params["code_name"])) { query.code_name = Request.Params["code_name"]; } if (!string.IsNullOrEmpty(Request.Params["mem_status"])) { query.ml_status = Convert.ToSByte(Request.Params["mem_status"]); } _memberLevel = new MemberLevelMgr(mySqlConnectionString); store = _memberLevel.MemberLevelList(query, out totalCount); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,totalCount:" + totalCount + ",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:true,totalCount:0,data:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public JsonResult UpdateActive() { try { MemberLevelQuery query = new MemberLevelQuery(); if (!string.IsNullOrEmpty(Request.Params["rowID"].ToString())) { query.rowID = Convert.ToInt32(Request.Params["rowID"].ToString()); } query.ml_status = Convert.ToSByte(Request.Params["ml_status"] ?? "0"); query.m_date = DateTime.Now; query.m_user = (Session["caller"] as Caller).user_id; _memberLevel = new MemberLevelMgr(mySqlConnectionString); if (_memberLevel.UpdateActive(query) > 0) { return Json(new { success = "true" }); } else { return Json(new { success = "false" }); } } 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); return Json(new { success = "false" }); } }
public HttpResponseBase MaxMLSeq() { string json = string.Empty; try { _memberLevel = new MemberLevelMgr(mySqlConnectionString); int ml_seq = _memberLevel.MaxMLSeq(); json = "{success:'true',ml_seq:'" + ml_seq + "'}"; } 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',ml_seq:'" + 1 + "'}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase DistinctSeq() { string json = string.Empty; try { MemberLevelQuery query = new MemberLevelQuery(); if (!string.IsNullOrEmpty(Request.Params["ml_seq"])) { query.ml_seq = Convert.ToInt32(Request.Params["ml_seq"]); _memberLevel = new MemberLevelMgr(mySqlConnectionString); if (_memberLevel.DistinctSeq(query)) { json = "{success:false}";//排序重複 } else { 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 SaveMemberLevel() { string json = string.Empty; try { MemberLevelQuery query = new MemberLevelQuery(); _memberLevel = new MemberLevelMgr(mySqlConnectionString); if (!string.IsNullOrEmpty(Request.Params["ml_name"])) { query.ml_name = Request.Params["ml_name"]; } if (!string.IsNullOrEmpty(Request.Params["ml_code"])) { query.ml_code = Request.Params["ml_code"]; } if (!string.IsNullOrEmpty(Request.Params["ml_minimal_amount"])) { query.ml_minimal_amount = Convert.ToInt32(Request.Params["ml_minimal_amount"]); } if (!string.IsNullOrEmpty(Request.Params["ml_max_amount"])) { query.ml_max_amount = Convert.ToInt32(Request.Params["ml_max_amount"]); } if (!string.IsNullOrEmpty(Request.Params["ml_month_seniority"])) { query.ml_month_seniority = Convert.ToInt32(Request.Params["ml_month_seniority"]); } if (!string.IsNullOrEmpty(Request.Params["ml_last_purchase"])) { query.ml_last_purchase = Convert.ToInt32(Request.Params["ml_last_purchase"]); } if (!string.IsNullOrEmpty(Request.Params["ml_minpurchase_times"])) { query.ml_minpurchase_times = Convert.ToInt32(Request.Params["ml_minpurchase_times"]); } if (!string.IsNullOrEmpty(Request.Params["ml_birthday_voucher"])) { query.ml_birthday_voucher = Convert.ToInt32(Request.Params["ml_birthday_voucher"]); } if (!string.IsNullOrEmpty(Request.Params["ml_shipping_voucher"])) { query.ml_shipping_voucher = Convert.ToInt32(Request.Params["ml_shipping_voucher"]); } if (!string.IsNullOrEmpty(Request.Params["ml_seq"])) { query.ml_seq = Convert.ToInt32(Request.Params["ml_seq"]); } if (!string.IsNullOrEmpty(Request.Params["rowID"]))//編輯 { query.rowID = Convert.ToInt32(Request.Params["rowID"]); query.m_user = (Session["caller"] as Caller).user_id; query.m_date = DateTime.Now; if (!string.IsNullOrEmpty(Request.Params["old_ml_seq"])) { query.old_ml_seq = Convert.ToInt32(Request.Params["old_ml_seq"]); } if (!string.IsNullOrEmpty(Request.Params["old_ml_code"])) { query.old_ml_code = (Request.Params["old_ml_code"]); } if (query.ml_seq != query.old_ml_seq && _memberLevel.DistinctSeq(query))//新代碼與老代碼不一樣並且重複 { json = "{success:'true',msg:'0'}";//排序重複 } else if (query.ml_code != query.old_ml_code && _memberLevel.DistinctCode(query)) { json = "{success:'true',msg:'2'}";//級別代碼重複 } else { if (_memberLevel.SaveMemberLevel(query) > 0) { json = "{success:'true',mag:'1'}";//保存成功 } else { json = "{success:'false'}";//保存失敗 } } } else//新增 { query.k_user = (Session["caller"] as Caller).user_id; query.k_date = DateTime.Now; query.k_user = (Session["caller"] as Caller).user_id; query.m_date = query.k_date; if (_memberLevel.DistinctSeq(query)) { json = "{success:'true',msg:'0'}";//排序重複 } else if (_memberLevel.DistinctCode(query)) { json = "{success:'true',msg:'2'}";//級別代碼重複 } else { if (_memberLevel.SaveMemberLevel(query) > 0) { json = "{success:'true',mag:'1'}";//保存成功 } else { json = "{success:'false'}";//保存失敗 } } } } 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; }