コード例 #1
0
        public ActionResult UpdateCompany(string InputId = null, string company = null, string address = null, string city = null, string state = null, string postalCode = null, string countryISOAlpha2Code = null, string phoneNbr = null, bool isRejected = false, string inLanguage = null, string Address2 = null)
        {
            CompanyFacade     fac   = new CompanyFacade(this.CurrentClient.ApplicationDBConnectionString, Helper.UserName);
            BadInputDataModel model = new BadInputDataModel();
            int pageNumber          = Convert.ToInt32(SessionHelper.CleanMatchPage);
            int pageno     = Convert.ToInt32(SessionHelper.CleanMatchPageNo);
            int totalCount = 0;

            totalCount = !string.IsNullOrEmpty(SessionHelper.CleanTotalCount) ? Convert.ToInt32(SessionHelper.CleanTotalCount) : 0;


            Tuple <List <CompanyEntity>, string> tuplecompany = fac.GetBIDCompany(Helper.oUser.UserId, pageNumber, pageno, out totalCount);

            model.Companies = tuplecompany.Item1;


            foreach (var com in model.Companies)
            {
                if (com.InputId == Convert.ToInt32(InputId))
                {
                    com.inLanguage = string.IsNullOrEmpty(com.inLanguage) ? "" : com.inLanguage;
                    inLanguage     = string.IsNullOrEmpty(inLanguage) ? "" : inLanguage;

                    if (com.CompanyName != company || com.Address != address || com.Address1 != Address2 || com.City != city || com.State != state || com.PostalCode != postalCode || com.CountryISOAlpha2Code != countryISOAlpha2Code || com.PhoneNbr != phoneNbr || com.inLanguage != inLanguage)
                    {
                        // Update company by default functionality of grid to update current company records
                        UpdateBadInputData(Convert.ToInt32(InputId), company, address, city, state, postalCode, countryISOAlpha2Code, phoneNbr, isRejected, inLanguage);
                    }
                }
            }
            return(null);
        }
コード例 #2
0
        // GET: BadInputData

        #region "Load Bad Input Data"
        public ActionResult Index(int?page, int?sortby, int?sortorder, int?pagevalue, string sort = null)
        {
            // Clear WorkQueue  for Data
            StewUserActivityCloseWindow();
            if (Request.IsAjaxRequest())
            {
                // Set User name in session.
                CompanyFacade fac = new CompanyFacade(this.CurrentClient.ApplicationDBConnectionString, Helper.UserName);
                #region Set pagination Code
                int pageNumber = (page ?? 1);
                if (!string.IsNullOrEmpty(SessionHelper.CleanMatchPageNo) && pagevalue == null)
                {
                    pagevalue = Convert.ToInt32(SessionHelper.CleanMatchPageNo);
                }

                if (pagevalue == null || Convert.ToInt32(pagevalue) == 0)
                {
                    SettingFacade sfac = new SettingFacade(this.CurrentClient.ApplicationDBConnectionString);
                    pagevalue = Convert.ToInt32(sfac.GetDefaultPageSize(Helper.oUser.UserId, "BadInputData"));
                    pagevalue = pagevalue == 0 ? 10 : pagevalue;
                }

                BadInputDataModel model = new BadInputDataModel();
                if (!(sortby.HasValue && sortby.Value > 0))
                {
                    sortby = 1;
                }

                if (!(sortorder.HasValue && sortorder.Value > 0))
                {
                    sortorder = 1;
                }

                int totalCount = 0;
                int pageno     = pagevalue.HasValue ? pagevalue.Value : 10;
                pageno = pageno < 5 ? 5 : pageno;
                // Set page no , sortorder , sortby and Page size to session
                ViewBag.SortBy    = sortby;
                ViewBag.SortOrder = sortorder;
                ViewBag.Page      = pageNumber;
                ViewBag.pageno    = pageno;
                Tuple <List <CompanyEntity>, string> tuplecompany = fac.GetBIDCompany(Helper.oUser.UserId, pageNumber, pageno, out totalCount);
                model.Companies = tuplecompany.Item1;
                SessionHelper.CleanQueueMessage = tuplecompany.Item2;

                SessionHelper.CleanMatchPage      = Convert.ToString(pageNumber);
                SessionHelper.CleanMatchPageNo    = Convert.ToString(pageno);
                SessionHelper.CleanTotalCount     = Convert.ToString(totalCount);
                SessionHelper.CleanMatchedCompany = JsonConvert.SerializeObject(model.Companies);
                #endregion

                IPagedList <CompanyEntity> pagedCompany = new StaticPagedList <CompanyEntity>(model.Companies.ToList(), pageNumber, pageno, totalCount);// Set model of Company entity to pass this model to view.
                return(PartialView("_Index", pagedCompany));
            }
            else
            {
                SessionHelper.BadInputData_IsFirstTimeFilter = true;
            }
            return(View());
        }
