private void ResetRepositories()
 {
     _configurationRepo = null;
     _sessionRepo       = null;
     _userRepo          = null;
     _dashboardRepo     = null;
 }
        public ActionResult ConfigurationPopupSave(ConfigurationModel model)
        {
            if (ModelState.IsValid)
            {
                string _loggedInUserID = System.Web.HttpContext.Current.Session["UserID"].ToString();
                _ConfigurationRepo = new ConfigurationRepo();
                _repoResponse      = new RepositoryResponse();
                _repoResponse      = _ConfigurationRepo.AddOrEditConfigurationDetails(model, _loggedInUserID);

                return(Json(new { success = _repoResponse.success, message = _repoResponse.message }));
            }
            else
            {
                List <string> fieldOrder = new List <string>(new string[] {
                    "UserName", "Password"
                })
                                           .Select(f => f.ToLower()).ToList();

                var _message1 = ModelState
                                .Select(m => new { Order = fieldOrder.IndexOf(m.Key.ToLower()), Error = m.Value })
                                .OrderBy(m => m.Order)
                                .SelectMany(m => m.Error.Errors.Select(e => e.ErrorMessage)).ToList();

                string _message = string.Join("<br/>", _message1);

                return(Json(new { success = false, message = _message }));
            }
        }
        public JsonResult LoadConfigurationDetailsForGrid()
        {
            _repoResponse = new RepositoryResponse();

            _ConfigurationRepo = new ConfigurationRepo();
            _repoResponse      = _ConfigurationRepo.LoadConfigurationGridData();
            if (_repoResponse.success)
            {
                var _sa = new JsonSerializerSettings();
                return(Json(_repoResponse.Data));
            }
            else
            {
                return(Json(new { success = _repoResponse.success, message = _repoResponse.message }));
            }
        }
        /// <summary>
        /// 合并配置文件
        /// </summary>
        /// <param name="option"></param>
        /// <param name="configuration"></param>
        public static FileConfigurationRepo MergeConfiguration(InitOption option, ConfigurationEnum configuration)
        {
            // 放在机器的配置
            var globalConfigurationFile = GetGlobalConfigurationFile();

            Dictionary <string, string> machineConfiguration = new Dictionary <string, string>();

            if (!globalConfigurationFile.Exists)
            {
                Log.Debug("没有找到机器配置" + globalConfigurationFile.FullName);
                // 不存在机器配置
            }
            else
            {
                // 规则是如果当前存在的,那么就不从机器获取
                machineConfiguration = CoinConfigurationSerializer.Deserialize(File.ReadAllText(globalConfigurationFile.FullName));
            }

            var currentConfiguration = GetBuildConfiguration();

            foreach (var(key, value) in machineConfiguration)
            {
                if (!currentConfiguration.ContainsKey(key))
                {
                    currentConfiguration[key] = value;
                }
            }

            SetLogLevel(configuration, currentConfiguration);

            // 下面代码只是让配置文件里面可以告诉小伙伴这个文件是做什么
            currentConfiguration["AAA须知"] = "此文件为构建过程多个命令共享信息使用,请不要加入代码仓库";

            // 序列化写入
            var fileConfiguration = ConfigurationHelper.GetCurrentConfiguration();
            IConfigurationRepo configurationRepo = fileConfiguration;

            foreach (var(key, value) in currentConfiguration)
            {
                configurationRepo.SetValue(key, value);
            }

            return(fileConfiguration);
        }
        public ActionResult ConfigurationPopupValues(string ID)
        {
            long _id = long.Parse(ID);

            _ConfigurationRepo = new ConfigurationRepo();
            _repoResponse      = new RepositoryResponse();
            if (_id > 0)
            {
                _repoResponse = _ConfigurationRepo.LoadConfigurationDetailsByID(_id);
            }

            if (_repoResponse.success == true)
            {
                ConfigurationModel model = new ConfigurationModel();
                model = _repoResponse.Data;
                return(Json(new { success = _repoResponse.success, message = _repoResponse.message, data = model }));
            }
            else
            {
                EvaluationModel model = new EvaluationModel();
                return(Json(new { success = _repoResponse.success, message = _repoResponse.message, data = model }));
            }
        }
 public ConfigurationController(IConfigurationRepo iConfigurationRepo)
 {
     this._iConfigurationRepo = iConfigurationRepo;
 }
 public ConfigurationManager(IConfigurationRepo configurationRepo)
 {
     _configurationRepo = configurationRepo;
 }
