public List <ResSkillVM> GetCandidateSkills(string CandidateId)
        {
            if (CandidateId == default || string.IsNullOrWhiteSpace(CandidateId))
            {
                ExceptionBase.ThrowException(404, "Candidate ID is null or Empty. ", "Candidate ID is null or Empty. ");
            }
            var IsFoundedCandidate = unitOfWork.GetRepository <Tbl_Candidate>().GetSingle(e => e.Code.ToString().Equals(CandidateId));

            if (IsFoundedCandidate is null)
            {
                ExceptionBase.ThrowException(404, "that is not a candidate ID .", "that candidate is not found. ");
            }
            var CandidateSkills = unitOfWork.GetRepository <Tbl_CandidateSkills>().GetAllIncluding(e => e.CandidateId.Equals(IsFoundedCandidate.Id));

            if (CandidateSkills == default || CandidateSkills.Count <= 0)
            {
                ExceptionBase.ThrowException(404, "this candidate has no registed skills.", "this candidate has no registed skills.");
            }
            List <Tbl_Skills> skills = new List <Tbl_Skills>();

            foreach (var item in CandidateSkills)
            {
                skills.Add(unitOfWork.GetRepository <Tbl_Skills>().GetSingle(e => e.Id.Equals(item.SkillId)));
            }
            return(mapper.Map <List <ResSkillVM> >(skills));
        }
Beispiel #2
0
        protected void rgSearchResults_ItemClick(object sender, RadMenuEventArgs e)
        {
            RadMenu menu = (RadMenu)sender;

            int OrganizatinChartID = int.Parse(menu.DataFieldID);

            enumNavigationMode currentNavigationMode = enumNavigationMode.None;

            if (OrganizatinChartID > 0)
            {
                try
                {
                    switch (e.Item.Value)
                    {
                    case "View":
                        ResetCurrentOrgChart(OrganizatinChartID);
                        currentNavigationMode = enumNavigationMode.View;
                        GoToOrgChartLink("~/OrgChart/OrgChartDetails.aspx", currentNavigationMode);
                        break;

                    case "ViewPublished":
                        ResetCurrentOrgChartLog(OrganizatinChartID);
                        currentNavigationMode = enumNavigationMode.View;
                        GoToOrgChartLink("~/PubOrgChart/OrgChartDetails.aspx", currentNavigationMode);
                        break;

                    case "Edit":
                        ResetCurrentOrgChart(OrganizatinChartID);
                        OrganizationChartManager.Instance.Check(CurrentOrgChartID, CurrentUserID, enumActionType.CheckOut);
                        currentNavigationMode = enumNavigationMode.Edit;
                        GoToOrgChartLink("~/OrgChart/OrgChartDetails.aspx", currentNavigationMode);
                        break;

                    case "ContinueEdit":
                        ResetCurrentOrgChart(OrganizatinChartID);
                        currentNavigationMode = enumNavigationMode.Edit;
                        GoToOrgChartLink("~/OrgChart/OrgChartDetails.aspx", currentNavigationMode);
                        break;

                    case "FinishEdit":
                        ResetCurrentOrgChart(OrganizatinChartID);
                        FinishEditOrgChart(CurrentOrgChartID, CurrentUserID);
                        break;

                    case "Delete":
                        DeleteOrgChart(OrganizatinChartID);
                        break;

                    default:
                        break;
                    }

                    rgSearchResults.Rebind();
                }
                catch (Exception ex)
                {
                    ExceptionBase.HandleException(ex);
                }
            }
        }
