public List <PlanInfo> GetTeamCurrentPlan() { List <PlanInfo> result = new List <PlanInfo>(); PlanFilter filter = new PlanFilter(); filter.MyStatus = 2; List <PlanInfo> palnList = Get(filter); if (palnList != null && palnList.Count > 0) { foreach (PlanInfo plan in palnList) { if ((plan.State == PlanState.Initilize && plan.Stage == PlanStage.PlanInitialize) || plan.Stage == PlanStage.CompleteEvaluate) { continue; } PlanDynamicManager dynamicManager = new PlanDynamicManager(); PlanDynamicState stage = dynamicManager.GetPlanDynamicState(plan.PlanDefineID, plan.Period.ID); if (stage == PlanDynamicState.Unknown) { continue; } else { result.Add(plan); } } } return(result); }
public ActionResult Index() { long depId = CurrenUser.DeptId ?? 4; if (CurrenUser.IsAdminAndAcct()) { depId = 4; } var currentYear = DateTime.Now.Year; var filter = new PlanFilter() { Id = depId, Year = currentYear }; ViewBag.AllPrograms = programService.GetModelAll(); ViewBag.AllSalse = usersServices.GetAll(x => x.DeptId == depId && x.IsActive == true); var listUserShow = planSaleService.GetAllByUser(CurrenUser, currentYear, depId); var listDeptShow = planSaleService.GetAllDeptList(currentYear, depId); var depList = usersServices.GetSalesDept(); ViewBag.AlldeptSalseList = new SelectList(depList, "Id", "DeptName"); ViewBag.PlanOfDep = listDeptShow; ViewBag.PlanFilter = filter; return(View(listUserShow)); }
public ActionResult SubmitPlan(long id, bool isSubmit = true) { var splan = planSaleService.GetByIModel(id); if (isSubmit) { splan.SubmitedBy = CurrenUser; splan.SubmitedDate = DateTime.Now; } else { splan.ApprovalBy = null; splan.ApprovedDate = null; splan.SubmitedBy = null; splan.SubmitedDate = null; } planSaleService.UpdateModel(splan); var filter = new PlanFilter() { Id = CurrenUser.DeptId.Value, Year = splan.PlanYear }; return(Index(filter)); }
public List <PlanInfo> GetTeamCompletedPlan() { PlanFilter filter = new PlanFilter(); filter.MyStatus = 2; filter.Stage = PlanStage.CompleteEvaluate; return(Get(filter)); }
public ListResponse <PlanInfo> Get([FromQuery] PlanFilter filter) { List <PlanInfo> list = PlanService.Current.Get(filter); ListResponse <PlanInfo> response = new ListResponse <PlanInfo>(); if (list != null && list.Count > 0) { response.Data = list; } return(response); }
internal List <PlanInfo> Get(PlanFilter filter) { PlanDac dac = new PlanDac(); if (filter.MyStatus == 1) { if (filter.Senders == null) { filter.Senders = new List <string>() { Utils.GetUserId() } } ; else { filter.Senders.Add(Utils.GetUserId()); } } else if (filter.MyStatus == 2) { if (filter.FirRecips == null) { filter.FirRecips = new List <string>() { Utils.GetUserId() } } ; else { filter.FirRecips.Add(Utils.GetUserId()); } } else if (filter.MyStatus == 3) { if (filter.SecRecips == null) { filter.SecRecips = new List <string>() { Utils.GetUserId() } } ; else { filter.SecRecips.Add(Utils.GetUserId()); } } List <PlanInfo> plans = dac.Get(filter); return(plans); }
public ActionResult PersonalFollowp(PlanFilter filter) { filter.FromDate = new DateTime(filter.Year, filter.Month, 1); var nextMonth = filter.FromDate.AddMonths(1); filter.NextMonth = nextMonth.Month; filter.NextYear = nextMonth.Year; filter.ToDate = nextMonth; var reports = ProcessPersonalFollowupReports(filter); var planYearReports = ProcessPersonalMonthlyReports(filter); ViewBag.CustomerFollowup = reports; ViewBag.PlanYear = planYearReports; ViewBag.SummaryByType = filter.SummaryByType; return(PartialView("_PorsonalFollowupReport")); }
public ActionResult Index(PlanFilter filter) { var listUserShow = planSaleService.GetAllByUser(CurrenUser, filter.Year, filter.Id); var listDeptShow = planSaleService.GetAllDeptList(filter.Year, filter.Id); ViewBag.PlanOfDep = listDeptShow; var depList = usersServices.GetSalesDept(); ViewBag.AlldeptSalseList = new SelectList(depList, "Id", "DeptName"); ViewBag.AllPrograms = programService.GetModelAll(); var listSales = usersServices.GetAll(x => x.DeptId == filter.Id && x.IsActive == true); ViewBag.AllSalse = listSales; ViewBag.PlanFilter = filter; return(PartialView("_List", listUserShow)); }
public ActionResult PlanOffice(PlanFilter filter) { var depList = usersServices.getAllCompany(); ViewBag.AlldeptSalseList = new SelectList(depList, "Id", "CompanyName"); ViewBag.AllPrograms = programService.GetModelAll(); var listDeptShow = planSaleService.GetAllDeptList(filter.Year, 0, filter.Id); if (!listDeptShow.Any() && DateTime.Now.Year <= filter.Year) { SetupdataForYear(filter.Year); listDeptShow = planSaleService.GetAllDeptList(filter.Year, 0, filter.Id); } ViewBag.PlanFilter = filter; return(PartialView("_OfficeDepList", listDeptShow)); }
public ActionResult PlanOffice() { var filter = new PlanFilter() { Id = CurrenUser.ComId.Value, Year = DateTime.Now.Year }; ViewBag.PlanFilter = filter; var depList = usersServices.getAllCompany(); ViewBag.AllPrograms = programService.GetModelAll(); ViewBag.AlldeptSalseList = new SelectList(depList, "Id", "CompanyName"); var listDeptShow = planSaleService.GetAllDeptList(filter.Year, 0, filter.Id); if (!listDeptShow.Any() && DateTime.Now.Year <= filter.Year) { SetupdataForYear(filter.Year); listDeptShow = planSaleService.GetAllDeptList(filter.Year, 0, filter.Id); } return(View(listDeptShow)); }
public ActionResult UpdatePlanValue(List <CRMPlanMonthModel> CRMPlanMonthModels) { var year = DateTime.Now.Year; foreach (var it in CRMPlanMonthModels) { year = it.PlanYear; var db = planMonthService.GetModelById(it.Id); db.PlanValue = it.PlanValue; db.PlanMonth = it.PlanMonth; db.PlanYear = it.PlanYear; db.ProgramMonthId = it.ProgramMonthId; planMonthService.UpdateModel(db); } var filter = new PlanFilter() { Id = CurrenUser.DeptId.Value, Year = year }; return(Index(filter)); }
public TestRunnerOptions(TestRunnerOptions copyFrom) { if (copyFrom == null) { return; } IgnoreFocus = copyFrom.IgnoreFocus; FixturePaths.AddAll(copyFrom.FixturePaths); LoaderPaths.AddAll(copyFrom.LoaderPaths); LoadAssemblyFromPath = copyFrom.LoadAssemblyFromPath; RandomSeed = copyFrom.RandomSeed; _flags = copyFrom._flags; ContextLines = copyFrom.ContextLines; SelfTest = copyFrom.SelfTest; PackageReferences.AddAll(copyFrom.PackageReferences); PlanFilter.CopyFrom(copyFrom.PlanFilter); TestTimeout = copyFrom.TestTimeout; PlanTimeout = copyFrom.PlanTimeout; SlowTestThreshold = copyFrom.SlowTestThreshold; AssertionMessageFormatMode = copyFrom.AssertionMessageFormatMode; PreviousRun = copyFrom.PreviousRun; }
/// <summary> /// Selects random plans (from planDB) that yield results specified /// in typesDesired. Only consider plans for which filter returns true. /// </summary> private bool RandomPlans(out RandomPlansResult result, Type[] typesDesired, PlanFilter filter, PlanDataBase planDB, bool forbidNull, MethodInfo method) { List<Plan> plans = new List<Plan>(); Plan.ParameterChooser[] parameterMap = new Plan.ParameterChooser[typesDesired.Length]; for (int i = 0; i < typesDesired.Length; i++) { Type typeDesired = typesDesired[i]; if (typeDesired.IsArray || typeDesired.Equals(typeof(ArrayList))) { int randArrayLength = Common.Enviroment.Random.Next(this.arrayMaxSize + 1); Transformer t; Type baseType = null; if (typeDesired.IsArray) { baseType = typeDesired.GetElementType(); t = ArrayBuilderTransformer.Get(baseType, randArrayLength); } else { baseType = typeof(object); t = ArrayListBuilderTransformer.Get(typeof(object), randArrayLength); } RandomPlansResult arrayResult; PlanFilter f; if (forbidNull) { f = delegate(Plan p, int x) { // Non-null heuristic if (baseType.IsValueType && (p.transformer is PrimitiveValueTransformer) && (p.transformer as PrimitiveValueTransformer).IsNull) return false; return true; }; } else f = delegate(Plan dontCareP, int dontCareInt) { return true; }; if (!RandomPlans(out arrayResult, t.ParameterTypes, f, planDB, forbidNull, null)) { //Util.Warning("\tNo array plans for type " + typeDesired.Name + " created"); result = null; return false; } plans.Add(new Plan(t, arrayResult.fplans, arrayResult.fparameterChoosers)); parameterMap[i] = new Plan.ParameterChooser(i, 0); } else { // Types for which default plans are not created // Don't want to create a plan for a value type which is just a type defn. if (typeDesired.IsValueType && typeDesired.IsGenericTypeDefinition) { result = null; return false; } //Array.createInstance can't create arrays of these types if (typeDesired.Name.Equals("TypedReference") || typeDesired.Name.Equals("ArgIterator") || typeDesired.Name.Equals("ByRef") || typeDesired.Name.Equals("RuntimeArgumentHandle")) { result = null; return false; } if (typeDesired.IsPointer) { result = null; return false; } Plan chosenplan; if (i == 0 && method != null && method.IsStatic) { chosenplan = new Plan(DummyTransformer.Get(typeDesired), new Plan[0], new Randoop.Plan.ParameterChooser[0]); } else { chosenplan = planDB.RandomPlan(typeDesired); if (chosenplan == null) { // No plans for type typeDesired created. result = null; return false; } if (!filter(chosenplan, i)) { result = null; return false; } // If plan represents "null" return false. if (forbidNull && (chosenplan.transformer is PrimitiveValueTransformer) && (chosenplan.transformer as PrimitiveValueTransformer).IsNull) { result = null; return false; } } plans.Add(chosenplan); Collection<int> possibleResultIndices = PossibleResultTupleIndices(chosenplan, typeDesired); if (possibleResultIndices.Count == 0) { result = null; return false; } parameterMap[i] = new Plan.ParameterChooser(i, possibleResultIndices[Common.Enviroment.Random.Next(possibleResultIndices.Count)]); } } result = new RandomPlansResult(plans.ToArray(), parameterMap); return true; }
/// <summary> /// Selects random plans (from planDB) that yield results specified /// in typesDesired. Only consider plans for which filter returns true. /// </summary> private bool RandomPlans(out RandomPlansResult result, Type[] typesDesired, PlanFilter filter, PlanDataBase planDB, bool forbidNull, MethodInfo method) { List<Plan> plans = new List<Plan>(); Plan.ParameterChooser[] parameterMap = new Plan.ParameterChooser[typesDesired.Length]; for (int i = 0; i < typesDesired.Length; i++) { Type typeDesired = typesDesired[i]; //if (typeDesired.IsArray || typeDesired.Equals(typeof(ArrayList))) //[email protected] changes as below to add List input generation if (typeDesired.IsArray || typeDesired.Equals(typeof(ArrayList)) || (!string.IsNullOrEmpty(typeDesired.FullName) && typeDesired.FullName.Contains("System.Collections.Generic.List"))) { int randArrayLength = Common.Enviroment.Random.Next(this.arrayMaxSize + 1); Transformer t; Type baseType = null; if (typeDesired.IsArray) { baseType = typeDesired.GetElementType(); t = ArrayBuilderTransformer.Get(baseType, randArrayLength); } else //[email protected] addes -- start { if (typeDesired.FullName.Contains("System.Collections.Generic.List")) { //string fullType = typeDesired.ToString(); //string elementType = fullType.Substring(fullType.IndexOf('[') + 1, fullType.IndexOf(']') - fullType.IndexOf('[') - 1); //baseType = System.Type.GetType(elementType); baseType = typeDesired.GetProperty("Item").PropertyType; if(baseType == null) baseType = typeof(object); t = ListBuilderTransformer.Get(baseType, randArrayLength); } //[email protected] addes -- end else { baseType = typeof(object); t = ArrayListBuilderTransformer.Get(typeof(object), randArrayLength); } } RandomPlansResult arrayResult; PlanFilter f; if (forbidNull) { f = delegate(Plan p, int x) { // Non-null heuristic if (baseType.IsValueType && (p.transformer is PrimitiveValueTransformer) && (p.transformer as PrimitiveValueTransformer).IsNull) return false; return true; }; } else f = delegate(Plan dontCareP, int dontCareInt) { return true; }; if (!RandomPlans(out arrayResult, t.ParameterTypes, f, planDB, forbidNull, null)) { //Util.Warning("\tNo array plans for type " + typeDesired.Name + " created"); result = null; return false; } plans.Add(new Plan(t, arrayResult.fplans, arrayResult.fparameterChoosers)); parameterMap[i] = new Plan.ParameterChooser(i, 0); } else { // Types for which default plans are not created // Don't want to create a plan for a value type which is just a type defn. if (typeDesired.IsValueType && typeDesired.IsGenericTypeDefinition) { result = null; return false; } //Array.createInstance can't create arrays of these types if (typeDesired.Name.Equals("TypedReference") || typeDesired.Name.Equals("ArgIterator") || typeDesired.Name.Equals("ByRef") || typeDesired.Name.Equals("RuntimeArgumentHandle")) { result = null; return false; } if (typeDesired.IsPointer) { result = null; return false; } Plan chosenplan; if (i == 0 && method != null && method.IsStatic) { chosenplan = new Plan(DummyTransformer.Get(typeDesired), new Plan[0], new Randoop.Plan.ParameterChooser[0]); } else { chosenplan = planDB.RandomPlan(typeDesired); if (chosenplan == null) { // No plans for type typeDesired created. result = null; return false; } //if ((method != null) && method.Name.Contains("heapSort") && !(chosenplan.transformer is PrimitiveValueTransformer)) //[email protected] // Console.WriteLine("debug."); if (!filter(chosenplan, i)) { result = null; return false; } // If plan represents "null" return false. if (forbidNull && (chosenplan.transformer is PrimitiveValueTransformer) && (chosenplan.transformer as PrimitiveValueTransformer).IsNull) { result = null; return false; } } plans.Add(chosenplan); Collection<int> possibleResultIndices = PossibleResultTupleIndices(chosenplan, typeDesired); if (possibleResultIndices.Count == 0) { result = null; return false; } parameterMap[i] = new Plan.ParameterChooser(i, possibleResultIndices[Common.Enviroment.Random.Next(possibleResultIndices.Count)]); } } result = new RandomPlansResult(plans.ToArray(), parameterMap); return true; }
private List <PersonalReport> ProcessPersonalMonthlyReports(PlanFilter filter) { ViewBag.PlanFilter = filter; var plans = planMonthService.GetQuery(x => (filter.Month == 0 || x.PlanMonth == filter.Month) && x.PlanYear == filter.Year); switch (filter.SummaryByType) { case SummaryByType.ByUser: plans = plans.Where(x => x.CRMPlanProgMonth.CRMPLanSale.SalesId == filter.Id); var usersList = usersServices.GetAllSales(CurrenUser, false).ToList(); if (CurrenUser.IsAdmin()) { usersList.Add(CurrenUser); } ViewBag.AlldeptSalseList = new SelectList(usersList.OrderBy(x => x.FullName), "Id", "FullName"); break; case SummaryByType.ByDeparment: plans = plans.Where(x => x.CRMPlanProgMonth.CRMPLanSale.Sales.DeptId == filter.Id); ViewBag.AlldeptSalseList = new SelectList(usersServices.GetAllDepartmentActive(CurrenUser), "Id", "DeptName"); break; case SummaryByType.ByOffice: plans = plans.Where(x => x.CRMPlanProgMonth.CRMPLanSale.Sales.ComId == filter.Id); ViewBag.AlldeptSalseList = new SelectList(usersServices.GetCompanies(CurrenUser), "Id", "CompanyName"); break; } var reports = new List <PersonalReport>(); var summary = crmCustomerService.SummarysList(CurrenUser, filter); var totalShipmentExc = summary.Sum(x => x.TotalShippments); //So lo thanh cong var totalSuccessExc = summary.Sum(x => x.SuccessFully); // khach hang moi thanh cong var totalVistedExc = summary.Sum(x => x.TotalVisitedSuccess); //Vieng tham var totaldocdExc = summary.Sum(x => x.TotalDocument); //Bai viet var totalEmailExc = summary.Sum(x => x.TotalFirstSendEmail); //Guid bao gia var hatMonthShipmentExc = 0; //So lo thanh cong var hatMonthSuccessExc = 0; // khach hang moi thanh cong var hatMonthVistedExc = 0; //Vieng tham var hatMonthdocdExc = 0; //Bai viet var hatMonthEmailExc = 0; //Guid bao gia // report for personal monthly if (filter.ReportType == ReportType.Monthly && filter.Month > 0) { var nextTime = new DateTime(filter.Year, filter.Month, 1).AddMonths(1); filter.NextMonth = nextTime.Month; filter.NextYear = nextTime.Year; var cusHatMonth = summary.Where(x => x.CreatedDate <= new DateTime(filter.Year, filter.Month, 15, 23, 59, 59)).ToList(); hatMonthShipmentExc = cusHatMonth.Sum(x => x.TotalShippments); //So lo thanh cong hatMonthSuccessExc = cusHatMonth.Sum(x => x.SuccessFully); // khach hang moi thanh cong hatMonthVistedExc = cusHatMonth.Sum(x => x.TotalVisitedSuccess); //Vieng tham hatMonthdocdExc = cusHatMonth.Sum(x => x.TotalDocument); //Bai viet hatMonthEmailExc = cusHatMonth.Sum(x => x.TotalFirstSendEmail); //Guid bao gia } var planMonths = plans.Where(x => (filter.Month == 0 || x.PlanMonth == filter.Month) && x.PlanYear == filter.Year).ToList(); foreach (var p in planMonths) { var report = new PersonalReport { PlanName = p.CRMPlanProgMonth.CRMPlanProgram.Name, PlanValue = p.PlanValue, Month = p.PlanMonth, Year = p.PlanYear }; if (filter.ReportType == ReportType.Monthly && filter.Month > 0) { var next = planMonthService.FindEntity(x => x.ProgramMonthId == p.Id && x.PlanMonth == filter.NextMonth && filter.NextYear == x.PlanYear); var nextPlan = next != null ? next.PlanValue : 0; report.PlanValueNextMonth = nextPlan; } switch (p.CRMPlanProgMonth.ProgramId) { case 1: report.TotalExc = totalSuccessExc; report.FistExc = hatMonthSuccessExc; report.LastExc = totalSuccessExc - hatMonthSuccessExc; break; case 2: report.TotalExc = totalEmailExc; report.FistExc = hatMonthEmailExc; report.LastExc = totalEmailExc - hatMonthEmailExc; break; case 3: report.TotalExc = totalVistedExc; report.FistExc = hatMonthVistedExc; report.LastExc = totalVistedExc - hatMonthVistedExc; break; case 4: report.TotalExc = totalShipmentExc; report.FistExc = hatMonthShipmentExc; report.LastExc = totalShipmentExc - hatMonthShipmentExc; break; case 5: report.TotalExc = totaldocdExc; report.FistExc = hatMonthdocdExc; report.LastExc = totaldocdExc - hatMonthdocdExc; break; } report.Odds = report.TotalExc - report.PlanValue; reports.Add(report); } ViewBag.PlanMount = plans.ToList(); return(reports); }
/// <summary> /// Selects random plans (from planDB) that yield results specified /// in typesDesired. Only consider plans for which filter returns true. /// </summary> private bool RandomPlans(out RandomPlansResult result, Type[] typesDesired, PlanFilter filter, PlanDataBase planDB, bool forbidNull, MethodInfo method) { List <Plan> plans = new List <Plan>(); Plan.ParameterChooser[] parameterMap = new Plan.ParameterChooser[typesDesired.Length]; for (int i = 0; i < typesDesired.Length; i++) { Type typeDesired = typesDesired[i]; //if (typeDesired.IsArray || typeDesired.Equals(typeof(ArrayList))) //[email protected] changes as below to add List input generation if (typeDesired.IsArray || typeDesired.Equals(typeof(ArrayList)) || (!string.IsNullOrEmpty(typeDesired.FullName) && typeDesired.FullName.Contains("System.Collections.Generic.List"))) { int randArrayLength = Common.Enviroment.Random.Next(this.arrayMaxSize + 1); Transformer t; Type baseType = null; if (typeDesired.IsArray) { baseType = typeDesired.GetElementType(); t = ArrayBuilderTransformer.Get(baseType, randArrayLength); } else //[email protected] addes -- start { if (typeDesired.FullName.Contains("System.Collections.Generic.List")) { //string fullType = typeDesired.ToString(); //string elementType = fullType.Substring(fullType.IndexOf('[') + 1, fullType.IndexOf(']') - fullType.IndexOf('[') - 1); //baseType = System.Type.GetType(elementType); baseType = typeDesired.GetProperty("Item").PropertyType; if (baseType == null) { baseType = typeof(object); } t = ListBuilderTransformer.Get(baseType, randArrayLength); } //[email protected] addes -- end else { baseType = typeof(object); t = ArrayListBuilderTransformer.Get(typeof(object), randArrayLength); } } RandomPlansResult arrayResult; PlanFilter f; if (forbidNull) { f = delegate(Plan p, int x) { // Non-null heuristic if (baseType.IsValueType && (p.transformer is PrimitiveValueTransformer) && (p.transformer as PrimitiveValueTransformer).IsNull) { return(false); } return(true); }; } else { f = delegate(Plan dontCareP, int dontCareInt) { return(true); } }; if (!RandomPlans(out arrayResult, t.ParameterTypes, f, planDB, forbidNull, null)) { //Util.Warning("\tNo array plans for type " + typeDesired.Name + " created"); result = null; return(false); } plans.Add(new Plan(t, arrayResult.fplans, arrayResult.fparameterChoosers)); parameterMap[i] = new Plan.ParameterChooser(i, 0); } else { // Types for which default plans are not created // Don't want to create a plan for a value type which is just a type defn. if (typeDesired.IsValueType && typeDesired.IsGenericTypeDefinition) { result = null; return(false); } //Array.createInstance can't create arrays of these types if (typeDesired.Name.Equals("TypedReference") || typeDesired.Name.Equals("ArgIterator") || typeDesired.Name.Equals("ByRef") || typeDesired.Name.Equals("RuntimeArgumentHandle")) { result = null; return(false); } if (typeDesired.IsPointer) { result = null; return(false); } Plan chosenplan; if (i == 0 && method != null && method.IsStatic) { chosenplan = new Plan(DummyTransformer.Get(typeDesired), new Plan[0], new Randoop.Plan.ParameterChooser[0]); } else { chosenplan = planDB.RandomPlan(typeDesired); if (chosenplan == null) { // No plans for type typeDesired created. result = null; return(false); } //if ((method != null) && method.Name.Contains("heapSort") && !(chosenplan.transformer is PrimitiveValueTransformer)) //[email protected] // Logger.Debug("debug."); if (!filter(chosenplan, i)) { result = null; return(false); } // If plan represents "null" return false. if (forbidNull && (chosenplan.transformer is PrimitiveValueTransformer) && (chosenplan.transformer as PrimitiveValueTransformer).IsNull) { result = null; return(false); } } plans.Add(chosenplan); Collection <int> possibleResultIndices = PossibleResultTupleIndices(chosenplan, typeDesired); if (possibleResultIndices.Count == 0) { result = null; return(false); } parameterMap[i] = new Plan.ParameterChooser(i, possibleResultIndices[Enviroment.Random.Next(possibleResultIndices.Count)]); } } result = new RandomPlansResult(plans.ToArray(), parameterMap); return(true); }