コード例 #3
0
        public JsonResult AcceptBIDMatch(string InputId, string Match, string CompanyName = null, string address = null, string city = null, string state = null, string postalCode = null, string countryISOAlpha2Code = null, string phoneNbr = null)
        {
            CompanyFacade     fac = new CompanyFacade(this.CurrentClient.ApplicationDBConnectionString, Helper.UserName);
            MatchEntity       selectedMatchEntity = new MatchEntity();
            CompanyEntity     company             = new CompanyEntity();
            BadInputDataModel model = new BadInputDataModel();
            int pageNumber          = Convert.ToInt32(SessionHelper.CleanMatchPage);
            int pageno     = Convert.ToInt32(SessionHelper.CleanMatchPageNo);
            int totalCount = 0;

            // Get match from the parameter and desacralize the string and convert into MatchEntity.
            if (!string.IsNullOrWhiteSpace(Match))
            {
                selectedMatchEntity = SerializeHelper.DeserializeString <MatchEntity>(Match);
            }
            // if temp data for Company is null then get company from the database.
            if (!string.IsNullOrWhiteSpace(SessionHelper.CleanMatchedCompany))
            {
                model.Companies = JsonConvert.DeserializeObject <List <CompanyEntity> >(SessionHelper.CleanMatchedCompany);
            }
            else
            {
                Tuple <List <CompanyEntity>, string> tuplecompany = fac.GetBIDCompany(Helper.oUser.UserId, pageNumber, pageno, out totalCount);
                model.Companies = tuplecompany.Item1;
                SessionHelper.CleanQueueMessage = tuplecompany.Item2;
            }
            // if current company src record id is equal to the match than current is acceptable company.
            if (model.Companies.Count > 0)
            {
                foreach (var companies in model.Companies)
                {
                    if (companies.InputId == Convert.ToInt32(InputId))
                    {
                        company = companies;
                    }
                }
                if (!Helper.IsSearchBYDUNS)
                {
                    company.CompanyName          = CompanyName;
                    company.Address              = address;
                    company.City                 = city;
                    company.State                = state;
                    company.PostalCode           = postalCode;
                    company.CountryISOAlpha2Code = countryISOAlpha2Code;
                }
                fac.AcceptBIDMatch(company, selectedMatchEntity);
            }
            return(new JsonResult {
                Data = "success"
            });
        }
コード例 #4
0
        public ActionResult FilterCleanData(List <FilterData> filters)
        {
            UserSessionFilterEntity filtermodel = new UserSessionFilterEntity();

            foreach (var item in filters)
            {
                if (item.FieldName == "SrcRecordId")
                {
                    filtermodel.SrcRecordId = item.FilterValue;
                }
                else if (item.FieldName == "CompanyName")
                {
                    filtermodel.CompanyName = item.FilterValue;
                }
                else if (item.FieldName == "City")
                {
                    filtermodel.City = item.FilterValue;
                }
                else if (item.FieldName == "State")
                {
                    filtermodel.State = item.FilterValue;
                }
                else if (item.FieldName == "Country")
                {
                    filtermodel.CountryISOAlpha2Code = item.FilterValue;
                }
                else if (item.FieldName == "ImportProcess")
                {
                    filtermodel.ImportProcess = item.FilterValue;
                }
                else if (item.FieldName == "CountryGroup")
                {
                    filtermodel.CountryGroupId = Convert.ToInt32(item.FilterValue);
                }
                else if (item.FieldName == "Tag")
                {
                    filtermodel.Tag = item.FilterValue;
                }
                else if (item.FieldName == "OrderByColumn")
                {
                    filtermodel.OrderByColumn = item.FilterValue;
                }
                else if (item.FieldName == "ErrorCode")
                {
                    filtermodel.ErrorCode = item.FilterValue;
                }
            }
            filtermodel.UserId = Helper.oUser.UserId;
            int pagenumber = 0;

            if (string.IsNullOrEmpty(Convert.ToString(SessionHelper.BadInputData_IsFirstTimeFilter)) || !SessionHelper.BadInputData_IsFirstTimeFilter)
            {
                UserSessionFacade fac = new UserSessionFacade(this.CurrentClient.ApplicationDBConnectionString);
                fac.InsertOrUpdateUserSessionFilter(filtermodel);
                pagenumber = 1;
            }
            else
            {
                if (SessionHelper.BadInputData_IsFirstTimeFilter)
                {
                    pagenumber = 1;
                }
                else
                {
                    if (!string.IsNullOrEmpty(SessionHelper.CleanMatchPage))
                    {
                        pagenumber = Convert.ToInt32(SessionHelper.CleanMatchPage);
                    }
                    else
                    {
                        pagenumber = 1;
                    }
                }
            }
            SessionHelper.BadInputData_IsFirstTimeFilter = false;

            int totalCount = 0;
            int pagevalue  = 0;

            if (!string.IsNullOrEmpty(SessionHelper.CleanMatchPageNo))
            {
                pagevalue = Convert.ToInt32(SessionHelper.CleanMatchPageNo);
            }
            if (pagevalue == null || pagevalue == 0)
            {
                SettingFacade sfac = new SettingFacade(this.CurrentClient.ApplicationDBConnectionString);
                pagevalue = Convert.ToInt32(sfac.GetDefaultPageSize(Helper.oUser.UserId, "BadInputData"));
                pagevalue = pagevalue == 0 ? 10 : pagevalue;
            }
            pagevalue = pagevalue < 5 ? 5 : pagevalue;

            BadInputDataModel model = new BadInputDataModel();
            CompanyFacade     cfac  = new CompanyFacade(this.CurrentClient.ApplicationDBConnectionString, Helper.UserName);
            Tuple <List <CompanyEntity>, string> tuplecompany = cfac.GetBIDCompany(Helper.oUser.UserId, 1, pagevalue, out totalCount);

            model.Companies = tuplecompany.Item1;
            SessionHelper.CleanQueueMessage = tuplecompany.Item2;

            SessionHelper.CleanMatchPage      = pagenumber.ToString();
            SessionHelper.CleanMatchPageNo    = Convert.ToString(pagevalue);
            SessionHelper.CleanTotalCount     = Convert.ToString(totalCount);
            SessionHelper.CleanMatchedCompany = JsonConvert.SerializeObject(model.Companies);
            IPagedList <CompanyEntity> pagedCompany = new StaticPagedList <CompanyEntity>(model.Companies.ToList(), pagenumber, pagevalue, totalCount);// Set model of Company entity to pass this model to view.

            return(PartialView("_Index", pagedCompany));
        }
