예제 #1
0
 private string adjustCasing(string input, bool extension)
 {
     if (caseAction == CaseAction.Unset)
     {
         caseAction = Helper.ReadEnum <CaseAction>(ConfigKeyConstants.LETTER_CASE_STRATEGY_KEY);
         if (caseAction == CaseAction.Unset)
         {
             caseAction = CaseAction.Ignore;
         }
     }
     if (caseAction == CaseAction.small)
     {
         input = input.ToLower();
     }
     else if (caseAction == CaseAction.UpperFirst)
     {
         if (!extension)
         {
             Regex r = new Regex(@"\b(\w)(\w+)?\b", RegexOptions.Multiline | RegexOptions.IgnoreCase);
             input = Helper.convertToCamelCase(input);
         }
         else
         {
             input = input.ToLower();
         }
     }
     else if (caseAction == CaseAction.CAPSLOCK)
     {
         input = input.ToUpper();
     }
     return(input);
 }
예제 #2
0
 public CaseBehaviorBuilder SetUp(CaseAction setUp)
 {
     return(Wrap((caseExecution, instance, innerBehavior) =>
     {
         setUp(caseExecution, instance);
         innerBehavior();
     }));
 }
예제 #3
0
 public CaseBehaviorBuilder SetUp(CaseAction setUp)
 {
     return Wrap((caseExecution, instance, innerBehavior) =>
     {
         setUp(caseExecution, instance);
         innerBehavior();
     });
 }
예제 #4
0
 public CaseBehaviorBuilder SetUpTearDown(CaseAction setUp, CaseAction tearDown)
 {
     return Wrap((caseExecution, instance, innerBehavior) =>
     {
         setUp(caseExecution, instance);
         innerBehavior();
         tearDown(caseExecution, instance);
     });
 }
예제 #5
0
        //public async Task Application410(CaseActionsCreateViewModel model)
        //{
        //    var caseAction = new CaseAction
        //    {
        //        Date = model.Date,
        //        LawCaseId = model.LawCaseId,
        //        LegalActionId = model.LegalActionId,
        //    };
        //    await this.dbContext.CaseActions.AddAsync(caseAction);
        //    await this.dbContext.SaveChangesAsync();
        //}

        public async Task CreateActionReport(CaseActionsCreateViewModel model)
        {
            var caseAction = new CaseAction
            {
                Date          = model.Date,
                LawCaseId     = model.LawCaseId,
                LegalActionId = model.LegalActionId,
            };

            await this.dbContext.AddAsync(caseAction);

            await this.dbContext.SaveChangesAsync();
        }
예제 #6
0
        public async Task EditAsync(CaseActionsEditViewModel model)
        {
            var caseAction = new CaseAction
            {
                Id            = model.Id,
                Date          = model.Date,
                LawCaseId     = model.LawCaseId,
                LegalActionId = model.LegalActionId,
            };

            this.dbContext.Update(caseAction);
            await this.dbContext.SaveChangesAsync();
        }
예제 #7
0
        public ActionResult EditorAjax(int id, int caseId, int?caseprogressnoteId, int?casesmartgoalId)
        {
            bool hasAccess = workerroleactionpermissionnewRepository.HasPermission(CurrentLoggedInWorkerRoleIDs, Constants.Areas.CaseManagement, Constants.Controllers.CaseAction, Constants.Actions.Edit, true);

            if (!hasAccess)
            {
                WebHelper.CurrentSession.Content.ErrorMessage = "You are not eligible to do this action";
                return(RedirectToAction(Constants.Actions.AccessDenied, Constants.Controllers.Home, new { Area = String.Empty }));
            }

            CaseAction caseaction = null;

            if (id > 0)
            {
                //find an existing caseaction from database
                caseaction = caseactionRepository.Find(id);
                if (caseaction == null)
                {
                    //throw an exception if id is provided but data does not exist in database
                    return(new HttpStatusCodeResult(System.Net.HttpStatusCode.NotFound, "Case Progress Note Action not found"));
                }
                else
                {
                    if (caseaction.CaseMemberID != null)
                    {
                        caseaction.CaseMemberIds = Convert.ToInt32(caseaction.CaseMemberID);
                    }

                    if (caseaction.CaseMemberID != null)
                    {
                        caseaction.CaseMemberWorkerID = caseaction.CaseMemberID + "-M";
                    }
                    else if (caseaction.CaseWorkerID != null)
                    {
                        caseaction.CaseMemberWorkerID = caseaction.CaseWorkerID + "-W";
                    }
                }
                //caseaction.CaseActionID = caseaction.ID;
            }
            else
            {
                //create a new instance if id is not provided
                caseaction = new CaseAction();
                caseaction.CaseProgressNoteID = caseprogressnoteId;
                caseaction.CaseSmartGoalID    = casesmartgoalId;
            }

            caseaction.CaseID = caseId;
            //return the html of editor to display on popup
            return(Content(this.RenderPartialViewToString(Constants.PartialViews.CreateOrEdit, caseaction)));
        }
        public static CaseBehaviorBuilder WrapConditionally(this CaseBehaviorBuilder builder, Func<Case, object, bool> condition, CaseAction setUp, CaseAction tearDown)
        {
            return builder.Wrap((@case, instance, innerBehavior) =>
            {
                var shouldRunSetupAndTeardown = condition(@case, instance);

                if (shouldRunSetupAndTeardown)
                    setUp(@case, instance);

                innerBehavior();

                if (shouldRunSetupAndTeardown)
                    tearDown(@case, instance);
            });
        }
