private void LoadSalesData()
 {
     CD_DomainContext context = new CD_DomainContext();
     string cdIds = DBUtils.Get_CD_ProductIDs(Utils.GetBrandCode(_productBrand));
     if (GetDosageSaCodes() != "")
         cdIds = DBUtils.GetCdProductIds(GetDosageSaCodes());
     if (this._regionType == SanofiRegionTypes.Province)
         context.Load(context.GetProvince_PerCustomer_PerDistributor_PerChannelQuery(cdIds, _startDate, _endDate, DBUtils.Get_CD_ProvinceIds(_groupRegionMapId, _productBrand), _selectedDistributorsIds), ProvincePerCustomerPerDistributorPerChannel_Callback, null);
     else if (this._regionType == SanofiRegionTypes.TotalIR)
         context.Load(context.GetTotal_PerCustomer_PerDistributor_PerChannelQuery(cdIds, _startDate, _endDate, _selectedDistributorsIds), TotalPerCustomerPerDistributorPerChannel_Callback, null);
 }
Пример #2
0
 private void LoadActualSales_Async()
 {
     CD_DomainContext context = new CD_DomainContext();
     DateTime start = new DateTime(_endYear - 2,1,1);
     DateTime end = new DateTime(_endYear, _endMonth, 1).AddMonths(1).AddSeconds(-1);
     LoadOperation<AccountsPerMonth> loadOp = context.Load(context.GetAccounts_PerMonthQuery(DBUtils.Get_CD_ProductIDs(Utils.GetBrandCode(_productBrand)), start,end, Utils.GetStringSeperated(_dsIds, "-")), Accounts_PerMonth_ResultCallBack, null);
 }
Пример #3
0
 private void LoadActualSales_Async()
 {
     CD_DomainContext context = new CD_DomainContext();
     string cdIds = DBUtils.Get_CD_ProductIDs(Utils.GetBrandCode(_productBrand));
     if (GetDosageSaCodes() != "")
         cdIds = DBUtils.GetCdProductIds(GetDosageSaCodes());
     LoadOperation<TotalActualPerProvincePerMonth> loadOp = context.Load(context.GetTotalActual_PerProvince_PerMonthQuery(cdIds, new DateTime(_startYear - 1,_startMonth,1),new DateTime(_endYear,_endMonth,1).AddMonths(1).AddMinutes(-1)),TotalActualPerProvincePerMonth_ResultCallBack,null);
 }
Пример #4
0
 private void LoadActualSales_Async()
 {
     if (this._regionType == SanofiRegionTypes.Province)
     {
         CD_DomainContext context = new CD_DomainContext();
         string cdIds = DBUtils.Get_CD_ProductIDs(Utils.GetBrandCode(_productBrand));
         if (GetDosageSaCodes() != "")
             cdIds = DBUtils.GetCdProductIds(GetDosageSaCodes());
         context.Load(context.GetProvinceActual_PerMonthQuery(cdIds, new DateTime(_endYear - 1, 1, 1), new DateTime(_endYear, _endMonth, 1).AddMonths(1).AddSeconds(-1), DBUtils.Get_CD_ProvinceIds(_groupRegionMapId, _productBrand)), ProvinceActualPerMonth_ResultCallBack, null);
     }
     else if (this._regionType == SanofiRegionTypes.TotalIR)
         _DAT_DomainContext.Load(_DAT_DomainContext.GetTotalActual_PerMonthQuery(Utils.GetBrandCode(_productBrand), 1, _endYear - 1, _endMonth, _endYear, GetDosageSaCodes()), TotalActual_PerMonth_ResultCallBack, null);
 }
 private void LoadNumberOfClientsFromCdDatabase()
 {
     string cdIds = DBUtils.Get_CD_ProductIDs(Utils.GetBrandCode(_productBrand));
     if (GetDosageSaCodes() != "")
         cdIds = DBUtils.GetCdProductIds(GetDosageSaCodes());
     if (_regionType == SanofiRegionTypes.TotalIR)
     {
         CD_DomainContext context = new CD_DomainContext();
         context.Load(context.GetTotal_Clients_PerDist_PerQuarterQuery(cdIds, _startDate, _endDate), TotalClientsPerDistPerQuarter_ResultCallBack, null);
     }
     else if (_regionType == SanofiRegionTypes.Province)
     {
         CD_DomainContext context = new CD_DomainContext();
         context.Load(context.GetProvince_Clients_PerDist_PerQuarterQuery(cdIds, _startDate, _endDate, DBUtils.Get_CD_ProvinceIds(_groupRegionMapId, _productBrand)), ProvinceClientsPerDistPerQuarter_ResultCallBack, null);
     }
 }
