예제 #1
0
        /// <summary>
        /// 授权经销商授权产品线区域
        /// </summary>
        /// <returns></returns>
        public static ResultData <object> DistributorProductLineRegionAuthority(DistributorAuthorityModel dto)
        {
            ResultData <object>            result = null;
            DistributorAuthorityOperateDTO disdto = new DistributorAuthorityOperateDTO();

            disdto = dto;
            disdto.ProductLineRegion = new List <DistributorProductLineOperateDTO>();
            DistributorProductLineOperateDTO dp = new DistributorProductLineOperateDTO();

            dp.DistributorProductLineID = dto.DistributorProductLineID.Value;
            dp.Regionlist = new List <DistributorRegionOperateDTO>();
            disdto.ProductLineRegion.Add(dp);
            var ass = dto.AuthorityRegion.Split('|').ToList();

            ass.ForEach(f => {
                if (f != "")
                {
                    DistributorRegionOperateDTO dr = new DistributorRegionOperateDTO();
                    var s         = f.Split(',').ToList();
                    dr.RegionID   = int.Parse(s[0]);
                    dr.DistrictID = int.Parse(s[1]);
                    dp.Regionlist.Add(dr);
                }
            });

            result = PostAPI <ResultData <object> >(WebConfiger.MasterDataServicesUrl + "DistributorAuthority", disdto);

            return(result);
        }
예제 #2
0
        /// <summary>
        /// 删除经销商产品线区域
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public bool DeleteDistributorProductLineRegionAuthority(DistributorAuthorityOperateDTO dto)
        {
            bool blResult = false;

            using (var tcdmse = new Entities.TCDMS_MasterDataEntities())
            {
                var qq = tcdmse.master_DistributorRegionInfo.Where(p => p.DistributorRegionID == dto.DistributorRegionID).FirstOrDefault();

                var mm = qq.master_DistributorProductLineInfo.master_DistributorInfo.DistributorName;
                var ww = tcdmse.dict_RegionInfo.Where(w => w.RegionID == qq.RegionID).Select(s => s.RegionName).FirstOrDefault();

                tcdmse.master_DistributorRegionInfo.Remove(qq);

                // 记录日志
                this.AddLog(tcdmse, new LogData
                {
                    CurrentLogType = LogType.DELETE,
                    LogDetails     = "删除授权区域 经销商:" + mm + "授权区域:" + ww,
                    OpratorName    = dto.ModifyUser
                });

                blResult = tcdmse.SaveChanges() > 0;
            }

            return(blResult);
        }
        public HttpResponseMessage UpdataDistributorAuthority(DistributorAuthorityOperateDTO dto)
        {
            ResultDTO <object> actionresult = new ResultDTO <object>();

            try
            {
                switch (dto.UpType)
                {
                case 1:    //经销商订货权限
                    actionresult.SubmitResult = _IDistributorServices.DistributorOrderGoodsAuthority(dto);
                    break;
                }
            }
            catch (Exception e)
            {
                actionresult.SubmitResult = false;
                actionresult.Message      = e.Message;
            }

            HttpResponseMessage result = new HttpResponseMessage
            {
                Content = new StringContent(JsonConvert.SerializeObject(actionresult),
                                            System.Text.Encoding.GetEncoding("UTF-8"),
                                            "application/json")
            };

            return(result);
        }
예제 #4
0
        /// <summary>
        /// 删除经销商运输方式
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public bool DeleteDistributorTransportAuthority(DistributorAuthorityOperateDTO dto)
        {
            bool blResult = false;

            using (var tcdmse = new Entities.TCDMS_MasterDataEntities())
            {
                var qq = tcdmse.master_DistributorTransport.Where(p => p.DistributorTransportID == dto.DistributorTransportID).FirstOrDefault();

                var mm = qq.master_DistributorInfo.DistributorName;
                var ww = qq.master_TransportInfo.TransportName;

                tcdmse.master_DistributorTransport.Remove(qq);

                // 记录日志
                this.AddLog(tcdmse, new LogData
                {
                    CurrentLogType = LogType.DELETE,
                    LogDetails     = "删除授权运输方式 经销商:" + mm + "授权运输方式:" + ww,
                    OpratorName    = dto.ModifyUser
                });

                blResult = tcdmse.SaveChanges() > 0;
            }

            return(blResult);
        }
