コード例 #1
0
 public ActionResult Index(string strDataConnectorType, int?id)
 {
     if (strDataConnectorType != null && id == null)
     {
         try
         {
             objConnectorRepository = new ConnectorRepository(strDataConnectorType);
             objConnectorRepository.GetDataConnectorVM().ExistingConnectionName = ConnectorRepository.objAllExistingConnections;
             return(View(objConnectorRepository.GetDataConnectorVM()));
         }
         catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); }
     }
     if (strDataConnectorType != null && id != null)
     {
         try
         {
             objConnectorRepository = new ConnectorRepository(strDataConnectorType);
             objConnectorRepository.GetDataConnectorVM().DataConnectors         = objConnectorRepository.GetExistingConnectionsById(int.Parse(id.ToString()));
             objConnectorRepository.GetDataConnectorVM().ExistingConnectionName = ConnectorRepository.objAllExistingConnections;
             return(View(objConnectorRepository.GetDataConnectorVM()));
         }
         catch (Exception ex)
         {
             ModelState.AddModelError(string.Empty, ex.Message);
         }
     }
     return(View(ConnectorConvert.ConvertDTOtoViewModel(ConnectorRepository.objAllExistingConnections)));
 }
コード例 #2
0
 public ProcessService(
     ILogging log,
     IProductRepository productRepo,
     ISyncContentService contentService,
     IConnectorRepository connectorRepo,
     ISyncProductService syncProductService,
     IMasterGroupMappingRepository masterGroupMappingRepo,
     ISyncProductGroupMappingService syncProductGroupMapping,
     ISyncContentProductGroupService contentProductGroupService,
     IFlattenHierachyProductGroupService flattenHierachyService,
     IConnectorPublicationRuleRepository connectorPublicarionRuleRepo,
     IFilterByParentProductGroupService filterByParentProductGroupService
     )
 {
     this.log                               = log;
     this.productRepo                       = productRepo;
     this.connectorRepo                     = connectorRepo;
     this.contentService                    = contentService;
     this.syncProductService                = syncProductService;
     this.masterGroupMappingRepo            = masterGroupMappingRepo;
     this.flattenHierachyService            = flattenHierachyService;
     this.syncProductGroupMapping           = syncProductGroupMapping;
     this.contentProductGroupService        = contentProductGroupService;
     this.connectorPublicarionRuleRepo      = connectorPublicarionRuleRepo;
     this.filterByParentProductGroupService = filterByParentProductGroupService;
 }
コード例 #3
0
 public DiscoveryRepository(IInnonAnalyticsEngineEntities db, IConnectorRepository conectorrepository, IRawTableRepository rawtablename, IElementRepository elementrepository)
 {
     _dbcontext             = db;
     _objConectorRepository = conectorrepository;
     _objRawTableName       = rawtablename;
     _objElementRepository  = elementrepository;
 }
コード例 #4
0
        public DataConnectionController(IConnectorRepository connectorrepository)
        {
            objConnectorRepository = connectorrepository;

            //if (ConnectorRepository.objAllExistingConnections == null)
            //    GetAllExistingConnections();
        }
 public CreateOrUpdateConnectorCommandHandler(IConnectorRepository connectorRepository,
                                              IChargeStationRepository chargeStationRepository,
                                              IGroupRepository groupRepository)
 {
     _connectorRepository     = connectorRepository;
     _chargeStationRepository = chargeStationRepository;
     _groupRepository         = groupRepository;
 }
コード例 #6
0
 public ConnectorFactory(
     IConnectorRepository connectorRepository,
     IConnectorAllocationStrategy connectorAllocationStrategy
     )
 {
     this.connectorRepository         = connectorRepository;
     this.connectorAllocationStrategy = connectorAllocationStrategy;
 }
