public int InsertDeliveryStorePlace(DeliveryStorePlace model) { try { return dao.InsertDeliveryStorePlace(model); } catch (Exception ex) { throw new Exception("DeliveryStorePlaceMgr-->InsertDeliveryStorePlace-->" + ex.Message, ex); } }
public int SelectDspName(DeliveryStorePlace model) { try { return dao.SelectDspName(model); } catch (Exception ex) { throw new Exception("DeliveryStorePlaceMgr-->SelectDspName-->" + ex.Message, ex); } }
public List<DeliveryStorePlaceQuery> GetDeliveryStorePlaceList(DeliveryStorePlace model, out int total) { try { return dao.GetDeliveryStorePlaceList(model,out total); } catch (Exception ex) { throw new Exception("DeliveryStorePlaceMgr-->GetDeliveryStorePlaceList-->" + ex.Message, ex); } }
public int InsertDeliveryStorePlace(DeliveryStorePlace model) { StringBuilder sbAll = new StringBuilder("insert into delivery_store_place(dsp_name,dsp_address,dsp_telephone,dsp_big_code,dsp_deliver_store,dsp_status,dsp_note,create_user,create_time,modify_user,modify_time) values"); sbAll.AppendFormat("('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}')", model.dsp_name, model.dsp_address, model.dsp_telephone, model.dsp_big_code, model.dsp_deliver_store, model.dsp_status, model.dsp_note, model.create_user, Common.CommonFunction.DateTimeToString(model.create_time), model.modify_user, Common.CommonFunction.DateTimeToString(model.modify_time)); try { return dbaccess.execCommand(sbAll.ToString()); } catch (Exception ex) { throw new Exception("DeliveryStorePlaceDao-->InsertDeliveryStorePlace-->" + ex.Message + "sql:" + sbAll.ToString(), ex); } }
public int UpdateDeliveryStorePlace(DeliveryStorePlace model) { StringBuilder sbAll = new StringBuilder(); sbAll.AppendFormat("update delivery_store_place set dsp_name='{0}',dsp_address='{1}',dsp_telephone='{2}',dsp_big_code='{3}',dsp_deliver_store='{4}',", model.dsp_name, model.dsp_address, model.dsp_telephone, model.dsp_big_code, model.dsp_deliver_store); sbAll.AppendFormat("dsp_note='{0}',modify_user='******',modify_time='{2}' where dsp_id={3} ",model.dsp_note,model.modify_user,Common.CommonFunction.DateTimeToString(model.modify_time),model.dsp_id); try { return dbaccess.execCommand(sbAll.ToString()); } catch (Exception ex) { throw new Exception("DeliveryStorePlaceDao-->UpdateDeliveryStorePlace-->" + ex.Message + "sql:" + sbAll.ToString(), ex); } }
public List<DeliveryStorePlaceQuery> GetDeliveryStorePlaceList(DeliveryStorePlace model, out int total) { total = 0; StringBuilder sbAll = new StringBuilder("SELECT dsp.dsp_id,dsp.dsp_name,dsp.dsp_address,dsp.dsp_deliver_store,dsp.dsp_big_code,dsp.dsp_telephone,zc.big,tp.parameterName,dsp.dsp_status,dsp.dsp_note,"); sbAll.Append("mu.user_username AS create_username,mu1.user_username AS modify_username,dsp.create_time,dsp.modify_time"); StringBuilder sbJoin = new StringBuilder(" FROM delivery_store_place dsp LEFT JOIN manage_user mu ON mu.user_id=dsp.create_user"); sbJoin.Append(" LEFT JOIN manage_user mu1 ON mu1.user_id=dsp.modify_user"); sbJoin.Append(" LEFT JOIN (SELECT big,bigcode FROM t_zip_code GROUP BY bigcode) zc ON zc.bigcode=dsp.dsp_big_code"); sbJoin.Append(" LEFT JOIN (SELECT s.parameterCode,s.parameterName FROM t_parametersrc s WHERE s.parameterType='deliver_store') tp ON tp.parameterCode=dsp.dsp_deliver_store"); StringBuilder sbWhr = new StringBuilder(" where 1=1 "); try { if (model.dsp_name != string.Empty) { sbWhr.AppendFormat(" and dsp.dsp_name like '%{0}%'", model.dsp_name); } if (model.dsp_big_code !="0") { sbWhr.AppendFormat(" and dsp.dsp_big_code = '{0}'", model.dsp_big_code); } if (model.dsp_deliver_store != "0") { sbWhr.AppendFormat(" and dsp.dsp_deliver_store='{0}'", model.dsp_deliver_store); } if (model.IsPage) { StringBuilder sbPage = new StringBuilder("select count(dsp.dsp_id)"); sbPage.Append(sbJoin).Append(sbWhr); total = Convert.ToInt32(dbaccess.getDataTable(sbPage.ToString()).Rows[0][0]); sbWhr.AppendFormat(" limit {0},{1}", model.Start, model.Limit); } return dbaccess.getDataTableForObj<DeliveryStorePlaceQuery>(sbAll.Append(sbJoin).Append(sbWhr).ToString()); } catch (Exception ex) { throw new Exception("DeliveryStorePlaceDao-->GetDeliveryStorePlaceList-->" + ex.Message + "sql:" + sbAll.Append(sbJoin).Append(sbWhr).ToString(), ex); } }
public int SelectDspName(DeliveryStorePlace model) { StringBuilder sbAll = new StringBuilder(); sbAll.AppendFormat("select count(dsp_id) from delivery_store_place where dsp_name='{0}'", model.dsp_name); try { return int.Parse(dbaccess.getDataTable(sbAll.ToString()).Rows[0][0].ToString()); } catch (Exception ex) { throw new Exception("DeliveryStorePlaceDao-->SelectDspName-->" + ex.Message + "sql:" + sbAll.ToString(), ex); } }
public JsonResult DeliveryStorePlaceSave() { string json = string.Empty; try { DeliveryStorePlace model = new DeliveryStorePlace(); DSPMgr = new DeliveryStorePlaceMgr(connectionString); if (!string.IsNullOrEmpty(Request.Form["dsp_name"])) { model.dsp_name = Request.Form["dsp_name"]; } model.modify_user = (System.Web.HttpContext.Current.Session["caller"] as Caller).user_id; model.modify_time = DateTime.Now; model.dsp_status = 1; if (!string.IsNullOrEmpty(Request.Form["dsp_big_code"])) { model.dsp_big_code = Request.Form["dsp_big_code"]; } if (!string.IsNullOrEmpty(Request.Form["dsp_deliver_store"])) { model.dsp_deliver_store = Request.Form["dsp_deliver_store"]; } if (!string.IsNullOrEmpty(Request.Form["dsp_address"])) { model.dsp_address = Request.Form["dsp_address"]; } if (!string.IsNullOrEmpty(Request.Form["dsp_telephone"])) { model.dsp_telephone = Request.Form["dsp_telephone"]; } if (!string.IsNullOrEmpty(Request.Form["dsp_note"])) { model.dsp_note = Request.Form["dsp_note"]; } if (!string.IsNullOrEmpty(Request.Form["dsp_id"])) { model.dsp_id = int.Parse(Request.Form["dsp_id"]); if (DSPMgr.UpdateDeliveryStorePlace(model) > 0) { return Json(new { success = "true" }); } } else { //if (DSPMgr.SelectDspName(model) != 0) //{ // return Json(new { success = "-1" }); //} model.create_user = model.modify_user; model.create_time = model.modify_time; if (DSPMgr.InsertDeliveryStorePlace(model) > 0) { return Json(new { 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:true,totalCount:0,data:[]}"; } return Json(new { success = "false" }); }
public HttpResponseBase GetDeliveryStorePlaceList() { List<DeliveryStorePlaceQuery> stores = new List<DeliveryStorePlaceQuery>(); string json = string.Empty; try { DeliveryStorePlace model = new DeliveryStorePlace(); model.Start = Convert.ToInt32(Request.Form["start"] ?? "0"); model.Limit = Convert.ToInt32(Request.Form["limit"] ?? "25"); if (!string.IsNullOrEmpty(Request.Form["dsp_name"])) { model.dsp_name = Request.Form["dsp_name"]; } if (!string.IsNullOrEmpty(Request.Form["dsp_big_code"])) { model.dsp_big_code = Request.Form["dsp_big_code"]; } if (!string.IsNullOrEmpty(Request.Form["dsp_deliver_store"])) { model.dsp_deliver_store = Request.Form["dsp_deliver_store"]; } DSPMgr = new DeliveryStorePlaceMgr(connectionString); int totalCount = 0; stores = DSPMgr.GetDeliveryStorePlaceList(model, out totalCount); IsoDateTimeConverter timeConverter = new IsoDateTimeConverter(); //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式 timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss"; json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(stores, 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; }