Exemple #8
0
        public RepositoryResponse AddorUpdateEvaluationData(EvaluationModel model, string _loggedInUserID, bool isSubmit)
        {
            baseModel = new RepositoryResponse();

            try
            {
                using (objSOMEntities = new SOMEntities())
                {
                    Evaluation db = objSOMEntities.Evaluations.Where(r => r.ID == model.ID).FirstOrDefault();
                    if (db == null)
                    {
                        objSOMEntities.Evaluations.Add(ConvertEvaluation_Model2DB(model, _loggedInUserID, isSubmit));
                        objSOMEntities.SaveChanges();
                        if (isSubmit)
                        {
                            baseModel = new RepositoryResponse {
                                success = true, message = "Evaluations Scroe Details Submitted to TQC Successfully"
                            };
                        }
                        else
                        {
                            baseModel = new RepositoryResponse {
                                success = true, message = "Evaluations Scroe Details added Successfully"
                            };
                        }
                    }
                    else
                    {
                        db.TotalScore         = int.Parse(model.TotalScore);
                        db.AheadOfPlan        = model.AheadOfPlan;
                        db.AsPerPlan          = model.AsPerPlan;
                        db.BasedOnInstruction = model.BasedOnInstruction;

                        db.BreakthroughImprovement         = model.BreakthroughImprovement;
                        db.CoordiantionWithInTheDept       = model.CoordiantionWithInTheDept;
                        db.CoordinationWithAnotherFunction = model.CoordinationWithAnotherFunction;

                        db.CoordinationWithMultipleFunctions = model.CoordinationWithMultipleFunctions;
                        db.Delayed = model.Delayed;
                        //db.EmployeeID = model.EmployeeID;
                        db.NominationID = model.NominationID;

                        //db.EvaluatorID = model.EvaluatorID;
                        db.FollowedUp = model.FollowedUp;
                        //db.ID = model.ID;

                        db.Implemented = model.Implemented;
                        db.ImplementedInAllApplicableAreas = model.ImplementedInAllApplicableAreas;
                        db.ImplementedPartially            = model.ImplementedPartially;
                        db.ImprovementFromCurrentSituation = model.ImprovementFromCurrentSituation;

                        db.IsActive             = true;
                        db.Participated         = model.Participated;
                        db.PreventionOfaFailure = model.PreventionOfaFailure;

                        db.ProactiveIdeaGeneratedBySelf  = model.ProactiveIdeaGeneratedBySelf;
                        db.ReactiveIdeaDrivenBySituation = model.ReactiveIdeaDrivenBySituation;
                        db.ScopeIdentified = model.ScopeIdentified;

                        if (isSubmit)
                        {
                            db.Status = (int)NominationStatus.Evaluators_Assign_TQC;
                        }
                        else
                        {
                            db.Status = (int)NominationStatus.Evaluators_Save;
                        }
                        db.ModifiedBy = _loggedInUserID;
                        objSOMEntities.SaveChanges();

                        if (isSubmit)
                        {
                            configRepo = new ConfigurationRepo();
                            bool result = configRepo.SendEmailUsingSOM_Evaluator_Assign_TQC(db.NominationID, _loggedInUserID);
                            if (result)
                            {
                                baseModel = new RepositoryResponse {
                                    success = true, message = "Evaluations Scroe Details Submitted to TQC Successfully and Send Mail to TQC"
                                };
                            }
                            else
                            {
                                baseModel = new RepositoryResponse {
                                    success = true, message = "Evaluations Scroe Details Submitted to TQC Successfully. Unable to Send Mail to TQC"
                                };
                            }
                        }
                        else
                        {
                            baseModel = new RepositoryResponse {
                                success = true, message = "Evaluations Scroe Details updated Successfully"
                            };
                        }
                    }
                }
                using (objSOMEntities = new SOMEntities())
                {
                    if (isSubmit)
                    {
                        var nomDet = objSOMEntities.Nominations.Where(r => r.NominationId == model.NominationID).FirstOrDefault();
                        nomDet.Status     = (int)NominationStatus.Evaluators_Assign_TQC;
                        nomDet.ModifiedBy = _loggedInUserID;
                        objSOMEntities.SaveChanges();
                    }
                }
                if (isSubmit)
                {
                    nomRepo = new NominationRepo();
                    //Add entry into Audit Log
                    AuditLogModel objAuditLog = new AuditLogModel();
                    objAuditLog.CurrentStatus  = NominationStatus.Evaluators_Assign_TQC;
                    objAuditLog.EmployeeNumber = model.EmployeeNumber;
                    objAuditLog.IsNewAlert     = true;
                    objAuditLog.IsNotification = true;
                    objAuditLog.NominationID   = model.NominationID;
                    objAuditLog.CreatedBy      = _loggedInUserID;
                    objAuditLog.EvaluatorID    = _loggedInUserID;
                    nomRepo.AddEntryIntoAuditLog(objAuditLog);

                    Nomination _nomModel;
                    using (objSOMEntities = new SOMEntities())
                    {
                        _nomModel = objSOMEntities.Nominations.Where(r => r.NominationId == model.NominationID).FirstOrDefault();
                    }
                    // Add entry into SOM
                    StarOfMonthModel SOMmodel = new StarOfMonthModel();
                    SOMmodel.Month        = _nomModel.SubmittedMonth;
                    SOMmodel.Year         = _nomModel.SubmittedYear;
                    SOMmodel.Description  = _nomModel.Idea;
                    SOMmodel.EmpId        = model.EmployeeNumber;
                    SOMmodel.NominationID = model.NominationID;
                    SOMmodel.IsDisplay    = true;
                    SOMmodel.IsApproved   = true;
                    SOMmodel.ApprovedBy   = int.Parse(_loggedInUserID);
                    SOMmodel.CreatedBy    = int.Parse(_loggedInUserID);
                    SOMmodel.CreatedDate  = DateTime.Now;
                    SOMmodel.ModifiedBy   = int.Parse(_loggedInUserID);
                    SOMmodel.ModifiedDate = DateTime.Now;
                    starRepo = new StarOfMonthRepo();
                    //starRepo.AddOrEditStarOfMonth(SOMmodel, _loggedInUserID);
                }

                if (isSubmit) //Send Nomination Submit Details to DH
                {
                    using (objSOMEntities = new SOMEntities())
                    {
                    }
                }
            }
            catch (Exception ex)
            {
                baseModel = new RepositoryResponse {
                    success = false, message = ex.ToString()
                };
            }
            return(baseModel);
        }
 /// <summary>
 /// 创建使用 <paramref name="repo"/> 管理的线程安全的应用程序配置。
 /// </summary>
 /// <param name="repo">配置管理器。</param>
 internal ConcurrentAppConfigurator(IConfigurationRepo repo)
 {
     _repo = repo ?? throw new ArgumentNullException(nameof(repo));
 }
Exemple #10
0
 public ConfigurationController(IConfigurationRepo config)
 {
     this._config = config;
 }
 public RedmineApiIntegration(IConfigurationRepo configurationRepo)
 {
     _redmineApiManager = new global::Redmine.Net.Api.RedmineManager(@"http://adlis/", configurationRepo.AdlisApiKey);
 }
        public SlackClient(IConfigurationRepo configurationRepo)
        {
            var uriString = @"https://hooks.slack.com/services/" + configurationRepo.SlackHook;

            _uri = new Uri(uriString);
        }