예제 #9
0
        public CaseBehaviorBuilder SetUpTearDown(CaseAction setUp, CaseAction tearDown)
        {
            return Wrap((@case, instance, innerBehavior) =>
            {
                if (@case.Exceptions.Any())
                    return;

                setUp(@case, instance);

                if (@case.Exceptions.Any())
                    return;

                innerBehavior();
                tearDown(@case, instance);
            });
        }
예제 #10
0
        public async Task <EntityResult> UpdateCaseStatus(CaseActionViewModel caseModel)
        {
            try
            {
                if (caseModel == null)
                {
                    throw new ArgumentNullException(nameof(caseModel));
                }

                Case currentCase = await _caseUnitOfWork.CaseRepository.GetByIDAsync(caseModel.CaseId);

                if (currentCase == null)
                {
                    throw new ArgumentException(CasesResource.CaseIsNotExist, nameof(caseModel));
                }

                var caseAction = new CaseAction
                {
                    CaseActionDate = DateTime.Now,
                    CaseId         = currentCase.Id,
                    Comment        = caseModel.Comment,
                    OldStatus      = currentCase.CaseStatus,
                    Status         = (Sanable.Cases.Domain.Model.CaseStatus)caseModel.Status,
                    StartApplyDate = caseModel.StartApplyDate,
                };

                currentCase.CaseActions.Add(caseAction);
                currentCase.CaseStatus = caseAction.Status;
                if (caseAction.Status == Sanable.Cases.Domain.Model.CaseStatus.Suspended)
                {
                    currentCase.CaseSuspensionDate = caseAction.StartApplyDate;
                }

                await _caseUnitOfWork.SaveAsync();

                return(EntityResult.Success);
            }
            catch (Exception ex)
            {
                _logger.Error(ex);
                throw;
            }
        }
예제 #11
0
        public CaseBehaviorBuilder SetUpTearDown(CaseAction setUp, CaseAction tearDown)
        {
            return(Wrap((@case, instance, innerBehavior) =>
            {
                if (@case.Exceptions.Any())
                {
                    return;
                }

                setUp(@case, instance);

                if (@case.Exceptions.Any())
                {
                    return;
                }

                innerBehavior();
                tearDown(@case, instance);
            }));
        }
예제 #12
0
        public ViewResult SmartGoalAction(int casesmartgoalId, int caseId, int?caseMemberId)
        {
            CaseSmartGoal caseSmartGoal = casesmartgoalRepository.Find(casesmartgoalId);

            if (caseSmartGoal != null)
            {
                List <CaseSmartGoalAssignment> goalAssignmentList = casesmartgoalRepository.FindAllCaseSmartGoalAssignmentByCaseSmargGoalID(caseSmartGoal.ID);
                if (goalAssignmentList != null)
                {
                    foreach (CaseSmartGoalAssignment goalAssignment in goalAssignmentList)
                    {
                        caseSmartGoal.SmartGoalName = caseSmartGoal.SmartGoalName.Concate(",", goalAssignment.SmartGoal.Name);
                    }
                }
            }
            caseSmartGoal.CaseID = caseId;
            CaseAction caseaction = new CaseAction();

            caseaction.CaseSmartGoal   = caseSmartGoal;
            caseaction.CaseSmartGoalID = casesmartgoalId;
            caseaction.CaseID          = caseId;
            if (caseMemberId.HasValue && caseMemberId.Value > 0)
            {
                caseaction.CaseMemberID = caseMemberId.Value;
                CaseMember caseMember = casememberRepository.Find(caseaction.CaseMemberID.Value);
                if (caseMember != null)
                {
                    ViewBag.DisplayID = caseMember.DisplayID;
                }
            }
            else
            {
                Case varCase = caseRepository.Find(caseId);
                if (varCase != null)
                {
                    ViewBag.DisplayID = varCase.DisplayID;
                }
            }
            return(View(caseaction));
        }
