public ActionResult _Index1(SupplierSearch supplierSearch, int?page)
        {
            int TotalCount  = 0;
            var pageSize    = 10;
            var pageNumber  = page ?? 1;
            int CurrentPage = pageNumber;
            int endPage     = CurrentPage + 4;
            int PagesToShow = 10;

            ViewBag.TotalCount = TotalCount;
            ViewBag.PageSize   = pageSize;
            var body = JsonConvert.SerializeObject(supplierSearch);
            var SupplierModelList = Services.SupplierService.GetSearchData(supplierSearch, page, out TotalCount);

            foreach (var date in SupplierModelList)
            {
                var str = date.RegistrationDate;
                if (!string.IsNullOrEmpty(str))
                {
                    str = str.Substring(0, str.Length - 9);
                    date.RegistrationDate = str;
                }
            }
            var result     = CommonFunction.GetPages(TotalCount, pageSize, CurrentPage, PagesToShow);
            int totalPages = (TotalCount / pageSize) + (TotalCount % pageSize == 0 ? 0 : 1);

            ViewBag.result      = result;
            ViewBag.totalPages  = totalPages;
            ViewBag.CurrentPage = CurrentPage;
            var pageCount = result.Count();

            ViewBag.pageCount = pageCount;
            ViewBag.endPage   = endPage;
            return(View(SupplierModelList));
        }
Esempio n. 2
0
        public static DataSet SupplierProductSearch(SupplierSearch suppliersearch)
        {
            var paramList = new List <ParameterValue>
            {
                new ParameterValue("StartDate", suppliersearch.StartDate),
                new ParameterValue("EndDate", suppliersearch.EndDate),
                new ParameterValue("Archive", suppliersearch.Supplier.Archive ? 1 : 0)
            };

            if (!String.IsNullOrEmpty(suppliersearch.Requester.RequesterID.ToString()))
            {
                paramList.Add(new ParameterValue("RequesterID", suppliersearch.Requester.RequesterID));
            }

            if (!String.IsNullOrEmpty(suppliersearch.Supplier.SupplierName))
            {
                paramList.Add(new ParameterValue("SupplierName", suppliersearch.Supplier.SupplierName));
            }
            if (!String.IsNullOrEmpty(suppliersearch.Supplier.MasterDataStatus))
            {
                paramList.Add(new ParameterValue("MasterDataStatus", suppliersearch.Supplier.MasterDataStatus));
            }
            if (!String.IsNullOrEmpty(suppliersearch.Supplier.Province))
            {
                paramList.Add(new ParameterValue("Province", suppliersearch.Supplier.Province));
            }
            if (!String.IsNullOrEmpty(suppliersearch.Requester.RequesterName))
            {
                paramList.Add(new ParameterValue("RequesterName", suppliersearch.Requester.RequesterName));
            }
            return(DataFacade.GetDataSet("SupplierProductSearch", paramList.ToArray()));
        }
Esempio n. 3
0
        public void Test_Find()
        {
            #region Arrange
            //Add code to create required resources
            #endregion Arrange

            var testKeyMark = TestUtils.RandomString();

            ISupplierConnector connector = new SupplierConnector();
            var newSupplier = new Supplier()
            {
                Name        = "TestSupplier",
                Address1    = "TestStreet 1",
                Address2    = "TestStreet 2",
                ZipCode     = "01010",
                City        = testKeyMark,
                CountryCode = "SE", //CountryCode needs to be valid
                Email       = "*****@*****.**",
                Active      = false,
                Bank        = "TestBank",
                Currency    = "SEK",
                Phone1      = "01011111345",
            };

            //Add entries
            for (var i = 0; i < 5; i++)
            {
                connector.Create(newSupplier);
            }

            //Apply base test filter
            var searchSettings = new SupplierSearch();
            searchSettings.City = testKeyMark;
            var fullCollection = connector.Find(searchSettings);

            Assert.AreEqual(5, fullCollection.TotalResources);
            Assert.AreEqual(5, fullCollection.Entities.Count);
            Assert.AreEqual(1, fullCollection.TotalPages);
            Assert.AreEqual(testKeyMark, fullCollection.Entities.First().City);

            //Apply Limit
            searchSettings.Limit = 2;
            var limitedCollection = connector.Find(searchSettings);

            Assert.AreEqual(5, limitedCollection.TotalResources);
            Assert.AreEqual(2, limitedCollection.Entities.Count);
            Assert.AreEqual(3, limitedCollection.TotalPages);

            //Delete entries
            foreach (var entry in fullCollection.Entities)
            {
                connector.Delete(entry.SupplierNumber);
            }

            #region Delete arranged resources
            //Add code to delete temporary resources
            #endregion Delete arranged resources
        }
