public HttpResponseBase TrialRecordSave() { string json = string.Empty; string jsonStr = string.Empty; TrialShareQuery query = new TrialShareQuery(); TrialPictureQuery trialP = new TrialPictureQuery(); List<TrialPictureQuery> trialPList = new List<TrialPictureQuery>(); _ITrialPictureMgr = new TrialPictureMgr(mySqlConnectionString); try { query.share_id = Convert.ToInt32(Request["share_id"]); #region 處理圖片 try { if (!string.IsNullOrEmpty(Request.Params["picInfo"])) { string[] picInfo = Request.Params["picInfo"].Split(';'); for (int i = 0; i < picInfo.Length - 1; i++) { string[] perValue = picInfo[i].Split(','); trialP = new TrialPictureQuery(); if (!string.IsNullOrEmpty(perValue[0])) { trialP.share_id = query.share_id; } if (!string.IsNullOrEmpty(perValue[1])) { trialP.image_filename = perValue[1]; } if (!string.IsNullOrEmpty(perValue[2])) { trialP.image_sort = Convert.ToUInt32(perValue[2]); } if (!string.IsNullOrEmpty(perValue[3])) { trialP.image_state = Convert.ToUInt32(perValue[3]); } trialPList.Add(trialP); } _ITrialPictureMgr = new TrialPictureMgr(mySqlConnectionString); _ITrialPictureMgr.SavePic(trialPList, trialP); } else { _ITrialPictureMgr.DeleteAllPic(trialP); } } 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 = "{failure:true}"; } #endregion _ITrialRecordMgr = new TrialRecordMgr(mySqlConnectionString); if (!string.IsNullOrEmpty(Request.Params["trial_id"])) { query.trial_id = Convert.ToInt32(Request.Params["trial_id"].ToString()); } if (!string.IsNullOrEmpty(Request.Params["user_name"])) { query.user_name = Request.Params["user_name"].ToString(); } if (!string.IsNullOrEmpty(Request.Params["user_gender"])) { query.user_gender = Convert.ToInt32(Request.Params["user_gender"].ToString()); } if (!string.IsNullOrEmpty(Request.Params["niming"])) { if (Request.Params["niming"] == "on") { query.is_show_name = 0;//匿名 } else { query.is_show_name = 1;//不匿名 } } if (!string.IsNullOrEmpty(Request.Params["content"])) { query.content = Request.Params["content"].ToString(); } if (!string.IsNullOrEmpty(Request.Params["status"])) { query.status = Convert.ToInt32(Request.Params["status"].ToString()); } int j = _ITrialRecordMgr.TrialRecordSave(query); if (j > 0) { json = "{success:true}"; } else { json = "{failure: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 = "{failure:true}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase GetShareRecordList() { string json = string.Empty; TrialShareQuery query = new TrialShareQuery(); // List<TrialShareQuery> store = new List<TrialShareQuery>(); int totalCount = 0; _ITrialRecordMgr = new TrialRecordMgr(mySqlConnectionString); try { query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量 query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");//用於分頁的變量 if (!string.IsNullOrEmpty(Request.Params["trial_id"])) { query.trial_id = Convert.ToInt32(Request.Params["trial_id"].ToString()); } if (!string.IsNullOrEmpty(Request.Params["relation_id"])) { query.share_id = Convert.ToInt32(Request.Params["relation_id"]); } DataTable _dt = _ITrialRecordMgr.GetShareList(query, out totalCount); //foreach (var item in store) //{ // item.gender = item.user_gender == 0 ? "小姐" : "先生"; //} if (Convert.ToBoolean(Request.Params["isSecret"])) { foreach (DataRow item in _dt.Rows) { if (!string.IsNullOrEmpty(item["user_name"].ToString())) { item["user_name"] = item["user_name"].ToString().Substring(0, 1) + "**"; } if (!string.IsNullOrEmpty(item["real_name"].ToString())) { item["real_name"] = item["real_name"].ToString().Substring(0, 1) + "**"; } if (!string.IsNullOrEmpty(item["after_name"].ToString())) { item["after_name"] = item["after_name"].ToString().Substring(0, 1) + "**"; } } } IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(_dt, 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,totalCount:0,data:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase VerifyMaxCount() { TrialRecordQuery query = new TrialRecordQuery(); string json = string.Empty; try { if (!string.IsNullOrEmpty(Request.Params["status"])) { query.status = Convert.ToInt32(Request.Params["status"]); } if (!string.IsNullOrEmpty(Request.Params["trial_id"])) { query.trial_id = Convert.ToInt32(Request.Params["trial_id"]); } _ITrialRecordMgr = new TrialRecordMgr(mySqlConnectionString); if (_ITrialRecordMgr.VerifyMaxCount(query)) { json = "{success:true}"; } else { json = "{failure: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 = "{failure:true}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
/// <summary> /// 更改活動使用狀態 /// </summary> /// <returns>數據庫操作結果</returns> public JsonResult TrialRecordUpdate() { string jsonStr = string.Empty; try { _ITrialRecordMgr = new TrialRecordMgr(mySqlConnectionString); TrialRecordQuery model = new TrialRecordQuery(); if (!string.IsNullOrEmpty(Request.Params["record_id"])) { model.record_id = Convert.ToInt32(Request.Params["record_id"].ToString()); } if (!string.IsNullOrEmpty(Request.Params["user_email"])) { model.user_email = Request.Params["user_email"].ToString(); } if (!string.IsNullOrEmpty(Request.Params["status"])) { model.status = Convert.ToInt32(Request.Params["status"].ToString()); } if (_ITrialRecordMgr.TrialRecordUpdate(model) > 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 GetTrialRecordList() { string json = string.Empty; TrialRecordQuery query = new TrialRecordQuery(); List<TrialRecordQuery> store = new List<TrialRecordQuery>(); int totalCount = 0; _ITrialRecordMgr = new TrialRecordMgr(mySqlConnectionString); try { query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");//用於分頁的變量 query.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");//用於分頁的變量 if (!string.IsNullOrEmpty(Request.Params["trial_id"])) { query.trial_id = Convert.ToInt32(Request.Params["trial_id"].ToString()); } if (!string.IsNullOrEmpty(Request.Params["luquStatus"])) { query.status = Convert.ToInt32(Request.Params["luquStatus"]); } if (!string.IsNullOrEmpty(Request.Params["relation_id"])) { query.record_id = Convert.ToInt32(Request.Params["relation_id"]); } //Request.Params["eventId"].ToString(); store = _ITrialRecordMgr.GetTrialRecordList(query, out totalCount); if (Convert.ToBoolean(Request.Params["isSecret"])) { foreach (var item in store) { if (!string.IsNullOrEmpty(item.user_name)) { item.user_name = item.user_name.Substring(0, 1) + "**"; } item.user_email = item.user_email.Split('@')[0] + "@***"; } } 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:false,totalCount:0,data:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }
public HttpResponseBase GetPromotionsAmountTrialList() { List<PromotionsAmountTrialQuery> store = new List<PromotionsAmountTrialQuery>(); string json = string.Empty; try { PromotionsAmountTrialQuery query = new PromotionsAmountTrialQuery(); #region 獲取query對象數據 query.Start = Convert.ToInt32(Request.Params["start"] ?? "0"); if (!string.IsNullOrEmpty(Request.Form["limit"])) { query.Limit = Convert.ToInt32(Request.Params["limit"]); } if (!string.IsNullOrEmpty(Request.Params["ddlSel"])) { query.expired = Convert.ToInt32(Request.Params["ddlSel"]); } if (!string.IsNullOrEmpty(Request.Params["serchcontent"])) { query.key = Request.Params["serchcontent"]; } #endregion _promotionsAmountTrialMgr = new PromotionsAmountTrialMgr(mySqlConnectionString); _prodMgr = new ProductMgr(mySqlConnectionString); int totalCount = 0; _ITrialRecordMgr = new TrialRecordMgr(mySqlConnectionString); store = _promotionsAmountTrialMgr.Query(query, out totalCount); List<Parametersrc> ProductFreightStore = new List<Parametersrc>(); List<Parametersrc> DeviceStore = new List<Parametersrc>(); List<Parametersrc> EventTypeStore = new List<Parametersrc>(); _parasrcMgr = new ParameterMgr(mySqlConnectionString); ProductFreightStore = _parasrcMgr.GetElementType("product_freight");//---deliver_type DeviceStore = _parasrcMgr.GetElementType("device");//--device EventTypeStore = _parasrcMgr.GetElementType("event_type");//--event_type foreach (var item in store) { for (int i = 0; i < ProductFreightStore.Count; i++) { if (int.Parse(ProductFreightStore[i].ParameterCode) == item.freight_type) { item.freight = ProductFreightStore[i].parameterName; } } for (int i = 0; i < DeviceStore.Count; i++) { if (DeviceStore[i].ParameterCode == item.device.ToString()) { item.device_name = DeviceStore[i].parameterName; } } for (int i = 0; i < EventTypeStore.Count; i++) { if (EventTypeStore[i].ParameterCode == item.event_type) { item.eventtype = EventTypeStore[i].parameterName; } } if (item.sale_productid != 0) { item.sale_product_name = _prodMgr.QueryClassify(Convert.ToUInt32(item.sale_productid)).Product_Name; } if (item.event_img_small != "") { item.event_img_small = imgServerPath + promoPath + item.event_img_small; } else { item.event_img_small = defaultImg; } if (item.event_img != "") { item.event_img = imgServerPath + promoPath + item.event_img; } else { item.event_img = defaultImg; } if (item.product_img != "") { if (item.product_img.ToString().StartsWith("T1") || item.product_img.ToString().StartsWith("T2")) { item.product_img = imgServerPath + promoPath + item.product_img; } else { item.product_img = imgServerPath + prodPath + GetDetailFolder(item.product_img) + item.product_img; } } else { item.product_img = defaultImg; } DataTable _dtCount = _ITrialRecordMgr.GetSumCount(item); if (_dtCount.Rows.Count != 0) { if (_dtCount.Rows[0][1].ToString() != "") { item.recordCount = Convert.ToInt32(_dtCount.Rows[0][1].ToString()); }; if (_dtCount.Rows[0][2].ToString() != "") { item.shareCount = Convert.ToInt32(_dtCount.Rows[0][2].ToString()); } } } IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(store, Formatting.Indented, timeConverter) + "}";//返回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:false,totalCount:0,data:[]}"; } this.Response.Clear(); this.Response.Write(json); this.Response.End(); return this.Response; }