예제 #13
0
        private void initMembers()
        {
            originalPath    = new Filepath();
            destinationPath = new Filepath();

            showname     = "";
            episodeTitle = "";

            seasonNr  = -1;
            episodeNr = -1;

            isVideoFile         = false;
            isSubtitleFile      = false;
            processingRequested = true;
            isMovie             = false;

            umlautAction             = UmlautAction.Unset;
            caseAction               = CaseAction.Unset;
            directoryStructureAction = DirectoryStructureAction.Unset;
            language           = Helper.Languages.None;
            ExtractedNameLevel = 0;
        }
예제 #14
0
        public ActionResult Index(int caseID, int?caseMemberID)
        {
            var  varCase   = caseRepository.Find(caseID);
            bool hasAccess = workerroleactionpermissionnewRepository.HasPermission(caseID, CurrentLoggedInWorkerRoleIDs, CurrentLoggedInWorker.ID, varCase.ProgramID, varCase.RegionID, varCase.SubProgramID, varCase.JamatkhanaID, Constants.Areas.CaseManagement, Constants.Controllers.CaseAction, Constants.Actions.Index, true);

            if (!hasAccess)
            {
                WebHelper.CurrentSession.Content.ErrorMessage = "You are not eligible to do this action";
                return(RedirectToAction(Constants.Actions.AccessDenied, Constants.Controllers.Home, new { Area = String.Empty }));
            }
            CaseAction caseAction = new CaseAction();

            caseAction.CaseID = caseID;
            if (caseMemberID.HasValue && caseMemberID > 0)
            {
                caseAction.CaseMemberID = caseMemberID.Value;
                CaseMember caseMember = casememberRepository.Find(caseAction.CaseMemberID.Value);
                if (caseMember != null)
                {
                    ViewBag.DisplayID = caseMember.DisplayID;
                    int muridProfileCount = casememberprofileRepository.All.Count(item => item.CaseMember.CaseID == caseID && item.CaseMemberID == caseMemberID.Value);
                    if (muridProfileCount == 0)
                    {
                        caseAction.ErrorMessage = "There is no profile created for family or family member " + caseMember.FirstName + " " + caseMember.LastName;
                    }
                    else
                    {
                        int assessmentCount = caseassessmentRepository.All.Count(item => item.CaseMember.CaseID == caseID && item.CaseMemberID == caseMemberID.Value);
                        if (assessmentCount == 0)
                        {
                            caseAction.ErrorMessage = "There is no assessment created for family or family member " + caseMember.FirstName + " " + caseMember.LastName;
                        }
                        else
                        {
                            int goalCount = caseGoalRepository.All.Count(item => item.CaseMember.CaseID == caseID && item.CaseMemberID == caseMemberID.Value);
                            if (goalCount == 0)
                            {
                                caseAction.ErrorMessage = "There is no goal identified for family or family member " + caseMember.FirstName + " " + caseMember.LastName;
                            }
                        }
                    }
                }
            }
            else
            {
                caseAction.CaseMemberID = 0;
                int muridProfileCount = casememberprofileRepository.All.Count(item => item.CaseMember.CaseID == caseID);
                if (muridProfileCount == 0)
                {
                    caseAction.ErrorMessage = "There is no profile created for this case";
                }
                else
                {
                    int assessmentCount = caseassessmentRepository.All.Count(item => item.CaseMember.CaseID == caseID);
                    if (assessmentCount == 0)
                    {
                        caseAction.ErrorMessage = "There is no assessment created for this case";
                    }
                    else
                    {
                        int goalCount = caseGoalRepository.All.Count(item => item.CaseMember.CaseID == caseID);
                        if (goalCount == 0)
                        {
                            caseAction.ErrorMessage = "There is no goal identified for this case";
                        }
                    }
                }
            }
            if (caseMemberID.HasValue && caseMemberID.Value > 0)
            {
                caseAction.CaseMemberID = caseMemberID.Value;
                CaseMember caseMember = casememberRepository.Find(caseAction.CaseMemberID.Value);
                if (caseMember != null)
                {
                    ViewBag.DisplayID = caseMember.DisplayID;
                }
            }
            else
            {
                if (varCase == null)
                {
                    varCase = caseRepository.Find(caseID);
                }
                if (varCase != null)
                {
                    ViewBag.DisplayID = varCase.DisplayID;
                }
            }
            //return view result
            return(View(caseAction));
        }
