public virtual bool AddLogistics(LogisticsInfo entity) { string SqlAdd = null; DataTable DtAdd = null; DataRow DrAdd = null; SqlAdd = "SELECT TOP 0 * FROM Logistics"; DtAdd = DBHelper.Query(SqlAdd); DrAdd = DtAdd.NewRow(); DrAdd["Logistics_ID"] = entity.Logistics_ID; DrAdd["Logistics_NickName"] = entity.Logistics_NickName; DrAdd["Logistics_Password"] = entity.Logistics_Password; DrAdd["Logistics_CompanyName"] = entity.Logistics_CompanyName; DrAdd["Logistics_Name"] = entity.Logistics_Name; DrAdd["Logistics_Tel"] = entity.Logistics_Tel; DrAdd["Logistics_Status"] = entity.Logistics_Status; DrAdd["Logistics_Addtime"] = entity.Logistics_Addtime; DrAdd["Logistics_Lastlogin_Time"] = entity.Logistics_Lastlogin_Time; DtAdd.Rows.Add(DrAdd); try { DBHelper.SaveChanges(SqlAdd, DtAdd); return(true); } catch (Exception ex) { throw ex; } finally { DtAdd.Dispose(); } }
public static bool AddLogisticsInfo(LogisticsInfo lg) { try { lg.serialNumber = IDGenerate.generateSerialNumber(); lg.totalPrice = (int.Parse(lg.number) * int.Parse(lg.price)).ToString(); FileTools.insertOneLineData(Global.logisticsInfoPath, lg.ToString()); List <Goods> allGoods = GetAllGoods(); foreach (Goods goods in allGoods) { if (goods.ID.Equals(lg.ID)) { goods.nums += int.Parse(lg.number); modifyGoods(goods); break; } } return(true); } catch (Exception) { return(false); } }
public bool CompleteOrder(LogisticsInfo logisticsInfo) { var result = true; using (var uow = GetUnitOfWork()) { var order = uow.Repository <ZZ_Order>().Find(logisticsInfo.OrderId); if (order != null && order.OrderStatus == (int)ZZOrderStatus.Processing) { order.OrderStatus = (int)ZZOrderStatus.Completed; uow.Repository <ZZ_Order>().Update(order); InsertOrderStatusHistory(uow, logisticsInfo.OrderId, (int)ZZOrderStatus.Completed); var li = new ZZ_LogisticsInfo(); li.Id = Guid.NewGuid(); li.OrderId = logisticsInfo.OrderId; li.ExpressCompany = logisticsInfo.ExpressCompany; li.ExpressTrackingNo = logisticsInfo.ExpressTrackingNo; li.Comments = logisticsInfo.Comments; uow.Repository <ZZ_LogisticsInfo>().Insert(li); _CommonBS.InsertMessage(uow, new NotificationMessage() { UserId = order.CustomerId, Title = string.Format("订单状态更新:{0}", order.TrackingNumber), Content = string.Format("您的订单【{0}】已经完成。快递公司:{1},快递号:{2}.", order.TrackingNumber, li.ExpressCompany, li.ExpressTrackingNo) }); uow.Save(); } else { return(false); } } return(result); }
public static List <LogisticsInfo> getAllLogisticsInfo() { List <Goods> goods = GetAllGoods(); Dictionary <string, string> map = new Dictionary <string, string>(); foreach (Goods g in goods) { map[g.ID] = g.name; } List <string[]> list = FileTools.readFile(Global.logisticsInfoPath); List <LogisticsInfo> lgs = new List <LogisticsInfo>(); foreach (string[] lines in list) { LogisticsInfo lg = Builder.buildLogisticsInfo(lines); if (!lg.ID.Equals("")) { lg.name = map[lg.ID]; } else { lg.name = ""; } lgs.Add(lg); } lgs.Reverse(); return(lgs); }
public ActionResult CompleteOrder(LogisticsInfo logisticsInfo) { var result = BS.CompleteOrder(logisticsInfo); return(new JsonResult() { Data = result }); }
public virtual bool EditLogistics(LogisticsInfo entity, RBACUserInfo UserPrivilege) { if (RBAC.CheckPrivilege(UserPrivilege, "bd38ff8b-f627-44ec-9275-39c9df7425e1")) { return(MyDAL.EditLogistics(entity)); } else { throw new TradePrivilegeException("没有权限,权限代码:bd38ff8b-f627-44ec-9275-39c9df7425e1错误"); } }
public virtual bool AddLogistics(LogisticsInfo entity, RBACUserInfo UserPrivilege) { if (RBAC.CheckPrivilege(UserPrivilege, "5793c951-d2ee-45f8-9c31-35fcb853819d")) { return(MyDAL.AddLogistics(entity)); } else { throw new TradePrivilegeException("没有权限,权限代码:5793c951-d2ee-45f8-9c31-35fcb853819d错误"); } }
public virtual IList <LogisticsInfo> GetLogisticss(QueryInfo Query) { int PageSize; int CurrentPage; IList <LogisticsInfo> entitys = null; LogisticsInfo entity = null; string SqlList, SqlField, SqlOrder, SqlParam, SqlTable; SqlDataReader RdrList = null; try { CurrentPage = Query.CurrentPage; PageSize = Query.PageSize; SqlTable = "Logistics"; SqlField = "*"; SqlParam = DBHelper.GetSqlParam(Query.ParamInfos); SqlOrder = DBHelper.GetSqlOrder(Query.OrderInfos); SqlList = DBHelper.GetSqlPage(SqlTable, SqlField, SqlParam, SqlOrder, CurrentPage, PageSize); RdrList = DBHelper.ExecuteReader(SqlList); if (RdrList.HasRows) { entitys = new List <LogisticsInfo>(); while (RdrList.Read()) { entity = new LogisticsInfo(); entity.Logistics_ID = Tools.NullInt(RdrList["Logistics_ID"]); entity.Logistics_NickName = Tools.NullStr(RdrList["Logistics_NickName"]); entity.Logistics_Password = Tools.NullStr(RdrList["Logistics_Password"]); entity.Logistics_CompanyName = Tools.NullStr(RdrList["Logistics_CompanyName"]); entity.Logistics_Name = Tools.NullStr(RdrList["Logistics_Name"]); entity.Logistics_Tel = Tools.NullStr(RdrList["Logistics_Tel"]); entity.Logistics_Status = Tools.NullInt(RdrList["Logistics_Status"]); entity.Logistics_Addtime = Tools.NullDate(RdrList["Logistics_Addtime"]); entity.Logistics_Lastlogin_Time = Tools.NullDate(RdrList["Logistics_Lastlogin_Time"]); entitys.Add(entity); entity = null; } } return(entitys); } catch (Exception ex) { throw ex; } finally { if (RdrList != null) { RdrList.Close(); RdrList = null; } } }
public static LogisticsInfo buildLogisticsInfo(string[] lines) { LogisticsInfo lg = new LogisticsInfo(); lg.serialNumber = lines[0]; lg.ID = lines[1]; lg.date = lines[2]; lg.number = lines[3]; lg.price = lines[4]; lg.totalPrice = lines[5]; return(lg); }
public string GetLogisticsNameByID(int ID) { LogisticsInfo entity = GetLogisticsByID(ID); if (entity != null) { return(entity.Logistics_CompanyName); } else { return("--"); } }
public ResultModel goodsStorage([FromBody] LogisticsInfo lg) // 物品入库 { ResultModel res = new ResultModel(); if (GoodsService.AddLogisticsInfo(lg)) { res.status = "200"; res.insert("serialNumber", lg.serialNumber); res.insert("totalPrice", lg.totalPrice); } else { res.status = "500"; } return(res); }
private static string[] GetUrlParam(object obj) { PropertyInfo[] properties = obj.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public); string text = ""; PropertyInfo[] array = properties; for (int i = 0; i < array.Length; i++) { PropertyInfo propertyInfo = array[i]; if (propertyInfo.GetValue(obj, null) != null && !(propertyInfo.Name == "Sign") && !(propertyInfo.Name == "Sign_Type") && !(propertyInfo.Name == "_Action") && !(propertyInfo.Name == "_Product") && !(propertyInfo.Name == "_Version") && !(propertyInfo.Name == "_Type")) { if (propertyInfo.Name == "Logistics_Info") { LogisticsInfo[] logistics_Info = ((NormalTrade)obj).Logistics_Info; int num = 0; LogisticsInfo[] array2 = logistics_Info; for (int j = 0; j < array2.Length; j++) { LogisticsInfo logisticsInfo = array2[j]; if (logisticsInfo.Logistics_Type != "") { string text2 = ""; if (num > 0) { text2 = "_" + num; } object obj2 = text; text = obj2 + "logistics_type" + text2 + "=" + logisticsInfo.Logistics_Type + "&logistics_fee" + text2 + "=" + logisticsInfo.Logistics_Fee + "&logistics_payment" + text2 + "=" + logisticsInfo.Logistics_Payment + "&"; num++; } } } else { string text3 = text; text = text3 + propertyInfo.Name.ToLower().Replace("input_charset", "_input_charset") + "=" + propertyInfo.GetValue(obj, null).ToString() + "&"; } } } if (text.EndsWith("&")) { text = text.Substring(0, text.Length - 1); } return(text.Split('&')); }
public virtual bool EditLogistics(LogisticsInfo entity) { string SqlAdd = null; DataTable DtAdd = null; DataRow DrAdd = null; SqlAdd = "SELECT * FROM Logistics WHERE Logistics_ID = " + entity.Logistics_ID; DtAdd = DBHelper.Query(SqlAdd); try { if (DtAdd.Rows.Count > 0) { DrAdd = DtAdd.Rows[0]; DrAdd["Logistics_ID"] = entity.Logistics_ID; DrAdd["Logistics_NickName"] = entity.Logistics_NickName; DrAdd["Logistics_Password"] = entity.Logistics_Password; DrAdd["Logistics_CompanyName"] = entity.Logistics_CompanyName; DrAdd["Logistics_Name"] = entity.Logistics_Name; DrAdd["Logistics_Tel"] = entity.Logistics_Tel; DrAdd["Logistics_Status"] = entity.Logistics_Status; DrAdd["Logistics_Addtime"] = entity.Logistics_Addtime; DrAdd["Logistics_Lastlogin_Time"] = entity.Logistics_Lastlogin_Time; DBHelper.SaveChanges(SqlAdd, DtAdd); } else { return(false); } } catch (Exception ex) { throw ex; } finally { DtAdd.Dispose(); } return(true); }
public virtual LogisticsInfo GetLogisticsByNickName(string NickName) { LogisticsInfo entity = null; SqlDataReader RdrList = null; try { string SqlList; SqlList = "SELECT * FROM Logistics WHERE Logistics_NickName = '" + NickName + "'"; RdrList = DBHelper.ExecuteReader(SqlList); if (RdrList.Read()) { entity = new LogisticsInfo(); entity.Logistics_ID = Tools.NullInt(RdrList["Logistics_ID"]); entity.Logistics_NickName = Tools.NullStr(RdrList["Logistics_NickName"]); entity.Logistics_Password = Tools.NullStr(RdrList["Logistics_Password"]); entity.Logistics_CompanyName = Tools.NullStr(RdrList["Logistics_CompanyName"]); entity.Logistics_Name = Tools.NullStr(RdrList["Logistics_Name"]); entity.Logistics_Tel = Tools.NullStr(RdrList["Logistics_Tel"]); entity.Logistics_Status = Tools.NullInt(RdrList["Logistics_Status"]); entity.Logistics_Addtime = Tools.NullDate(RdrList["Logistics_Addtime"]); entity.Logistics_Lastlogin_Time = Tools.NullDate(RdrList["Logistics_Lastlogin_Time"]); } return(entity); } catch (Exception ex) { throw ex; } finally { if (RdrList != null) { RdrList.Close(); RdrList = null; } } }
public override string ResultGet() { LogisticsInfo info = new LogisticsInfo(); IList <LogisticsDetailInfo> list = new List <LogisticsDetailInfo>(); try { int expressId = 0; string code = string.Empty; if (HttpContext.Current.Request["expressId"] != null) { int.TryParse(HttpContext.Current.Request["expressId"], out expressId); } if (HttpContext.Current.Request["code"] != null) { code = HttpContext.Current.Request["code"]; } switch (expressId) { case 1: #region 中通 cn.zto.api.WebService zto = new cn.zto.api.WebService(); DataTable dTable = zto.Search(LogisticsConfig.Instance.ZTOLogistics.UserName, LogisticsConfig.Instance.ZTOLogistics.Password, code); if (dTable != null && dTable.Rows.Count > 0) { // 解析数据 dTable.DefaultView.Sort = "cdate,ctime"; foreach (DataRow item in dTable.Rows) { list.Add(new LogisticsDetailInfo() { cdate = string.Format("{0} {1}", item["cdate"].ToString(), item["ctime"].ToString()), process = item["process"].ToString() }); } } info.expressId = 1; info.expressName = "中通快递"; info.expressCode = code; info.list = list; #endregion break; case 5: #region 京东 string url = string.Format(LogisticsConfig.Instance.JDLogistics.URL, code); string strJson = CommUtil.SendGetWebRequest(url, "UTF-8"); // 解析数据 Regex regex = new Regex("(?s)\"ope_name\":\"(?<ope_name>[^\"]+)\",\"ope_remark\":\"(?<ope_remark>[^\"]+)\",\"ope_time\":\"(?<ope_time>[^\"]+)\",\"ope_title\":\"(?<ope_title>[^\"]+)\"", RegexOptions.IgnoreCase); MatchCollection colldd = regex.Matches(strJson); if (colldd != null || colldd.Count > 0) { foreach (Match dd in colldd) { list.Add(new LogisticsDetailInfo() { cdate = dd.Groups["ope_time"].ToString().Replace(@"\/", "-"), process = string.Format("{0} {1}", dd.Groups["ope_remark"].ToString(), dd.Groups["ope_title"].ToString()) }); } } info.expressId = 1; info.expressName = "京东快递"; info.expressCode = code; info.list = list; #endregion break; } } catch { } return(ResultResponse(info, "info")); }
public virtual void EditLogistics() { int Logistics_ID = tools.CheckInt(Request.Form["Logistics_ID"]); string Logistics_Password = tools.CheckStr(Request.Form["Logistics_Password"]); string password_confirm = tools.CheckStr(Request.Form["password_confirm"]); string Logistics_CompanyName = tools.CheckStr(Request.Form["Logistics_CompanyName"]); string Logistics_Name = tools.CheckStr(Request.Form["Logistics_Name"]); string Logistics_Tel = tools.CheckStr(Request.Form["Logistics_Tel"]); int Logistics_Status = tools.CheckInt(Request.Form["Logistics_Status"]); if (Logistics_Password.Length == 0) { Public.Msg("error", "错误信息", "请填写登录密码", false, "{back}"); return; } if (Logistics_Password != password_confirm) { Public.Msg("error", "错误信息", "登录密码与确认密码不一致", false, "{back}"); return; } if (Logistics_CompanyName.Length == 0) { Public.Msg("error", "错误信息", "请填写物流商公司名", false, "{back}"); return; } if (Logistics_Name.Length == 0) { Public.Msg("error", "错误信息", "请填写联系人", false, "{back}"); return; } if (Logistics_Tel.Length == 0) { Public.Msg("error", "错误信息", "请填写联系电话", false, "{back}"); return; } LogisticsInfo entity = GetLogisticsByID(Logistics_ID); if (entity != null) { entity.Logistics_ID = Logistics_ID; entity.Logistics_Password = encrypt.MD5(Logistics_Password); entity.Logistics_CompanyName = Logistics_CompanyName; entity.Logistics_Name = Logistics_Name; entity.Logistics_Tel = Logistics_Tel; entity.Logistics_Status = Logistics_Status; if (MyBLL.EditLogistics(entity, Public.GetUserPrivilege())) { Public.Msg("positive", "操作成功", "操作成功", true, "Logistics_list.aspx"); } else { Public.Msg("error", "错误信息", "操作失败,请稍后重试", false, "{back}"); } } else { Public.Msg("error", "错误信息", "操作失败,请稍后重试", false, "{back}"); } }
public virtual void AddLogistics() { int Logistics_ID = tools.CheckInt(Request.Form["Logistics_ID"]); string Logistics_NickName = tools.CheckStr(Request.Form["Logistics_NickName"]); string password_confirm = tools.CheckStr(Request.Form["password_confirm"]); string Logistics_Password = tools.CheckStr(Request.Form["Logistics_Password"]); string Logistics_CompanyName = tools.CheckStr(Request.Form["Logistics_CompanyName"]); string Logistics_Name = tools.CheckStr(Request.Form["Logistics_Name"]); string Logistics_Tel = tools.CheckStr(Request.Form["Logistics_Tel"]); int Logistics_Status = tools.CheckInt(Request.Form["Logistics_Status"]); DateTime Logistics_Addtime = DateTime.Now; DateTime Logistics_Lastlogin_Time = DateTime.Now; if (Logistics_NickName.Length == 0) { Public.Msg("error", "错误信息", "请填写登录名", false, "{back}"); return; } LogisticsInfo logisticsinfo = GetLogisticsByNickName(Logistics_NickName); if (logisticsinfo != null) { Public.Msg("error", "错误信息", "登录名已存在", false, "{back}"); return; } if (Logistics_Password.Length == 0) { Public.Msg("error", "错误信息", "请填写登录密码", false, "{back}"); return; } if (Logistics_Password != password_confirm) { Public.Msg("error", "错误信息", "登录密码与确认密码不一致", false, "{back}"); return; } if (Logistics_CompanyName.Length == 0) { Public.Msg("error", "错误信息", "请填写物流商公司名", false, "{back}"); return; } if (Logistics_Name.Length == 0) { Public.Msg("error", "错误信息", "请填写联系人", false, "{back}"); return; } if (Logistics_Tel.Length == 0) { Public.Msg("error", "错误信息", "请填写联系电话", false, "{back}"); return; } LogisticsInfo entity = new LogisticsInfo(); entity.Logistics_ID = Logistics_ID; entity.Logistics_NickName = Logistics_NickName; entity.Logistics_Password = encrypt.MD5(Logistics_Password); entity.Logistics_CompanyName = Logistics_CompanyName; entity.Logistics_Name = Logistics_Name; entity.Logistics_Tel = Logistics_Tel; entity.Logistics_Status = Logistics_Status; entity.Logistics_Addtime = Logistics_Addtime; entity.Logistics_Lastlogin_Time = Logistics_Lastlogin_Time; if (MyBLL.AddLogistics(entity, Public.GetUserPrivilege())) { Public.Msg("positive", "操作成功", "操作成功", true, "Logistics_add.aspx"); } else { Public.Msg("error", "错误信息", "操作失败,请稍后重试", false, "{back}"); } }