Пример #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);
        }
Пример #2
0
        public ActionResult GetList(JQueryDataTableParamModel param)
        {
            PartnerService PartnerService = new PartnerService();

            var allPartners = PartnerService.GetAllExposeDto();

            IEnumerable<PartnerDto> filteredPartners;

            if (!string.IsNullOrEmpty(param.sSearch))
            {
                //Used if particulare columns are filtered
                var PartnerIdFilter = Convert.ToString(Request["sSearch_2"]);
                var PartnerNameFilter = Convert.ToString(Request["sSearch_3"]);

                //Optionally check whether the columns are searchable at all
                var isPartnerIdSearchable = Convert.ToBoolean(Request["bSearchable_2"]);
                var isPartnerNameSearchable = Convert.ToBoolean(Request["bSearchable_3"]);

                filteredPartners = allPartners
                   .Where(c => isPartnerIdSearchable && c.PartnerId != null && c.PartnerId.ToLower().Contains(param.sSearch.ToLower())
                            || isPartnerNameSearchable && c.PartnerName != null && c.PartnerName.ToLower().Contains(param.sSearch.ToLower()));
            }
            else
            {
                filteredPartners = allPartners;
            }

            var isPartnerIdSortable = Convert.ToBoolean(Request["bSortable_1"]);
            var sortColumnIndex = Convert.ToInt32(Request["iSortCol_0"]);
            Func<PartnerDto, string> orderingFunction = (c => sortColumnIndex == 1 && isPartnerIdSortable ? c.PartnerId.ToString() :
                                                          "");

            var sortDirection = Request["sSortDir_0"]; // asc or desc
            if (sortDirection == "asc")
                filteredPartners = filteredPartners.OrderBy(orderingFunction);
            else
                filteredPartners = filteredPartners.OrderByDescending(orderingFunction);

            IEnumerable<PartnerDto> displayedPartners;

            if (param.iDisplayLength != -1)
                displayedPartners = filteredPartners.Skip(param.iDisplayStart).Take(param.iDisplayLength);
            else
                displayedPartners = filteredPartners;

            var result = from c in displayedPartners
                         select new[]
                              {
                                  c.Id.ToString(),
                                  c.IsActive,
                                  c.PartnerId,
                                  c.PartnerName,
                                  c.AddressLine1,
                                  c.AddressLine2,
                                  c.City,
                                  c.State,
                                  c.Postcode,
                                  c.Contact,
                                  c.Phone,
                                  c.Fax,
                                  c.SupplierNo
                              };
            return Json(new
            {
                sEcho = param.sEcho,
                iTotalRecords = allPartners.Count(),
                iTotalDisplayRecords = filteredPartners.Count(),
                aaData = result
            },
                        JsonRequestBehavior.AllowGet);
        }
Пример #3
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);
        }
Пример #4
0
        public ActionResult Index()
        {
            ClientService clientService = new ClientService();
            PartnerService partnerService = new PartnerService();

            ClientPartnerModel model = new ClientPartnerModel();
            model.Clients = clientService.GetAllExposeDto().ToList();
            model.Partners = partnerService.GetAllExposeDto().ToList();
            return View(model);
        }