예제 #15
0
 public CaseActionDescription(CaseAction yourCaseAction, string yourInfo)
 {
     caseAction = yourCaseAction;
     addInfo    = yourInfo;
 }
예제 #16
0
 private string adjustCasing(string input, bool extension)
 {
     if (caseAction == CaseAction.Unset) {
         caseAction = Helper.ReadEnum<CaseAction>(ConfigKeyConstants.LETTER_CASE_STRATEGY_KEY);
         if (caseAction == CaseAction.Unset)
             caseAction = CaseAction.Ignore;
     }
     if (caseAction == CaseAction.small) {
         input = input.ToLower();
     }
     else if (caseAction == CaseAction.UpperFirst) {
         if (!extension) {
             Regex r = new Regex(@"\b(\w)(\w+)?\b", RegexOptions.Multiline | RegexOptions.IgnoreCase);
             input = Helper.convertToCamelCase(input);
         }
         else {
             input = input.ToLower();
         }
     }
     else if (caseAction == CaseAction.CAPSLOCK) {
         input = input.ToUpper();
     }
     return input;
 }
예제 #17
0
        private void initMembers()
        {
            originalPath = new Filepath();
            destinationPath = new Filepath();

            showname = "";
            episodeTitle = "";

            seasonNr = -1;
            episodeNr = -1;

            isVideoFile = false;
            isSubtitleFile = false;
            processingRequested = true;
            isMovie = false;

            umlautAction = UmlautAction.Unset;
            caseAction = CaseAction.Unset;
            directoryStructureAction = DirectoryStructureAction.Unset;
            language = Helper.Languages.None;
            ExtractedNameLevel = 0;
        }
