Ejemplo n.º 1
0
        public ActionResult Assign(FormCollection col)
        {
            int    enquiryId    = Convert.ToInt32(col.GetValue("Enquiry").AttemptedValue);
            int    projectId    = Convert.ToInt32(col.GetValue("Project").AttemptedValue);
            int    TeamType     = Convert.ToInt32(col.GetValue("TeamType").AttemptedValue);
            string TeamTypeName = (TeamType == 1)?"Non Kenwood Team":"Kenwood Team";
            string TeamName     = String.Empty;

            if (TeamType == 1)
            {
                TeamName = col.GetValue("Non_Kenwood").AttemptedValue.ToString();
            }
            else
            {
                TeamName = teamRepository.Find(Convert.ToInt32(col.GetValue("Team").AttemptedValue)).TeamName;
            }
            TeamProject team = new TeamProject();

            team.ProjectID = projectId;
            team.TeamID    = Convert.ToInt32(col.GetValue("Team").AttemptedValue);
            BusinessFlowContext context = new BusinessFlowContext();

            context.TeamProjects.Add(team);
            context.SaveChanges();

            return(RedirectToAction("TeamAssigned", team));
        }
Ejemplo n.º 2
0
        public static List <CustomerModel> CustomerListExport(IEnumerable <int> zipCodes, string site, bool isProduction)
        {
            BusinessFlowContext.SetContext(site, isProduction);
            var customerList   = new List <CustomerModel>();
            var customerSearch = new CustomerSearchRequest();
            var stateCriterion = new AdditionalCriterion();

            stateCriterion.CriterionID   = "customer_postal_code";
            stateCriterion.CriterionType = AdditionalCriterionType.Database;


            customerSearch.MaxRows = 20000;
            customerSearch.Filter  = CustomerSearchFilter.Active;
            customerSearch.AddCriterion(stateCriterion);
            customerSearch.AddCriterion("lu_dt", AdditionalColumnType.Database, DateTime.Today.AddYears(-4).ToShortDateString(), AdditionalCriterionCondition.GreaterThan);

            for (var i = 0; i < zipCodes.Count(); i += 10)
            {
                stateCriterion.Parameters = zipCodes.Skip(i).Take(10).Select(z => z.ToString()).ToArray();
                var customers = BusinessFlow.WebServices.Customer.Search(customerSearch);

                foreach (dsCustomerList.CustomersRow customer in customers.Customers)
                {
                    customerList.Add(SafeCreate(customer));
                }
            }

            return(customerList);
        }
Ejemplo n.º 3
0
        public static List <CustomerModel> CustomerListExport(string state, string site, bool isProduction)
        {
            BusinessFlowContext.SetContext(site, isProduction);
            var customerList   = new List <CustomerModel>();
            var customerSearch = new CustomerSearchRequest();
            var stateCriterion = new AdditionalCriterion();

            stateCriterion.CriterionID   = "customer_region_cd";
            stateCriterion.CriterionType = AdditionalCriterionType.Database;
            stateCriterion.Parameters    = new string[] { state };

            customerSearch.MaxRows = 50000;
            customerSearch.Filter  = CustomerSearchFilter.Active;
            customerSearch.AddCriterion(stateCriterion);
            customerSearch.AddCriterion("lu_dt", AdditionalColumnType.Database, DateTime.Today.AddYears(-3).ToShortDateString(), AdditionalCriterionCondition.GreaterThan);

            var customers = BusinessFlow.WebServices.Customer.Search(customerSearch);

            if (customers.Customers.Rows.Count == 50000)
            {
                throw new NotImplementedException(state + " is just TOO BIG!!");
            }

            foreach (dsCustomerList.CustomersRow customer in customers.Customers)
            {
                customerList.Add(SafeCreate(customer));
            }

            return(customerList);
        }
Ejemplo n.º 4
0
        public static List <CustomerModel> CustomerPointInTimeExport(DateTime since, string site, bool isProduction)
        {
            BusinessFlowContext.SetContext(site, isProduction);
            var customerList   = new List <CustomerModel>();
            var customerSearch = new CustomerSearchRequest();

            customerSearch.AddCriterion("customer_closed", AdditionalColumnType.Database, "0");
            customerSearch.AddCriterion("customer_suspended", AdditionalColumnType.Database, "0");
            customerSearch.AddCriterion("lu_dt", AdditionalColumnType.Database, since.ToShortDateString(), AdditionalCriterionCondition.GreaterThan);
            customerSearch.MaxRows = 10000;

            var customers = BusinessFlow.WebServices.Customer.Search(customerSearch);

            foreach (dsCustomerList.CustomersRow customer in customers.Customers)
            {
                customerList.Add(SafeCreate(customer));
            }

            return(customerList);
        }