Пример #6
0
        private void LoadActual_Async()
        {
            _provinceActualQty = new Dictionary<int, double>();
            _provinceActualVal = new Dictionary<int, double>();
            _provinceLastYearActualQty = new Dictionary<int, double>();
            _provinceLastYearActualVal = new Dictionary<int, double>();

            CD_DomainContext context = new CD_DomainContext();
            string cdIds = DBUtils.Get_CD_ProductIDs(Utils.GetBrandCode(_productBrand));
            if (GetDosageSaCodes() != "")
                cdIds = DBUtils.GetCdProductIds(GetDosageSaCodes());
            context.Load<TotalActualPerProvincePerMonth>(context.GetTotalActual_PerProvince_PerMonthQuery(cdIds, _startDate, _endDate), TotalActualPerProvincePerMonth_ThisYear_ResultCallBack, null);
        }
Пример #7
0
 private void LoadDate()
 {
     CD_DomainContext context = new CD_DomainContext();
     string cdIds = DBUtils.Get_CD_ProductIDs(Utils.GetBrandCode(_productBrand));
     if (GetDosageSaCodes() != "")
         cdIds = DBUtils.GetCdProductIds(GetDosageSaCodes());
     if (_regionType == SanofiRegionTypes.TotalIR)
     {
         context.Load<TotalSalesPerDSDaily>(context.GetTotalSales_PerDS_DailyQuery(cdIds, _startDate, _endDate), TotalSalesPerDSDaily_ResultCallBack, null);
     }
     else if (_regionType == SanofiRegionTypes.Province)
     {
         context.Load<ProvinceSalesPerDSDaily>(context.GetProvinceSales_PerDS_DailyQuery(cdIds, _startDate, _endDate, DBUtils.Get_CD_ProvinceIds(_groupRegionMapId, _productBrand)), ProvinceSalesPerDSDaily_ResultCallBack, null);
     }
 }
Пример #8
0
        public static void Load_CD_DataRange()
        {
            try
            {
                CD_DomainContext context = new CD_DomainContext();
                LoadOperation<CDDataRange> loadOp = context.Load(context.GetDataRangeQuery(), CD_DataRange_Loaded, null);
            }
            catch (Exception ex)
            {


                string msg = ex.Message;
                if (ex.InnerException != null)
                    msg += ("Inner: \n" + ex.InnerException.Message);
                System.IO.File.WriteAllText(@"C:\inetpub\wwwroot\snfgis\loadcd_datarange1_error.txt", msg);
            }
        }