예제 #18
0
        /// <summary>
        /// i will get a myRunCaseData that will give caseActionActuator from XmlNode
        /// </summary>
        /// <param name="yourRunNode">your XmlNode</param>
        /// <returns>myRunCaseData you want</returns>
        public static MyRunCaseData <ICaseExecutionContent> GetCaseRunData(XmlNode sourceNode)
        {
            MyRunCaseData <ICaseExecutionContent> myCaseData = new MyRunCaseData <ICaseExecutionContent>();
            CaseProtocol contentProtocol = CaseProtocol.unknownProtocol;

            if (sourceNode == null)
            {
                myCaseData.AddErrorMessage("Error :source data is null");
            }
            else
            {
                if (sourceNode.Name == "Case")
                {
                    #region Basic information
                    if (sourceNode.Attributes["id"] == null)
                    {
                        myCaseData.AddErrorMessage("Error :not find the ID");
                    }
                    else
                    {
                        try
                        {
                            myCaseData.id = int.Parse(sourceNode.Attributes["id"].Value);
                        }
                        catch (Exception)
                        {
                            myCaseData.AddErrorMessage("Error :find the error ID");
                        }
                    }
                    myCaseData.name = CaseTool.GetXmlAttributeVauleEx(sourceNode, "remark", "NULL");
                    #endregion

                    #region Content
                    //XmlNode tempCaseContent = sourceNode.SelectSingleNode("Content"); //sourceNode["Content"] 具有同样的功能
                    XmlNode tempCaseContent = sourceNode["Content"];
                    if (tempCaseContent == null)
                    {
                        myCaseData.AddErrorMessage("Error :can not find Content");
                    }
                    else
                    {
                        if (tempCaseContent.Attributes["protocol"] != null && tempCaseContent.Attributes["actuator"] != null)
                        {
                            try
                            {
                                contentProtocol            = (CaseProtocol)Enum.Parse(typeof(CaseProtocol), tempCaseContent.Attributes["protocol"].Value);
                                myCaseData.contentProtocol = contentProtocol;
                            }
                            catch
                            {
                                myCaseData.AddErrorMessage("Error :error protocol in Content");
                            }
                            switch (contentProtocol)
                            {
                            case CaseProtocol.console:
                                myCaseData.testContent = CaseProtocolExecutionForConsole.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.activeMQ:
                                myCaseData.testContent = CaseProtocolExecutionForActiveMQ.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.mysql:
                                myCaseData.testContent = CaseProtocolExecutionForMysql.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.ssh:
                                myCaseData.testContent = CaseProtocolExecutionForSsh.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.vanelife_http:
                                myCaseData.testContent = CaseProtocolExecutionForVanelife_http.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.http:
                                myCaseData.testContent = CaseProtocolExecutionForHttp.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.tcp:
                                myCaseData.testContent = CaseProtocolExecutionForTcp.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.telnet:
                                myCaseData.testContent = CaseProtocolExecutionForTelnet.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.com:
                                myCaseData.testContent = CaseProtocolExecutionForCom.GetRunContent(tempCaseContent);
                                break;

                            case CaseProtocol.vanelife_comm:
                                myCaseData.AddErrorMessage("Error :this protocol not supported for now");
                                break;

                            case CaseProtocol.vanelife_tcp:
                                myCaseData.AddErrorMessage("Error :this protocol not supported for now");
                                break;

                            case CaseProtocol.vanelife_telnet:
                                myCaseData.AddErrorMessage("Error :this protocol not supported for now");
                                break;

                            case CaseProtocol.defaultProtocol:
                                myCaseData.AddErrorMessage("Error :this protocol not supported for now");
                                break;

                            default:
                                myCaseData.AddErrorMessage("Error :this protocol not supported for now");
                                break;
                            }
                            if (myCaseData.testContent != null)
                            {
                                if (myCaseData.testContent.MyErrorMessage != null)  //将testContent错误移入MyRunCaseData,执行case时会检查MyRunCaseData中的错误
                                {
                                    myCaseData.AddErrorMessage("Error :the Content not analyticaled Because:" + myCaseData.testContent.MyErrorMessage);
                                    //return myCaseData;
                                }
                            }
                        }
                        else
                        {
                            myCaseData.AddErrorMessage("Error :can not find protocol or actuator in Content");
                        }
                    }
                    #endregion

                    #region Expect
                    XmlNode tempCaseExpect = sourceNode["Expect"];
                    if (tempCaseExpect == null)
                    {
                        myCaseData.caseExpectInfo.myExpectType = CaseExpectType.judge_default;
                    }
                    else
                    {
                        if (tempCaseExpect.Attributes["method"] != null)
                        {
                            try
                            {
                                myCaseData.caseExpectInfo.myExpectType = (CaseExpectType)Enum.Parse(typeof(CaseExpectType), "judge_" + tempCaseExpect.Attributes["method"].Value);
                            }
                            catch
                            {
                                myCaseData.AddErrorMessage("Error :find error CaseExpectType in Expect");
                                myCaseData.caseExpectInfo.myExpectType = CaseExpectType.judge_default;
                            }
                        }
                        else
                        {
                            myCaseData.caseExpectInfo.myExpectType = CaseExpectType.judge_is;
                        }
                        myCaseData.caseExpectInfo.myExpectContent = CaseTool.GetXmlParametContent(tempCaseExpect);
                    }
                    #endregion

                    #region Action
                    XmlNode tempCaseAction = sourceNode["Action"];
                    if (tempCaseAction != null)
                    {
                        if (tempCaseAction.HasChildNodes)
                        {
                            foreach (XmlNode tempNode in tempCaseAction.ChildNodes)
                            {
                                CaseResult tempResult = CaseResult.Unknow;
                                CaseAction tempAction = CaseAction.action_unknow;
                                try
                                {
                                    tempResult = (CaseResult)Enum.Parse(typeof(CaseResult), tempNode.Name);
                                }
                                catch
                                {
                                    myCaseData.AddErrorMessage(string.Format("Error :find error CaseAction in Action with [{0}] in [{1}]", tempNode.InnerXml, tempNode.Name));
                                    continue;
                                }
                                try
                                {
                                    tempAction = (CaseAction)Enum.Parse(typeof(CaseAction), "action_" + CaseTool.GetXmlAttributeVauleWithEmpty(tempNode, "action"));
                                }
                                catch
                                {
                                    myCaseData.AddErrorMessage(string.Format("Error :find error CaseAction in Action with [{0}] in [{1}]", tempNode.InnerXml, CaseTool.GetXmlAttributeVauleWithEmpty(tempNode, "action")));
                                    continue;
                                }
                                if (tempNode.InnerText != "")
                                {
                                    myCaseData.AddCaseAction(tempResult, new CaseActionDescription(tempAction, tempNode.InnerText));
                                }
                                else
                                {
                                    myCaseData.AddCaseAction(tempResult, new CaseActionDescription(tempAction, null));
                                }
                            }
                        }
                    }
                    #endregion

                    #region Attribute
                    XmlNode tempCaseAttribute = sourceNode["Attribute"];
                    if (tempCaseAttribute != null)
                    {
                        if (tempCaseAttribute.HasChildNodes)
                        {
                            if (tempCaseAttribute["Delay"] != null)
                            {
                                try
                                {
                                    myCaseData.caseAttribute.attributeDelay = int.Parse(tempCaseAttribute["Delay"].InnerText);
                                }
                                catch
                                {
                                    myCaseData.AddErrorMessage("Error :find error Delay data in Attribute");
                                }
                            }
                            if (tempCaseAttribute["Level"] != null)
                            {
                                try
                                {
                                    myCaseData.caseAttribute.attributeLevel = int.Parse(tempCaseAttribute["Level"].InnerText);
                                }
                                catch
                                {
                                    myCaseData.AddErrorMessage("Error :find error Level data in Attribute");
                                }
                            }
                            if (tempCaseAttribute["ParameterSave"] != null)
                            {
                                if (tempCaseAttribute["ParameterSave"].HasChildNodes)
                                {
                                    foreach (XmlNode tempNode in tempCaseAttribute["ParameterSave"].ChildNodes)
                                    {
                                        if (tempNode.Name == "NewParameter")
                                        {
                                            string          tempParameterName       = CaseTool.GetXmlAttributeVaule(tempNode, "name");
                                            string          tempParameterMode       = CaseTool.GetXmlAttributeVaule(tempNode, "mode");
                                            string          tempParameterAdditional = CaseTool.GetXmlAttributeVaule(tempNode, "additional");
                                            string          tempFindVaule           = tempNode.InnerText;
                                            PickOutFunction tempPickOutFunction     = PickOutFunction.pick_str;
                                            if (tempParameterName == null)
                                            {
                                                myCaseData.AddErrorMessage("Error :can not find name data in NewParameter in Attribute");
                                                continue;
                                            }
                                            if (tempParameterName == "")
                                            {
                                                myCaseData.AddErrorMessage("Error :the name data in NewParameter is empty in Attribute");
                                                continue;
                                            }
                                            if (tempParameterMode == null)
                                            {
                                                myCaseData.AddErrorMessage("Error :can not find mode data in NewParameter in Attribute");
                                                continue;
                                            }
                                            if (tempFindVaule == "")
                                            {
                                                myCaseData.AddErrorMessage("Error :the NewParameter vaule is empty in Attribute");
                                                continue;
                                            }
                                            try
                                            {
                                                tempPickOutFunction = (PickOutFunction)Enum.Parse(typeof(PickOutFunction), "pick_" + tempParameterMode);
                                            }
                                            catch
                                            {
                                                myCaseData.AddErrorMessage("Error :find error ParameterSave mode in Attribute");
                                                continue;
                                            }
                                            myCaseData.caseAttribute.addParameterSave(tempParameterName, tempFindVaule, tempPickOutFunction, tempParameterAdditional);
                                        }
                                    }
                                }
                            }
                        }
                    }
                    #endregion
                }
                else
                {
                    myCaseData.AddErrorMessage("Error :source data is error");
                }
            }
            return(myCaseData);
        }
