Exemplo n.º 1
0
 public ContentResult UpdateDown()
 {
     try
     {
         string    url = Server.MapPath("~/BaseFile/BasePostCode2016.xls");
         DataTable dt  = ExportHelper.LoadExcelToDataTable(url);
         for (int i = 0; i < dt.Rows.Count; i++)
         {
             BasePostCode code = new BasePostCode();
             code.IsHave   = false;
             code.PostCode = dt.Rows[i][0].ToString();
             code.PostName = dt.Rows[i][1].ToString();
             BasePostCode oldCode = BasePostCode.GetByPostCode(code.PostCode);
             if (oldCode == null)
             {
                 code.InsertAndReturnIdentity();
             }
         }
         return(Content("ok"));
     }
     catch (Exception ex)
     {
         Log.Instance.Write(ex.ToString(), "BasePostCode_UpdateDown_error");
         return(Content("更新异常"));
     }
 }
Exemplo n.º 2
0
        public ContentResult ToEdit(BasePostCode para)
        {
            if (string.IsNullOrWhiteSpace(para.PostName))
            {
                return(Content("快递公司名不能为空"));
            }
            if (RepeatHelper.NoRepeat("BasePostCode", "PostName", para.PostName, para.ID) > 0)
            {
                return(Content("快递公司名已存在"));
            }
            if (!string.IsNullOrWhiteSpace(para.PostCode))
            {
                if (RepeatHelper.NoRepeat("BasePostCode", "PostCode", para.PostCode, para.ID) > 0)
                {
                    return(Content("快递公司代号已存在"));
                }
            }
            int rtn = para.UpdateByID();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("保存出错"));
        }
Exemplo n.º 3
0
        public ContentResult ToAdd(BasePostCode para)
        {
            if (string.IsNullOrWhiteSpace(para.PostName))
            {
                return(Content("快递公司名不能为空"));
            }
            if (RepeatHelper.NoRepeat("BasePostCode", "PostName", para.PostName, para.ID) > 0)
            {
                return(Content("快递公司名已存在"));
            }
            if (!string.IsNullOrWhiteSpace(para.PostCode))
            {
                if (RepeatHelper.NoRepeat("BasePostCode", "PostCode", para.PostCode, para.ID) > 0)
                {
                    return(Content("快递公司代号已存在"));
                }
            }
            int rtn = para.InsertAndReturnIdentity();

            if (rtn > 0)
            {
                return(Content("ok"));
            }
            return(Content("添加出错"));
        }
Exemplo n.º 4
0
 public ContentResult ToDel(int id)
 {
     if (BasePostCode.DeleteByID(id) > 0)
     {
         return(Content("ok"));
     }
     return(Content("删除出错"));
 }
Exemplo n.º 5
0
 public ContentResult ToHave(int id, bool ishave)
 {
     if (BasePostCode.TohaveByID(id, ishave) > 0)
     {
         return(Content("ok"));
     }
     return(Content((ishave == true ? "启用" : "禁用") + "出错"));
 }
Exemplo n.º 6
0
        //
        // GET: /j_Order_xfzShow/

        public ActionResult logistics(string orderNo)
        {
            j_OrderPost orderPost = j_OrderPost.GetInfoByOrderNo(orderNo);

            if (orderPost == null)
            {
                return(View("Error", new ErrorPage {
                    Title = "", Message = "无物流信息"
                }));
            }
            BasePostCode PostCode = BasePostCode.GetEntityByID(orderPost.CodeID);


            return(Redirect("https://m.kuaidi100.com/index_all.html?type=" + orderPost.PostName + "&postid=" + orderPost.PostNo + "&callbackurl=" + Request.Url));
        }
Exemplo n.º 7
0
        public ContentResult ToSendOrder(j_OrderPost orderPost)
        {
            if (string.IsNullOrWhiteSpace(orderPost.OrderNo) || string.IsNullOrWhiteSpace(orderPost.PostNo) || orderPost.CodeID == 0)
            {
                return(Content("您还没有填完哦"));
            }
            string       msg      = string.Empty;
            BasePostCode postCode = BasePostCode.GetEntityByID(orderPost.CodeID);

            if (postCode == null)
            {
                return(Content("该快递没有收录"));
            }
            orderPost.PostName = postCode.PostName;//快递名
            j_OrderPost old = j_OrderPost.GetInfoByOrderNo(orderPost.OrderNo);

            orderPost.Dat = DateTime.Now;
            if (old != null && !string.IsNullOrWhiteSpace(old.PostNo))
            {
                orderPost.ID = old.ID;
                int rtn = 0;
                rtn = orderPost.UpdateByID();
                msg = rtn > 0 ? "ok" : "保存失败";
            }
            else
            {
                msg = j_OrderPost.SendOrder(orderPost, CurrentUser.UserName);
            }


            if (msg == "ok")
            {
                return(Content("ok"));
            }
            else
            {
                return(Content(msg));
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// 订单扫描页面
        /// </summary>
        /// <returns></returns>
        public ActionResult GetOrderIDIndex(string ID)
        {
            ViewData["IsWx"] = IsWx ? "1" : "0";
            if (IsWx)
            {
                WXVariousApi VariousApi = new WXVariousApi();
                VariousApi.LoadWxConfigIncidentalAccess_token();
                string nonceStr  = WXVariousApi.GenerateNonceStr();
                string timestamp = WXVariousApi.GenerateTimeStamp();
                ViewData["signature"] = VariousApi.GetSignature(Request.Url.ToString(), nonceStr, timestamp);
                ViewData["nonceStr"]  = nonceStr;
                ViewData["timestamp"] = timestamp;
                ViewData["AppID"]     = VariousApi.WxConfig.APPID;
            }
            Order order = Order.GetOrderByOrderNo(ID);


            List <BasePostCode> PostCodes = BasePostCode.GetAllBySort();

            PostCodes             = PostCodes.FindAll(m => m.IsHave).ToList();
            ViewData["PostCodes"] = PostCodes;

            return(View(order));
        }
Exemplo n.º 9
0
        public ActionResult Edit(int id)
        {
            BasePostCode para = BasePostCode.GetEntityByID(id);

            return(View(para));
        }
Exemplo n.º 10
0
        public ActionResult Index()
        {
            List <BasePostCode> PostCodes = BasePostCode.GetAllBySort();

            return(View(PostCodes));
        }