コード例 #7
0
 public UpdateGroupCommandHandler(IGroupRepository groupRepository,
                                  IChargeStationRepository chargeStationRepository,
                                  IConnectorRepository connectorRepository)
 {
     _groupRepository         = groupRepository;
     _chargeStationRepository = chargeStationRepository;
     _connectorRepository     = connectorRepository;
 }
コード例 #8
0
        public ActionResult DataConnection_Update([DataSourceRequest] DataSourceRequest request, ConnectorDTO _dtoConnector)
        {
            if (_dtoConnector != null && ModelState.IsValid)
            {
                _dtoConnector.SessionId = Session.SessionID;
                objConnectorRepository  = new ConnectorRepository(_dtoConnector);
                objConnectorRepository.SaveConnection();
            }

            return(Json(new[] { _dtoConnector }.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet));
        }
コード例 #9
0
        public ActionResult DataConnection_TestConnection(ConnectorDTO _dtoConnector)
        {
            try
            {
                objConnectorRepository = new ConnectorRepository(_dtoConnector);
                objConnectorRepository.TestConnection();

                return(Json(new { success = true, message = Resources.Resources.ConnectorTestMessage }));
            }
            catch (Exception ex)
            {
                return(Json(new { success = false, message = ex.Message + " " + ex.InnerException.Message }));
            }
        }
コード例 #10
0
 public ProcessImportService(
     ILogging log,
     IConnectorRepository connectorRepo,
     IProductGroupRepository productGroupRepo,
     IMasterGroupMappingRepository masterGroupMappingRepo,
     IProductGroupMappingRepository productGroupMappingRepo,
     IMagentoProductGroupSettingRepository magentoSettingRepo
     )
 {
     this.log                     = log;
     this.connectorRepo           = connectorRepo;
     this.productGroupRepo        = productGroupRepo;
     this.masterGroupMappingRepo  = masterGroupMappingRepo;
     this.productGroupMappingRepo = productGroupMappingRepo;
     this.magentoSettingRepo      = magentoSettingRepo;
 }