Пример #9
0
 public void TotalActualPerProvincePerMonth_ThisYear_ResultCallBack(LoadOperation<TotalActualPerProvincePerMonth> result)
 {
     if (Utils.LoadOperation_Error_Handled(result.Error, "CD"))
     {
         _loadedDataThisYear = new List<TotalActualPerProvincePerMonth>();
         foreach (TotalActualPerProvincePerMonth dataItem in result.Entities)
         {
             _loadedDataThisYear.Add(dataItem);
             if (!DBUtils.Null_Handled(dataItem))
                 continue;
             Add_to_Province_ThisYear_Actual_Dictionaries((int)dataItem.QTY, (int)dataItem.ProductID, new DateTime((int)dataItem.YearT,(int)dataItem.MonthT,1).AddMonths(1).AddSeconds(-1), (int)dataItem.ProvinceID);
             Add_to_Provinces_With_Actual((int)dataItem.ProvinceID);        
         }
         CD_DomainContext context = new CD_DomainContext();
         context.Load<TotalActualPerProvincePerMonth>(context.GetTotalActual_PerProvince_PerMonthQuery(DBUtils.Get_CD_ProductIDs(Utils.GetBrandCode(_productBrand)), _startDate.AddYears(-1), _endDate.AddYears(-1)), TotalActualPerProvincePerMonth_LastYear_ResultCallBack, null);
     }
 }
Пример #10
0
        /*
        private void AfterDraw(string position)
        {
            Snf.Silver.Main.GisService.Polygon region = new Snf.Silver.Main.GisService.Polygon
            {
                Caption = "",
                Description = ""
            };
            region.Points = new System.Collections.ObjectModel.ObservableCollection<GisService.Point>();
            string[] splits = position.Split(new char[] { ',' });


            foreach (string split in splits)
            {
                string[] coords = split.Split(new char[] { ' ' });
                region.Points.Add(new Snf.Silver.Main.GisService.Point { X = Convert.ToDouble(coords[0]), Y = Convert.ToDouble(coords[1]) });
            }

            //_gisService.CreateRegionAsync(1, region);
        }*/

        void MapPolygon_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            ChangeDeselectedPolygonsColorToOriginalColor();

            var selectedPolygon = (sender as BIT.AVL.Silver.Map.Geometry.Polygon);

            _selectedRegoinOrginalColor = selectedPolygon.FillColor;
            _selectedRegionsOpacity = new Dictionary<int, double>();

            _selectedRegionMapId = GetRegionMapId(selectedPolygon.TempID);

            foreach (BIT.AVL.Silver.Map.Geometry.Polygon p in DrawControl.DrawLayer.Children)
            {
                if (GetRegionGroupId(p.TempID) == GetRegionGroupId(selectedPolygon.TempID))
                {
                    _selectedRegionsOpacity.Add(GetRegionMapId(p.TempID), p.Opacity);
                    ChangeSelectedPolygonsColorToOrange(p);
                }
            }

            SetMenusButton(DBUtils.GetGroupRegionName(_selectedRegionMapId, (SanofiProductBrands) _selected_Product));
            if (_selected_RegionType == SanofiRegionTypes.Tehran)
            {
                ShowShowLocations();
                if (DistrictDSIDs.ContainsKey(DBUtils.GetDistrictId(_selectedRegionMapId)))
                {
                    EnableShowLocations();
                }
                else
                {
                    DisableShowLocations();
                    CD_DomainContext context = new CD_DomainContext();
                    context.Load(context.GetDSID_PerDistrictQuery(DBUtils.GetDistrictId(_selectedRegionMapId) + ""), DSID_PerDistrict_ResultCallback, null);
                }
            }
        }