Esempio n. 4
0
 public ActionResult GetPage(SupplierSearch condition)
 {
     string where = string.Empty;
     if (!string.IsNullOrWhiteSpace(condition.keyword))
     {
         where += string.Format(" and (Name like '%{0}%' or Address like '%{0}%' or Phone like '%{0}%' or Card like '%{0}%' )", condition.keyword);
     }
     return(GetPages(condition, where));
 }
Esempio n. 5
0
        public static IEnumerable <SupplierSearch> Search(SupplierSearch suppliersearch)
        {
            var paramList = new List <ParameterValue>
            {
                new ParameterValue("StartDate", suppliersearch.StartDate),
                new ParameterValue("EndDate", suppliersearch.EndDate),
                new ParameterValue("Archive", suppliersearch.Supplier.Archive ? 1 : 0)
            };

            if (!String.IsNullOrEmpty(suppliersearch.Supplier.SupplierName))
            {
                paramList.Add(new ParameterValue("SupplierName", suppliersearch.Supplier.SupplierName));
            }
            if (!String.IsNullOrEmpty(suppliersearch.Supplier.MasterDataStatus))
            {
                paramList.Add(new ParameterValue("MasterDataStatus", suppliersearch.Supplier.MasterDataStatus));
            }
            if (!String.IsNullOrEmpty(suppliersearch.Supplier.Province))
            {
                paramList.Add(new ParameterValue("Province", suppliersearch.Supplier.Province));
            }
            if (!String.IsNullOrEmpty(suppliersearch.Requester.RequesterName))
            {
                paramList.Add(new ParameterValue("RequesterName", suppliersearch.Requester.RequesterName));
            }

            var dataTable = DataFacade.GetDataTable("SupplierMasterDataSearch",
                                                    paramList.ToArray());


            return((from DataRow r in dataTable.Rows
                    select new SupplierSearch
            {
                Supplier = new Supplier
                {
                    SupplierName = r["SupplierName"].ToString(),
                    Province = r["Province"].ToString(),
                    SupplierSpecialistStatus = r["SupplierSpecialistStatus"].ToString(),
                    CategoryManager = r["AssignedCategoryManager"].ToString(),
                    MasterDataComment = r["MasterDataComment"].ToString(),
                    MasterDataStatusDate = (DateTime)r["MasterDataStatusDate"],
                    MasterDataStatus = r["MasterDataStatus"].ToString(),
                    RequesterID = (int)r["RequesterID"],
                    SupplierID = (int)r["SupplierID"]
                },
                Requester = new Requester
                {
                    RequestDate = (DateTime)r["RequestDate"],
                    Motivation = r["Motivation"].ToString(),
                    RequesterName = r["RequesterName"].ToString(),
                }
            }).ToList());
        }
Esempio n. 6
0
        private ActionResult GetPages(SupplierSearch condition, string where)
        {
            PageJsonModel <Supplier> page = new PageJsonModel <Supplier>();

            page.pageIndex = condition.pageIndex;
            page.pageSize  = condition.pageSize;
            page.strForm   = "Supplier";
            page.strSelect = " * ";
            page.strWhere  = where;
            page.strOrder  = "ID desc";
            page.LoadList();
            return(Json(page.pageResponse, JsonRequestBehavior.AllowGet));
        }
Esempio n. 7
0
        public ActionResult ExportExcel(SupplierSearch condition)
        {
            StringBuilder where = new StringBuilder();
            where.Append("select Name,Address,Phone,Card,B_Name,AddTime from [Supplier] where 1=1 ");
            if (!string.IsNullOrWhiteSpace(condition.keyword))
            {
                where.Append(string.Format(" and (Name like '%{0}%' or Address like '%{0}%' or Phone like '%{0}%' or Card like '%{0}%')", condition.keyword));
            }
            DataTable dt = ExportWay.ExcelDataTable(where.ToString());

            string[] list = { "供应商", " 所属地区", "手机号", "身份证号", "添加人", "添加时间" };
            return(File(ExportWay.GetExcel(dt, list), "application/vnd.ms-excel", "供应商信息" + DateTime.Now.ToShortTimeString() + ".xls"));
        }