예제 #5
0
        /// <summary>
        /// 授权经销商产品线
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public bool DistributorProductLineAuthority(DistributorAuthorityOperateDTO dto)
        {
            bool blResult = false;

            using (var tcdmse = new Entities.TCDMS_MasterDataEntities())
            {
                var pp = tcdmse.master_DistributorInfo.Where(p => p.DistributorID == dto.DistributorID).FirstOrDefault();
                if (pp == null)
                {
                    throw new Exception("该经销商已不存在");
                }
                foreach (var line in dto.ProductLineRegion)
                {
                    master_DistributorProductLineInfo displine = new master_DistributorProductLineInfo();
                    displine.DistributorID = pp.DistributorID;
                    displine.ProductLineID = line.ProductLineID;
                    tcdmse.master_DistributorProductLineInfo.Add(displine);

                    var qq = tcdmse.master_ProductLine.Where(q => q.ProductLineID == line.ProductLineID).Select(s => s.ProductLineName).FirstOrDefault();
                    // 记录日志
                    this.AddLog(tcdmse, new LogData
                    {
                        CurrentLogType = LogType.ADD,
                        LogDetails     = "经销商授权 经销商:" + pp.DistributorName + "授权产品线:" + qq,
                        OpratorName    = dto.CreateUser
                    });
                }

                blResult = tcdmse.SaveChanges() > 0;
            }

            return(blResult);
        }
예제 #6
0
        /// <summary>
        /// 删除经销商信息
        /// </summary>
        /// <returns></returns>
        public static ResultData <object> DeleteDistributorAuthority(DistributorAuthorityOperateDTO dto)
        {
            ResultData <object> result = null;

            result = DeleteAPI <ResultData <object> >(WebConfiger.MasterDataServicesUrl + "DistributorAuthority?DistributorAuthorityOperateDTO=" + TransformHelper.ConvertDTOTOBase64JsonString(dto));

            return(result);
        }
예제 #7
0
        /// <summary>
        /// 修改经销商授权
        /// </summary>
        /// <returns></returns>
        public static ResultData <object> UpdataDistributorAuthority(DistributorAuthorityOperateDTO dto)
        {
            ResultData <object> result = null;

            result = PutAPI <ResultData <object> >(WebConfiger.MasterDataServicesUrl + "DistributorAuthority", dto);

            return(result);
        }
예제 #8
0
        /// <summary>
        /// 授权经销商付款条款
        /// </summary>
        /// <returns></returns>
        public static ResultData <object> DistributorPayAuthority(DistributorAuthorityModel dto)
        {
            ResultData <object>            result = null;
            DistributorAuthorityOperateDTO disdto = new DistributorAuthorityOperateDTO();

            disdto           = dto;
            disdto.PayIDlist = dto.PayID;

            result = PostAPI <ResultData <object> >(WebConfiger.MasterDataServicesUrl + "DistributorAuthority", disdto);

            return(result);
        }
예제 #9
0
        /// <summary>
        /// 授权经销商运输方式
        /// </summary>
        /// <returns></returns>
        public static ResultData <object> DistributorTransportAuthority(DistributorAuthorityModel dto)
        {
            ResultData <object>            result = null;
            DistributorAuthorityOperateDTO disdto = new DistributorAuthorityOperateDTO();

            disdto = dto;
            disdto.TransportIDlist = new List <int>()
            {
                dto.TransportID.Value
            };

            result = PostAPI <ResultData <object> >(WebConfiger.MasterDataServicesUrl + "DistributorAuthority", disdto);

            return(result);
        }
예제 #10
0
        /// <summary>
        /// 授权经销商产品线
        /// </summary>
        /// <returns></returns>
        public static ResultData <object> DistributorProductLineAuthority(DistributorAuthorityModel dto)
        {
            ResultData <object>            result = null;
            DistributorAuthorityOperateDTO disdto = new DistributorAuthorityOperateDTO();

            disdto = dto;
            disdto.ProductLineRegion = new List <DistributorProductLineOperateDTO>()
            {
                new DistributorProductLineOperateDTO()
                {
                    ProductLineID = dto.ProductLineID.Value
                }
            };
            result = PostAPI <ResultData <object> >(WebConfiger.MasterDataServicesUrl + "DistributorAuthority", disdto);

            return(result);
        }
