Esempio n. 1
0
        private static PriceSetEntity TranslatePriceSetEntity(PriceSetInfo info)
        {
            PriceSetEntity entity = new PriceSetEntity();

            if (info != null)
            {
                entity.PriceSetID    = info.PriceSetID;
                entity.CustomerID    = info.CustomerID;
                entity.StorageID     = info.StorageID;
                entity.CarrierID     = info.CarrierID;
                entity.ReceivingType = info.ReceivingType;
                entity.ReceivingID   = info.ReceivingID;
                entity.TemType       = info.TemType;

                entity.configPrice       = info.configPrice;
                entity.configHandInAmt   = info.configHandInAmt;
                entity.configSortPrice   = info.configSortPrice;
                entity.configCosting     = info.configCosting;
                entity.configHandOutAmt  = info.configHandOutAmt;
                entity.configSortCosting = info.configSortCosting;

                entity.DeliveryModel = info.DeliveryModel;
                entity.Remark        = info.Remark;
                entity.Status        = info.Status;
                entity.CreateDate    = info.CreateDate;
                entity.ChangeDate    = info.ChangeDate;

                entity.customer = CustomerService.GetCustomerById(info.CustomerID);
                entity.storage  = StorageService.GetStorageEntityById(info.StorageID);
                entity.carrier  = CarrierService.GetCarrierById(info.CarrierID);
                entity.receiver = ReceiverService.GetReceiverById(info.ReceivingID);
                //if (!string.IsNullOrEmpty(entity.ReceivingType))
                //{
                //    if ("仓库".Equals(entity.ReceivingType))
                //    {
                //        StorageEntity sentity= StorageService.GetStorageEntityById(entity.ReceivingID);
                //        if (sentity != null)
                //        {
                //            entity.ReceivingName = sentity.StorageName;
                //        }
                //    }
                //    if ("门店".Equals(entity.ReceivingType))
                //    {
                //        StorageEntity sentity = StorageService.GetStorageEntityById(entity.ReceivingID);
                //        if (sentity != null)
                //        {
                //            entity.ReceivingName = sentity.StorageName;
                //        }
                //    }
                //}
            }

            return(entity);
        }
Esempio n. 2
0
        private static ReceiverEntity TranslateReceiverEntity(ReceiverInfo info, bool isRead = true)
        {
            ReceiverEntity entity = new ReceiverEntity();

            if (info != null)
            {
                entity.CustomerID       = info.CustomerID;
                entity.ReceiverType     = info.ReceiverType;
                entity.DefaultCarrierID = info.DefaultCarrierID;
                entity.DefaultStorageID = info.DefaultStorageID;
                entity.ProvinceID       = info.ProvinceID;
                entity.CityID           = info.CityID;
                entity.Address          = info.Address;
                entity.Remark           = info.Remark;

                entity.OperatorID   = info.OperatorID;
                entity.ReceiverName = info.ReceiverName;
                entity.ReceiverNo   = info.ReceiverNo;
                entity.Status       = info.Status;
                entity.CreateDate   = info.CreateDate;
                entity.ChangeDate   = info.ChangeDate;
                entity.ReceiverID   = info.ReceiverID;

                if (isRead)
                {
                    City     city     = BaseDataService.GetAllCity().FirstOrDefault(t => t.CityID == info.CityID) ?? new City();
                    Province province = BaseDataService.GetAllProvince().FirstOrDefault(t => t.ProvinceID == info.ProvinceID) ?? new Province();
                    entity.province = province;
                    entity.city     = city;
                    entity.customer = new CustomerEntity();
                    entity.customer = CustomerService.GetCustomerById(info.CustomerID);

                    CarrierEntity carrier = CarrierService.GetCarrierById(info.DefaultCarrierID);
                    entity.Carrier = carrier;

                    StorageEntity storage = StorageService.GetStorageEntityById(info.DefaultStorageID);
                    entity.Storage = storage;
                }
                //获取联系人信息
                entity.listContact = ContactService.GetContactByRule(UnionType.Receiver.ToString(), info.ReceiverID);
            }

            return(entity);
        }
Esempio n. 3
0
        public static void GetAllTest()
        {
            BaseDataRepository   mr          = new BaseDataRepository();
            DataSet              ds          = mr.GetAllTest();
            DataTable            dt          = ds.Tables[0];
            List <Province>      proList     = GetAllProvince();
            List <City>          cList       = GetAllCity();
            List <CarrierEntity> carrList    = CarrierService.GetCarrierAll();
            List <StorageEntity> storageList = StorageService.GetStorageAll();

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    //ReceiverRepository mrs = new ReceiverRepository();
                    //ReceiverInfo info = new ReceiverInfo();
                    //List<CustomerEntity> listCus = CustomerService.GetCustomerByRule(dr["客户名称"].ToString(), -1);
                    //if (listCus != null && listCus.Count > 0)
                    //{
                    //    info.CustomerID = listCus[0].CustomerID;
                    //}
                    //info.ReceiverName = dr["门店名称"].ToString();
                    //info.ReceiverNo = dr["门店编号"].ToString();
                    //info.Address = dr["门店地址"].ToString();
                    //Province pInfo = proList.Find(p => p.ProvinceName.Equals(dr["所属省份"].ToString().Replace("省", "").Replace("市", "")));
                    //info.ProvinceID = pInfo != null ? pInfo.ProvinceID : 0;
                    //info.ReceiverType = "门店";
                    //City cInfo = cList.Find(p => p.CityName.Equals(dr["所属市区"].ToString().Replace("市", "")));
                    //info.CityID = cInfo != null ? cInfo.CityID : 0;
                    //info.Address = dr["门店地址"].ToString();
                    //info.OperatorID = 1;
                    //info.Remark = dr["门店描述"].ToString();
                    //CarrierEntity centity = carrList.Find(p => p.CarrierShortName.Equals(dr["默认承运商简称"].ToString()));
                    //info.DefaultCarrierID = centity != null ? centity.CarrierID : 0;
                    //StorageEntity sEntity = storageList.Find(p => p.StorageName.Equals(dr["默认出库仓"]));
                    //info.DefaultStorageID = sEntity != null ? sEntity.StorageID : 0;
                    //info.Status = 1;
                    //info.CreateDate = DateTime.Now;
                    //info.ChangeDate = DateTime.Now;
                    //long id = mrs.CreateNew(info);

                    List <ReceiverEntity> list = ReceiverService.GetReceiverByRule(dr["门店名称"].ToString(), "", "", -1);
                    long id = list != null && list.Count > 0 ? list[0].ReceiverID : 0;

                    ContactRepository cr      = new ContactRepository();
                    ContactInfo       contact = new ContactInfo();
                    if (!string.IsNullOrEmpty(dr["联系人"].ToString()) || !string.IsNullOrEmpty(dr["联系方式"].ToString()))
                    {
                        contact.ContactName = dr["联系人"].ToString();
                        contact.Mobile      = dr["联系方式"].ToString();
                        contact.Telephone   = dr["联系方式"].ToString();
                        contact.Email       = "";
                        contact.Remark      = "";
                        contact.UnionType   = UnionType.Receiver.ToString();//客户
                        contact.UnionID     = id;
                        contact.CreateDate  = DateTime.Now;
                        contact.ChangeDate  = DateTime.Now;
                        cr.CreateNew(contact);
                    }
                }
            }
        }