Beispiel #3
0
        public static TrackerItem GetForUser(int userID, long JNPID)
        {
            TrackerItem trackerItem = null;

            try
            {
                DataTable dataTable = ExecuteDataTable("spr_GetTrackerItemByID", userID, JNPID);

                if (dataTable.Rows.Count == 1)
                {
                    DataRow dataRow = dataTable.Rows[0];

                    if (dataRow != null)
                    {
                        trackerItem = new TrackerItem(dataRow);
                    }
                }
            }
            catch (Exception ex)
            {
                trackerItem = null;
                ExceptionBase.HandleException(ex);
            }

            return(trackerItem);
        }
        private EtatInfos Ajouter(
            EtatInfos etatInfos)
        {
            try
            {
                etatInfos.EstActif = true;

                using (lockeur.RecupererLockEcriture())
                {
#if DEBUG
                    if (dicoEtatsInfos.ContainsKey(etatInfos.EtatOrigine))
                    { // L'état est déjà dans l'arbre => erreur
                        throw new ExceptionTechniqueArbreConstruction(
                                  ExceptionBase.RecupererLibelleMessage());
                    }
#endif

                    dicoEtatsInfos
                    .Add(
                        etatInfos.EtatOrigine,
                        etatInfos);

                    return(etatInfos);
                }
            }
            catch (Exception ex)
            {
                throw EncapsulerEtGererException <ExceptionTechniqueArbreConstruction>(
                          ex);
            }
        }
Beispiel #5
0
        //public static JobAnnouncementPackage GetByID(int userID, long JNPID)
        //{
        //    JobAnnouncementPackage item = null;

        //    try
        //    {
        //        //TODO: this stored procedure returns rows more sutable for Business.TrackerItem.
        //        //think about modifying this SP eliminating some fields and @userID and creating a separate
        //        //stored procedure for retrieving a separate Business.TrackerItem. (better - rename this SP
        //        //to spr_GetTrackerItemByID and create a new spr_GetJNPByID
        //        DataTable dataTable = ExecuteDataTable("spr_GetJNPByID", userID, JNPID);

        //        if (dataTable.Rows.Count == 1)
        //        {
        //            DataRow dataRow = dataTable.Rows[0];

        //            if (dataRow != null)
        //            {
        //                item = new JobAnnouncementPackage(dataRow);
        //            }
        //        }

        //    }
        //    catch (Exception ex)
        //    {
        //        item = null;
        //        ExceptionBase.HandleException(ex);
        //    }

        //    return item;
        //}

        public static JobAnnouncementPackage GetByID(long JNPID)
        {
            JobAnnouncementPackage item = null;

            try
            {
                DataTable dataTable = ExecuteDataTable("spr_GetJNPByID", JNPID);

                if (dataTable.Rows.Count == 1)
                {
                    DataRow dataRow = dataTable.Rows[0];

                    if (dataRow != null)
                    {
                        item = new JobAnnouncementPackage(dataRow);
                    }
                }
            }
            catch (Exception ex)
            {
                item = null;
                ExceptionBase.HandleException(ex);
            }

            return(item);
        }
Beispiel #6
0
        private static void GetExceptionStackTraceString(Exception ex, ref List <string> errList)
        {
            if (ex == null)
            {
                return;
            }
            //移除 < a href ></ a >
            string hrefPattern =
                @"(?is)<a(?:(?!href=).)*href=(['""]?)(?<url>[^""\s>]*)\1[^>]*>(?<text>(?:(?!</?a\b).)*)</a>";
            string stackTraceString = Regex.Replace(ex.StackTrace, hrefPattern, string.Empty);

            errList.Add(stackTraceString);
            errList.Add(string.Format("- {0} : {1} \r\n", ex.GetType().FullName, ex.Message));
            ExceptionBase exceptionBase = ex as ExceptionBase;

            if (exceptionBase != null && exceptionBase.InnerExceptions != null &&
                exceptionBase.InnerExceptions.Count > 0)
            {
                foreach (Exception iex in exceptionBase.InnerExceptions)
                {
                    GetExceptionStackTraceString(iex, ref errList);
                }
            }
            else
            {
                GetExceptionStackTraceString(ex.InnerException, ref errList);
            }
        }
