コード例 #1
0
        public ResponseModel Update(ConfigurationMaster configurationMaster)
        {
            var methodName = MethodBase.GetCurrentMethod().Name;
            var result     = new ResponseModel();

            try
            {
                if (_context.ConfigurationMaster.Any(master => master.ID == configurationMaster.ID))
                {
                    _logger.LogInformation($"Start Function => {methodName}, Parameters => {JsonSerializer.Serialize(configurationMaster)}");
                    _context.ConfigurationMaster.Update(configurationMaster);
                    _context.SaveChanges();
                    result.Success = true;
                    _logger.LogInformation($"Finish Function => {methodName}, Result => {JsonSerializer.Serialize(result)}");
                }
                else
                {
                    _logger.LogInformation($"Start Function => {methodName}, Inquiry => ConfiguartionMaster Data no found.");
                }
            }
            catch (Exception ex)
            {
                var messageError = $"Error Function => {methodName}";
                _logger.LogError(ex, messageError);
                throw new ArgumentException(messageError, ex);
            }

            return(result);
        }
コード例 #2
0
        static void Main(string[] args)
        {
            LogFactory.Assign(new ConsoleLogFactory());

            ServiceHostInfo info = new ServiceHostInfo();

            info.Name     = ConfigurationMaster.Get(ServiceConfiguration.DefaultServiceConfigurationName);
            info.Address  = Dns.GetHostName();
            info.Port     = int.Parse(ConfigurationMaster.Get(ServiceConfiguration.DefaultServicePortConfigurationName));
            info.Binding  = new NetTcpBinding(ServiceConfiguration.DefaultNetTcpBindingName);
            info.Contract = typeof(IDeviceConnectorService);
            info.Service  = typeof(DeviceConnectorService);

            Console.WriteLine(string.Format(@"Service is starting on [{0}]", info.ToString()));

            ManagedServiceHostActivator <IDeviceConnectorService> activator = new ManagedServiceHostActivator <IDeviceConnectorService>(info);

            activator.Start();

            Console.WriteLine(string.Format(@"Service address [{0}]", activator.ServiceHost.Description.Endpoints.First().Address));

            Console.WriteLine();
            Console.WriteLine("Press any key to close service.");
            Console.ReadKey();

            activator.Stop();
        }
