Ejemplo n.º 1
0
 /// <summary>
 /// 新增插入信息
 /// </summary>
 /// <param name="sc">一個Shipping_carrior對象</param>
 /// <returns>受影響的行數</returns>
 public int InsertShippingCarrior(ShippingCarrior sc)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append("INSERT INTO shipping_carrior( ");
     sb.Append(" `delivery_store_id`,`freight_big_area`,`freight_type`,`delivery_freight_set`,");
     sb.Append(" `active`,`charge_type`,`shipping_fee`,`return_fee`,`size_limitation`,");
     sb.Append(" `length`,`width`,`height`,`weight`,`pod`,`note`");
     sb.Append(") values (");
     sb.AppendFormat(" '{0}','{1}','{2}','{3}',", sc.Delivery_store_id, sc.Freight_big_area, sc.Freight_type, sc.Delivery_freight_set);
     sb.AppendFormat(" '{0}','{1}','{2}','{3}','{4}',", sc.Active, sc.Charge_type, sc.Shipping_fee, sc.Return_fee, sc.Size_limitation);
     sb.AppendFormat(" '{0}','{1}','{2}','{3}','{4}','{5}')", sc.Length, sc.Width, sc.Height, sc.Weight, sc.Pod, sc.Note);
     return _dbAccess.execCommand(sb.ToString());
 }
Ejemplo n.º 2
0
 public int Update(ShippingCarrior sc)
 {
     return _shippingCarriorDao.UpdateShippingCarrior(sc);
 }
Ejemplo n.º 3
0
 public int Save(ShippingCarrior sc)
 {
     return _shippingCarriorDao.InsertShippingCarrior(sc);
 }
Ejemplo n.º 4
0
 public List<ShippingCarriorCustom> QueryAll(ShippingCarrior sc, out int totalCount)
 {
     return _shippingCarriorDao.QueryAll(sc, out totalCount);
 }
Ejemplo n.º 5
0
 public int LogisticsAddCheck(ShippingCarrior sc)
 {
     try
     {
         return _shippingCarriorDao.LogisticsAddCheck(sc);
     }
     catch (Exception ex)
     {
         throw new Exception("ShippingCarriorMgr-->LogisticsAddCheck-->" + ex.Message, ex);
     }
 }