コード例 #11
0
        public ActionResult DataConnection_Insert([DataSourceRequest] DataSourceRequest request, ConnectorDTO _dtoConnector)
        {
            try
            {
                if (_dtoConnector != null && ModelState.IsValid)
                {
                    _dtoConnector.SessionId = Session.SessionID;
                    objConnectorRepository  = new ConnectorRepository(_dtoConnector);
                    objConnectorRepository.SaveConnection();
                }

                return(Json(new[] { _dtoConnector }.ToDataSourceResult(request, ModelState), JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.Message);
                return(Content(ex.Message + ex.InnerException.Message));
            }
        }
コード例 #12
0
        public ActionResult CreateDatabaseConnector(ConnectorsDTO objDCDTO)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    objDCDTO.SessionId     = Session.SessionID;
                    objConnectorRepository = new ConnectorRepository(objDCDTO);

                    if (Request.Form["btnTest"] != null)
                    {
                        objConnectorRepository.TestConnection();
                        return(Json(new { success = true, message = Resources.Resources.ConnectorTestMessage }));
                    }
                    else
                    {
                        objConnectorRepository.SaveConnection();
                        GetAllExistingConnections();
                        return(Json(new { success = true, message = Resources.Resources.ConnectorSaveMessage }));
                    }
                }
                catch (Exception ex)
                {
                    //ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
                    //Response.StatusCode = 400;
                    //ModelState.AddModelError(string.Empty, ex.Message + ex.InnerException.Message);
                    //return Content(ex.Message + ex.InnerException.Message);

                    return(Json(new { success = false, message = ex.Message + ex.InnerException.Message }));
                }
            }
            else
            {
                return(Content(Resources.Resources.ConnectorValidationFailed));
            }
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: weedkiller/Analytics
        static void Main(string[] args)
        {
            try
            {
                Console.WriteLine("Initialization...... ");

                //Aggregate_Save obj = new Aggregate_Save();
                //obj.Update_Hour_Aggregation(3628);

                // Interpolation.Get_Previous_and_Next_Good_Value(DateTime.Parse("2015-09-01 00:30:00"), 3575);

                //data_staus is used for the interpoliation of data
                string[] data_status = ConfigurationManagerHelper.AppSettings["bad_data_status"].ToString().Split(',');

                InnonAnalyticsEngineEntities _dbcontext = new InnonAnalyticsEngineEntities();

                IElementRepository _ElementRepository = new ElementRepository(_dbcontext);
                //Get All Elements from the tblElement where Elemet Type is point (point has data)
                IList <ElementDTO> list_element_dto = _ElementRepository.Get_Element_By_Element_Tag_Type(Common.Enums.TagType.point, false);
                //list_element_dto = list_element_dto.Where(e => e.ID == 2366).ToList();
                //GenerateMissingData(list_element_dto[0]);

                ITagRepository _TagRepository = new TagRepository(_dbcontext);

                //Get All non deleted tag type mapping
                IList <Tag_Type_Mapping_DTO> list_tag_type_dto = _TagRepository.Get_Tag_Type_Mapping(false);
                Console.WriteLine("Updating point dim ");
                IPoint_Dim_Service _Point_dim_service = new Point_Dim_Service();
                _Point_dim_service.Update_Point_Dim(list_element_dto, list_tag_type_dto);

                Console.WriteLine("Start Data Migration ");
                IDatawareHouseMigrationLogRepository _DatawareHouseMigrationLogRepository = new DatawareHouseMigrationLogRepository(_dbcontext);



                //Get all element data migration history from [tblDatawareHouseMigrationLog]
                IList <DatawareHouseMigrationLogDTO> list_datawaredousemigrationLog_dto = _DatawareHouseMigrationLogRepository.get_Data_Migration_Logs();

                //Creat an arry of tasks, Number of Point element found in tblElement table
                Task[] taskArray = new Task[list_element_dto.Count];


                DateTime starttime = DateTime.Now;
                Console.WriteLine("Start " + starttime);


                //Initialize Connector Repository for getting the data connection info of each table
                IConnectorRepository _connector_rep = _connector_rep = new ConnectorRepository(_dbcontext);
                ConnectorDTO         _dto_connector = new ConnectorDTO();

                //running loop on each task in the task array ()
                for (int i = 0; i < taskArray.Length; i++)
                {
                    DateTime default_from_dt, default_to_dt = System.DateTime.Now;;
                    taskArray[i] = Task.Factory.StartNew(() =>
                    {
                        try
                        {
                            //First Step get database or data connector information of each points
                            //The connection info is same as the previous we will not get the connector info again
                            if (_dto_connector.ConnectionID != list_element_dto[i].ConnectionInfo.ConnectionID)
                            {
                                _dto_connector = _connector_rep.GetExistingConnectionById(list_element_dto[i].ConnectionInfo.ConnectionID);
                            }
                            //Console.WriteLine("No." + i + " " + _dto_connector.ConnectionID + " -- " + _dto_connector.ConnectionName);

                            //Sec Step set from_date and to_date
                            //If the element is not runing first time than change the from datetime (get last run datetime), All log save in the tbldatawaredousemigrationLog
                            if (list_datawaredousemigrationLog_dto.Any(element => element.Element_ID == list_element_dto[i].ID))
                            {
                                DateTime?_timestamp_to = list_datawaredousemigrationLog_dto.Where(element => element.Element_ID == list_element_dto[i].ID).OrderByDescending(t => t.Last_Run_Start).First().Timestamp_To;

                                if (_timestamp_to.HasValue)
                                {
                                    default_from_dt = Convert.ToDateTime(_timestamp_to.Value.AddMilliseconds(2).ToString("yyyy-MM-dd,HH:mm:ss.fff"));
                                    //    GetRowsForEachTable(list_element_dto[j], _dto_connector, j);
                                }
                                else
                                {
                                    default_from_dt = CheckLastRecordInsterted(list_element_dto[i].ID);
                                    //    GetRowsForEachTable(list_element_dto[j], _dto_connector, j);
                                }
                            }
                            else
                            {
                                default_from_dt = CheckLastRecordInsterted(list_element_dto[i].ID);
                                //GetRowsForEachTable(list_element_dto[j], _dto_connector, j);
                            }

                            Console.WriteLine("No." + i + " " + list_element_dto[i].ID + " " + default_from_dt + " -- " + default_to_dt);
                            //End sec

                            //Third Get Raw Data;
                            IList <RawDataDTO> list_RawDataDTO = new List <RawDataDTO>();
                            list_RawDataDTO = GetRawData(list_element_dto[i], default_from_dt, default_to_dt, _dto_connector, _dbcontext);
                            //End Get Raw Data

                            Console.WriteLine("Total Records " + list_RawDataDTO.Count());
                            //Save DataMirgrationLog
                            tblDatawareHouseMigrationLog tbldatamigrationlog = SaveDataMigrationLog(list_element_dto[i], default_to_dt);
                            //End
                            if (list_RawDataDTO.Count > 0)
                            {
                                //Get Convert Raw data in to Point_Mesaure_Fact_DTO
                                IList <Point_Measure_Fact> point_measure_fact_list_dto = Convert_Raw_Data_To_Point_Measure_Fact_DTO(list_element_dto[i], list_RawDataDTO);
                                //End

                                //Saving in to the Datawarehouse table Point_Measure_Fact
                                Final_Insert_In_To_DatawareHouse_Table(point_measure_fact_list_dto);
                                //End

                                //Update DataMirgrationLog
                                if (point_measure_fact_list_dto.Count > 0)
                                {
                                    UpdateDataMigrationLog(tbldatamigrationlog, point_measure_fact_list_dto.Count(), point_measure_fact_list_dto.LastOrDefault().Timestamp_From);
                                }
                                //End
                            }

                            //Aggregation
                            //Task aggregationtask = GetAggregation(list_element_dto[i]);
                            //EndAggregation

                            Console.WriteLine("Missing Data " + list_element_dto[i].Source_Element_Name_History);

                            try
                            {
                                //Get Raw missing data if any thing accedently during the process than we need to get the missing data
                                IList <RawDataDTO> list_Mising_RawDataDTO = GetRawMissingData(list_element_dto[i], _dto_connector);
                                Console.WriteLine("Get Missing Data " + list_Mising_RawDataDTO.Count);
                                if (list_Mising_RawDataDTO.Count > 0)
                                {
                                    //Get Convert Raw data in to Point_Mesaure_Fact_DTO
                                    IList <Point_Measure_Fact> missing_point_measure_fact_list_dto = Convert_Raw_Data_To_Point_Measure_Fact_DTO(list_element_dto[i], list_Mising_RawDataDTO);
                                    //End

                                    //Saving in to the Datawarehouse table Point_Measure_Fact
                                    Final_Insert_In_To_DatawareHouse_Table(missing_point_measure_fact_list_dto);
                                    //End
                                }

                                //End End of Raw missing data saving
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("Error in Missing Data " + ex.Message);
                            }
                            Console.WriteLine("Generate Missing Data ");
                            try
                            {
                                IList <RawDataDTO> list_Genrated_Mising_RawDataDTO = GenerateMissingData(list_element_dto[i]);
                                //Get Convert Raw data in to Point_Mesaure_Fact_DTO
                                IList <Point_Measure_Fact> genrated_missing_point_measure_fact_list_dto = Convert_Raw_Data_To_Point_Measure_Fact_DTO(list_element_dto[i], list_Genrated_Mising_RawDataDTO);
                                //End

                                //Saving in to the Datawarehouse table Point_Measure_Fact
                                Final_Insert_In_To_DatawareHouse_Table(genrated_missing_point_measure_fact_list_dto);
                                //End
                            }
                            catch (Exception ex)
                            {
                                Helper.WriteToFile(ex.Message);
                            }



                            try
                            {
                                //Console.WriteLine("Deleting Data " + list_element_dto[i].Source_Element_Name_History);
                                //Deleting Any Duplication
                                Delete_Duplicate(list_element_dto[i]);
                                //End
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("Error in Delete duplicate Data " + ex.Message);
                            }

                            try
                            {
                                //Check interpolation
                                Console.WriteLine("Interpolation");
                                bool Is_Read_For_Aggregation = Interpolation.InterPolateData(default_from_dt, default_to_dt, list_element_dto[i]);
                                Console.WriteLine("End Interpolation");
                                //End Interpolation
                                if (Is_Read_For_Aggregation)
                                {
                                    Console.WriteLine("Aggregate Data Migration ");
                                    IAggregation_Service agr_service = new Aggregation_Service();
                                    agr_service.Calculate_and_Save_Aggregation_WareHouse_By_ElementID(list_element_dto[i].ID);
                                    Console.WriteLine("End Aggregate Data Migration ");
                                }
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("Error in Aggregation Data " + ex.Message);
                            }

                            // aggregationtask.Wait();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("Exception " + ex.Message);
                        }
                    });
                    taskArray[i].Wait();
                }
                Console.WriteLine("End Min " + DateTime.Now.Subtract(starttime).TotalMinutes);
                Console.WriteLine("End Sec " + DateTime.Now.Subtract(starttime).TotalSeconds);
                Helper.WriteToFile("Finished Start Time " + starttime + ", End Time " + System.DateTime.Now + " -- " + " Total Min " + DateTime.Now.Subtract(starttime).TotalMinutes);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception in mian " + ex.Message);
            }

            //Console.ReadLine();
        }
