コード例 #1
0
        public ActionResult Details(string CustomerTypeID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    CustomerdemographicsBusinessModelLayers customerdemographicsBusinessModelLayers = new CustomerdemographicsBusinessModelLayers();

                    BusinessModelLayer.CustomerdemographicsSingle customerdemographics = customerdemographicsBusinessModelLayers.GetAllCustomerdemographicss().FirstOrDefault(x => x.CustomerTypeID == CustomerTypeID);

                    return(View(customerdemographics));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        public ActionResult Edit(string CustomerTypeID, string sortOrder, string currentFilter, string searchString, int?page, string PgeSize)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    ViewBag.CurrentSort    = sortOrder;
                    ViewBag.CustomerTypeID = CustomerTypeID;

                    BusinessLayer.Validation pge      = new BusinessLayer.Validation();
                    List <SelectListItem>    PgeSizes = pge.PageSize();

                    //Assigning generic list to ViewBag
                    ViewBag.PgeSizeList = PgeSizes;

                    if (searchString != null)
                    {
                        page = 1;
                    }
                    else
                    {
                        searchString = currentFilter;
                    }

                    ViewBag.CurrentFilter = searchString;

                    //CUSTOMERDEMOGRAPHICS TABLE MASTER
                    BusinessModelLayer.Customerdemographics.CustomerdemographicsMasterDetailModel pageModel          = new BusinessModelLayer.Customerdemographics.CustomerdemographicsMasterDetailModel();
                    CustomerdemographicsBusinessModelLayers customerdemographicsBusinessModelLayers                  = new CustomerdemographicsBusinessModelLayers();
                    Customerdemographics.CustomerdemographicsMasterDetailModel customerdemographicsMasterDetailModel = new Customerdemographics.CustomerdemographicsMasterDetailModel();

                    pageModel.Customerdemographics = customerdemographicsBusinessModelLayers.GetAllCustomerdemographicss().FirstOrDefault(x => x.CustomerTypeID == CustomerTypeID);

                    int pageSize = 10;
                    if (PgeSize != null)
                    {
                        Int32.TryParse(PgeSize, out pageSize);
                    }
                    ViewBag.PgeSize = pageSize;

                    int pageNumber = (page ?? 1);


                    //CUSTOMERCUSTOMERDEMO DETAIL BEGIN

                    ViewBag.CustomerTypeIDSortParm = String.IsNullOrEmpty(sortOrder) ? "CustomerTypeID_desc" : "";
                    CustomercustomerdemoBusinessModelLayers customercustomerdemoBusinessModelLayers = new CustomercustomerdemoBusinessModelLayers();

                    List <BusinessModelLayer.Vwcustomercustomerdemo> customercustomerdemos = customercustomerdemoBusinessModelLayers.GetAllVwcustomercustomerdemos().FindAll(x => x.CustomerTypeID == CustomerTypeID).ToList();

                    if (!String.IsNullOrEmpty(searchString))
                    {
                        customercustomerdemos = customercustomerdemos.Where(s => s.CustomerTypeID == CustomerTypeID && s.CustomerTypeID.ToString().ToLower().Contains(searchString.ToLower())).ToList();
                    }

                    switch (sortOrder)
                    {
                    case "CustomerTypeID_desc":
                        customercustomerdemos = customercustomerdemos.OrderByDescending(s => s.CustomerTypeID).ToList();
                        break;

                    default:      // CustomerTypeID ascending
                        customercustomerdemos = customercustomerdemos.OrderBy(s => s.CustomerTypeID).ToList();
                        break;
                    }
                    pageModel.CustomercustomerdemoVwDetl = customercustomerdemos.ToPagedList(pageNumber, pageSize);

                    //CUSTOMERCUSTOMERDEMO DETAIL END
                    return(View(pageModel));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #3
0
        public IHttpActionResult Get(string CustomerTypeID)
        {
            try     // handle exogenous exceptions
            {
                try // log all exceptions
                {
                    CustomerdemographicsBusinessModelLayers customerdemographicsBusinessModelLayers = new CustomerdemographicsBusinessModelLayers();
                    List <BusinessModelLayer.CustomerdemographicsSingle> customerdemographicss      = customerdemographicsBusinessModelLayers.GetAllCustomerdemographicss().FindAll(x => x.CustomerTypeID == CustomerTypeID);

                    //BusinessModelLayer.CustomerdemographicsSingle customerdemographicss = customerdemographicsBusinessModelLayers.GetCustomerdemographicsData(CustomerTypeID);
                    return(Ok(customerdemographicss));
                }
                catch (Exception ex)
                {
                    BusinessLayer.ExceptionLogging exlog = new BusinessLayer.ExceptionLogging();
                    exlog.SendExcepToDB(ex);
                    throw;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }