Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
        public static void Add_to_Lists(LoadOperation<ProvinceActualPerMonth> result, CommonRawDataCollection loadedData, Dictionary<DateTime, bool> month_With_Actual)
        {
            if (loadedData == null)
                return;

            foreach (ProvinceActualPerMonth dataItem in result.Entities)
            {
                loadedData.Add(new CommonRawData() { IsActual = true, Date = new DateTime(dataItem.YearT, dataItem.MonthT, 1), QTY = DBUtils.Get_Equivalented_QTY(dataItem.QTY, dataItem.ProductID), VAL = DBUtils.Get_Value_AccTo_PricePerTypeList(dataItem.QTY, DBUtils.GetFirstSAPRODUCTCODE(dataItem.ProductID), dataItem.MonthT, dataItem.YearT, "") });
                Set_MonthWtih_Value_to_True(month_With_Actual, dataItem.YearT, dataItem.MonthT);
            }
        }
Exemplo n.º 3
0
 public static void Add_to_Lists(LoadOperation<ProvinceObjective_PerMonth> result, CommonRawDataCollection loadedData, Dictionary<DateTime, bool> months_With_Objective_QTY, Dictionary<DateTime, bool> months_With_Objective_VAL)
 {
     foreach (ProvinceObjective_PerMonth dataItem in result.Entities)
     {
         double qty = 0;
         double val = 0;
         if (dataItem.QTY != null)
         {
             qty += (double)dataItem.QTY;
             Set_MonthWtih_Value_to_True(months_With_Objective_QTY, dataItem.YearT, dataItem.MonthT);
             if (dataItem.VAL == null && (DBUtils.Have_Equivalent(dataItem.BrandCode) || dataItem.SAProductCode != "" ))
             {
                 if (dataItem.SAProductCode != "")
                     val = DBUtils.Get_Value_AccTo_PricePerTypeList((double)dataItem.QTY, dataItem.SAProductCode, dataItem.MonthT, dataItem.YearT, GetPriceType(dataItem.TypeT));
                 else
                     val = (double)dataItem.QTY * DBUtils.Get_Equivalented_PricePerType(dataItem.BrandCode, dataItem.MonthT, dataItem.YearT,GetPriceType(dataItem.TypeT));
                 
                 Set_MonthWtih_Value_to_True(months_With_Objective_VAL, dataItem.YearT, dataItem.MonthT);
             }
         }
         if (dataItem.VAL != null)
         {
             val += (double)dataItem.VAL;
             Set_MonthWtih_Value_to_True(months_With_Objective_VAL, dataItem.YearT, dataItem.MonthT);
             if (dataItem.QTY == null && DBUtils.Have_Equivalent(dataItem.BrandCode))
             {
                // qty = (double)dataItem.VAL / DBUtils.Get_Equivalented_Price(dataItem.BrandCode, dataItem.MonthT, dataItem.YearT);
                 qty = (double)dataItem.VAL / DBUtils.Get_Equivalented_PricePerType(dataItem.BrandCode, dataItem.MonthT, dataItem.YearT, GetPriceType(dataItem.TypeT));
                 Set_MonthWtih_Value_to_True(months_With_Objective_QTY, dataItem.YearT, dataItem.MonthT);
             }
         }
         Add_to_LoadedData(loadedData, dataItem, qty, val);
     }
 }
Exemplo n.º 4
0
        public static void Add_to_Lists(LoadOperation<TotalActual_PerMonth> result, CommonRawDataCollection loadedData, Dictionary<DateTime, bool> month_With_Actual)
        {
            if (loadedData == null)
                return;

            foreach (TotalActual_PerMonth dataItem in result.Entities)
            {
                double val = (dataItem.VAL != null) ? dataItem.VAL : DBUtils.Get_Value_AccTo_PricePerTypeList(dataItem.QTY, dataItem.SAPRODUCTCODE, dataItem.MonthT, dataItem.YearT, "");
                loadedData.Add(new CommonRawData { IsActual = true, Date = new DateTime(dataItem.YearT, dataItem.MonthT, 1), QTY = DBUtils.Get_Equivalented_QTY(dataItem.QTY, dataItem.SAPRODUCTCODE), VAL = val });
                Set_MonthWtih_Value_to_True(month_With_Actual, dataItem.YearT, dataItem.MonthT);
            }
        }
Exemplo n.º 5
0
 public static void Add_to_Lists(LoadOperation<TotalSalesInObjective_PerMonth> result, CommonRawDataCollection loadedData, Dictionary<DateTime, bool> month_With_SalesInObjective)
 {
     if (loadedData == null)
         return;
     foreach (TotalSalesInObjective_PerMonth dataItem in result.Entities)
     {
         double val = dataItem.VAL;
         loadedData.Add(new CommonRawData { IsSalesInObjective = true, Date = new DateTime(dataItem.YearT, dataItem.MonthT, 1), VAL = val });
         Set_MonthWtih_Value_to_True(month_With_SalesInObjective, dataItem.YearT, dataItem.MonthT);
     }
 }
Exemplo n.º 6
0
 private static void Add_to_LoadedData(CommonRawDataCollection loadedData, TotalObjective_PerProvince_PerMonth dataItem, double qty, double val)
 {
     if (loadedData == null)
         return;
     if (DBUtils.IsBudget(dataItem.TypeT))
         loadedData.Add(new CommonRegionData() { IsBudget = true, BrandCode = dataItem.BrandCode, Date = new DateTime(dataItem.YearT, dataItem.MonthT, 1), RegionMapId = DBUtils.GetRegionMapId_DatRegionCode( dataItem.RegionCode), QTY = qty, VAL = val });
     if (DBUtils.IsF1(dataItem.TypeT))
         loadedData.Add(new CommonRegionData() { IsF1 = true, BrandCode = dataItem.BrandCode, Date = new DateTime(dataItem.YearT, dataItem.MonthT, 1), RegionMapId = DBUtils.GetRegionMapId_DatRegionCode( dataItem.RegionCode), QTY = qty, VAL = val });
     if (DBUtils.IsF2(dataItem.TypeT))
         loadedData.Add(new CommonRegionData() { IsF2 = true, BrandCode = dataItem.BrandCode, Date = new DateTime(dataItem.YearT, dataItem.MonthT, 1), RegionMapId = DBUtils.GetRegionMapId_DatRegionCode(dataItem.RegionCode), QTY = qty, VAL = val });
 }
Exemplo n.º 7
0
        public static void Add_to_Lists(LoadOperation<TotalObjective_PerMonth> result, CommonRawDataCollection loadedData, Dictionary<DateTime, bool> months_With_Objective_QTY, Dictionary<DateTime, bool> months_With_Objective_VAL)
        {
            if (loadedData == null)
                return;

            foreach (TotalObjective_PerMonth dataItem in result.Entities)
            {
                double val = (dataItem.VAL != null) ? dataItem.VAL : DBUtils.Get_Value_AccTo_PricePerTypeList(dataItem.QTY, dataItem.SAPRODUCTCODE, dataItem.MonthT, dataItem.YearT, GetPriceType(dataItem.TypeT));
                if (DBUtils.IsBudget(dataItem.TypeT))
                    loadedData.Add(new CommonRawData { IsBudget = true, Date = new DateTime(dataItem.YearT, dataItem.MonthT, 1), QTY = DBUtils.Get_Equivalented_QTY(dataItem.QTY, dataItem.SAPRODUCTCODE), VAL = val });
                if (DBUtils.IsF1(dataItem.TypeT))
                    loadedData.Add(new CommonRawData { IsF1 = true, Date = new DateTime(dataItem.YearT, dataItem.MonthT, 1), QTY = DBUtils.Get_Equivalented_QTY(dataItem.QTY, dataItem.SAPRODUCTCODE), VAL = val });
                if (DBUtils.IsF2(dataItem.TypeT))
                    loadedData.Add(new CommonRawData { IsF2 = true, Date = new DateTime(dataItem.YearT, dataItem.MonthT, 1), QTY = DBUtils.Get_Equivalented_QTY(dataItem.QTY, dataItem.SAPRODUCTCODE), VAL = val });

                Set_MonthWtih_Value_to_True(months_With_Objective_VAL, dataItem.YearT, dataItem.MonthT);
                Set_MonthWtih_Value_to_True(months_With_Objective_QTY, dataItem.YearT, dataItem.MonthT);
            }
        }
Exemplo n.º 8
0
 private static void Add_to_LoadedData(CommonRawDataCollection loadedData, ProvinceObjective_PerMonth dataItem, double qty, double val)
 {
     if (loadedData == null)
         return;
     if (DBUtils.IsBudget(dataItem.TypeT))
         loadedData.Add(new CommonRawData() { IsBudget = true, Date = new DateTime(dataItem.YearT, dataItem.MonthT, 1), QTY = qty, VAL = val });
     if (DBUtils.IsF1(dataItem.TypeT))
         loadedData.Add(new CommonRawData() { IsF1 = true, Date = new DateTime(dataItem.YearT, dataItem.MonthT, 1), QTY = qty, VAL = val });
     if (DBUtils.IsF2(dataItem.TypeT))
         loadedData.Add(new CommonRawData() { IsF2 = true, Date = new DateTime(dataItem.YearT, dataItem.MonthT, 1), QTY = qty, VAL = val });
 }
Exemplo n.º 9
0
 public static void Add_to_Lists(LoadOperation<TotalActualPerDistrictPerMonth> result, CommonRawDataCollection loadedData, Dictionary<DateTime, bool> month_With_Actual)
 {
     if (loadedData == null)
         return;
     foreach (TotalActualPerDistrictPerMonth dataItem in result.Entities)
     {
         if (DBUtils.Null_Handled(dataItem))
         {
             loadedData.Add(new CommonRegionData { IsActual = true, BrandCode = DBUtils.Get_DAT_BrandCode((int)dataItem.ProductID), Date = new DateTime((int)dataItem.YearT, (int)dataItem.MonthT, 1), RegionMapId = DBUtils.GetRegionMapId_DistrictCode( dataItem.DistrictID), QTY = DBUtils.Get_Equivalented_QTY((int)dataItem.QTY, DBUtils.GetFirstSAPRODUCTCODE((int)dataItem.ProductID)), VAL = DBUtils.Get_Value_AccTo_PricePerTypeList((int)dataItem.QTY, DBUtils.GetFirstSAPRODUCTCODE((int)dataItem.ProductID), (int)dataItem.MonthT, (int)dataItem.YearT, "") });
             Set_MonthWtih_Value_to_True(month_With_Actual, (int)dataItem.YearT, (int)dataItem.MonthT);
         }
     }
 }
Exemplo n.º 10
0
        public MainPage()
        {
            InitializeComponent();

            InitializeMap();

            _loadedData = new CommonRawDataCollection();
            Initialize_MonthWith_Dictionaries();

            DBUtils.Load_PriceList();
            DBUtils.Load_PricePerTypeList();

            DBUtils.Load_Available_ObjectiveTypes();
            DBUtils.Load_ObjectiveNotations();
            DBUtils.Load_SpecialObjectiveYears();

            DBUtils.Load_ProductMap_Table();
            DBUtils.Load_RegionMap_Table();
            DBUtils.LoadProvinceGroupView();

            DBUtils.Load_CD_DataRange();
            DBUtils.Load_DAT_DataRange();

        }
Exemplo n.º 11
0
        public void TotalActual_PerMonth_ResultCallback(LoadOperation<TotalActual_PerMonth> result)
        {
            object[] state = (object[])result.UserState;
            if (result.Error == null)
            {
                if (state.Length == 5)
                {
                    _regionsData = new RegionValueCollection
                    {
                        Product = (SanofiProductBrands)state[0],
                        StartMonth = (int)state[1],
                        StartYear = (int)state[2],
                        EndMonth = (int)state[3],
                        EndYear = (int)state[4],
                        Polygons = Polygons.Total_NoPolygon
                    };
                    _loadedData = new CommonRawDataCollection();
                    Utils.Add_to_Lists(result, _loadedData, _months_With_Actual);
                    foreach (CommonRawData dataItem in _loadedData)
                        AddToRegionDataTotals(dataItem.QTY, dataItem.VAL);

                    SetPageByData(_regionsData, _selected_RegionType);
                }
            }
            else
            {
                SetPageForEndOfLoadData();
            }
            RemovefromLoadingList("GetTotalActual_PerMonthQuery", state);
        }
Exemplo n.º 12
0
 public void TotalActualPerProvincePerMonth_ResultCallback(LoadOperation<TotalActualPerProvincePerMonth> result)
 {
     object[] state = (object[])result.UserState;
     if (Utils.LoadOperation_Error_Handled(result.Error, "CD"))
     {
         if (state.Length == 5)
         {
             _regionsData = new RegionValueCollection
             {
                 Product = (SanofiProductBrands)state[0],
                 StartMonth = (int)state[1],
                 StartYear = (int)state[2],
                 EndMonth = (int)state[3],
                 EndYear = (int)state[4],
                 Polygons = Polygons.Provinces,
                 ObjectivesLoaded = false
             };
             _loadedData = new CommonRawDataCollection();
             Utils.Add_to_Lists(result, _loadedData, _months_With_Actual);
             foreach (CommonRegionData dataItem in _loadedData)
             {
                 if (!Utils.IsPermitted(C.SHOW_IRAN_PERMISSIONCODE))
                     if (!Utils.IsPermitted(DBUtils.Get_PermissionCode(dataItem.RegionMapId)))
                         continue;
                 Add_to_RegionData(dataItem.QTY, dataItem.VAL, dataItem.RegionMapId);
             }
             if (_isShare)
                 SetPageByData(_regionsData, _selected_RegionType);
             else
                 if (AreCurrentSelections(_regionsData.Product, SanofiRegionTypes.Province, _regionsData.StartMonth, _regionsData.StartYear, _regionsData.EndMonth, _regionsData.EndYear))
                     if (!_regionsData.ObjectivesLoaded)
                         LoadProvinceObjectives(_regionsData.Product, _regionsData.StartMonth, _regionsData.StartYear, _regionsData.EndMonth, _regionsData.EndYear);
         }
     }
     else
         SetPageForEndOfLoadData();
     RemovefromLoadingList("GetTotalActual_PerProvince_PerMonthQuery", state);
 }
Exemplo n.º 13
0
 private void EmptyResultSet()
 {
     _regionsData = null;
     _loadedData = null;
 }
Exemplo n.º 14
0
        public MatOutChart(SanofiProductBrands product,SanofiRegionTypes regionT,int aGroupRegionMapId,string regionName,int endM,int endY, string dosageName, bool? wasValueSelected)
        {
            InitializeComponent();
            _productBrand = product;
            _regionType = regionT;
            _groupRegionMapId = aGroupRegionMapId;
            _regionName = regionName;
            _endMonth = endM;
            _endYear = endY;
            _dosageName = dosageName;
            _loadedData = new CommonRawDataCollection();
            _wasValueSelected = wasValueSelected;

            _haveAnyObjective= DBUtils.HaveAnyObjective(endY, endY, Utils.GetBrandCode(product), regionT);
            Set_Axis_Label();
            Initialize_ItemSources();
            Initialize_MonthWith_Dictionaries();
            Set_Table_Labels();
            if (_regionType != SanofiRegionTypes.TotalIR || !_isValue || dosageName == "")
                _showSalesIn = false;
            SetDosageCombo();
            if (DBUtils.Get_F1_StartMonth(endY) > endM)
                _showF01 = false;
            if (DBUtils.Get_F2_StartMonth(endY) > endM)
                _showF02 = false;
        }