コード例 #14
0
 public UpdateMaxCurrentConnectorHandler(IConnectorRepository connectorRepository, IGroupRepository groupRepository)
 {
     this.connectorRepository = connectorRepository ?? throw new ArgumentNullException(nameof(connectorRepository));
     this.groupRepository     = groupRepository ?? throw new ArgumentNullException(nameof(groupRepository));
 }
コード例 #15
0
 public AllocationThroughMinNumberExclusionStrategy(IConnectorRepository connectorRepository, IGroupRepository groupRepository)
 {
     this.connectorRepository = connectorRepository;
     this.groupRepository     = groupRepository;
 }
コード例 #16
0
 public ConnectorController(IConnectorRepository connectorRepository)
 {
     ConnectorRepository = connectorRepository;
 }
コード例 #17
0
 public DiscoveryController(IDiscoveryRepository discoveryrep, IConnectorRepository connectorrep, IElementRepository elementrep)
 {
     objDiscoveryRep        = discoveryrep;
     objConnectorRepository = connectorrep;
     objElementRepository   = elementrep;
 }
コード例 #18
0
 public PointMeaningFullDataController(IConnectorRepository connectorrep, IElementRepository elementrep, ITagRepository tagrep)
 {
     objConnectorRepository = connectorrep;
     objElementRepository   = elementrep;
     objTagRepository       = tagrep;
 }
 public GetAllConnectorsCommandHandler(IConnectorRepository connectorRepository)
 {
     _connectorRepository = connectorRepository;
 }
コード例 #20
0
 public ElementRepository(IInnonAnalyticsEngineEntities db, IMetricRepository metricRepository, IConnectorRepository connector_rep)
 {
     _dbcontext        = db;
     _metricRepository = metricRepository;
     _connector_rep    = connector_rep;
 }
コード例 #21
0
 public DeleteConnectorCommandHandler(IConnectorRepository connectorRepository)
 {
     _connectorRepository = connectorRepository;
 }
コード例 #22
0
 public DeleteConnectorHandler(IConnectorRepository connectorRepository)
 {
     this.connectorRepository = connectorRepository;
 }