Beispiel #7
0
        public string CreateSkill(ReqSkillVM req)
        {
            if (req is null)
            {
                ExceptionBase.ThrowException(404, "Skill Req is empty , make sure of providing Requird Data!", "Skill Req is empty , make sure of providing Requird Data!");
            }
            var IsSkillAdded = unitOfWork.GetRepository <Tbl_Skills>().GetSingle(e => e.SkillName.Equals(req.SkillName));

            if (!(IsSkillAdded is null))
            {
                return(IsSkillAdded.Code.ToString());
            }
            var NewSkill = new Tbl_Skills()
            {
                SkillName = req.SkillName,
                Rate      = req.Rate
            };

            if (NewSkill is null)
            {
                ExceptionBase.ThrowException(500, "Cannot Parse req object to  Tbl_Skills", "Cannot Parse req object to  Tbl_Skills");
            }
            unitOfWork.GetRepository <Tbl_Skills>().Add(NewSkill);
            unitOfWork.SaveChanges();
            return(NewSkill.Code.ToString());
        }
		public UserDetails (bool showDetailed, ExceptionBase.NETGTKSharp.Application app, ExceptionInfo exinfo, Server server) : 
				base(Gtk.WindowType.Toplevel)
		{
			this.Build ();
			//Set title and description
			this.Title = language.winTitle;
			this.lblDescription.Text = language.winDescription;
			//Name the tabs
			this.btnSkip.Label = language.bSkip;
			this.btnSend.Label = language.bSend;
			GtkLabel3.Text = language.appVersionCaption;
			GtkLabel4.Text = language.netVersionCaption;
			GtkLabel5.Text = language.osVersionCaption;
			GtkLabel.Text = language.errorDetailsCaption;
			label6.Text = app.Version;
			label7.Text = Environment.Version.ToString ();
			label8.Text = ReadSTDOutput ("lsb_release", "--d").Replace ("Description:", "").Trim () + " " + ReadSTDOutput ("arch", "");
			this.image26.Pixbuf = app.Icon;
			label4.Text = exinfo.Message;
			label5.Text = exinfo.Inner;
			ex = exinfo;
			sv = server;
			appl = app;
			if (showDetailed == false)
				notebook1.GetNthPage (1).HideAll ();
		}