Esempio n. 8
0
        public List <SupplierModel> GetSearchData(SupplierSearch supplierSearch, int?page, out int TotalCount)
        {
            //int pageSize = 10;
            int pageNumber = (page ?? 1);
            var body       = JsonConvert.SerializeObject(supplierSearch);
            var result     = ServerResponse.Invoke <ServiceResult <List <SupplierModel> > >("api/supplier/getSearchData", body, "Post");

            TotalCount = result.TotalCount;
            if (result.data != null)
            {
                var model = result.data.ToList();
                return(model);
            }
            else
            {
            }
            return(result.data.ToList());
        }
    private void GenerateReport()
    {
        try
        {
            DataSet        dsSupplierReport = new DataSet();
            SupplierSearch supSearch        = new SupplierSearch();
            supSearch.FromDate = dtpFromDate.Date;
            supSearch.ToDate   = dtpToDate.Date;
            supSearch.Sup_Id   = Int32.Parse(ddlSupplier.SelectedValue.ToString());
            dsSupplierReport   = new SupplierDAO().SelectSupplierRelatedExpences(supSearch);

            Session["SupPayReport"] = dsSupplierReport;

            dxgvSupplierPaymentReport.DataSource = dsSupplierReport;
            dxgvSupplierPaymentReport.DataBind();
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Esempio n. 10
0
 public IEnumerable <SupplierSearch> Search(SupplierSearch suppliersearch)
 {
     return(SupplierMasterDataDao.Search(suppliersearch));
 }
Esempio n. 11
0
 public DataSet SupplierProductSearch(SupplierSearch suppliersearch)
 {
     return(SupplierDao.SupplierProductSearch(suppliersearch));
 }
Esempio n. 12
0
 public DataSet ExportToExcel(SupplierSearch suppliersearch)
 {
     return(SupplierDao.ExportToExcel(suppliersearch));
 }
Esempio n. 13
0
        public static IEnumerable <SupplierSearch> Search(SupplierSearch suppliersearch)
        {
            var paramList = new List <ParameterValue>
            {
                new ParameterValue("StartDate", suppliersearch.StartDate),
                new ParameterValue("EndDate", suppliersearch.EndDate),
                new ParameterValue("Archive", suppliersearch.Supplier.Archive ? 1 : 0)
            };

            if (!String.IsNullOrEmpty(suppliersearch.Requester.RequesterID.ToString()))
            {
                paramList.Add(new ParameterValue("RequesterID", suppliersearch.Requester.RequesterID));
            }

            if (!String.IsNullOrEmpty(suppliersearch.Supplier.SupplierName))
            {
                paramList.Add(new ParameterValue("SupplierName", suppliersearch.Supplier.SupplierName));
            }
            if (!String.IsNullOrEmpty(suppliersearch.Supplier.MasterDataStatus))
            {
                paramList.Add(new ParameterValue("MasterDataStatus", suppliersearch.Supplier.MasterDataStatus));
            }
            if (!String.IsNullOrEmpty(suppliersearch.Supplier.Province))
            {
                paramList.Add(new ParameterValue("Province", suppliersearch.Supplier.Province));
            }
            if (!String.IsNullOrEmpty(suppliersearch.Requester.RequesterName))
            {
                paramList.Add(new ParameterValue("RequesterName", suppliersearch.Requester.RequesterName));
            }

            var dataTable = DataFacade.GetDataTable("SupplierSearch",
                                                    paramList.ToArray());

            //null approved date
            DateTime?nullDate;

            nullDate = null;

            return((from DataRow r in dataTable.Rows
                    select new SupplierSearch
            {
                Supplier = new Supplier
                {
                    SupplierName = r["SupplierName"].ToString(),
                    Province = r["Province"].ToString(),
                    SupplierSpecialistStatus = r["SupplierSpecialistStatus"].ToString(),
                    CategoryManager = r["CategoryManager"].ToString(),
                    MasterDataComment = r["MasterDataComment"].ToString(),
                    MasterDataStatusDate = !String.IsNullOrEmpty(r["MasterDataStatusDate"].ToString()) ? Convert.ToDateTime(r["MasterDataStatusDate"]) : nullDate,
                    MasterDataStatus = r["MasterDataStatus"].ToString(),
                    CategoryManagerStatus = r["CategoryManagerStatus"].ToString(),
                    SupplierID = (int)r["SupplierID"],
                    Archive = Convert.ToBoolean(r["Archive"].ToString())
                },
                Requester = new Requester
                {
                    RequestDate = Convert.ToDateTime(r["RequestDate"]),
                    Motivation = r["Motivation"].ToString(),
                    RequesterName = r["RequesterName"].ToString(),
                    RequesterID = (int)r["RequesterID"],
                    ContactNo = r["ContactNo"].ToString(),
                    EmailAddress = r["EmailAddress"].ToString(),
                    SiteName = r["SiteName"].ToString(),
                    SiteNumber = r["SiteNumber"].ToString()
                }
            }).ToList());
        }
        public ServiceResult <List <Supplier> > GetSearchData(SupplierSearch supplierSearch)

        {
            ServiceResult <List <Supplier> > model = new ServiceResult <List <Supplier> >();
            var source   = db.Suppliers.Where(x => x.IsActive == true);
            var pageSize = 10;

            if (supplierSearch != null)
            {
                if (supplierSearch.IsActive == false)
                {
                    source = db.Suppliers.Where(n => n.IsActive == false);
                }
                if (!string.IsNullOrEmpty(supplierSearch.Name))
                {
                    source = source.Where(x => x.Name.ToLower().Contains(supplierSearch.Name.ToLower()));
                }
                if (!string.IsNullOrEmpty(supplierSearch.ContactNumber))
                {
                    source = source.Where(x => x.ContactNumber.ToLower().Contains(supplierSearch.ContactNumber.ToLower()));
                }
                if (!string.IsNullOrEmpty(supplierSearch.Code))
                {
                    source = source.Where(x => x.Code.ToLower().Contains(supplierSearch.Code.ToLower()));
                }
                if (!string.IsNullOrEmpty(supplierSearch.PermanentPostalCode))
                {
                    source = source.Where(x => x.PermanentPostalCode.ToLower().Contains(supplierSearch.PermanentPostalCode.ToLower()));
                }
            }
            int count = source.Count();
            var items = source.OrderByDescending(m => m.Id).Skip(((supplierSearch.Page ?? 1) - 1) * pageSize).Take(pageSize).ToList();

            model.data = items.Select(x => new Supplier
            {
                Id   = x.Id,
                Code = x.Code,
                Name = x.Name,
                PermanentAddress1        = x.PermanentAddress1,
                PermanentAddress2        = x.PermanentAddress2,
                PermanentAddress3        = x.PermanentAddress3,
                PermanentCity            = x.PermanentCity,
                PermanentCountry         = x.PermanentCountry,
                PermanentPostalCode      = x.PermanentPostalCode,
                ContactNumber            = x.ContactNumber,
                CorrespondanceAddress1   = x.CorrespondanceAddress1,
                CorrespondanceAddress2   = x.CorrespondanceAddress2,
                CorrespondanceAddress3   = x.CorrespondanceAddress3,
                CorrespondanceCity       = x.CorrespondanceCity,
                CorrespondanceCountry    = x.CorrespondanceCountry,
                CorrespondancePostalCode = x.CorrespondancePostalCode,
                Limit            = x.Limit,
                LogId            = x.LogId,
                FaxNumber        = x.FaxNumber,
                RegistrationDate = x.RegistrationDate,
                IsActive         = x.IsActive
            }).ToList();
            model.TotalCount = count;

            return(model);
        }
    private void GenerateReport()
    {
        try
        {

            DataSet dsSupplierReport    = new DataSet();
            SupplierSearch supSearch    = new SupplierSearch();
            supSearch.FromDate          = dtpFromDate.Date;
            supSearch.ToDate            = dtpToDate.Date;
            supSearch.Sup_Id            = Int32.Parse(ddlSupplier.SelectedValue.ToString());
            dsSupplierReport            = new SupplierDAO().SelectSupplierRelatedExpences(supSearch);

            Session["SupPayReport"] = dsSupplierReport;

            dxgvSupplierPaymentReport.DataSource = dsSupplierReport;
            dxgvSupplierPaymentReport.DataBind();
        }
        catch (Exception ex)
        {

            throw ex;
        }
    }