예제 #19
0
        public ActionResult SaveAjax(CaseAction caseaction)
        {
            //id=0 means add operation, update operation otherwise
            //caseaction.ID = caseaction.CaseActionID;
            bool isNew = caseaction.ID == 0;

            if (ModelState.ContainsKey("CaseMemberID"))
            {
                ModelState["CaseMemberID"].Errors.Clear();
            }
            //validate data
            if (ModelState.IsValid)
            {
                try
                {
                    //if (caseaction.IsCompleted == false || caseaction.IsCompleted==null)
                    //{
                    //    throw new CustomException("Please check Is Completed");
                    //}
                    if (caseaction.ActionStartTime > caseaction.ActionEndTime)
                    {
                        throw new CustomException("Start date can't be greater than end date.");
                    }

                    if (string.IsNullOrEmpty(caseaction.CaseMemberWorkerID))
                    {
                        throw new CustomException("Please select a worker/member");
                    }
                    else
                    {
                        var CaseWorker_Member = caseaction.CaseMemberWorkerID.Split('-');
                        if (CaseWorker_Member[1] == "M")
                        {
                            caseaction.CaseMemberID = Convert.ToInt32(CaseWorker_Member[0]);
                            caseaction.CaseWorkerID = null;
                        }
                        else
                        {
                            caseaction.CaseWorkerID = Convert.ToInt32(CaseWorker_Member[0]);
                            caseaction.CaseMemberID = null;
                        }
                    }

                    //<JL:Comment:No need to check access again on post. On edit we are already checking permission.>
                    //if (caseaction.ID > 0)
                    //{
                    //    var primaryWorkerID = GetPrimaryWorkerOfTheCase(caseaction.CaseID);
                    //    if (caseaction.CreatedByWorkerID != CurrentLoggedInWorker.ID && primaryWorkerID != CurrentLoggedInWorker.ID && CurrentLoggedInWorkerRoleIDs.IndexOf(1) == -1 && (CurrentLoggedInWorkerRoleIDs.IndexOf(SiteConfigurationReader.RegionalManagerRoleID) == -1))
                    //    {
                    //        WebHelper.CurrentSession.Content.ErrorMessage = "You are not eligible to do this action";
                    //        return Json(new { success = true, url = Url.Action(Constants.Actions.AccessDenied, Constants.Controllers.Home, new { Area = String.Empty }) });
                    //        //return RedirectToAction(Constants.Actions.AccessDenied, Constants.Controllers.Home, new { Area = String.Empty });
                    //    }
                    //}
                    //</JL:Comment:07/08/2017>

                    //set the id of the worker who has added/updated this record
                    caseaction.LastUpdatedByWorkerID = CurrentLoggedInWorker.ID;

                    caseactionRepository.InsertOrUpdate(caseaction);
                    caseactionRepository.Save();

                    //call repository function to save the data in database

                    //set status message
                    if (isNew)
                    {
                        caseaction.SuccessMessage = "Action has been added successfully";
                    }
                    else
                    {
                        caseaction.SuccessMessage = "Action has been updated successfully";
                    }
                    try
                    {
                        var caseWorker = caseworkerRepository.Find(Convert.ToInt32(caseaction.CaseWorkerID));

                        var worker = workerRepository.Find(caseWorker.WorkerID);


                        string subject         = ConfigurationManager.AppSettings["subject"].ToString();
                        string site            = "";
                        String strPathAndQuery = Request.Url.PathAndQuery;
                        String currentHost     = Request.Url.AbsoluteUri.Replace(strPathAndQuery, "/");

                        string myHostTest = SiteConfigurationReader.GetAppSettingsString("Test");
                        string myHostLive = SiteConfigurationReader.GetAppSettingsString("Live");


                        if (currentHost == myHostLive)
                        {
                            site = myHostLive;
                        }
                        else
                        {
                            site = myHostTest;
                        }
                        string message = "Dear User,<br /><br />A new action has been assigned to you.<br /><br /><a href='{0}'>Click here to view the action</a><br /><br />Regards,<br /><br />eCMS System Manager";
                        if (caseaction.CaseProgressNoteID > 0)
                        {
                            message = message.Replace("{0}", site + "/CaseManagement/CaseProgressNote/Edit?noteID=" + caseaction.CaseProgressNoteID + "&CaseID=" + caseaction.CaseID + "&caseMemberId=" + caseaction.CaseMemberID + "");
                        }
                        else if (caseaction.CaseSmartGoalID > 0)
                        {
                            message = message.Replace("{0}", site + "/CaseManagement/CaseSmartGoal/Edit?casesmartgoalId=" + caseaction.CaseSmartGoalID + "&CaseID=" + caseaction.CaseID + "&caseMemberId=" + caseaction.CaseMemberID + "");
                        }
                        else
                        {
                            message = message.Replace("{0}", site + "/CaseManagement/CaseSmartGoalServiceProvider/Index?casesmartgoalId=0&casesmartgoalserviceproviderId=" + caseaction.CaseSmartGoalServiceProviderID + "&CaseID=" + caseaction.CaseID + "&caseMemberId=" + caseaction.CaseMemberID + "");
                        }
                        eCMS.BusinessLogic.Helpers.ExcEMail.SendEmail(worker.EmailAddress, subject, message, true);
                    }
                    catch (Exception ex)
                    {
                    }
                }
                catch (CustomException ex)
                {
                    caseaction.ErrorMessage = ex.UserDefinedMessage;
                }
                catch (Exception ex)
                {
                    ExceptionManager.Manage(ex);
                    caseaction.ErrorMessage = Constants.Messages.UnhandelledError;
                }
            }
            else
            {
                foreach (var modelStateValue in ViewData.ModelState.Values)
                {
                    foreach (var error in modelStateValue.Errors)
                    {
                        caseaction.ErrorMessage = error.ErrorMessage;
                        break;
                    }
                    if (caseaction.ErrorMessage.IsNotNullOrEmpty())
                    {
                        break;
                    }
                }
            }
            //return the status message in json
            if (caseaction.ErrorMessage.IsNotNullOrEmpty())
            {
                return(Json(new { success = false, data = this.RenderPartialViewToString(Constants.PartialViews.Alert, caseaction) }));
            }
            else
            {
                return(Json(new { success = true, data = this.RenderPartialViewToString(Constants.PartialViews.Alert, caseaction) }));
            }
        }