예제 #11
0
        /// <summary>
        /// 授权经销商订货权限
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public bool DistributorOrderGoodsAuthority(DistributorAuthorityOperateDTO dto)
        {
            bool blResult = false;

            using (var tcdmse = new Entities.TCDMS_MasterDataEntities())
            {
                var pp = tcdmse.master_DistributorInfo.Where(p => p.DistributorID == dto.DistributorID).FirstOrDefault();
                if (pp == null)
                {
                    throw new Exception("该经销商已不存在");
                }
                pp.IsOrderGoods = dto.IsOrderGoods;
                pp.ModifyTime   = dto.ModifyTime;
                pp.ModifyUser   = dto.ModifyUser;

                blResult = tcdmse.SaveChanges() > 0;
            }

            return(blResult);
        }
        public HttpResponseMessage DeleteDistributorAuthority(string DistributorAuthorityOperateDTO)
        {
            ResultDTO <object> actionresult = new ResultDTO <object>();

            try
            {
                DistributorAuthorityOperateDTO dto = TransformHelper.ConvertBase64JsonStringToDTO <DistributorAuthorityOperateDTO>(DistributorAuthorityOperateDTO);
                switch (dto.DelType)
                {
                case 1:    //删除经销商付款条款
                    actionresult.SubmitResult = _IDistributorServices.DeleteDistributorPayAuthority(dto);
                    break;

                case 2:    //删除经销商运输方式
                    actionresult.SubmitResult = _IDistributorServices.DeleteDistributorTransportAuthority(dto);
                    break;

                case 3:    //删除经销商产品线
                    actionresult.SubmitResult = _IDistributorServices.DeleteDistributorProductLineAuthority(dto);
                    break;

                case 4:    //删除经销商授权产品线区域
                    actionresult.SubmitResult = _IDistributorServices.DeleteDistributorProductLineRegionAuthority(dto);
                    break;
                }
            }
            catch (Exception e)
            {
                actionresult.SubmitResult = false;
                actionresult.Message      = e.Message;
            }

            HttpResponseMessage result = new HttpResponseMessage
            {
                Content = new StringContent(JsonConvert.SerializeObject(actionresult),
                                            System.Text.Encoding.GetEncoding("UTF-8"),
                                            "application/json")
            };

            return(result);
        }
예제 #13
0
        /// <summary>
        /// 授权经销商产品线区域
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public bool DistributorProductLineRegionAuthority(DistributorAuthorityOperateDTO dto)
        {
            bool blResult = false;

            using (var tcdmse = new Entities.TCDMS_MasterDataEntities())
            {
                var pp = tcdmse.master_AreaInfo.ToList();
                foreach (var line in dto.ProductLineRegion)
                {
                    foreach (var r in line.Regionlist)
                    {
                        master_DistributorRegionInfo dr = new master_DistributorRegionInfo();
                        dr.DistributorProductLineID = line.DistributorProductLineID;
                        dr.RegionID   = r.RegionID;
                        dr.DistrictID = r.DistrictID;
                        dr.AreaID     = pp.Where(p => p.AreaID == r.DistrictID).Select(s => s.AreaPID).FirstOrDefault();
                        dr.DepartID   = pp.Where(p => p.AreaID == dr.AreaID).Select(s => s.DepartID).FirstOrDefault();

                        tcdmse.master_DistributorRegionInfo.Add(dr);

                        var qq = tcdmse.master_DistributorProductLineInfo.Where(q => q.DistributorProductLineID == line.DistributorProductLineID).Select(s => s.master_DistributorInfo.DistributorName).FirstOrDefault();
                        var ww = tcdmse.dict_RegionInfo.Where(w => w.RegionID == r.RegionID).Select(s => s.RegionName).FirstOrDefault();
                        // 记录日志
                        this.AddLog(tcdmse, new LogData
                        {
                            CurrentLogType = LogType.ADD,
                            LogDetails     = "经销商授权 经销商:" + qq + "授权区域:" + ww,
                            OpratorName    = dto.CreateUser
                        });
                    }
                }

                blResult = tcdmse.SaveChanges() > 0;
            }

            return(blResult);
        }
예제 #14
0
        /// <summary>
        /// 授权经销商运输方式
        /// </summary>
        /// <param name="dto"></param>
        /// <returns></returns>
        public bool DistributorTransportAuthority(DistributorAuthorityOperateDTO dto)
        {
            bool blResult = false;

            using (var tcdmse = new Entities.TCDMS_MasterDataEntities())
            {
                var pp = tcdmse.master_DistributorInfo.Where(p => p.DistributorID == dto.DistributorID).FirstOrDefault();
                if (pp == null)
                {
                    throw new Exception("该经销商已不存在");
                }
                if (dto.TransportIDlist != null)
                {
                    foreach (var tra in dto.TransportIDlist)
                    {
                        master_DistributorTransport distar = new master_DistributorTransport();
                        distar.TransportID   = tra;
                        distar.DistributorID = pp.DistributorID;
                        tcdmse.master_DistributorTransport.Add(distar);

                        var qq = tcdmse.master_TransportInfo.Where(q => q.TransportID == tra).Select(s => s.TransportName).FirstOrDefault();
                        // 记录日志
                        this.AddLog(tcdmse, new LogData
                        {
                            CurrentLogType = LogType.ADD,
                            LogDetails     = "经销商授权 经销商:" + pp.DistributorName + "授权运输方式:" + qq,
                            OpratorName    = dto.CreateUser
                        });
                    }
                }

                blResult = tcdmse.SaveChanges() > 0;
            }

            return(blResult);
        }