Beispiel #9
0
        public static bool EstIdentique <T>(
            this IEnumerable <T> elements1,
            IEnumerable <T> elements2)
        {
            try
            {
                elements1 = (elements1 as ICollection <T>) ?? elements1.ToArray(); // Permet de ne pas recalculer en permanence le contenu si c'est un Enumerable 'pur'
                elements2 = (elements2 as ICollection <T>) ?? elements2.ToArray();

                if (elements1.Count() != elements2.Count())
                {
                    return(false);
                }
                else
                {
                    return(!elements1
                           .Except(elements2)
                           .Any());
                }
            }
            catch (Exception ex)
            {
                Fabrique.Instance
                ?.RecupererGestionnaireTraces()
                ?.PublierException(
                    ex);

                throw new ExceptionTechnique(
                          ExceptionBase.RecupererLibelleMessage(),
                          ex);
            }
        }
        private static JQWorkflowStatus FillObjectFromDataRow(DataRow returnRow)
        {
            JQWorkflowStatus jqw = new JQWorkflowStatus();

            try
            {
                jqw.JQWorkflowRecID    = (long)returnRow["JQWorkflowRecID"];
                jqw.JQID               = (long)returnRow["JQID"];
                jqw.JQWorkflowStatusID = (int)returnRow["JQWorkflowStatusID"];
                if (returnRow["IsCurrent"] != DBNull.Value)
                {
                    jqw.IsCurrent = (bool)returnRow["IsCurrent"];
                }
                if (returnRow["CreatedByID"] != DBNull.Value)
                {
                    jqw.CreatedByID = (int)returnRow["CreatedByID"];
                }
                if (returnRow["CreateDate"] != DBNull.Value)
                {
                    jqw.CreateDate = (DateTime)returnRow["CreateDate"];
                }
            }
            catch (Exception ex)
            {
                ExceptionBase.HandleException(ex);
                jqw = null;
            }
            return(jqw);
        }
        public static List <JNPWorkflowNoteStatus> GetAll()
        {
            List <JNPWorkflowNoteStatus> list = new List <JNPWorkflowNoteStatus>();

            try
            {
                DataTable dataTable = ExecuteDataTable("spr_GetAllJNPWorkflowNoteStatus");

                if (dataTable.Rows.Count > 0)
                {
                    foreach (DataRow dataRow in dataTable.Rows)
                    {
                        JNPWorkflowNoteStatus item = new JNPWorkflowNoteStatus();
                        item.FillObjectFromRowData(dataRow);

                        list.Add(item);
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionBase.HandleException(ex);
            }

            return(list);
        }
        private void SaveCategoryRatingGroups()
        {
            try
            {
                CategoryRatingGroup bestQuilifiedGroup = CategoryRatingGroupManager.GetBestQuilifiedGroup(CurrentCRID);
                bestQuilifiedGroup.ScoringRangeGroupTypeName = rtbBQGroupTypeName.Text.Trim();
                bestQuilifiedGroup.RangeMin             = Int32.Parse(rtbBQRangeMin.Text);
                bestQuilifiedGroup.RangeMax             = Int32.Parse(rtbBQRangeMax.Text);
                bestQuilifiedGroup.QualifyingStatements = rtbBQQualifyingStatements.Text.Trim();
                CategoryRatingGroupManager.Update(bestQuilifiedGroup, base.CurrentUserID);

                CategoryRatingGroup wellQuilifiedGroup = CategoryRatingGroupManager.GetWellQuilifiedGroup(CurrentCRID);
                if (wellQuilifiedGroup != null)
                {
                    wellQuilifiedGroup.ScoringRangeGroupTypeName = rtbWQGroupTypeName.Text.Trim();
                    wellQuilifiedGroup.RangeMin             = Int32.Parse(rtbWQRangeMin.Text);
                    wellQuilifiedGroup.RangeMax             = Int32.Parse(rtbWQRangeMax.Text);
                    wellQuilifiedGroup.QualifyingStatements = rtbWQQualifyingStatements.Text.Trim();
                    CategoryRatingGroupManager.Update(wellQuilifiedGroup, base.CurrentUserID);
                }

                CategoryRatingGroup quilifiedGroup = CategoryRatingGroupManager.GetQuilifiedGroup(CurrentCRID);
                quilifiedGroup.ScoringRangeGroupTypeName = rtbQGroupTypeName.Text.Trim();
                quilifiedGroup.RangeMin             = Int32.Parse(rtbQRangeMin.Text);
                quilifiedGroup.RangeMax             = Int32.Parse(rtbQRangeMax.Text);
                quilifiedGroup.QualifyingStatements = rtbQQualifyingStatements.Text.Trim();
                CategoryRatingGroupManager.Update(quilifiedGroup, base.CurrentUserID);
            }
            catch (Exception ex)
            {
                ExceptionBase.HandleException(ex);
            }
        }
        private static CRWorkflowStatus  FillObjectFromDataRow(DataRow dataRow)
        {
            CRWorkflowStatus crw = new CRWorkflowStatus();

            try
            {
                crw.CRWorkflowRecID    = (long)dataRow["CRWorkflowRecID"];
                crw.CRID               = (long)dataRow["CRID"];
                crw.CRWorkflowStatusID = (int)dataRow["CRWorkflowStatusID"];
                if (dataRow["IsCurrent"] != DBNull.Value)
                {
                    crw.IsCurrent = (bool)dataRow["IsCurrent"];
                }
                if (dataRow["CreatedByID"] != DBNull.Value)
                {
                    crw.CreatedByID = (int)dataRow["CreatedByID"];
                }
                if (dataRow["CreateDate"] != DBNull.Value)
                {
                    crw.CreateDate = (DateTime)dataRow["CreateDate"];
                }
            }
            catch (Exception ex)
            {
                ExceptionBase.HandleException(ex);
                crw = null;
            }
            return(crw);
        }
Beispiel #14
0
        public string CreateEmployer(ReqEmployerVM req)
        {
            if (req is null)
            {
                ExceptionBase.ThrowException(404, "Employer Req is empty , make sure of providing Requird Data!", "Employer Req is empty , make sure of providing Requird Data!");
            }
            var IsEmployerAdded = unitOfWork.GetRepository <Tbl_Employer>().GetSingle(e => e.EmployerName.Equals(req.EmployerName));

            if (!(IsEmployerAdded is null))
            {
                return(IsEmployerAdded.Code.ToString());
            }
            var NewEmployer = new Tbl_Employer()
            {
                EmployerName = req.EmployerName
            };

            if (NewEmployer is null)
            {
                ExceptionBase.ThrowException(500, "Cannot Parse req object to  Tbl_Employer", "Cannot Parse req object to  Tbl_Employer");
            }
            unitOfWork.GetRepository <Tbl_Employer>().Add(NewEmployer);
            unitOfWork.SaveChanges();
            return(NewEmployer.Code.ToString());
        }
Beispiel #15
0
        public static JNPWorkflowNote GetByRecID(long jnpWorkflowRecID)
        {
            JNPWorkflowNote item = null;

            try
            {
                DataTable dataTable = ExecuteDataTable("spr_GetJNPWorkflowNoteByRecID", jnpWorkflowRecID);

                if (dataTable.Rows.Count == 1)
                {
                    DataRow dataRow = dataTable.Rows[0];

                    if (dataRow != null)
                    {
                        item = new JNPWorkflowNote(dataRow);
                    }
                }
            }
            catch (Exception ex)
            {
                item = null;
                ExceptionBase.HandleException(ex);
            }

            return(item);
        }
        public IEtatTransitionsSortantes Supprimer(
            Transition transition)
        {
            try
            {
                if (transitions.Contains(transition))
                {
                    transitions.Remove(
                        transition);
                }
                else
                {
                    throw new ExceptionTechnique(
                              ExceptionBase.RecupererLibelleMessage(
                                  $"Impossible de supprimer la transition {transition}"));
                }

                return(this);
            }
            catch (Exception ex)
            {
                throw EncapsulerEtGererException <ExceptionTechnique>(
                          ex);
            }
        }
Beispiel #17
0
 /// <summary>
 /// Get all the matching record from the database. Inlcude Supported
 /// </summary>
 /// <returns></returns>
 protected IQueryable <Entity> GetAllNew(Expression <Func <Entity, Boolean> > predicate)
 {
     try
     {
         if (_includes.Count == 0)
         {
             return(GetObjectSet().Where(predicate).ForEach(item => item.DecryptRecords <Entity>()));
         }
         else
         {
             DbQuery <Entity> entityQuery = GetObjectSet().Include(_includes.Dequeue());
             while (_includes.Count > 0)
             {
                 entityQuery = entityQuery.Include(_includes.Dequeue());
             }
             return(entityQuery.Where(predicate).ForEach(item => item.DecryptRecords <Entity>()));
         }
     }
     catch (ArgumentException e)
     {
         throw new ExceptionDataError(e, ExceptionBase.GetRefId());
     }
     catch (Exception e)
     {
         throw new ExceptionCritical(e, ExceptionBase.GetRefId());
     }
 }
        public List <ResEmployerVM> GetCandidateEmployers(string CandidateId)
        {
            if (CandidateId == default || string.IsNullOrWhiteSpace(CandidateId))
            {
                ExceptionBase.ThrowException(404, "Candidate ID is null or Empty. ", "Candidate ID is null or Empty. ");
            }
            var IsFoundedCandidate = unitOfWork.GetRepository <Tbl_Candidate>().GetSingle(e => e.Code.ToString().Equals(CandidateId));

            if (IsFoundedCandidate is null)
            {
                ExceptionBase.ThrowException(404, "that is not a candidate ID .", "that candidate is not found. ");
            }
            var CandEmployers = unitOfWork.GetRepository <Tbl_CandidateEmployer>().GetSingle(e => e.CandidateId.Equals(IsFoundedCandidate.Id));

            if (CandEmployers is null)
            {
                ExceptionBase.ThrowException(404, "Candidate has no previous or current employers. ", "Candidate has no previous or current employers. ");
            }
            var PrevEmp = unitOfWork.GetRepository <Tbl_Employer>().GetSingle(e => e.Id.Equals(CandEmployers.PreviousEmployerId));
            var CurrEmp = unitOfWork.GetRepository <Tbl_Employer>().GetSingle(e => e.Id.Equals(CandEmployers.CurrentEmployerId));
            List <ResEmployerVM> employerVMs = new List <ResEmployerVM>();

            employerVMs.Add(mapper.Map <ResEmployerVM>(PrevEmp));
            employerVMs.Add(mapper.Map <ResEmployerVM>(CurrEmp));
            return(employerVMs);
        }
Beispiel #19
0
        public static JNPWorkflowStatus GetCurrentJNPWorkflowStatus(long jnpID)
        {
            JNPWorkflowStatus item = null;

            try
            {
                DataTable dataTable = ExecuteDataTable("spr_GetJNPWorkflowStatusByJNPID", jnpID);

                if (dataTable.Rows.Count == 1)
                {
                    DataRow dataRow = dataTable.Rows[0];

                    if (dataRow != null)
                    {
                        item = new JNPWorkflowStatus(dataRow);
                    }
                }
            }
            catch (Exception ex)
            {
                item = null;
                ExceptionBase.HandleException(ex);
            }

            return(item);
        }
Beispiel #20
0
        public List <ResCandidateVM> GetEmployerCandidates(string EmployerId)
        {
            if (EmployerId == default || string.IsNullOrWhiteSpace(EmployerId))
            {
                ExceptionBase.ThrowException(404, "Employer ID is null or Empty. ", "Employer ID is null or Empty. ");
            }
            var IsFoundedEmployer = unitOfWork.GetRepository <Tbl_Employer>().GetSingle(e => e.Code.ToString().Equals(EmployerId));

            if (IsFoundedEmployer is null)
            {
                ExceptionBase.ThrowException(404, "that is not a Employer ID .", "that Employer is not found. ");
            }
            var EmpCandidates = unitOfWork.GetRepository <Tbl_CandidateEmployer>().GetAllIncluding(e => e.CurrentEmployerId.Equals(IsFoundedEmployer.Id) || e.PreviousEmployerId.Equals(IsFoundedEmployer.Id));

            if (EmpCandidates == default || EmpCandidates.Count <= 0)
            {
                ExceptionBase.ThrowException(404, "this Employer has no registered Candidates.", "this Employer has no registered Candidates.");
            }
            List <ResCandidateVM> candidateVMs = new List <ResCandidateVM>();

            foreach (var item in EmpCandidates)
            {
                candidateVMs.Add(mapper.Map <ResCandidateVM>(unitOfWork.GetRepository <Tbl_Candidate>().GetSingle(x => x.Id.Equals(item.CandidateId))));
            }
            return(candidateVMs);
        }
        /// <summary>
        /// 进行异常处理(由异常管理器调用)
        /// </summary>
        /// <param name="e">异常</param>
        /// <param name="level">异常等级(传递给日志记录器处理)</param>
        /// <returns>处理结果,将影响下面的处理器</returns>
        /// <remarks>
        /// 异常管理器将根据返回的结果进行下一步的处理,约定:<br />
        ///		返回的结果中,ResultNo值:
        ///		<list type="bullet">
        ///			<item><description>
        ///				小于0:表示处理异常,管理器将立即退出异常处理
        ///			</description></item>
        ///			<item><description>
        ///				0:处理正常
        ///			</description></item>
        ///			<item><description>
        ///				1:已处理,需要下一个异常处理器进一步处理,<br />
        ///				此时ResultAttachObject为返回的异常(可能与传入的异常是不一致的)
        ///			</description></item>
        ///			<item><description>
        ///				2:已处理,需要重新轮询异常处理器进行处理<br />
        ///					此时ResultAttachObject为返回的异常(可能与传入的异常是不一致的)<br />
        ///					此时异常管理器将重新进行异常处理
        ///			</description></item>
        ///		</list>
        /// </remarks>
        public override IAOPResult Handle(Exception e, int level)
        {
            var ex = e as HttpWebException;

            if (ex != null)
            {
                var app             = ex.HttpAppInstance;
                var sourceException = ExceptionBase.FindSourceException(ex);

                //忽略某些状态码,此时不记录日志
                var writeLog = true;
                var ihcs     = this.IgnoreHttpCodes;
                if (!string.IsNullOrEmpty(ignoreHttpCodes))
                {
                    var he = sourceException as HttpException;
                    if (he != null)
                    {
                        var hc = "," + he.GetHttpCode() + ",";
                        if (ihcs.Contains(hc))
                        {
                            writeLog = false;
                        }
                    }
                }
                if (writeLog)
                {
                    this.LogService.WriteLog(this, level, this.GetFormattedString(sourceException, level, app));
                }
                //是否启用自定义信息
                if (!this.IsCustomEnabled(ex))
                {
                    goto EXIT;
                }

                app.Server.ClearError();
                app.Response.Clear();
                var fileExists = false;
                if (this.DefaultRedirectUrl != null && this.CheckRedirectFileExists)
                {
                    var filePath = WebHelper.UrlCombine(app.Request.ApplicationPath, this.DefaultRedirectUrl, false);
                    fileExists = File.Exists(app.Request.MapPath(filePath));
                }
                if (!fileExists && this.CheckRedirectFileExists)
                {
                    this.LogService.WriteLog(this.GetType(), LogLevel.WARN, "WARNING: The file defined in HttpWebExceptionHandler's defaultRedirectUrl do not exists, please check it!");
                }
                if (!string.IsNullOrEmpty(this.DefaultRedirectUrl) && (fileExists || !this.CheckRedirectFileExists) && !WebHelper.IsUrlEquals(this.DefaultRedirectUrl, app.Request))
                {
                    app.Response.Redirect(string.Format(this.DefaultRedirectUrl, sourceException.GetHashCode(), 0, level, HttpUtility.UrlEncode(HttpUtility.HtmlEncode(sourceException.Message), app.Request.ContentEncoding), HttpUtility.UrlEncode(HttpUtility.HtmlEncode(app.Request.Url.PathAndQuery), app.Request.ContentEncoding)), true);
                }
                else
                {
                    app.Response.Write(this.GetDisplayMessage(ex));
                    app.CompleteRequest();
                }
            }
EXIT:
            return(AOPResult.Success());
        }
 public DeliveryOutput(ExceptionBase exception, IFileManager fileManager)
 {
     DeliveryLocations = null;
     DroneId           = exception.DroneId;
     Fail             = true;
     FailureException = exception;
     this.fileManager = fileManager;
 }
 public DeliveryOutput(List <Location> locations, string droneId, IFileManager fileManager)
 {
     DeliveryLocations = locations;
     DroneId           = droneId;
     Fail             = false;
     this.fileManager = fileManager;
     FailureException = null;
 }
Beispiel #24
0
 /// <summary>
 /// 如果处理失败,则抛出异常 <see cref="ExceptionBase"/>
 /// </summary>
 /// <returns>返回本身</returns>
 public static IAOPResult ThrowErrorOnFailed(this IAOPResult aop)
 {
     if (aop.IsFailed())
     {
         var e = new ExceptionBase(aop.ResultNo, aop.ResultDescription);
         e.Data.Add(typeof(IAOPResult), aop);
         throw e;
     }
     return(aop);
 }
        public string UpdateCandidateProfile(ReqCandidateVM req, string CandidateId)
        {
            if (req is null)
            {
                ExceptionBase.ThrowException(404, "Candidate Req is empty , make sure of providing Requird Data!", "Candidate Req is empty , make sure of providing Requird Data!");
            }
            if (CandidateId == default || string.IsNullOrWhiteSpace(CandidateId))
            {
                ExceptionBase.ThrowException(404, "Candidate ID is null or Empty. ", "Candidate ID is null or Empty. ");
            }
            var IsFoundedCandidate = unitOfWork.GetRepository <Tbl_Candidate>().GetSingle(e => e.Code.ToString().Equals(CandidateId));

            if (IsFoundedCandidate is null)
            {
                ExceptionBase.ThrowException(404, "that is not a candidate ID .", "that candidate is not found. ");
            }
            var UpdatedCandidate = mapper.Map <Tbl_Candidate>(req);

            unitOfWork.GetRepository <Tbl_Candidate>().Update(UpdatedCandidate);
            if (!(req.ReqSkills is null) && req.ReqSkills.Count > 0)
            {
                List <Tbl_CandidateSkills> candidateSkills = new List <Tbl_CandidateSkills>();
                foreach (var item in req.ReqSkills)
                {
                    candidateSkills.Add(new Tbl_CandidateSkills()
                    {
                        CandidateId = IsFoundedCandidate.Id,
                        SkillId     = unitOfWork.GetRepository <Tbl_Skills>().GetSingle(e => e.SkillName.Equals(item.SkillName)).Id
                    });
                }
                unitOfWork.GetRepository <Tbl_CandidateSkills>().UpdateRing(candidateSkills.ToArray());
            }
            if (!(req.ReqEmployers is null) && req.ReqEmployers.Count > 0)
            {
                var PrevEmployer      = req.ReqEmployers.Where(x => x.ReqEmployerType.Equals(ReqEmployerTypeVM.PreviousEmployer)).FirstOrDefault();
                var CurrentEmployer   = req.ReqEmployers.Where(x => x.ReqEmployerType.Equals(ReqEmployerTypeVM.CurrentEmployer)).FirstOrDefault();
                var CandidateEmployer = new Tbl_CandidateEmployer();
                if (PrevEmployer != null)
                {
                    var PrevEmp = unitOfWork.GetRepository <Tbl_Employer>().GetSingle(e => e.EmployerName.Equals(PrevEmployer.EmployerName));
                    CandidateEmployer.CandidateId        = IsFoundedCandidate.Id;
                    CandidateEmployer.PreviousEmployerId = PrevEmp.Id;
                }
                if (CurrentEmployer != null)
                {
                    var CurrEmp = unitOfWork.GetRepository <Tbl_Employer>().GetSingle(e => e.EmployerName.Equals(CurrentEmployer.EmployerName));
                    CandidateEmployer.CurrentEmployerId = CurrEmp.Id;
                }
                unitOfWork.GetRepository <Tbl_CandidateEmployer>().Update(CandidateEmployer);
            }

            unitOfWork.SaveChanges();
            return("Success");
        }
Beispiel #26
0
        public void OnAuthorization(AuthorizationFilterContext context)
        {
            var unathorizedException = new ExceptionBase(ExceptionCodes.IDENTITY_NOT_AUTHORIZED, "User is not authorized", null, StatusCodes.Status403Forbidden);

            // Check if token is a valid one...

            if (false)
            {
                throw unathorizedException;
            }
        }
        public string GetConnectionId(string userId)
        {
            var tblToken = unitOfWork.GetRepository <Tbl_Token>().GetSingle(e => e.UserId.Equals(userId));

            if (tblToken == null)
            {
                throw ExceptionBase.ThrowException(400, "You Don't have token", "You Don't have token");
            }

            return(tblToken.ConnectionId);
        }
Beispiel #28
0
 public SeriesGradeKSATaskStatement(DataRow singleRowData)
 {
     // Load Object by dataRow
     try
     {
         this.FillObjectFromRowData(singleRowData);
     }
     catch (Exception ex)
     {
         ExceptionBase.HandleException(ex);
     }
 }
        private void BindData()
        {
            try
            {
                rtbFinalKSA.Text = CategoryRatingManager.GetFinalKSAS(CurrentJAID);

                PopulateCategoryRatingGroups();
            }
            catch (Exception ex)
            {
                ExceptionBase.HandleException(ex);
            }
        }
Beispiel #30
0
        public ResSkillVM GetSkill(string SkillId)
        {
            if (SkillId == default || string.IsNullOrWhiteSpace(SkillId))
            {
                ExceptionBase.ThrowException(404, "Skill ID is null or Empty.", "Skill ID is null or Empty.");
            }
            var IsFoundedSkill = unitOfWork.GetRepository <Tbl_Skills>().GetSingle(e => e.Code.ToString().Equals(SkillId));

            if (IsFoundedSkill is null)
            {
                ExceptionBase.ThrowException(404, "that is not a Skill ID .", "that Skill is not found.");
            }
            return(mapper.Map <ResSkillVM>(IsFoundedSkill));
        }
Beispiel #31
0
        public ResEmployerVM GetEmployer(string EmployerId)
        {
            if (EmployerId == default || string.IsNullOrWhiteSpace(EmployerId))
            {
                ExceptionBase.ThrowException(404, "Employer ID is null or Empty. ", "Employer ID is null or Empty. ");
            }
            var IsFoundedEmployer = unitOfWork.GetRepository <Tbl_Employer>().GetSingle(e => e.Code.ToString().Equals(EmployerId));

            if (IsFoundedEmployer is null)
            {
                ExceptionBase.ThrowException(404, "that is not a Employer ID .", "that Employer is not found. ");
            }
            return(mapper.Map <ResEmployerVM>(IsFoundedEmployer));
        }
 public static WebErrorResponse FromExceptionBase(ExceptionBase exception)
 {
     return new WebErrorResponse(exception.Error, exception.Type, exception.Details);
 }