예제 #20
0
        public ActionResult DeleteAjax(int id)
        {
            //find the caseaction in database
            CaseAction caseaction = caseactionRepository.Find(id);

            if (caseaction == null)
            {
                //set error message if it does not exist in database
                caseaction = new CaseAction();
                caseaction.ErrorMessage = "CaseAction not found";
            }
            else
            {
                try
                {
                    bool hasAccess = workerroleactionpermissionnewRepository.HasPermission(CurrentLoggedInWorkerRoleIDs, Constants.Areas.CaseManagement, Constants.Controllers.CaseAction, Constants.Actions.Delete, true);
                    if (!hasAccess)
                    {
                        WebHelper.CurrentSession.Content.ErrorMessage = "You are not eligible to do this action";
                        return(RedirectToAction(Constants.Actions.AccessDenied, Constants.Controllers.Home, new { Area = String.Empty }));
                    }

                    //<JL:Comment:No need to check access again on post. On edit we are already checking permission.>
                    //var primaryWorkerID = GetPrimaryWorkerOfTheCase(caseaction.CaseMember != null ? caseaction.CaseMember.CaseID : (caseaction.CaseWorker!=null?caseaction.CaseWorker.CaseID:0));
                    //if (caseaction.CreatedByWorkerID != CurrentLoggedInWorker.ID && primaryWorkerID != CurrentLoggedInWorker.ID && CurrentLoggedInWorkerRoleIDs.IndexOf(1) == -1 && (CurrentLoggedInWorkerRoleIDs.IndexOf(SiteConfigurationReader.RegionalManagerRoleID) == -1))
                    //{
                    //    WebHelper.CurrentSession.Content.ErrorMessage = "You are not eligible to do this action";
                    //    return Json(new { success = true, url = Url.Action(Constants.Actions.AccessDenied, Constants.Controllers.Home, new { Area = String.Empty }) });
                    //    //return RedirectToAction(Constants.Actions.AccessDenied, Constants.Controllers.Home, new { Area = String.Empty });
                    //}
                    //</JL:Comment:07/08/2017>

                    //delete caseaction from database
                    caseactionRepository.Delete(caseaction);
                    caseactionRepository.Save();
                    //set success message
                    caseaction.SuccessMessage = "Case Progress Note Action has been deleted successfully";
                }
                catch (CustomException ex)
                {
                    caseaction.ErrorMessage = ex.UserDefinedMessage;
                }
                catch (Exception ex)
                {
                    if (ex.Message == "Store update, insert, or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=472540 for information on understanding and handling optimistic concurrency exceptions.")
                    {
                        caseaction.SuccessMessage = "Case Progress Note Action has been deleted successfully";
                    }
                    else
                    {
                        ExceptionManager.Manage(ex);
                        caseaction.ErrorMessage = Constants.Messages.UnhandelledError;
                    }
                }
            }
            //return action status in json to display on a message bar
            if (caseaction.ErrorMessage.IsNotNullOrEmpty())
            {
                return(Json(new { success = false, data = this.RenderPartialViewToString(Constants.PartialViews.Alert, caseaction) }));
            }
            else
            {
                return(Json(new { success = true, data = this.RenderPartialViewToString(Constants.PartialViews.Alert, caseaction) }));
            }
        }
예제 #21
0
 public virtual void VisitCaseAction(CaseAction caseAction)
 {
     DefaultVisit(caseAction);
 }