Пример #11
0
        public void DSID_PerDistrict_ResultCallback(LoadOperation<DSID_PerDistrict> result)
        {
            if (result.Error == null)
            {
                foreach (DSID_PerDistrict dataItem in result.Entities)
                {
                    if (dataItem.DistrictID == null)
                        continue;
                    if (DistrictDSIDs.ContainsKey((int)dataItem.DistrictID))
                    {
                        if (DistrictDSIDs[(int)dataItem.DistrictID].Where<DSID_PerDistrict>(d => d.DSID == dataItem.DSID ).Count<DSID_PerDistrict>() < 1)
                            DistrictDSIDs[(int)dataItem.DistrictID].Add(dataItem);
                    }
                    else
                    {
                        DistrictDSIDs.Add((int)dataItem.DistrictID, new List<DSID_PerDistrict>() { dataItem });
                    }
                }
                if (DistrictDSIDs != null && DistrictDSIDs.ContainsKey(DBUtils.GetDistrictId(_selectedRegionMapId)) && DistrictDSIDs[DBUtils.GetDistrictId(_selectedRegionMapId)].Count > 0)
                    EnableShowLocations();
            }

            if (result.UserState != null)
            {
                object[] state = (object[])result.UserState;
                if (!IsLoading("GetTotalActual_PerDistrict_PerMonthQuery", state))
                {
                                           SanofiProductBrands product = (SanofiProductBrands)state[0];
                       int startM = (int)state[1];
                        int startY = (int)state[2];
                        int endM = (int)state[3];
                        int endY = (int)state[4];
                    CD_DomainContext context = new CD_DomainContext();
                    AddtoLoadingList("GetTotalActual_PerDistrict_PerMonthQuery", state);
                    DateTime start = new DateTime(startY, startM, 1);
                    DateTime end = new DateTime(endY, endM, 1).AddMonths(1).AddSeconds(-1);
                 //   context.Load(context.GetTotalActual_PerDistrict_PerMonthQuery(DBUtils.Get_CD_ProductIDs(Utils.GetBrandCode(product)), start, end, "6-2-3-5-21", "28348-85784*65561-28079*29549-33865*83023*32929"), TotalActualPerDistrictPerMonth_ResultCallback, state);
                    string pids = DBUtils.Get_CD_ProductIDs(Utils.GetBrandCode(product));
                    string distids =GetListStringDistrictIds();
                   // string dsids = GetListOfDSIDs();
                    context.Load(context.GetTotalActual_PerDistrict_PerMonthQuery(pids, start, end,distids), TotalActualPerDistrictPerMonth_ResultCallback, state);
                }
            }
        }
Пример #12
0
 private void LoadTehranResult(SanofiProductBrands product, int startM, int startY, int endM, int endY)
 {
     object[] state = { product, startM, startY, endM, endY };
     CD_DomainContext context = new CD_DomainContext();
     context.Load(context.GetDSID_PerDistrictQuery(""), DSID_PerDistrict_ResultCallback, state);
 }
Пример #13
0
 private void LoadProvinceResult(SanofiProductBrands product, int startM, int startY, int endM, int endY)
 {
     object[] state = { product, startM, startY, endM, endY };
     if (!IsLoading("GetTotalActual_PerProvince_PerMonthQuery", state))
     {
         CD_DomainContext context = new CD_DomainContext();
         AddtoLoadingList("GetTotalActual_PerProvince_PerMonthQuery", state);
         DateTime start = new DateTime(startY, startM, 1);
         DateTime end = new DateTime(endY, endM, 1).AddMonths(1).AddSeconds(-1);
         context.Load(context.GetTotalActual_PerProvince_PerMonthQuery(DBUtils.Get_CD_ProductIDs(Utils.GetBrandCode(product)), start, end ), TotalActualPerProvincePerMonth_ResultCallback, state);
     }
 }
 private void LoadDistributorsMonthly()
 {
     CD_DomainContext context = new CD_DomainContext();
     string cdIds = DBUtils.Get_CD_ProductIDs(Utils.GetBrandCode(_productBrand));
     if (GetDosageSaCodes() != "")
         cdIds = DBUtils.GetCdProductIds(GetDosageSaCodes());
     DateTime start = new DateTime(_startYear, _startMonth, 1);
     DateTime end = new DateTime(_endYear, _endMonth, 1).AddMonths(1).AddSeconds(-1);
     if (this._regionType == SanofiRegionTypes.Province)
         context.Load(context.GetProvince_PerDistributorQuery(cdIds, start,end , DBUtils.Get_CD_ProvinceIds(_groupRegionMapId, _productBrand)), ProvincePerDistributor_ResultCallback, null);
     else if (this._regionType == SanofiRegionTypes.TotalIR)
         context.Load(context.GetTotal_PerDistributorQuery(cdIds, start, end), TotalPerDistributor_ResultCallack, null);
 }