Пример #1
0
 /// <summary>
 /// 查詢超商店家
 /// </summary>
 /// <param name="store">Store Model</param>
 /// <param name="status">店家狀態</param>
 /// <returns>Store Model List</returns>
 public List<DeliveryStoreQuery> Query(DeliveryStore store, out int totalCount)
 {
     store.Replace4MySQL();
     StringBuilder tempStr = new StringBuilder("select delivery_store.rowid,delivery_store_id,a.parametername as delivery_store_name,big,bigcode,middle,middlecode,");
     tempStr.Append("small,smallcode,store_id,store_name,address,phone,status from delivery_store left join ");
     tempStr.Append(" (select parametercode,parametername from t_parametersrc where parametertype='deliver_store') a on ");
     tempStr.Append("delivery_store.delivery_store_id=a.parametercode where 1=1");
     if (store.delivery_store_id != 0)
     {
         tempStr.AppendFormat(" and delivery_store_id = {0}", store.delivery_store_id); ;
     }
     if (store.status != 0)
     {
         tempStr.AppendFormat(" and status = {0}", store.status);
     }
     totalCount = 0;
     if (store.IsPage)
     {
         System.Data.DataTable _dt = _access.getDataTable(tempStr.ToString());
         if (_dt != null && _dt.Rows.Count > 0)
         {
             totalCount = _dt.Rows.Count;
         }
         tempStr.AppendFormat(" limit {0},{1}", store.Start, store.Limit);
     }
     return _access.getDataTableForObj<DeliveryStoreQuery>(tempStr.ToString());
 }
Пример #2
0
 public int Save(DeliveryStore store)
 {
     store.Replace4MySQL();
     StringBuilder strSql = new StringBuilder("insert into delivery_store(`delivery_store_id`,`big`,`bigcode`,`middle`,`middlecode`,`small`,`smallcode`,`store_id`,`store_name`,");
     strSql.AppendFormat("`address`,`phone`,`status`)values({0},'{1}','{2}','{3}','{4}',",store.delivery_store_id,store.big,store.bigcode,store.middle,store.middlecode);
     strSql.AppendFormat("'{0}','{1}','{2}','{3}','{4}','{5}',{6})", store.small, store.smallcode, store.store_id, store.store_name, store.address, store.phone, store.status);
     return _access.execCommand(strSql.ToString());
 }
Пример #3
0
 public int Update(DeliveryStore store)
 {
     store.Replace4MySQL();
     StringBuilder strSql = new StringBuilder("update delivery_store set ");
     strSql.AppendFormat("delivery_store_id={0},big='{1}',bigcode='{2}',middle='{3}',middlecode='{4}',", store.delivery_store_id, store.big, store.bigcode, store.middle, store.middlecode);
     strSql.AppendFormat("small='{0}',smallcode='{1}',store_id='{2}',store_name='{3}',address='{4}',", store.small, store.smallcode,store.store_id, store.store_name, store.address);
     strSql.AppendFormat("phone='{0}',status={1} where rowid={2}", store.phone, store.status, store.rowid);
     return _access.execCommand(strSql.ToString());
 }
Пример #4
0
 public List<DeliveryStoreQuery> Query(DeliveryStore store, out int totalCount)
 {
     
     try
     {
         return _deliveryDao.Query(store, out totalCount);
     }
     catch (Exception ex)
     {
         throw new Exception("DeliveryStoreMgr-->Query-->" + ex.Message, ex);
     }
 }
Пример #5
0
 public int Update(DeliveryStore store)
 {
     
     try
     {
         return _deliveryDao.Update(store);
     }
     catch (Exception ex)
     {
         throw new Exception("DeliveryStoreMgr-->Update-->" + ex.Message, ex);
     }
 }
Пример #6
0
 public int Save(DeliveryStore store)
 {
     try
     {
         return _deliveryDao.Save(store);
     }
     catch (Exception ex)
     {
         throw new Exception("DeliveryStoreMgr-->SingleCompareSave-->" + ex.Message, ex);
     }
     
 }