コード例 #3
0
        public JsonResult Update(ConfigurationMaster master)
        {
            master.UpdateBy   = _userProfile.UserID;
            master.UpdateDate = DateTime.Now;
            var result = _configurationDataService.Update(master);

            return(Json(result));
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: aquarius20th/WPF_Gimela
        static void Main(string[] args)
        {
            LogFactory.Assign(new ConsoleLogFactory());
            ServiceProvider.Bootstrap();

            ServiceHostInfo info = new ServiceHostInfo();

            info.Name     = ConfigurationMaster.Get(ServiceConfiguration.DefaultServiceConfigurationName);
            info.Address  = Dns.GetHostName();
            info.Port     = int.Parse(ConfigurationMaster.Get(ServiceConfiguration.DefaultServicePortConfigurationName));
            info.Binding  = new NetTcpBinding(ServiceConfiguration.DefaultNetTcpBindingName);
            info.Contract = typeof(IDeviceProfileService);
            info.Service  = typeof(DeviceProfileService);

            Console.WriteLine(string.Format(@"Service is starting on [{0}]", info.ToString()));

            ManagedServiceHostActivator <IDeviceProfileService> activator = new ManagedServiceHostActivator <IDeviceProfileService>(info);

            activator.Start();

            Console.WriteLine(string.Format(@"Service address [{0}]", activator.ServiceHost.Description.Endpoints.First().Address));

            string serverName      = ConfigurationMaster.Get(@"HttpServerName");
            string httpServerName  = serverName + " HTTP Server";
            int    httpBindingPort = int.Parse(ConfigurationMaster.Get(@"HttpServerPort"));

            Server server = null;

            server = new Server(httpServerName);
            server.Add(HttpListenerFactory.Create(IPAddress.Any, httpBindingPort));

            server.Add(new CameraListModule());
            server.Add(new CameraModule());
            server.Add(new CameraThumbnailModule());

            FileModule             fileModule = new FileModule();
            EmbeddedResourceLoader embedded   = new EmbeddedResourceLoader();

            embedded.Add("/", Assembly.GetExecutingAssembly(),
                         Assembly.GetExecutingAssembly().GetName().Name,
                         Assembly.GetExecutingAssembly().GetName().Name + @".Resources.favicon.ico");
            fileModule.Resources.Add(embedded);
            server.Add(fileModule);
            server.Add(new SimpleRouter("/favicon.ico", "/resources/favicon.ico"));

            server.Start(5);

            Console.WriteLine(string.Format("Start {0} on {1}.", httpServerName, httpBindingPort));

            Console.WriteLine();
            Console.WriteLine("Press any key to close service.");
            Console.ReadKey();

            server.Stop(true);
            activator.Stop();
        }
コード例 #5
0
        public UpdateSkinViewModel()
        {
            SkinColorType skin = SkinHelper.DefaultSkinColor;

            if (ConfigurationMaster.ContainsKey(SkinHelper.SkinColorConfigurationKey))
            {
                skin = SkinHelper.StringToSkinColorType(ConfigurationMaster.Get(SkinHelper.SkinColorConfigurationKey));
            }

            DefaultColorType = skin;
        }
コード例 #6
0
        public Result AddConfigurationMaster(ConfigurationMaster configurationMaster)
        {
            try
            {
                ConfigurationMaster configurationMaster1 = new ConfigurationMaster();
                using (DB_A3E3FF_scampusMaster2020Context db = new DB_A3E3FF_scampusMaster2020Context())
                {
                    configurationMaster1.ConfigName                 = configurationMaster.ConfigName;
                    configurationMaster1.NoOfBranches               = configurationMaster.NoOfBranches;
                    configurationMaster1.NoOfStaff                  = configurationMaster.NoOfStaff;
                    configurationMaster1.NoOfStudent                = configurationMaster.NoOfStudent;
                    configurationMaster1.NoOfVideoConferenceDaily   = configurationMaster.NoOfVideoConferenceDaily;
                    configurationMaster1.MaxDurationOfConference    = configurationMaster.MaxDurationOfConference;
                    configurationMaster1.MaxNoOfVideoRecording      = configurationMaster.MaxNoOfVideoRecording;
                    configurationMaster1.MaxParticipantInConference = configurationMaster.MaxParticipantInConference;
                    configurationMaster1.BaseUrl          = configurationMaster.BaseUrl;
                    configurationMaster1.BrandLogo        = configurationMaster.BrandLogo;
                    configurationMaster1.PageTitle        = configurationMaster.PageTitle;
                    configurationMaster1.AccoutExpiryDate = configurationMaster.AccoutExpiryDate;
                    configurationMaster1.BrandName        = configurationMaster.BrandName;
                    configurationMaster1.BrandCode        = configurationMaster.BrandCode;
                    configurationMaster1.PageTitle        = configurationMaster.PageTitle;
                    configurationMaster1.UpdatedBy        = configurationMaster.CreatedBy;
                    configurationMaster1.UpdatedDate      = configurationMaster.CreatedDate;

                    db.ConfigurationMaster.Add(configurationMaster1);
                    var result = db.SaveChanges();
                    if (result == 1)
                    {
                        return(new Result {
                            StatusCode = 1, Message = "Added Successfully..!"
                        });
                    }
                    else
                    {
                        return(new Result {
                            StatusCode = -1, Message = "Added Failed..!"
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                return(new Result {
                    StatusCode = -1, Message = ex.Message
                });

                throw ex;
            }
        }
コード例 #7
0
        public IActionResult UpdateConfigurationMaster([FromBody] PostModel inUsers)
        {
            ConfigurationMaster obj = JsonConvert.DeserializeObject <ConfigurationMaster>(inUsers.Key);

            try
            {
                var result = _configurationss.UpdateConfigurationMaster(obj);
                return(Ok(result));
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #8
0
        public Result UpdateConfigurationMaster(ConfigurationMaster configurationMaster)
        {
            try
            {
                using (DB_A3E3FF_scampusMaster2020Context db = new DB_A3E3FF_scampusMaster2020Context())
                {
                    var data = db.ConfigurationMaster.Where(x => x.ConfigId == configurationMaster.ConfigId).FirstOrDefault();
                    data.ConfigName                 = configurationMaster.ConfigName;
                    data.NoOfBranches               = configurationMaster.NoOfBranches;
                    data.NoOfStaff                  = configurationMaster.NoOfStaff;
                    data.NoOfStudent                = configurationMaster.NoOfStudent;
                    data.NoOfVideoConferenceDaily   = configurationMaster.NoOfVideoConferenceDaily;
                    data.MaxDurationOfConference    = configurationMaster.MaxDurationOfConference;
                    data.MaxNoOfVideoRecording      = configurationMaster.MaxNoOfVideoRecording;
                    data.MaxParticipantInConference = configurationMaster.MaxParticipantInConference;
                    data.BaseUrl          = configurationMaster.BaseUrl;
                    data.BrandLogo        = configurationMaster.BrandLogo;
                    data.PageTitle        = configurationMaster.PageTitle;
                    data.AccoutExpiryDate = configurationMaster.AccoutExpiryDate;
                    data.BrandName        = configurationMaster.BrandName;
                    data.BrandCode        = configurationMaster.BrandCode;
                    data.PageTitle        = configurationMaster.PageTitle;
                    data.UpdatedBy        = configurationMaster.CreatedBy;
                    data.UpdatedDate      = configurationMaster.CreatedDate;
                    var result = db.SaveChanges();
                    if (result == 1)
                    {
                        return(new Result {
                            StatusCode = 1, Message = "Configuration Updated Successfully ..!"
                        });
                    }
                    else
                    {
                        return(new Result {
                            StatusCode = -1, Message = "Configuration Failed ..!"
                        });
                    }
                }
            }
            catch (Exception ex)
            {
                return(new Result {
                    StatusCode = -1, Message = ex.Message
                });

                throw ex;
            }
        }
コード例 #9
0
        public ConfigurationMaster InquiryMaster(Guid id)
        {
            var result = new ConfigurationMaster();

            try
            {
                _logger.LogInformation($"Start => {MethodBase.GetCurrentMethod().Name}");
                result = _dataAccess.ConfigurationDataAccess.InquiryMaster(id);
                _logger.LogInformation($"Finish => {MethodBase.GetCurrentMethod().Name}", JsonSerializer.Serialize(result));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Faile => {MethodBase.GetCurrentMethod().Name}");
            }

            return(result);
        }
コード例 #10
0
        public DataTableResponseModel InquiryMasterDatatable(DatableOption option, ConfigurationMaster master)
        {
            var result = new DataTableResponseModel();

            try
            {
                _logger.LogInformation($"Start => {MethodBase.GetCurrentMethod().Name}");
                result = _dataAccess.ConfigurationDataAccess.InquiryMasterDatatable(option, master);
                _logger.LogInformation($"Finish => {MethodBase.GetCurrentMethod().Name}", JsonSerializer.Serialize(result));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Faile => {MethodBase.GetCurrentMethod().Name}");
            }

            return(result);
        }
コード例 #11
0
        public DataTableResponseModel InquiryMasterDatatable(DatableOption option, ConfigurationMaster master)
        {
            var methodName = MethodBase.GetCurrentMethod().Name;
            var result     = new DataTableResponseModel();

            try
            {
                _logger.LogInformation($"Start Function => {methodName}, Parameters => {JsonSerializer.Serialize(master)}");
                result = _dataAccess.ConfigurationDataAccess.InquiryMasterDatatable(option, master);
                _logger.LogInformation($"Finish Function => {methodName}, Result => {JsonSerializer.Serialize(result)}");
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Error Function => {methodName}");
            }

            return(result);
        }
コード例 #12
0
        public ConfigurationMaster InquiryMaster(Guid id)
        {
            var methodName = MethodBase.GetCurrentMethod().Name;
            var result     = new ConfigurationMaster();

            try
            {
                _logger.LogInformation($"Start Function => {methodName}, Parameters => {JsonSerializer.Serialize(id)}");
                result = _dataAccess.ConfigurationDataAccess.InquiryMaster(id);
                _logger.LogInformation($"Finish Function => {methodName}, Result => {JsonSerializer.Serialize(result)}");
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Error Function => {methodName}");
            }

            return(result);
        }
コード例 #13
0
        public ResponseModel Create(ConfigurationMaster master)
        {
            var response = new ResponseModel();

            try
            {
                _logger.LogInformation($"Start => {MethodBase.GetCurrentMethod().Name}", JsonSerializer.Serialize(master));
                var result = _dataAccess.ConfigurationDataAccess.Create(master);
                _logger.LogInformation($"Finish => {MethodBase.GetCurrentMethod().Name}", JsonSerializer.Serialize(result));

                response.Datas   = result;
                response.Success = true;
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Faile => {MethodBase.GetCurrentMethod().Name}");
            }

            return(response);
        }
コード例 #14
0
        public ConfigurationMaster InquiryMaster(Guid id)
        {
            var methodName = MethodBase.GetCurrentMethod().Name;
            var result     = new ConfigurationMaster();

            try
            {
                _logger.LogInformation($"Start Function => {methodName}, Parameters => {JsonSerializer.Serialize(id)}");
                var entity = _context.ConfigurationMaster.FirstOrDefault(r => r.ID == id);
                result = entity;
                _logger.LogInformation($"Finish Function => {methodName}, Result => {JsonSerializer.Serialize(result)}");
            }
            catch (Exception ex)
            {
                var messageError = $"Error Function => {methodName}";
                _logger.LogError(ex, messageError);
                throw new ArgumentException(messageError, ex);
            }

            return(result);
        }
コード例 #15
0
        public ResponseModel Delete(ConfigurationMaster master)
        {
            var methodName = MethodBase.GetCurrentMethod().Name;
            var response   = new ResponseModel();

            try
            {
                _logger.LogInformation($"Start Function => {methodName}, Parameters => {JsonSerializer.Serialize(master)}");
                var result = _dataAccess.ConfigurationDataAccess.Delete(master);
                _logger.LogInformation($"Finish Function => {methodName}, Result => {JsonSerializer.Serialize(result)}");

                response.Datas   = result;
                response.Success = true;
            }
            catch (Exception ex)
            {
                _logger.LogError(ex, $"Error Function => {methodName}");
            }

            return(response);
        }
コード例 #16
0
        public ResponseModel Create(ConfigurationMaster master)
        {
            var methodName = MethodBase.GetCurrentMethod().Name;
            var result     = new ResponseModel();

            try
            {
                _logger.LogInformation($"Start Function => {methodName}, Parameters => {JsonSerializer.Serialize(master)}");
                _context.ConfigurationMaster.Add(master);
                _context.SaveChanges();
                result.Success = true;
                _logger.LogInformation($"Finish Function => {methodName}, Result => {JsonSerializer.Serialize(result)}");
            }
            catch (Exception ex)
            {
                var messageError = $"Error Function => {methodName}";
                _logger.LogError(ex, messageError);
                throw new ArgumentException(messageError, ex);
            }

            return(result);
        }
コード例 #17
0
        private void OnLoaded(object sender, RoutedEventArgs e)
        {
            try
            {
                if (ConfigurationMaster.ContainsKey(SkinHelper.SkinColorConfigurationKey))
                {
                    SkinColorType skin = SkinHelper.StringToSkinColorType(ConfigurationMaster.Get(SkinHelper.SkinColorConfigurationKey));
                    SkinHelper.LoadSkin(skin);
                }

                LanguageLoader.LoadLanguageResource(CultureHelper.Component, CultureHelper.Culture);
            }
            catch (Exception ex)
            {
                ExceptionHandler.Handle(ex);
            }

            LoginModel     model     = new LoginModel();
            LoginViewModel viewModel = new LoginViewModel(model, LoginResultCallback);

            loginView.DataContext = viewModel;
        }
コード例 #18
0
        public ResponseModel Delete(ConfigurationMaster configurationMaster)
        {
            var methodName = MethodBase.GetCurrentMethod().Name;
            var result     = new ResponseModel();

            try
            {
                _logger.LogInformation($"Start Function => {methodName}, Parameters => {JsonSerializer.Serialize(configurationMaster)}");
                _context.ConfigurationMaster.Remove(_context.ConfigurationMaster.FirstOrDefault(r => r.ID == configurationMaster.ID));
                _context.ConfigurationDetail.AddRange(_context.ConfigurationDetail.Where(r => r.ConfigurationID == configurationMaster.ID).ToList());
                _context.SaveChanges();
                result.Success = true;
                _logger.LogInformation($"Finish Function => {methodName}, Result => {JsonSerializer.Serialize(result)}");
            }
            catch (Exception ex)
            {
                var messageError = $"Error Function => {methodName}";
                _logger.LogError(ex, messageError);
                throw new ArgumentException(messageError, ex);
            }

            return(result);
        }
コード例 #19
0
        public JsonResult Delete(ConfigurationMaster master)
        {
            var result = _configurationDataService.Delete(master);

            return(Json(result));
        }
コード例 #20
0
        public JsonResult InquiryMasterDatatable(DatableOption option, ConfigurationMaster master)
        {
            var result = _configurationDataService.InquiryMasterDatatable(option, master);

            return(Json(result));
        }
コード例 #21
0
        public DataTableResponseModel InquiryMasterDatatable(DatableOption option, ConfigurationMaster master)
        {
            var methodName = MethodBase.GetCurrentMethod().Name;
            var result     = new DataTableResponseModel();

            try
            {
                _logger.LogInformation($"Start Function => {methodName}, Parameters => {JsonSerializer.Serialize(master)}");

                var query = _context.ConfigurationMaster
                            .Where(r => (master.ID == Guid.Empty || r.ID == master.ID))
                            .Where(r => master.IsActive == null || r.IsActive == master.IsActive)
                            .OrderByDescending(r => r.CreateDate)
                            .ThenByDescending(r => r.UpdateDate)
                            .Select(item => new ConfigurationMaster
                {
                    ID           = item.ID,
                    TemplateName = item.TemplateName,
                    InputFile    = item.InputFile,
                    OutputFile   = item.OutputFile,
                    CreateDate   = item.CreateDate,
                    CreateBy     = item.CreateBy,
                    UpdateDate   = item.UpdateDate,
                    IsActive     = item.IsActive
                });

                switch (option.sortingby)
                {
                case 1: query = (option.orderby == "asc" ? query.OrderBy(r => r.TemplateName) : query.OrderByDescending(r => r.TemplateName)); break;

                case 2: query = (option.orderby == "asc" ? query.OrderBy(r => r.InputFile) : query.OrderByDescending(r => r.InputFile)); break;

                case 3: query = (option.orderby == "asc" ? query.OrderBy(r => r.OutputFile) : query.OrderByDescending(r => r.OutputFile)); break;

                case 4: query = (option.orderby == "asc" ? query.OrderBy(r => r.CreateDate) : query.OrderByDescending(r => r.CreateDate)); break;

                case 5: query = (option.orderby == "asc" ? query.OrderBy(r => r.CreateBy) : query.OrderByDescending(r => r.CreateBy)); break;

                case 6: query = (option.orderby == "asc" ? query.OrderBy(r => r.UpdateDate) : query.OrderByDescending(r => r.UpdateDate)); break;

                case 7: query = (option.orderby == "asc" ? query.OrderBy(r => r.UpdateBy) : query.OrderByDescending(r => r.UpdateBy)); break;

                default: query = (option.orderby == "asc" ? query.OrderBy(r => r.CreateDate) : query.OrderByDescending(r => r.CreateDate)); break;
                }

                var datas        = query.Skip(option.start).Take(option.length).ToList();
                var recordsTotal = query.Count();
                result = new DataTableResponseModel
                {
                    status          = true,
                    message         = "success",
                    data            = datas,
                    draw            = option.draw,
                    recordsTotal    = recordsTotal,
                    recordsFiltered = recordsTotal
                };

                _logger.LogInformation($"Finish Function => {methodName}, Result => {JsonSerializer.Serialize(result)}");
            }
            catch (Exception ex)
            {
                var messageError = $"Error Function => {methodName}";
                _logger.LogError(ex, messageError);
                throw new ArgumentException(messageError, ex);
            }

            return(result);
        }
コード例 #22
0
 private void SaveSkin(SkinColorType colorType)
 {
     ConfigurationMaster.Set(SkinHelper.SkinColorConfigurationKey, colorType.ToString());
 }