public CommonRtnEntity Add([FromBody] CustomersSuppliersInfo info) { ICustomersSuppliersInfoServices services = new CustomersSuppliersInfoServices(); int result = 0; //编辑 if (info.ID > 0) { info.UpdateTime = DateTime.Now; services.Update(info); result = info.ID; } else { result = services.Add(info); } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = result > 0, Data = result, Message = result > 0 ? "添加成功!" : "添加失败!" }; return(rtnInfo); }
public CommonRtnEntity GetList([FromBody] SearchBase <CustomersSuppliersSearch> searchInfo) { ICustomersSuppliersInfoServices services = new CustomersSuppliersInfoServices(); int totalCount = 0; List <CustomersSuppliersInfo> list = services.QueryPage(x => x.Name.Contains(searchInfo.Data.Name) && x.Type == searchInfo.Data.Type && x.PersonName.Contains(searchInfo.Data.PersonName) && x.PersonPhone.Contains(searchInfo.Data.PersonPhone) && x.QQ.Contains(searchInfo.Data.QQ) && x.WeiXin.Contains(searchInfo.Data.WeiXin) , ref totalCount, searchInfo.PageIndex, searchInfo.PageSize, " CreateTime desc "); CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = list.Count > 0, Data = new { TotalCount = totalCount, Data = list }, Message = "查询成功!" }; return(rtnInfo); }
public CommonRtnEntity GetBuyOrderInfo([FromBody] SearchBase <string> searchInfo) { IBuyOrderInfoServices services = new BuyOrderInfoServices(); BuyOrderInfo orderInfo = services.QueryByID(searchInfo.Data); List <WareInfo> wareList = new List <WareInfo>(); if (orderInfo != null) { wareList = (new WareInfoServices()).Query(ware => ware.OrderID == orderInfo.ID); } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = orderInfo != null, Data = new { Info = orderInfo, WareList = wareList }, Message = orderInfo != null ? "查询成功!" : "查询失败!" }; return(rtnInfo); }
public CommonRtnEntity List([FromBody] SearchBase <OrderInfo> searchInfo) { int result = 0; int totalCount = 0; IOrderServices services = new OrderServices(); List <OrderInfo> list = services.QueryPage(x => x.ID.Equals(searchInfo.Data.ID) && x.UserID.Equals(searchInfo.Data.UserID) && x.DeliverType.Equals(searchInfo.Data.DeliverType) && x.DeliverNo.Contains(searchInfo.Data.DeliverNo) //&& (searchInfo.Data.IsIncumbency == null || searchInfo.Data.IsIncumbency.Value == x.IsIncumbency) , ref totalCount, searchInfo.PageIndex, searchInfo.PageSize, " CreateTime desc "); //list.ForEach(x => x.Pwd = ""); CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = list.Count > 0, Data = new { TotalCount = totalCount, Data = list }, Message = "查询成功!" }; return(rtnInfo); }
public CommonRtnEntity Delete([FromBody] object [] ids) { IBuyOrderInfoServices services = new BuyOrderInfoServices(); bool result = services.DeleteByIds(ids); if (result) { //删除订单也需要删除商品 WareInfoServices wareServices = new WareInfoServices(); List <string> orderIDList = new List <string>(); for (int i = 0; i < ids.Length; i++) { orderIDList.Add(ids[i] + ""); } wareServices.DeleteByOrderID(orderIDList); } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = result, Data = result, Message = result ? "删除成功!":"删除失败" }; return(rtnInfo); }
public CommonRtnEntity UpdatePwdByAdmin([FromBody] InUpdatePwdInfo info) { bool isSuccess = false; string message = ""; IUserServices services = new UserServices(); UserInfo _info = services.QueryByID(info.ID); if (_info != null) { _info.Pwd = CommonUtitlity.CommonHelper.GetPwdCryptoStr(info.Pwd); isSuccess = services.Update(_info); message = "修改成功!"; } else { isSuccess = false; message = "未找到用户!"; } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = isSuccess, Data = isSuccess, Message = message }; return(rtnInfo); }
public CommonRtnEntity Add([FromBody] UserInfo info) { IUserServices services = new UserServices(); int result = 0; //编辑 if (info.ID > 0) { UserInfo oldUserInfo = services.QueryByID(info.ID); if (oldUserInfo != null) { info.Pwd = oldUserInfo.Pwd; } info.UpdateTime = DateTime.Now; services.Update(info); result = info.ID; } else { result = services.Add(info); } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = result > 0, Data = result, Message = result > 0 ? "添加成功!" : "添加失败!" }; return(rtnInfo); }
public CommonRtnEntity GetEmailContent(string userName, string pwd, string keyWords, int tryCount = 1) { CommonRtnEntity rtnInfo = new CommonRtnEntity(); string rtnmsg = ""; bool result = true; if (string.IsNullOrEmpty(userName)) { result = false; rtnmsg = "邮箱账号不能为空!"; } else if (string.IsNullOrEmpty(pwd)) { result = false; rtnmsg = "邮箱密码不能为空!"; } if (result) { IEmailServices advertisementServices = new EmailServices(); string content = ""; result = advertisementServices.GetEmailContent(userName, pwd, keyWords, out content, out rtnmsg, tryCount); rtnInfo.Success = result; rtnInfo.Data = content; rtnInfo.Message = result ? "获取成功!" : rtnmsg; } else { rtnInfo.Success = result; rtnInfo.Data = ""; rtnInfo.Message = rtnmsg; } return(rtnInfo); }
public CommonRtnEntity GetList([FromBody] SearchBase <UserInfo> searchInfo) { IUserServices services = new UserServices(); int totalCount = 0; List <UserInfo> list = services.QueryPage(x => x.Name.Contains(searchInfo.Data.Name) && x.LoginName.Contains(searchInfo.Data.LoginName) && x.PersonPhone.Contains(searchInfo.Data.PersonPhone) && x.Email.Contains(searchInfo.Data.Email) //&& (searchInfo.Data.IsIncumbency == null || searchInfo.Data.IsIncumbency.Value == x.IsIncumbency) , ref totalCount, searchInfo.PageIndex, searchInfo.PageSize, " CreateTime desc "); list.ForEach(x => x.Pwd = ""); CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = list.Count > 0, Data = new { TotalCount = totalCount, Data = list }, Message = "查询成功!" }; return(rtnInfo); }
public CommonRtnEntity Add([FromBody] OrderInfo info) { IOrderServices services = new OrderServices(); int result = 0; //编辑 if (info.ID > 0) { OrderInfo oldOrderInfo = services.QueryByID(info.ID); info.UpdateTime = DateTime.Now; services.Update(info); result = info.ID; } else { result = services.Add(info); } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = result > 0, Data = result, Message = result > 0 ? "成功" : "失败" }; return(rtnInfo); }
public CommonRtnEntity Register([FromBody] WebUserInfo info) { IWebUserServices services = new WebUserServices(); int result = 0; //编辑 if (info.ID > 0) { WebUserInfo oldUserInfo = services.QueryByID(info.ID); if (oldUserInfo != null) { info.Pwd = oldUserInfo.Pwd; } info.LastLoginTime = DateTime.Now; services.Update(info); result = info.ID; } else { result = services.Add(info); } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = result > 0, Data = result, Message = result > 0 ? "注册成功!" : "注册失败!" }; return(rtnInfo); }
public CommonRtnEntity Add([FromBody] InRoleInfo info) { IRoleInfoServices services = new RoleInfoServices(); int result = 0; RoleInfo roleInfo = info.Info; //编辑 if (roleInfo.ID > 0) { roleInfo.UpdateTime = DateTime.Now; services.Update(roleInfo); result = roleInfo.ID; } else { result = services.Add(roleInfo); } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = result > 0, Data = result, Message = result > 0 ? "添加成功!" : "添加失败!" }; return(rtnInfo); }
public CommonRtnEntity GetInfoByLessThanInviteCountAndUpdateDoing(string clientName, string projectName, int inviteCount, string status = "0") { lock (GetInfoByLessThanInviteCountAndUpdateDoingLockStr) { IMobileInfoServices advertisementServices = new MobileInfoServices(); List <MobileInfo> list = new List <MobileInfo>(); list = advertisementServices.Query(d => d.ProjectName == projectName && d.ClientName == clientName && d.Status == status && !SqlFunc.IsNullOrEmpty(d.InviteCode)).Take(5).ToList(); list = list.Where(x => x.InviteCount < inviteCount).ToList(); MobileInfo info = null; if (list != null && list.Count > 0) { info = list[(new Random()).Next(0, list.Count - 1)]; info.Status = "占用"; if (info.CreateTime < DateTime.Now.AddYears(-5)) { info.CreateTime = DateTime.Now; } info.UpdateTime = DateTime.Now; advertisementServices.Update(info); } string errorMsg = "暂未获取到!"; CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = info != null, Data = info, Message = info != null ? "获取成功!" : errorMsg }; return(rtnInfo); } }
public CommonRtnEntity GetOrderSituation([FromBody] SearchBase <BuyOrderSearch> searchInfo) { IBuyOrderInfoServices services = new BuyOrderInfoServices(); DateTime start = DateTime.Parse(DateTime.Now.AddDays(-15).ToString("yyyy-MM-dd")); DateTime end = DateTime.Now; List <BuyOrderInfo> list = null; list = services.Query(d => d.CreateTime >= start && d.CreateTime <= end ); List <string> xList = new List <string>(); Dictionary <string, List <double> > data = new Dictionary <string, List <double> >(); data.Add("PO", new List <double>()); data.Add("SO", new List <double>()); IEnumerable <IGrouping <string, BuyOrderInfo> > query = list.GroupBy(pet => pet.CreateTime.Value.ToString("MM-dd"), pet => pet); for (int i = 0; i < (end - start).TotalDays; i++) { string dayStr = start.AddDays(i).ToString("MM-dd"); xList.Add(dayStr); List <BuyOrderInfo> todayList = new List <BuyOrderInfo>(); IGrouping <string, BuyOrderInfo> groupToday = query.Where(x => x.Key == dayStr).FirstOrDefault(); if (groupToday != null) { todayList = groupToday.ToList(); } double poTotalMoney = todayList.Where(x => x.OrderType == "PO").Sum(x => x.TotalMoney); double soTotalMoney = todayList.Where(x => x.OrderType == "SO").Sum(x => x.TotalMoney); data["PO"].Add(poTotalMoney); data["SO"].Add(soTotalMoney); } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = list.Count > 0, Data = new { XList = xList, Data = data }, Message = "查询成功!" }; return(rtnInfo); }
public CommonRtnEntity Login([FromBody] WebUserInfo webUserInfo) { //throw new Exception("123"); IWebUserServices webUserServices = new WebUserServices(); string pwd = webUserInfo.Pwd; pwd = CommonUtitlity.CommonHelper.GetPwdCryptoStr(pwd); WebUserInfo info = webUserServices.Query(d => d.LoginName == webUserInfo.LoginName && d.Pwd == pwd).FirstOrDefault(); Out_LoginUserInfo outUser = null; if (info != null) { info.LastLoginTime = DateTime.Now; info.LastLoginIP = Accessor.HttpContext.Connection.RemoteIpAddress.ToString(); webUserServices.Update(info); outUser = new Out_LoginUserInfo(); outUser.ID = info.ID; outUser.Name = info.Name; //outUser.Age = info.Age; outUser.LoginName = info.LoginName; outUser.ID = info.ID; //如果是基于用户的授权策略,这里要添加用户;如果是基于角色的授权策略,这里要添加角色 //var claims = new Claim[] { new Claim(ClaimTypes.Name, User.LoginName), new Claim(ClaimTypes.Role, "Sys"), new Claim(ClaimTypes.Expiration, DateTime.Now.AddSeconds(_requirement.Expiration.TotalSeconds).ToString()) }; ////用户标识 //var identity = new ClaimsIdentity(JwtBearerDefaults.AuthenticationScheme); //identity.AddClaims(claims); TokenModel tokenModel = new TokenModel(); tokenModel.Uid = info.ID; tokenModel.Uname = info.LoginName; tokenModel.Sub = "admin"; outUser.Token = JwtToken.IssueJWT(tokenModel); } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = outUser != null, Data = outUser, Message = outUser != null ? "登录成功!" : "账号或者密码错误!" }; return(rtnInfo); }
public CommonRtnEntity GetInfoByStatusAndUpdateDoing(string clientName, string projectName, string status, bool isUseNextOperationTime = false) { lock (GetInfoByStatusAndUpdateDoingLockStr) { IMobileInfoServices advertisementServices = new MobileInfoServices(); List <MobileInfo> list = new List <MobileInfo>(); if (isUseNextOperationTime) { list = advertisementServices.Query(d => d.Status == status && d.ProjectName == projectName && d.ClientName == clientName && d.NextOperationTime < DateTime.Now); } else { list = advertisementServices.Query(d => d.Status == status && d.ProjectName == projectName && d.ClientName == clientName); } MobileInfo info = null; if (list != null && list.Count > 0) { info = list[(new Random()).Next(0, list.Count - 1)]; info.Status = "占用"; if (info.CreateTime < DateTime.Now.AddYears(-5)) { info.CreateTime = DateTime.Now; } if (info.NextOperationTime < DateTime.Now.AddYears(-5)) { info.NextOperationTime = DateTime.Now.AddHours(3); } info.UpdateTime = DateTime.Now; advertisementServices.Update(info); } string errorMsg = "暂未获取到!"; if (isUseNextOperationTime) { MobileInfo nextOperationInfo = advertisementServices.Query(d => d.Status == status && d.ProjectName == projectName && d.ClientName == clientName).OrderBy(x => x.NextOperationTime).FirstOrDefault(); if (nextOperationInfo != null) { errorMsg = "成熟时间:" + nextOperationInfo.NextOperationTime.ToString("yyyy-MM-dd HH:mm:ss"); } } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = info != null, Data = info, Message = info != null ? "获取成功!" : errorMsg }; return(rtnInfo); } }
public CommonRtnEntity FindPwd([FromBody] WebUserInfo info) { int result = 0; CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = result > 0, Data = result, Message = result > 0 ? "添加成功!" : "添加失败!" }; return(rtnInfo); }
public CommonRtnEntity SetIsInvoice([FromBody] object[] ids) { BuyOrderInfoServices services = new BuyOrderInfoServices(); bool result = services.SetIsInvoice(ids, true); CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = result, Data = result, Message = result ? "标记开票成功!" : "标记开票失败" }; return(rtnInfo); }
public CommonRtnEntity Update([FromBody] OrderInfo info) { int result = 0; CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = result > 0, Data = result, Message = result > 0 ? "获取成功" : "获取失败" }; return(rtnInfo); }
public CommonRtnEntity Delete([FromBody] object[] ids) { ICustomersSuppliersInfoServices services = new CustomersSuppliersInfoServices(); bool result = services.DeleteByIds(ids); CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = result, Data = result, Message = result ? "删除成功!" : "删除失败" }; return(rtnInfo); }
public CommonRtnEntity Post([FromBody] UserInfo userInfo) { IAdvertisementServices advertisementServices = new AdvertisementServices(); int userID = advertisementServices.Add(userInfo); CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = userID > 0, Data = userID, Message = "添加成功!" }; return(rtnInfo); }
public CommonRtnEntity GetById(int id) { string aa = null; string bb = aa ?? "666"; IAdvertisementServices advertisementServices = new AdvertisementServices(); List <UserInfo> list = advertisementServices.Query(d => d.ID == id); CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = true, Data = list, Message = "查询成功!" }; return(rtnInfo); }
public CommonRtnEntity Get(string clientName, string projectName, string mobileNum) { IMobileInfoServices advertisementServices = new MobileInfoServices(); MobileInfo info = advertisementServices.Query(d => d.MobileNum == mobileNum && d.ProjectName == projectName && d.ClientName == clientName).FirstOrDefault(); //((MobileInfoServices)advertisementServices).MyTest(); CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = info != null, Data = info, Message = "查询成功!" }; return(rtnInfo); }
public CommonRtnEntity GetCustomersSuppliersInfo([FromBody] SearchBase <string> searchInfo) { ICustomersSuppliersInfoServices services = new CustomersSuppliersInfoServices(); CustomersSuppliersInfo orderInfo = services.QueryByID(searchInfo.Data); CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = orderInfo != null, Data = new { Info = orderInfo }, Message = orderInfo != null ? "查询成功!" : "查询失败!" }; return(rtnInfo); }
public CommonRtnEntity Add([FromBody] InOrderInfo info) { IBuyOrderInfoServices services = new BuyOrderInfoServices(); int result = 0; //编辑 if (info.Info.ID > 0) { info.Info.UpdateTime = DateTime.Now; services.Update(info.Info); result = info.Info.ID; List <WareInfo> wareList = (new WareInfoServices()).Query(ware => ware.OrderID == info.Info.ID); if (wareList.Count > 0) { (new WareInfoServices()).DeleteByIds(wareList.Select(x => x.ID + "").ToArray()); } } else { result = services.Add(info.Info); } if (result > 0) { foreach (var item in info.WareList) { item.OrderID = result; (new WareInfoServices()).Add(item); } } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = result > 0, Data = result, Message = result > 0 ? "添加成功!":"添加失败!" }; return(rtnInfo); }
public CommonRtnEntity Get(string projectName, string mobileNum) { IAbandonedMobileServices advertisementServices = new AbandonedMobileServices(); AbandonedMobile info = advertisementServices.Query(d => d.MobileNum == mobileNum && d.ProjectName == projectName).FirstOrDefault(); if (info != null) { info.Count++; advertisementServices.Update(info); } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = info != null, Data = info, Message = "查询成功!" }; return(rtnInfo); }
public CommonRtnEntity GetSaleWareSituation([FromBody] SearchBase <BuyOrderSearch> searchInfo) { IWareInfoServices services = new WareInfoServices(); DateTime start = DateTime.Parse(DateTime.Now.AddDays(-15).ToString("yyyy-MM-dd")); DateTime end = DateTime.Parse(DateTime.Now.AddDays(1).ToString("yyyy-MM-dd")); List <WareInfo> list = services.Query("[OrderID] in (select b.ID from BuyOrderInfo as b where b.OrderType='SO' and b.CreateTime>='" + start.ToString("yyyy-MM-dd") + "' and b.CreateTime<='" + end.ToString("yyyy-MM-dd") + "')"); List <string> wareNameList = new List <string>(); IEnumerable <IGrouping <string, WareInfo> > query = list.GroupBy(pet => pet.Name, pet => pet); List <Object> dataList = new List <object>(); foreach (var item in query) { wareNameList.Add(item.Key); dataList.Add( new { value = item.ToList().Sum(x => x.TotalMoney), name = item.Key, } ); } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = list.Count > 0, Data = new { WareNameList = wareNameList, DataList = dataList }, Message = "查询成功!" }; return(rtnInfo); }
public CommonRtnEntity Delete([FromBody] OrderInfo info) { IOrderServices services = new OrderServices(); int result = 0; //编辑 if (info.ID > 0) { result = services.DeleteById(info.ID) == true?1:0; } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = result > 0, Data = result, Message = result > 0 ? "成功" : "失败" }; return(rtnInfo); }
public CommonRtnEntity GetInfo([FromBody] SearchBase <string> searchInfo) { IUserServices services = new UserServices(); UserInfo orderInfo = services.QueryByID(searchInfo.Data); if (orderInfo != null) { orderInfo.Pwd = ""; } CommonRtnEntity rtnInfo = new CommonRtnEntity() { Success = orderInfo != null, Data = new { Info = orderInfo }, Message = orderInfo != null ? "查询成功!" : "查询失败!" }; return(rtnInfo); }
public CommonRtnEntity Add([FromBody] MobileInfo info) { CommonRtnEntity rtnInfo = new CommonRtnEntity(); try { IMobileInfoServices advertisementServices = new MobileInfoServices(); info.CreateTime = DateTime.Now; info.UpdateTime = DateTime.Now; int result = advertisementServices.Add(info); rtnInfo.Success = result > 0; rtnInfo.Data = result; rtnInfo.Message = "添加成功!"; } catch (Exception ex) { rtnInfo.Success = false; rtnInfo.Data = ex.Message; rtnInfo.Message = ex.Message; } return(rtnInfo); }