Пример #7
0
        public JsonResult GetSuperStore()
        {
            IDeliveryStoreImplMgr _deliveryMgr = new DeliveryStoreMgr(connectionString);
            JsonResult result = null;
            int storeId = 0;
            int.TryParse(Request.Params["storeId"] ?? "0", out storeId);

            DeliveryStore store = new DeliveryStore();
            store.delivery_store_id = storeId;
            store.IsPage = false;

            int count = 0;

            try
            {
                if (storeId != 0)
                {
                    result = Json(_deliveryMgr.Query(store, out count));
                }

            }
            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 result;
        }
Пример #8
0
        public HttpResponseBase SaveDeliveryStore()
        {
            DeliveryStore store = new DeliveryStore();
            string json = "{success:false}";
            try
            {
                #region 填充實體

                if (!string.IsNullOrEmpty(Request.Form["delivery_store_id"]))
                {
                    store.delivery_store_id = Convert.ToInt32(Request.Form["delivery_store_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Form["BigText"]))
                {
                    store.big = Request.Form["BigText"];
                }
                if (!string.IsNullOrEmpty(Request.Form["bigcode"]))
                {
                    store.bigcode = Request.Form["bigcode"];
                }
                if (!string.IsNullOrEmpty(Request.Form["MiddleText"]))
                {
                    store.middle = Request.Form["MiddleText"];
                }
                if (!string.IsNullOrEmpty(Request.Form["middlecode"]))
                {
                    store.middlecode = Request.Form["middlecode"];
                }
                if (!string.IsNullOrEmpty(Request.Form["smallcode"]))
                {
                    string[] small = Request.Form["smallcode"].Split('/');
                    store.small = small[1];
                    store.smallcode = small[0];
                }
                if (!string.IsNullOrEmpty(Request.Form["store_id"]))
                {
                    store.store_id = Request.Form["store_id"];
                }
                if (!string.IsNullOrEmpty(Request.Form["store_name"]))
                {
                    store.store_name = Request.Form["store_name"];
                }
                if (!string.IsNullOrEmpty(Request.Form["address"]))
                {
                    store.address = Request.Form["address"];
                }
                if (!string.IsNullOrEmpty(Request.Form["phone"]))
                {
                    store.phone = Request.Form["phone"];
                }
                if (!string.IsNullOrEmpty(Request.Form["status"]))
                {
                    store.status = Convert.ToInt32(Request.Form["status"]);
                }
                #endregion

                deliveryStoreMgr = new DeliveryStoreMgr(connectionString);
                if (!string.IsNullOrEmpty(Request.Form["rowid"]))
                {
                    store.rowid = Convert.ToInt32(Request.Form["rowid"]);
                    if (deliveryStoreMgr.Update(store) > 0)
                    {
                        json = "{success:true}";
                    }
                }
                else
                {
                    if (deliveryStoreMgr.Save(store) > 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;
        }
Пример #9
0
 public HttpResponseBase QueryDeliveryStore()
 {
     List<DeliveryStoreQuery> stores = new List<DeliveryStoreQuery>();
     string json = string.Empty;
     try
     {
         DeliveryStore query = new DeliveryStore();
         query.Start = Convert.ToInt32(Request.Form["start"] ?? "0");
         query.status = 0;
         if (!string.IsNullOrEmpty(Request.Form["limit"]))
         {
             query.Limit = Convert.ToInt32(Request.Form["limit"]);
         }
         if (!string.IsNullOrEmpty(Request.Form["Delivery"]))
         {
             query.delivery_store_id = Convert.ToInt32(Request.Form["Delivery"]);
         }
         if (!string.IsNullOrEmpty(Request.Form["Status"]))
         {
             query.status = Convert.ToInt32(Request.Form["Status"]);
         }
         deliveryStoreMgr = new DeliveryStoreMgr(connectionString);
         int totalCount = 0;
         stores = deliveryStoreMgr.Query(query, out totalCount);
         json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(stores) + "}";
     }
     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;
 }