/// <summary> /// 新增关账日信息 /// </summary> /// <returns></returns> public bool AddAccountDate(AccountDateOperateDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var pp = tcdmse.master_AccountDateInfo.Where(p => p.AccountDateBelongModel == dto.AccountDateBelongModel && p.AccountDateYear == dto.AccountDateYear).FirstOrDefault(); if (pp != null) { throw new Exception("年份及模块不可重复!"); } var newitem = new master_AccountDateInfo(); newitem = Mapper.Map <AccountDateOperateDTO, master_AccountDateInfo>(dto); tcdmse.master_AccountDateInfo.Add(newitem); // 记录日志 this.AddLog(tcdmse, new LogData { CurrentLogType = LogType.ADD, LogDetails = "新增关账日" + dto.AccountDateName, OpratorName = dto.CreateUser }); result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 运输方式新增 /// </summary> /// <returns></returns> public bool AddTransport(TransportOperateDTO dto) { bool blResult = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { master_TransportInfo transport = new master_TransportInfo(); var dumplicated = tcdmse.master_TransportInfo.AsNoTracking().Where(p => p.TransportName == dto.TransportName).FirstOrDefault(); if (dumplicated != null) { throw new Exception("运输方式名称不可同名!"); } Mapper.Map <TransportOperateDTO, master_TransportInfo>(dto, transport); tcdmse.master_TransportInfo.Add(transport); // 记录日志 this.AddLog(tcdmse, new LogData { CurrentLogType = LogType.ADD, LogDetails = "新增运输方式" + dto.TransportName, OpratorName = dto.CreateUser }); blResult = tcdmse.SaveChanges() > 0; } return(blResult); }
/// <summary> /// 运输方式修改 /// </summary> /// <returns></returns> public bool UpdateTransport(TransportOperateDTO dto) { bool blResult = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var pp = tcdmse.master_TransportInfo.Where(p => p.TransportID == dto.TransportID).FirstOrDefault(); if (pp == null) { throw new Exception("此条信息不存在!"); } var dumplicated = tcdmse.master_TransportInfo.AsNoTracking().Where(p => p.TransportName == dto.TransportName && p.TransportID != pp.TransportID).FirstOrDefault(); if (dumplicated != null) { throw new Exception("运输方式名称不可同名!"); } if (pp != null) { pp.TransportName = dto.TransportName; pp.OrderType = dto.OrderType; pp.ModifyUser = dto.ModifyUser; pp.ModifyTime = dto.ModifyTime; } blResult = tcdmse.SaveChanges() > 0; } return(blResult); }
/// <summary> /// 停启用客户信息 /// </summary> /// <param name="dto"></param> /// <returns></returns> public bool ChangeStatusCustomer(CustomerOperateDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var pp = tcdmse.master_CustomerInfo.Where(p => p.CustomerID == dto.CustomerID).FirstOrDefault(); if (pp == null) { throw new Exception("此条信息不存在!"); } if (pp.IsActive == null || pp.IsActive == false) { pp.IsActive = true; pp.NoActiveReason = null; pp.NoActiveTime = null; } else { pp.IsActive = false; pp.NoActiveReason = dto.NoActiveReason; pp.NoActiveTime = dto.NoActiveTime; } pp.ModifyTime = dto.ModifyTime; pp.ModifyUser = dto.ModifyUser; result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 新增付款条款信息 /// </summary> /// <returns></returns> public bool AddPayment(PaymentOperateDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var dumplicated = tcdmse.master_PaymentInfo.AsNoTracking().Where(p => p.PayName == dto.PayName).FirstOrDefault(); if (dumplicated != null) { throw new Exception("付款条款不可同名!"); } var newitem = new master_PaymentInfo(); newitem = Mapper.Map <PaymentOperateDTO, master_PaymentInfo>(dto); tcdmse.master_PaymentInfo.Add(newitem); // 记录日志 this.AddLog(tcdmse, new LogData { CurrentLogType = LogType.ADD, LogDetails = "新增付款条款" + dto.PayName, OpratorName = dto.CreateUser }); result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 修改付款条款信息 /// </summary> /// <returns></returns> public bool UpdatePayment(PaymentOperateDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var pp = tcdmse.master_PaymentInfo.Where(p => p.PayID == dto.PayID).FirstOrDefault(); if (pp == null) { throw new Exception("此条信息不存在!"); } var dumplicated = tcdmse.master_PaymentInfo.AsNoTracking().Where(p => p.PayName == dto.PayName && p.PayID != pp.PayID).FirstOrDefault(); if (dumplicated != null) { throw new Exception("付款条款不可同名!"); } dto.CreateTime = pp.CreateTime; dto.CreateUser = pp.CreateUser; Mapper.Map <PaymentOperateDTO, master_PaymentInfo>(dto, pp); result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 停/启用付款条款信息 /// </summary> /// <returns></returns> public bool StartOrStopPayment(PaymentOperateDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var pp = tcdmse.master_PaymentInfo.Where(p => p.PayID == dto.PayID).FirstOrDefault(); if (pp == null) { throw new Exception("此条信息不存在!"); } if (pp.PayStatus == null || pp.PayStatus == false) { pp.PayStatus = true; } else { pp.PayStatus = false; } pp.ModifyTime = dto.ModifyTime; pp.ModifyUser = dto.ModifyUser; result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 导入数据 /// </summary> /// <param name="impdto"></param> /// <returns></returns> public bool ImportData(List <ExcelImportDataDTO> impdtolst) { bool blResult = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { foreach (var p in impdtolst) { if (p is ExcelCustomerInfoDTO) { ExcelCustomerInfoDTO exrdt = p as ExcelCustomerInfoDTO; if (exrdt.UpLogic == 2) { var pp = tcdmse.master_CustomerInfo.Where(m => m.CustomerID == exrdt.CustomerID).FirstOrDefault(); pp.master_DistributorInfo = tcdmse.master_DistributorInfo.FirstOrDefault(g => g.DistributorName == exrdt.DistributorName); pp.CustomerName = exrdt.CustomerName; pp.Province = exrdt.Province; pp.City = exrdt.City; pp.OracleNO = exrdt.OracleNO; pp.OracleName = exrdt.OracleName; pp.XSWNO = exrdt.XSWNO; pp.IsActive = true; pp.ModifyUser = exrdt.Importer; pp.ModifyTime = DateTime.Now; } else { master_CustomerInfo mprd = new master_CustomerInfo(); mprd.CustomerID = Guid.NewGuid(); mprd.master_DistributorInfo = tcdmse.master_DistributorInfo.FirstOrDefault(g => g.DistributorName == exrdt.DistributorName); mprd.CustomerName = exrdt.CustomerName; mprd.Province = exrdt.Province; mprd.City = exrdt.City; mprd.OracleNO = exrdt.OracleNO; mprd.OracleName = exrdt.OracleName; mprd.XSWNO = exrdt.XSWNO; mprd.IsActive = true; mprd.CreateUser = exrdt.Importer; mprd.CreateTime = DateTime.Now; tcdmse.master_CustomerInfo.Add(mprd); // 记录日志 this.AddLog(tcdmse, new LogData { CurrentLogType = LogType.IMPORT, LogDetails = "导入客户" + exrdt.CustomerName, OpratorName = exrdt.Importer }); } } } blResult = tcdmse.SaveChanges() > 0; } return(blResult); }
/// <summary> /// 新增汇率信息 /// </summary> /// <returns></returns> public bool AddRate(RateOperateDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var newitem = new master_RateInfo(); newitem = Mapper.Map <RateOperateDTO, master_RateInfo>(dto); tcdmse.master_RateInfo.Add(newitem); result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 新增用户统计 /// </summary> /// <returns></returns> public bool AddUsersStat(UsersStatOperateDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var newitem = new master_UsersStat(); newitem = Mapper.Map <UsersStatOperateDTO, master_UsersStat>(dto); tcdmse.master_UsersStat.Add(newitem); result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 新增短信 /// </summary> /// <returns></returns> public bool AddMessageStat(List <MessageOperateDTO> dtolist) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var newitemlist = new List <master_MessageStat>(); newitemlist = Mapper.Map <List <MessageOperateDTO>, List <master_MessageStat> >(dtolist); tcdmse.master_MessageStat.AddRange(newitemlist); result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 删除关账日信息 /// </summary> /// <returns></returns> public bool DeleteAccountDate(AccountDateSearchDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var pp = tcdmse.master_AccountDateInfo.Where(p => p.AccountDateID == dto.AccountDateID).FirstOrDefault(); if (pp == null) { throw new Exception("此条信息不存在!"); } tcdmse.master_AccountDateInfo.Remove(pp); result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 删除用户统计信息 /// </summary> /// <returns></returns> public bool DeleteUsersStat(UsersStatResultDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var pp = tcdmse.master_UsersStat.Where(p => p.UsersStatID == dto.UsersStatID).FirstOrDefault(); if (pp == null) { throw new Exception("此条信息不存在!"); } tcdmse.master_UsersStat.Remove(pp); result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 客户信息审核成功 /// </summary> /// <param name="dto"></param> /// <returns></returns> public bool CustomerAuditSuccess(CustomerAuditOperateDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var pp = tcdmse.master_CustomerApplyInfo.Where(p => p.CustomerApplyID == dto.CustomerApplyID).FirstOrDefault(); if (pp == null) { throw new Exception("此条申请信息不存在!"); } pp.Auditor = dto.Auditor; pp.AuditReason = null; pp.AuditTime = dto.AuditTime; pp.ModifyTime = dto.ModifyTime; pp.ModifyUser = dto.ModifyUser; pp.Status = dto.Status; master_CustomerInfo newitem = new master_CustomerInfo() { City = pp.City, Country = pp.Country, CreateTime = dto.ModifyTime, CreateUser = dto.ModifyUser, CustomerID = pp.CustomerApplyID, CustomerName = pp.CustomerName, DistributorID = pp.DistributorID, IsActive = true, Province = pp.Province, }; tcdmse.master_CustomerInfo.Add(newitem); // 记录日志 this.AddLog(tcdmse, new LogData { CurrentLogType = LogType.ADD, LogDetails = "新增客户" + newitem.CustomerName, OpratorName = newitem.CreateUser }); result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 修改运维管理员邮箱 /// </summary> /// <param name="dto"></param> /// <returns></returns> public bool UpdateOperationInfo(OperationOperateDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var pp = tcdmse.master_UserInfo.Where(p => p.UserID == dto.UserID).FirstOrDefault(); if (pp == null) { throw new Exception("此条信息不存在!"); } pp.Email = dto.Email; pp.ModifyTime = dto.ModifyTime; pp.ModifyUser = dto.ModifyUser; result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 运输方式停/启用 /// </summary> /// <returns></returns> public bool StopEnableTransport(TransportOperateDTO dto) { bool blResult = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var pp = tcdmse.master_TransportInfo.Where(p => p.TransportID == dto.TransportID).FirstOrDefault(); if (pp != null) { pp.TransportStatus = dto.TransportStatus; pp.ModifyUser = dto.ModifyUser; pp.ModifyTime = dto.ModifyTime; } blResult = tcdmse.SaveChanges() > 0; } return(blResult); }
/// <summary> /// 修改汇率信息 /// </summary> /// <returns></returns> public bool UpdateRate(RateOperateDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var pp = tcdmse.master_RateInfo.Where(p => p.RateID == dto.RateID).FirstOrDefault(); if (pp == null) { throw new Exception("此条信息不存在!"); } dto.CreateTime = pp.CreateTime; dto.CreateUser = pp.CreateUser; Mapper.Map <RateOperateDTO, master_RateInfo>(dto, pp); result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 新增客户信息 /// </summary> /// <param name="dto"></param> /// <returns></returns> public bool AddCustomer(CustomerOperateDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { master_CustomerInfo newitem = new master_CustomerInfo(); Mapper.Map <CustomerOperateDTO, master_CustomerInfo>(dto, newitem); tcdmse.master_CustomerInfo.Add(newitem); // 记录日志 this.AddLog(tcdmse, new LogData { CurrentLogType = LogType.ADD, LogDetails = "新增客户" + dto.CustomerName, OpratorName = dto.CreateUser }); result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 客户信息审核失败 /// </summary> /// <param name="dto"></param> /// <returns></returns> public bool CustomerAuditFail(CustomerAuditOperateDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var pp = tcdmse.master_CustomerApplyInfo.Where(p => p.CustomerApplyID == dto.CustomerApplyID).FirstOrDefault(); if (pp == null) { throw new Exception("此条申请信息不存在!"); } pp.Auditor = dto.Auditor; pp.AuditTime = dto.AuditTime; pp.AuditReason = dto.AuditReason; pp.ModifyTime = dto.ModifyTime; pp.ModifyUser = dto.ModifyUser; pp.Status = dto.Status; result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 删除付款条款信息 /// </summary> /// <returns></returns> public bool DeletePayment(PaymentSearchDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var pp = tcdmse.master_PaymentInfo.Where(p => p.PayID == dto.PayID).FirstOrDefault(); if (pp == null) { throw new Exception("此条信息不存在!"); } tcdmse.master_PaymentInfo.Remove(pp); // 记录日志 this.AddLog(tcdmse, new LogData { CurrentLogType = LogType.DELETE, LogDetails = "删除付款条款" + pp.PayName, OpratorName = dto.ModifyUser }); result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// 修改关账日信息 /// </summary> /// <returns></returns> public bool UpdateAccountDate(AccountDateOperateDTO dto) { bool result = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { var pp = tcdmse.master_AccountDateInfo.Where(p => p.AccountDateID == dto.AccountDateID).FirstOrDefault(); if (pp == null) { throw new Exception("此条信息不存在!"); } var qq = tcdmse.master_AccountDateInfo.Where(p => p.AccountDateID != dto.AccountDateID && p.AccountDateYear == dto.AccountDateYear && p.AccountDateBelongModel == dto.AccountDateBelongModel).FirstOrDefault(); if (qq != null) { throw new Exception("年份及模块不可重复!"); } dto.CreateTime = pp.CreateTime; dto.CreateUser = pp.CreateUser; Mapper.Map <AccountDateOperateDTO, master_AccountDateInfo>(dto, pp); result = tcdmse.SaveChanges() > 0; } return(result); }
/// <summary> /// //导入关帐日数据 /// </summary> /// <param name="impdtolst"></param> /// <returns></returns> public bool ImportData(List <ExcelImportDataDTO> impdtolst) { bool blResult = false; using (var tcdmse = new Entities.TCDMS_MasterDataEntities()) { foreach (var p in impdtolst) { if (p is ExclCloseDataDTO)//判断是否是关帐日信息 { ExclCloseDataDTO exrdt = p as ExclCloseDataDTO; exrdt.AccountDateBelongModellist.ForEach(f => { master_AccountDateInfo mprd = new master_AccountDateInfo(); mprd.AccountDateName = exrdt.AccountDateName; mprd.AccountDateYear = Convert.ToInt16(exrdt.AccountDateYear); mprd.AccountDatePlace = exrdt.AccountDatePlace; //判断每个字符串传过来的值是否为空,如果为空,则当月日期为空。 if (!string.IsNullOrEmpty(exrdt.MonthDate))//一月 { mprd.MonthDate = Convert.ToDateTime(exrdt.MonthDate); } else { mprd.MonthDate = null; } if (!string.IsNullOrEmpty(exrdt.FebDate))//二月 { mprd.FebDate = Convert.ToDateTime(exrdt.FebDate); } else { mprd.FebDate = null; } if (!string.IsNullOrEmpty(exrdt.MarchDate))//三月 { mprd.MarchDate = Convert.ToDateTime(exrdt.MarchDate); } else { mprd.MarchDate = null; } if (!string.IsNullOrEmpty(exrdt.AprilDate))//四月 { mprd.AprilDate = Convert.ToDateTime(exrdt.AprilDate); } else { mprd.AprilDate = null; } if (!string.IsNullOrEmpty(exrdt.MayDate))//五月 { mprd.MayDate = Convert.ToDateTime(exrdt.MayDate); } else { mprd.MayDate = null; } if (!string.IsNullOrEmpty(exrdt.JuneDate))//六月 { mprd.JuneDate = Convert.ToDateTime(exrdt.JuneDate); } else { mprd.JuneDate = null; } if (!string.IsNullOrEmpty(exrdt.JulyDate))//七月 { mprd.JulyDate = Convert.ToDateTime(exrdt.JulyDate); } else { mprd.JulyDate = null; } if (!string.IsNullOrEmpty(exrdt.AugustDate))//八月 { mprd.AugustDate = Convert.ToDateTime(exrdt.AugustDate); } else { mprd.AugustDate = null; } if (!string.IsNullOrEmpty(exrdt.SepDate))//九月 { mprd.SepDate = Convert.ToDateTime(exrdt.SepDate); } else { mprd.SepDate = null; } if (!string.IsNullOrEmpty(exrdt.OctDate))//十月 { mprd.OctDate = Convert.ToDateTime(exrdt.OctDate); } else { mprd.OctDate = null; } if (!string.IsNullOrEmpty(exrdt.NovDate))//十一月 { mprd.NovDate = Convert.ToDateTime(exrdt.NovDate); } else { mprd.NovDate = null; } if (!string.IsNullOrEmpty(exrdt.DecDate))//十二月 { mprd.DecDate = Convert.ToDateTime(exrdt.DecDate); } else { mprd.DecDate = null; } mprd.CreateUser = p.Importer; mprd.CreateTime = DateTime.Now; mprd.ModifyTime = DateTime.Now; mprd.ModifyUser = p.Importer; mprd.AccountDateBelongModel = f; tcdmse.master_AccountDateInfo.Add(mprd); }); } } blResult = tcdmse.SaveChanges() > 0; } return(blResult); }