Exemplo n.º 1
0
        public JsonResult Add(string clientId, string partnerId, string carrierId,
                                string partnerEDINo, string eDIDocCode, string eDIDocType, string directory,
                                string line, string entryName, string import, string importNote)
        {
            string result = string.Empty;
            int intValue;
            ClientService clientService = new ClientService();
            PartnerService partnerService = new PartnerService();
            try
            {
                ClientPartner clientPartner = new ClientPartner();

                Client queryClient = clientService.GetByClientId(clientId);
                if(queryClient != null)
                {
                    clientPartner.Client = unitOfWork.ClientRepository.GetByID(queryClient.Id);
                }

                clientPartner.CarrierId = carrierId != null ? carrierId : String.Empty;
                clientPartner.PartnerEDINo = partnerEDINo != null ? partnerEDINo : String.Empty;
                clientPartner.EDIDocCode = eDIDocCode != null ? eDIDocCode : String.Empty;
                clientPartner.EDIDocType = eDIDocType != null ? eDIDocType : String.Empty;
                clientPartner.Directory = directory != null ? directory : String.Empty;

                Partner queryPartner = partnerService.GetByPartnerId(partnerId);
                if (queryPartner != null)
                {
                    clientPartner.Partner = unitOfWork.PartnerRepository.GetByID(queryPartner.Id);
                }

                clientPartner.Line = Int32.TryParse(line, out intValue) ? intValue : 0;
                clientPartner.EntryName = entryName;
                clientPartner.Import = import;
                clientPartner.ImportNote = importNote;

                unitOfWork.ClientPartnerRepository.Insert(clientPartner);
                unitOfWork.Save();
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }

            return Json(result);
        }
Exemplo n.º 2
0
        public JsonResult Add(string partnerId, string partnerName, string storeId, string storeName,
                                  string addressLine1, string addressLine2, string city, string state,
                                  string postcode, string country, string comment1, string comment2, string comment3,
                                  string email,string phoneNo,string faxNo, string dCI_MyerStore, string receiverID2,
                                  string udf1, string udf2, string udf3, string udf4, string udf5,
                                  string udf6, string udf7, string udf8, string udf9, string udf10,
                                    string line, string entryName, string import, string importNote)
        {
            string result = string.Empty;

            int intValue;

            try
            {
                PartnerService partnerService = new PartnerService();
                PartnerStore partnerStore = new PartnerStore();
                Partner queryPartner = partnerService.GetByPartnerId(partnerId);
                if(queryPartner != null)
                {
                    partnerStore.Partner = unitOfWork.PartnerRepository.GetByID(queryPartner.Id);
                }

                partnerStore.StoreId = storeId;
                partnerStore.StoreName = storeName;
                partnerStore.AddressLine1 = addressLine1;
                partnerStore.AddressLine2 = addressLine2;
                partnerStore.City = city;
                partnerStore.State = state;
                partnerStore.Postcode = postcode;
                partnerStore.Country = country;
                partnerStore.Comment1 = comment1;
                partnerStore.Comment2 = comment2;
                partnerStore.Comment3 = comment3;
                partnerStore.Email = email;
                partnerStore.PhoneNo = phoneNo;
                partnerStore.FaxNo = faxNo;
                partnerStore.DCI_MyerStore = dCI_MyerStore;
                partnerStore.ReceiverID2 = receiverID2;
                partnerStore.Udf1 = udf1;
                partnerStore.Udf2 = udf2 ;
                partnerStore.Udf3 = udf3;
                partnerStore.Udf4 = udf4;
                partnerStore.Udf5 = udf5;
                partnerStore.Udf6 = udf6 != null ? Convert.ToDouble(udf6) : new Nullable<double>();
                partnerStore.Udf7 = udf7 != null ? Convert.ToDouble(udf7) : new Nullable<double>();
                partnerStore.Udf8 = udf8 != null ? Convert.ToDouble(udf8) : new Nullable<double>();
                partnerStore.Udf9 = udf9 != null ? Convert.ToDouble(udf9) : new Nullable<double>();
                partnerStore.Udf10 = udf10 != null ? Convert.ToDouble(udf10) : new Nullable<double>();
                partnerStore.Line = Int32.TryParse(line, out intValue) ? intValue : 0;
                partnerStore.EntryName = entryName;
                partnerStore.Import = import;
                partnerStore.ImportNote = importNote;

                unitOfWork.PartnerStoreRepository.Insert(partnerStore);
                unitOfWork.Save();
            }
            catch (Exception ex)
            {
                result = ex.Message;
            }

            return Json(result);
        }