コード例 #5
0
        public ActionResult GetFilteredCompanyList(int?mode, int?page, int?sortby, int?sortorder, int?pagevalue, string sort = null)
        {
            // For Filtration of data .
            CompanyFacade fac = new CompanyFacade(this.CurrentClient.ApplicationDBConnectionString, Helper.UserName);

            #region Set Pagination code
            //Get Current Page size ,page Number.
            if (!string.IsNullOrEmpty(SessionHelper.CleanMatchPage))
            {
                page = Convert.ToInt32(SessionHelper.CleanMatchPage);
            }

            if (!string.IsNullOrEmpty(SessionHelper.CleanMatchPageNo))
            {
                pagevalue = Convert.ToInt32(SessionHelper.CleanMatchPageNo);
            }

            if (pagevalue == null || Convert.ToInt32(pagevalue) == 0)
            {
                SettingFacade sfac = new SettingFacade(this.CurrentClient.ApplicationDBConnectionString);
                pagevalue = Convert.ToInt32(sfac.GetDefaultPageSize(Helper.oUser.UserId, "BadInputData"));
                pagevalue = pagevalue == 0 ? 10 : pagevalue;
            }

            int pageNumber          = (page ?? 1);
            BadInputDataModel model = new BadInputDataModel();
            if (!(sortby.HasValue && sortby.Value > 0))
            {
                sortby = 1;
            }

            if (!(sortorder.HasValue && sortorder.Value > 0))
            {
                sortorder = 1;
            }

            int totalCount = 0;
            int pageno     = pagevalue.HasValue ? pagevalue.Value : 10;
            pageno            = pageno < 5 ? 5 : pageno;
            ViewBag.SortBy    = sortby;
            ViewBag.SortOrder = sortorder;
            ViewBag.Page      = pageNumber;
            ViewBag.pageno    = pageno;
            #endregion

            if (!string.IsNullOrEmpty(SessionHelper.CleanMatchedCompany)) //if Company is already in temp data then don't do db call to find company list
            {
                model.Companies = JsonConvert.DeserializeObject <List <CompanyEntity> >(SessionHelper.CleanMatchedCompany);
                totalCount      = !string.IsNullOrEmpty(SessionHelper.CleanTotalCount) ? Convert.ToInt32(SessionHelper.CleanTotalCount) : 0;
            }
            else
            {
                //model.Companies = fac.GetBIDCompany(Helper.oUser.UserId, pageNumber, pageno, out totalCount);//Get Company List if it is not found from the TempData
                Tuple <List <CompanyEntity>, string> tuplecompany = fac.GetBIDCompany(Helper.oUser.UserId, pageNumber, pageno, out totalCount);
                model.Companies = tuplecompany.Item1;
                SessionHelper.CleanQueueMessage = tuplecompany.Item2;
            }
            if (sortorder != null && sortby != null)
            {
                model.Companies = SortData(model.Companies, Convert.ToInt32(sortorder), Convert.ToInt32(sortby));
            }

            if (totalCount <= 0 && model.Companies.Count == 0 && pageNumber > 1)
            {
                totalCount = Convert.ToInt32(pagevalue);
            }

            // Set model of Company entity to pass this model to view.
            IPagedList <CompanyEntity> pagedCompany = new StaticPagedList <CompanyEntity>(model.Companies.ToList(), pageNumber, pageno, totalCount);
            ViewBag.CloseAlert = "<script type='text/javascript'>$(document).ready(function(){parent.backToparent();});</script>";
            if (Request.IsAjaxRequest())
            {
                return(PartialView("_Index", pagedCompany));
            }

            return(View(pagedCompany));
        }