Ejemplo n.º 6
0
 public int LogisticsUpdateActive(ShippingCarrior sc)
 {
     try
     {
         return _shippingCarriorDao.LogisticsUpdateActive(sc);
     }
     catch (Exception ex)
     {
         throw new Exception("ShippingCarriorMgr-->LogisticsUpdateActive-->" + ex.Message, ex);
     }
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 查詢符合條件的ShippintCarrior集合
        /// </summary>
        /// <param name="sc">查詢的條件</param>
        /// <returns>符合條件的集合</returns>
        public List<ShippingCarriorCustom> QueryAll(ShippingCarrior sc, out int totalCount)
        {
            StringBuilder sb = new StringBuilder();
            sb.Append(@"SELECT sc.rid,sc.delivery_store_id,sc.freight_big_area,sc.freight_type,sc.delivery_freight_set,sc.active,sc.charge_type,sc.shipping_fee,sc.return_fee,
                            sc.size_limitation,sc.length,sc.width,sc.height,sc.weight,sc.pod,sc.note,ds.store_name FROM shipping_carrior sc ");
            sb.Append(@"
  LEFT JOIN delivery_store ds ON ds.delivery_store_id = sc.delivery_store_id
");
            sb.AppendFormat(" WHERE 1=1 ");
            if (sc.Rid != 0)
            {
                sb.AppendFormat(" AND sc.Rid ={0}", sc.Rid);
            }
            if (sc.Delivery_store_id != 0)
            {
                sb.AppendFormat(" AND sc.delivery_store_id ={0}", sc.Delivery_store_id);
            }
            if (sc.Freight_big_area != 0)
            {
                sb.AppendFormat(" AND sc.freight_big_area ={0}", sc.Freight_big_area);
            }
            if (sc.Freight_type != 0)
            {
                sb.AppendFormat(" AND sc.freight_type ={0}", sc.Freight_type);
            }
            if (sc.Delivery_freight_set != 0)
            {
                sb.AppendFormat(" AND sc.delivery_freight_set", sc.Delivery_freight_set);
            }
            if (sc.Active != 0)
            {
                sb.AppendFormat(" AND sc.active", sc.Active);
            }

            totalCount = 0;

            System.Data.DataTable _dt = _dbAccess.getDataTable("SELECT COUNT(Rid) AS totalCount from shipping_carrior ");
            if (_dt != null)
            {
                totalCount = Convert.ToInt32(_dt.Rows[0]["totalCount"]);
            }

            IParametersrcImplDao _parameterDao = new ParametersrcDao(strConn);
            List<Parametersrc> parameterList = _parameterDao.QueryParametersrcByTypes("freight_big_area", "freight_type");
            List<ShippingCarriorCustom> list = _dbAccess.getDataTableForObj<ShippingCarriorCustom>(sb.ToString());
            foreach (ShippingCarriorCustom q in list)
            {
                var alist = parameterList.Find(m => m.ParameterType == "freight_big_area" && m.ParameterCode == q.Freight_big_area.ToString());
                var blist = parameterList.Find(m => m.ParameterType == "freight_type" && m.ParameterCode == q.Freight_type.ToString());
                if (alist != null)
                {
                    q.Area_name = alist.parameterName;
                }
                if (blist != null)
                {
                    q.Freight_type_Name = blist.parameterName;
                }
            }

            return _dbAccess.getDataTableForObj<ShippingCarriorCustom>(sb.ToString());
        }
Ejemplo n.º 8
0
        public int LogisticsAddCheck(ShippingCarrior sc)
        {
            StringBuilder sb = new StringBuilder();
            int i = 0;
            try
            {
                sb.AppendFormat("select count(rid) as countNum from shipping_carrior where delivery_store_id='{0}'", sc.Delivery_store_id);
                sb.AppendFormat(" and delivery_freight_set='{0}'", sc.Delivery_freight_set);
                System.Data.DataTable _dt = _dbAccess.getDataTable(sb.ToString());
                if (_dt.Rows.Count > 0)
                {
                    i = Convert.ToInt32(_dt.Rows[0]["countNum"].ToString());
                }
                return i;
            }
            catch (Exception ex)
            {
                throw new Exception("ShippingCarriorDao-->LogisticsAddCheck-->" + ex.Message + "sql:" + sb.ToString(), ex);
            }

        }
Ejemplo n.º 9
0
        public int LogisticsUpdateActive(ShippingCarrior sc)
        {
            StringBuilder sb = new StringBuilder();
            try
            {
                sb.Append("set sql_safe_updates=0;");
                sb.AppendFormat("update shipping_carrior set active='{0}'", sc.Active);
                sb.AppendFormat("where rid='{0}'", sc.Rid);
                sb.Append(";set sql_safe_updates=1;");
                return _dbAccess.execCommand(sb.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("ShippingCarriorDao-->LogisticsUpdateActive-->" + ex.Message + "sql:" + sb.ToString(), ex);
            }

        }
Ejemplo n.º 10
0
        public int LogisticsUpdate(ShippingCarrior sc)
        {
            StringBuilder sql = new StringBuilder();
            try
            {
                sql.Append("set sql_safe_updates=0;");
                sql.Append(" update shipping_carrior   set  ");
                sql.AppendFormat("freight_big_area='{0}',", sc.Freight_big_area);
                sql.AppendFormat("freight_type='{0} ' ,", sc.Freight_type);
                sql.AppendFormat(" `delivery_freight_set`='{0}' ,", sc.Delivery_freight_set);
                sql.AppendFormat(" charge_type='{0}', ", sc.Charge_type);
                sql.AppendFormat(" shipping_fee='{0}', ", sc.Shipping_fee);
                sql.AppendFormat(" return_fee='{0}' ,", sc.Return_fee);
                sql.AppendFormat(" size_limitation= '{0}',", sc.Size_limitation);
                sql.AppendFormat(" length= {0},", sc.Length);
                sql.AppendFormat(" width= {0},", sc.Width);
                sql.AppendFormat(" height= {0},", sc.Height);
                sql.AppendFormat(" weight= {0},", sc.Weight);
                sql.AppendFormat("note= '{0}',", sc.Note);
                sql.AppendFormat("pod= '{0}'", sc.Pod);
                sql.AppendFormat(" where rid= '{0}'", sc.Rid);
                sql.Append(";set sql_safe_updates=1;");
                return _dbAccess.execCommand(sql.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("ShippingCarriorDao-->LogisticsUpdate-->" + ex.Message + "sql:" + sql.ToString(), ex);
            }

        }
Ejemplo n.º 11
0
        public int LogisticsSave(ShippingCarrior sc)
        {
            StringBuilder sb = new StringBuilder();
            try
            {
                sb.AppendFormat(@"INSERT INTO shipping_carrior (delivery_store_id,freight_big_area,freight_type,delivery_freight_set,active,charge_type,shipping_fee,");
                sb.AppendFormat("return_fee,size_limitation,length,width,height,weight,pod,note) VALUES (");
                sb.AppendFormat("'{0}','{1}','{2}','{3}'", sc.Delivery_store_id, sc.Freight_big_area, sc.Freight_type, sc.Delivery_freight_set);
                sb.AppendFormat(",'{0}','{1}','{2}','{3}'", sc.Active, sc.Charge_type, sc.Shipping_fee, sc.Return_fee);
                sb.AppendFormat(",'{0}','{1}',{2},{3},{4}", sc.Size_limitation, sc.Length, sc.Width, sc.Height, sc.Weight);
                sb.AppendFormat(",'{0}','{1}'", sc.Pod, sc.Note);
                sb.AppendFormat(");");
                return _dbAccess.execCommand(sb.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("ShippingCarriorDao-->LogisticsSave-->" + ex.Message + "sql:" + sb.ToString(), ex);
            }

        }
Ejemplo n.º 12
0
        /// <summary>
        /// 更新Shiiping_carrior表
        /// </summary>
        /// <param name="sc">需要更新的數據</param>
        /// <returns>受影響的行數</returns>
        public int UpdateShippingCarrior(ShippingCarrior sc)
        {
            StringBuilder sb = new StringBuilder("UPDATE shipping_carrior SET ");

            sb.AppendFormat(" delivery_freight_set = {0}, delivery_store_id = {1}, freight_big_area = {2}, freight_type = {3}, active={4}, charge_type = {5}, shipping_fee = {6}, return_fee = {7}, size_limitation = {8}, length = {9}, width = {10}, height = {11}, weight = {12}, pod = {13}, note = '{14}' WHERE rid = {15} ", sc.Delivery_freight_set, sc.Delivery_store_id, sc.Freight_big_area, sc.Freight_type, sc.Active, sc.Charge_type, sc.Shipping_fee, sc.Return_fee, sc.Size_limitation, sc.Length, sc.Width, sc.Height, sc.Weight, sc.Pod, sc.Note, sc.Rid);
            try
            {
                return _dbAccess.execCommand(sb.ToString());
            }
            catch (Exception ex)
            {
                throw new Exception("ShippingCarriorDao-->UpdateShippingCarrior-->" + ex.Message + "sql:" + sb.ToString(), ex);
            }
        }
Ejemplo n.º 13
0
        /// <summary>
        /// 保存物流設定
        /// </summary>
        /// <returns></returns>
        /*[HttpPost]*/
        public HttpResponseBase SaveShippingCarrior(ShippingCarrior sc)
        {
            string json = string.Empty;
            try
            {
                _shippingCarriorMgr = new ShippingCarriorMgr(connectionString);
                int rowCount = 0;
                if (sc.Rid > 0)//修改
                {
                    rowCount = _shippingCarriorMgr.Update(sc);
                }
                else//新增
                {
                    rowCount = _shippingCarriorMgr.Save(sc);
                }
                if (rowCount > 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;
        }