public static bool Is_Objective_Value(DateTime date, string brandCode, SanofiRegionTypes regionType, bool isBudget, bool isF1, bool isF2) { int year = date.Year; List<AvailableObjective> existingAOInYear = Get_Existing_AvailableObjectives_InYear(year,brandCode,regionType); if (existingAOInYear.Count == 0) return false; int month = date.Month; bool haveF2 = false; bool haveF1 = false; bool haveBudget = false; foreach (AvailableObjective ao in existingAOInYear) { if (DBUtils.IsF2(ao.ObjectiveType)) haveF2 = true; if (DBUtils.IsF1(ao.ObjectiveType)) haveF1 = true; if (DBUtils.IsBudget(ao.ObjectiveType)) haveBudget = true; } if (isBudget) return Is_Budget_Objective_Value(year, month, haveF1, haveF2); else if (isF1) return Is_F1_Objective_Value(year, month, haveBudget, haveF2); else if (isF2) return Is_F2_Objective_Value(year, month, haveBudget, haveF1); return false; }
public static bool HaveAnyObjective(int startYear, int endYear, string brandCode, SanofiRegionTypes regionType) { string regionTypeLetter = (regionType == SanofiRegionTypes.Province) ? "P" : "T"; foreach (AvailableObjective ao in _availableObjectiveList) if (ao.BrandCode.ToLower().Trim() == brandCode.ToLower().Trim() && ao.YearT >= startYear && ao.YearT <= endYear && regionTypeLetter.ToLower().Trim() == ao.TotalProvince.ToLower().Trim()) return true; return false; }
private static List<AvailableObjective> Get_Existing_AvailableObjectives_InYear(int year, string brandCode, SanofiRegionTypes regionType) { List<AvailableObjective> result = new List<AvailableObjective>(); string regLetter = ""; regLetter = (regionType == SanofiRegionTypes.Province) ? "P" : regLetter; regLetter = (regionType == SanofiRegionTypes.TotalIR) ? "T" : regLetter; foreach (AvailableObjective ao in _availableObjectiveList) if (brandCode.ToLower().Trim() == ao.BrandCode.ToLower().Trim() && ao.YearT == year && ao.TotalProvince.ToLower().Trim() == regLetter.ToLower().Trim()) result.Add(ao); return result; }
public SalesPerDSDaily(SanofiProductBrands productBrand, SanofiRegionTypes regionType, DateTime startDate, DateTime endDate, int aGroupRegionMapId, string dosageName) { InitializeComponent(); _productBrand = productBrand; _regionType = regionType; _startDate = startDate; _endDate = endDate; _groupRegionMapId = aGroupRegionMapId; _dosageName = dosageName; SetDosageCombo(); }
public DistributorsMatOutQuarterly(SanofiProductBrands productBrand, SanofiRegionTypes regionType, int aGroupRegionMapId, DateTime startDate, DateTime endDate, string dosageName) { InitializeComponent(); _productBrand = productBrand; _regionType = regionType; _groupRegionMapId = aGroupRegionMapId; _startDate = startDate; _endDate = endDate; _dosageName = dosageName; SetTitle(); SetDosageCombo(); }
public DistributorsMonthly(SanofiProductBrands productBrand, SanofiRegionTypes regionType, int aGroupRegionMapId, int startM, int startY, int endM, int endY, string dosageName) { InitializeComponent(); _productBrand = productBrand; _regionType = regionType; _groupRegionMapId = aGroupRegionMapId; _startMonth = startM; _startYear = startY; _endMonth = endM; _endYear = endY; _dosageName = dosageName; SetTitle(); SetDosageCombo(); }
public CustomersRanking(SanofiProductBrands product, SanofiRegionTypes regionType, int aGroupRegionMapId, int startMonth, int startYear, int endMonth, int endYear, string dosageName) { InitializeComponent(); _productBrand = product; _startMonth = startMonth; _startYear = startYear; _endMonth = endMonth; _endYear = endYear; _regionType = regionType; _groupRegionMapId = aGroupRegionMapId; _dosageName = dosageName; SetDosageCombo(); Initialize_MonthWith_Dictionaries(); SetTitle(); }
public SalesTeamWindow(SanofiProductBrands productBrand, SanofiRegionTypes regionT , int aRegionMapId, string regionName,int startmonth, int startyear, int endmonth, int endyear) { InitializeComponent(); _productBrand = productBrand; _startMonth = startmonth; _startYear = startyear; _endMonth = endmonth; _endYear = endyear; _regionMapId = aRegionMapId; _regionType = regionT; if (regionT == SanofiRegionTypes.Province) { _groupRegionMapIds = DBUtils.GetGroupMember_RegionMapIdsList(aRegionMapId, _productBrand); LoadOperation<TotalSalesTeam> loadOp = _optimaContext.Load(_optimaContext.Get_ProvinceSalesTeamQuery(Utils.GetOptimaCode(_productBrand), _startMonth, _startYear, _endMonth, _endYear,Utils.GetStringSeperated2(_groupRegionMapIds,"-")), TotalSalesTeam_ResultCallBack, null); } else { LoadOperation<TotalSalesTeam> loadOp = _optimaContext.Load(_optimaContext.Get_TotalSalesTeamQuery(Utils.GetOptimaCode(_productBrand), _startMonth, _startYear, _endMonth, _endYear), TotalSalesTeam_ResultCallBack, null); } SetTitle(); }
public AccountMatOut(SanofiProductBrands product,SanofiRegionTypes regionType, int aGroupRegionMapId, int endMonth, int endYear, List<AccountGridObj> accounts) { InitializeComponent(); _productBrand = product; _endMonth = endMonth; _endYear = endYear; _dsIds = new List<string>(); foreach (AccountGridObj a in accounts) { _dsIds.AddRange(a.DisCustomerCodes); _dsIdsString += "-"+ a.DSID; } _dsIdsString = (_dsIdsString == "") ? "" : _dsIdsString.Substring(1); _accounts = accounts; _regionType = regionType; _groupRegionMapId = aGroupRegionMapId; _loadedData = new List<CommonRawData>(); SetTitle(); Initialize_MonthWith_Dictionaries(); InitializeCollections(); }
public static int Get_StartMonthIndex_ForActualMatOut(int endYear, SanofiRegionTypes regionType) { DateTime firstAvailableActualData = (regionType == SanofiRegionTypes.TotalIR) ? C.DAT_FIRST_TIME_WITH_ACTUAL : C.CD_FIRST_TIME_WITH_ACTUAL; int distanceFromBeginningOfChartToBeginningOfDataInMonth = Utils.GetDistanceInMonth(firstAvailableActualData.Month, firstAvailableActualData.Year, 1, endYear - 1); int startMonthIndex = (distanceFromBeginningOfChartToBeginningOfDataInMonth >= 11) ? 0 : (11 - distanceFromBeginningOfChartToBeginningOfDataInMonth); return startMonthIndex; }
private void SetCategoryNameLabel(SanofiRegionTypes regionT) { if (CategoryNameTbl != null) CategoryNameTbl.Text = Utils.GetCategoryNameLabel(regionT); }
private static void OpenSalesTeamWindow(SanofiProductBrands product, SanofiRegionTypes regionType, int aRegionMapId, string regionName, int startmonth, int startyear, int endmonth, int endyear) { SalesTeamWindow salesTeamWindow = new SalesTeamWindow(product, regionType, aRegionMapId, regionName, startmonth, startyear, endmonth, endyear); salesTeamWindow.Show(); }
/* private void LoadTehranPolygons() { //_gisService.GetRegionsByLayerAsync(2, Polygons.TehranRegions); _isLoadingTehranRegions = true; }*/ private bool IsPolygonsLoaded(SanofiRegionTypes regionT) { if (regionT == SanofiRegionTypes.Province) return (_provincePolygonsPoints != null); else if (regionT == SanofiRegionTypes.Tehran) return (_tehranPolygonsPoints != null); else if (regionT == SanofiRegionTypes.TotalIR) return true; return false; }
public YTDPerformance(SanofiProductBrands product, SanofiRegionTypes regionT, int aGroupRegionMapId, int endMonth, int endYear, string dosageName) { InitializeComponent(); _productBrand = product; _regionType = regionT; _groupRegionMapId = aGroupRegionMapId; _endMonth = endMonth; _endYear = endYear; _dosageName = dosageName; _loadedData = new CommonRawDataCollection(); InitializeMonthWithDictionaries(); SetTitles(); SetDosageCombo(); }
public static List<int> Get_ActualMatOut_Indices(int month, int year, int endYear, SanofiRegionTypes regionType, int actualMatOut_ItemSource_Length) { List<int> resultIndices = new List<int>(); int distanceFromTheBeginningOfChart = Utils.GetDistanceInMonth(1, endYear - 1, month, year); int startIndex = (distanceFromTheBeginningOfChart < 0) ? 0 : distanceFromTheBeginningOfChart; int startIndexForActualMatOut = Utils.Get_StartMonthIndex_ForActualMatOut(endYear, regionType); for (int i = startIndex; i < distanceFromTheBeginningOfChart + 12; i++) { if (i >= startIndexForActualMatOut && (i - startIndexForActualMatOut) < actualMatOut_ItemSource_Length) resultIndices.Add(i - startIndexForActualMatOut); } return resultIndices; }
private void TehranRegions_Checked(object sender, RoutedEventArgs e) { _selected_RegionType = SanofiRegionTypes.Tehran; ClearMap(); EmptyResultSet(); MoveMapToTehran(); SetProductsAndFranchiseCmbs(_selected_RegionType); ConditionChanged((SanofiProductBrands)_selected_Product, SanofiRegionTypes.Tehran, _selected_StartMonth, _selected_StartYear, _selected_EndMonth, _selected_EndYear); }
private void Provinces_Checked(object sender, RoutedEventArgs e) { _selected_RegionType = SanofiRegionTypes.Province; ClearMap(); EmptyResultSet(); MoveMapToIran(); SetProductsAndFranchiseCmbs(_selected_RegionType); if (_isShare && ShareRadio != null) ShareRadio.IsChecked = true; ConditionChanged((SanofiProductBrands)_selected_Product, SanofiRegionTypes.Province, _selected_StartMonth, _selected_StartYear, _selected_EndMonth, _selected_EndYear); }
private void SetProductsAndFranchiseCmbs(SanofiRegionTypes regionType) { if (regionType == SanofiRegionTypes.TotalIR) { if (ProductsCmb.Items.Count < MAX_NUMBER_OF_PRODUCTS_COMBOBOX_ITEMS) ProductsCmb.Items.Add(new ComboBoxItem() { Content = "Total" }); SetProductsCmbByPermissions(); if (FranchiseCmb != null) { MakeFranchiseChoiseVisible(); SetFranchiseCmbByPermissions(); } } else { if (this.ProductsCmb.Items.Count == MAX_NUMBER_OF_PRODUCTS_COMBOBOX_ITEMS) for (int i = (MAX_NUMBER_OF_PRODUCTS_COMBOBOX_ITEMS - 1); i >= MAX_NUMBER_OF_PRODUCTS_IN_PROVINCE_MODE; i--) ProductsCmb.Items.RemoveAt(i); if (this.FranchiseCmb != null) MakeFranchiseChoiseInvisible(); } }
private Color GetRegionColor(double salesOut, SanofiRegionTypes regionType, double maxSalesOut, bool isShare, double objective) { if (regionType == SanofiRegionTypes.Province || regionType == SanofiRegionTypes.Tehran) { if (isShare) { if (salesOut > maxSalesOut) { return Colors.Gray; } return Colors.Purple; } else { if (objective == 0) return Colors.Transparent; double performance = GetPerformance(salesOut, objective); if (performance >= _PerformanceYellowTreshhold) return Colors.Green; else if (performance >= _PerformanceRedTreshhold) return Colors.Yellow; else return Colors.Red; } } return Colors.Transparent; }
private static double Get_RegionOpacity(SanofiRegionTypes regionType, double salesOut, double maxSalesOut, bool isShare) { if (regionType == SanofiRegionTypes.Province || regionType == SanofiRegionTypes.Tehran) { if (isShare) { if (salesOut >= maxSalesOut || maxSalesOut <= 0) return 1; else { double value = salesOut / maxSalesOut; if (value > 1) value = 1; else if (value < 0) value = 0; return value; } } } return 1; }
private bool IsLoadingPolygons(SanofiRegionTypes mapMode) { switch (mapMode) { case SanofiRegionTypes.Province: return _isLoadingProvinces; case SanofiRegionTypes.Tehran: return _isLoadingTehranRegions; case SanofiRegionTypes.TotalIR: return false; } return false; }
public static ObservableCollection<DateDoubleChartObj> Initialize_ActualMatOut_SourceCollection(int endYear, int endMonth, SanofiRegionTypes regionType) { ObservableCollection<DateDoubleChartObj> result = new ObservableCollection<DateDoubleChartObj>(); int StartMonthIndex_ForActualMatOut = Utils.Get_StartMonthIndex_ForActualMatOut(endYear, regionType); for (int i = StartMonthIndex_ForActualMatOut; i < (12 + endMonth); i++) { int month = (((i + 1) % 12) == 0) ? 12 : ((i + 1) % 12); int year = (i < 12) ? (endYear - 1) : endYear; result.Add(new DateDoubleChartObj { Date = new DateTime(year, month, 1), Value = 0 }); } return result; }
public static void Add_To_ActualMatOut_Chart_ItemSource(CommonRawData dataItem, int endYear, SanofiRegionTypes regionType, ObservableCollection<DateDoubleChartObj> actualMatOut_ChartItemSource_QTY, ObservableCollection<DateDoubleChartObj> actualMatOut_ChartItemSource_VAL) { List<int> actualMatIndexes = Utils.Get_ActualMatOut_Indices(dataItem.Date.Month, dataItem.Date.Year, endYear, regionType, actualMatOut_ChartItemSource_QTY.Count); foreach (int ind in actualMatIndexes) { actualMatOut_ChartItemSource_QTY[ind].Value += dataItem.QTY; actualMatOut_ChartItemSource_VAL[ind].Value += dataItem.VAL; } }
private void ShowLocationsBtn_Click(object sender, RoutedEventArgs e) { _selected_RegionType = SanofiRegionTypes.TehranLocations; ClearPage(); MoveMapToTehran(); SetProductsAndFranchiseCmbs(_selected_RegionType); DrawCurrentDistrictLocations(); TehranRegionsRadioButton.IsChecked = false; }
public static string GetCategoryNameLabel(SanofiRegionTypes regionT) { if (regionT == SanofiRegionTypes.Province) return "Provinces"; if (regionT == SanofiRegionTypes.Tehran) return "Tehran Regions"; return ""; }
private void LoadNewConditionData(SanofiProductBrands product, SanofiRegionTypes regionT, int startMonth, int endMonth, int startYear, int endYear) { if (!IsPolygonsLoaded(regionT) && !IsLoadingPolygons(regionT)) LoadPolygons(regionT); if (!IsRegionsDataAvailable(product, startMonth, startYear, endMonth, endYear, regionT)) LoadResult_AccTo_RegionType(); }
private void SetControlsInMapMargin(SanofiRegionTypes regionT, RegionValueCollection regionValCol) { if (regionT == SanofiRegionTypes.Province) { ShowSharePerformance(); RemoveTotalIrTexts(); SetSlider(regionValCol); }else if (regionT == SanofiRegionTypes.Tehran) { HideSharePerformance(); RemoveTotalIrTexts(); SetSlider(regionValCol); } else if (regionT == SanofiRegionTypes.TotalIR) { RemoveSlider(); SetMenusButton(C.TOTAL_IR); SetTotalIrText(regionValCol); } }
private void ConditionChanged(SanofiProductBrands product, SanofiRegionTypes regionT, int startMonth, int startYear, int endMonth, int endYear) { SetPageForStartOfLoadData(); ClearPage(); if (AreReasonableParameters((SanofiProductBrands)_selected_Product, _selected_StartMonth, _selected_StartYear, _selected_EndMonth, _selected_EndYear)) { LoadNewConditionData(product, regionT, startMonth, endMonth, startYear, endYear); SetPageByData(_regionsData, regionT); } else { SetPageForEndOfLoadData(); } }
private void Customers_Checked(object sender, RoutedEventArgs e) { _selected_RegionType = (SanofiRegionTypes)(-1); ClearPage(); MoveMapToTehran(); SetProductsAndFranchiseCmbs(_selected_RegionType); DrawHospitalPoints(); }
private void LoadPolygons(SanofiRegionTypes regionT) { if (regionT == SanofiRegionTypes.Province) Start_Loading_UnloadedProvincePolygons(); else if (regionT == SanofiRegionTypes.Tehran) Start_Loading_UnloadedTehranPolygons(); else SetPageForEndOfLoadData(); }