예제 #1
0
        protected override void OnSaveChangesSuccess(RuleCategory ruleCategory, UIActionType action)
        {
            if (action == UIActionType.ADD || action == UIActionType.EDIT)
            {
                DateTime     fromDate, toDate;
                RuleCategory ruleCat = base.GetByID(ruleCategory.ID);

                if (ruleCat.PersonRuleCatAssignList != null && ruleCat.PersonRuleCatAssignList.Count > 0)
                {
                    fromDate = ruleCat.PersonRuleCatAssignList.Min(x => Utility.ToMildiDateTime(x.FromDate));
                    toDate   = ruleCat.PersonRuleCatAssignList.Max(x => Utility.ToMildiDateTime(x.ToDate));
                }
                else
                {
                    fromDate = DateTime.Now.AddYears(-2);
                    toDate   = DateTime.Now.AddYears(5);
                }


                //دوره تاریخ پیشفرض پارامتر
                foreach (Rule rule in ruleCat.RuleList)
                {
                    if (rule.HasParameter && (rule.AssignRuleParamList == null || rule.AssignRuleParamList.Count == 0))
                    {
                        BRuleParameter busRuleParam = new BRuleParameter(rule.TemplateId, ruleCat.ID);
                        busRuleParam.InsertParameter(new List <RuleTemplateParameter>(), fromDate, toDate);
                    }
                }
            }
        }
예제 #2
0
        private void CheckAccessGroupsLoadAccess_AccessGroups()
        {
            string[] retMessage = new string[4];
            try
            {
                if (HttpContext.Current.Request.QueryString.AllKeys.Contains("FlowState"))
                {
                    UIActionType uam = (UIActionType)Enum.Parse(typeof(UIActionType), this.StringBuilder.CreateString(HttpContext.Current.Request.QueryString["FlowState"]).ToUpper());
                    switch (uam)
                    {
                    case UIActionType.ADD:
                        this.AccessGroupBusiness.CheckAccessGroupsLoadAccess_onOrganizationFlowInsert();
                        break;

                    case UIActionType.EDIT:
                        this.AccessGroupBusiness.CheckAccessGroupsLoadAccess_onOrganizationFlowUpdate();
                        break;
                    }
                }
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                Response.Redirect("WhitePage.aspx?" + typeof(IllegalServiceAccess).Name + "=" + retMessage[1]);
            }
        }
예제 #3
0
        /// <summary>
        /// عملیات درج و بروزرسانی انجام میشود
        /// </summary>
        /// <param name="obj"></param>
        /// <returns>شناسه آیتم درج یا بروزرسانی شده</returns>
        public virtual decimal BaseSaveChanges(T obj, UIActionType action)
        {
            try
            {
                BaseGetReadyBeforeSave(obj, action);

                if (action == UIActionType.ADD)
                {
                    InsertValidate(obj);
                    BaseUIValidate(obj, action);
                    Insert(obj);
                }
                else if (action == UIActionType.EDIT)
                {
                    UpdateValidate(obj);
                    BaseUIValidate(obj, action);
                    Update(obj);
                }
                else if (action == UIActionType.DELETE)
                {
                    DeleteValidate(obj);
                    BaseUIValidate(obj, action);
                    Delete(obj);
                }
                BaseOnSaveChangesSuccess(obj, action);
                BaseUpdateCFP(obj, action);
                LogUserAction(obj, action.ToString(), this.CurrentUsername, IsBusinessLogEnable);
                return(obj.ID);
            }
            catch (Exception ex)
            {
                LogException(ex, typeof(T).Name, "SaveChanges", IsBusinessLogEnable);
                throw ex;
            }
        }
예제 #4
0
        protected override void UpdateCFP(PersonParamValue value, UIActionType action)
        {
            try
            {
                decimal  personId   = value.Person.ID;
                DateTime newCfpDate = value.FromDate;
                //CFP cfp = base.GetCFP(personId);
                //if (cfp.ID == 0 || cfp.Date > newCfpDate)
                //{
                //    DateTime calculationLockDate = base.UIValidator.GetCalculationLockDate(personId);

                //    //بسته بودن محاسبات
                //    if (calculationLockDate > Utility.GTSMinStandardDateTime && calculationLockDate > newCfpDate)
                //    {
                //        newCfpDate = calculationLockDate.AddDays(1);
                //    }

                base.UpdateCFP(personId, newCfpDate);

                // }
            }
            catch (Exception ex)
            {
                LogException(ex);
                throw ex;
            }
        }
예제 #5
0
        public void OpenInteractCard(UIActionType type)
        {
            switch (type)
            {
            case UIActionType.pickup:
                ac_action_type.text = "Pick Up: Space";
                break;

            case UIActionType.interact:
                ac_action_type.text = "Interact: Space";
                break;

            case UIActionType.open:
                ac_action_type.text = "Open: Space";
                break;

            case UIActionType.talk:
                ac_action_type.text = "Talk: Space";
                break;

            default:
                break;
            }

            interactCard.SetActive(true);
        }
예제 #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="shiftPair"></param>
 /// <param name="action"></param>
 private void GetReadyBeforeSaveShiftPair(ShiftPair shiftPair, UIActionType action)
 {
     if (shiftPair.NextDayContinual)
     {
         shiftPair.To += 1440;
     }
 }
예제 #7
0
    public string[] UpdateRegisteredRequest_RegisteredRequestsPage(string state, string SelectedRegisteredRequestID, string SelectedRegisteredRequestAttachmentFile)
    {
        this.InitializeCulture();

        string[] retMessage = new string[4];

        try
        {
            UIActionType uam = (UIActionType)Enum.Parse(typeof(UIActionType), this.StringBuilder.CreateString(state).ToUpper());
            decimal      selectedRegisteredRequestID = decimal.Parse(this.StringBuilder.CreateString(SelectedRegisteredRequestID));
            SelectedRegisteredRequestAttachmentFile = this.StringBuilder.CreateString(SelectedRegisteredRequestAttachmentFile);

            switch (uam)
            {
            case UIActionType.DELETE:
                if (selectedRegisteredRequestID == 0)
                {
                    retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, new Exception(GetLocalResourceObject("NoRegisteredRequestsSelectedforDelete").ToString()), retMessage);
                    return(retMessage);
                }
                this.RegisteredRequestsBusiness.DeleteRequest(selectedRegisteredRequestID);
                if (SelectedRegisteredRequestAttachmentFile != null && SelectedRegisteredRequestAttachmentFile != string.Empty)
                {
                    this.MasterRequestBusiness.DeleteRequestAttachment(WebConfigurationManager.AppSettings["RequestAttachmentsPath"] + "\\" + SelectedRegisteredRequestAttachmentFile);
                }
                break;
            }

            retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
            string SuccessMessageBody = string.Empty;
            switch (uam)
            {
            case UIActionType.DELETE:
                SuccessMessageBody = GetLocalResourceObject("DeleteComplete").ToString();
                break;

            default:
                break;
            }
            retMessage[1] = SuccessMessageBody;
            retMessage[2] = "success";
            retMessage[3] = selectedRegisteredRequestID.ToString();
            return(retMessage);
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            return(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            return(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            return(retMessage);
        }
    }
        public string[] UpdateExceptionShift_MasterExceptionShiftsPage(string state, string SelectedExceptionShiftID)
        {
            this.InitializeCulture();

            string[] retMessage = new string[4];

            decimal      selectedExceptionShiftID = decimal.Parse(this.StringBuilder.CreateString(SelectedExceptionShiftID), CultureInfo.InvariantCulture);
            UIActionType uam = UIActionType.ADD;

            try
            {
                AttackDefender.CSRFDefender(this.Page);
                switch (this.StringBuilder.CreateString(state))
                {
                case "Delete":
                    uam = UIActionType.DELETE;
                    if (selectedExceptionShiftID == 0)
                    {
                        retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, new Exception(GetLocalResourceObject("NoExceptionShiftSelectedforDelete").ToString()), retMessage);
                        return(retMessage);
                    }
                    this.ExceptionShiftsBusiness.DeleteExceptionShift(selectedExceptionShiftID);
                    break;

                default:
                    break;
                }

                retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
                string SuccessMessageBody = string.Empty;
                switch (uam)
                {
                case UIActionType.DELETE:
                    SuccessMessageBody = GetLocalResourceObject("DeleteComplete").ToString();
                    break;

                default:
                    break;
                }
                retMessage[1] = SuccessMessageBody;
                retMessage[2] = "success";
                retMessage[3] = selectedExceptionShiftID.ToString();
                return(retMessage);
            }
            catch (UIValidationExceptions ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
                return(retMessage);
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                return(retMessage);
            }
            catch (Exception ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
                return(retMessage);
            }
        }
예제 #9
0
        public decimal SaveChanges(RuleCategory ruleCategory, UIActionType action)
        {
            switch (action)
            {
            case UIActionType.ADD:
            {
                this.InsertValidate(ruleCategory);
                this.EnableInsertValidate = false;
                this.SetInsertedMutualRules(ruleCategory);
                ruleCategory.Parent = this.GetRoot();
                return(base.SaveChanges(ruleCategory, action));
            }

            case UIActionType.EDIT:
            {
                this.UpdateValidate(ruleCategory);
                this.EnableUpdateValidate = false;
                ruleCategory = this.SetUpdatedMutualRules(ruleCategory);
                return(base.SaveChanges(ruleCategory, action));
            }

            case UIActionType.DELETE:
            {
                return(base.SaveChanges(ruleCategory, action));
            }
            }
            return(0);
        }
예제 #10
0
 protected override void OnSaveChangesSuccess(Operator opr, UIActionType action)
 {
     if (action == UIActionType.ADD || action == UIActionType.EDIT)
     {
         new BRole().SetUserRole(opr.Person, RoleCustomCode.Operator);
     }
 }
예제 #11
0
    public string[] UpdateCalculationRange_MasterCalculationRangePage(string state, string SelectedCalculationRangeID)
    {
        this.InitializeCulture();

        string[] retMessage = new string[4];

        try
        {
            AttackDefender.CSRFDefender(this.Page);
            decimal      CalculationRangeID         = 0;
            decimal      selectedCalculationRangeID = decimal.Parse(this.StringBuilder.CreateString(SelectedCalculationRangeID), CultureInfo.InvariantCulture);
            UIActionType uam = (UIActionType)Enum.Parse(typeof(UIActionType), this.StringBuilder.CreateString(state).ToUpper());

            CalculationRangeGroup calculationRange = new CalculationRangeGroup();
            calculationRange.ID = selectedCalculationRangeID;

            switch (uam)
            {
            case UIActionType.DELETE:
                if (selectedCalculationRangeID == 0)
                {
                    retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, new Exception(GetLocalResourceObject("NoCalculationRangeSelectedforDelete").ToString()), retMessage);
                    return(retMessage);
                }
                CalculationRangeID = this.CalculationRangeBusiness.DeleteDateRange(calculationRange);
                break;
            }

            retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
            string SuccessMessageBody = string.Empty;
            switch (uam)
            {
            case UIActionType.DELETE:
                SuccessMessageBody = GetLocalResourceObject("DeleteComplete").ToString();
                break;

            default:
                break;
            }
            retMessage[1] = SuccessMessageBody;
            retMessage[2] = "success";
            retMessage[3] = CalculationRangeID.ToString();
            return(retMessage);
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            return(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            return(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            return(retMessage);
        }
    }
예제 #12
0
        protected void UpdateCFP1(CalculationRangeGroup obj, UIActionType action)
        {
            if (action == UIActionType.EDIT)
            {
                NHibernateSessionManager.Instance.ClearSession();
                CalculationRangeGroup dateRangeGroup = base.GetByID(obj.ID);
                if (dateRangeGroup.PersonRangeAssignmentList != null)
                {
                    foreach (PersonRangeAssignment assign in dateRangeGroup.PersonRangeAssignmentList)
                    {
                        decimal  personId   = assign.Person.ID;
                        CFP      cfp        = base.GetCFP(personId);
                        DateTime newCfpDate = assign.FromDate;

                        if (cfp.ID == 0 || cfp.Date > newCfpDate)
                        {
                            DateTime calculationLockDate = base.UIValidator.GetCalculationLockDate(personId);

                            //بسته بودن محاسبات
                            if (calculationLockDate > Utility.GTSMinStandardDateTime && calculationLockDate > newCfpDate)
                            {
                                newCfpDate = calculationLockDate.AddDays(1);
                            }

                            base.UpdateCFP(personId, newCfpDate);
                        }
                    }
                }
            }
        }
예제 #13
0
        public decimal UpdateContract(Contract contract, UIActionType UAT, out decimal contractIdChangedIsDefault)
        {
            decimal contractId = 0;

            contractIdChangedIsDefault = 0;
            try
            {
                using (NHibernateSessionManager.Instance.BeginTransactionOn())
                {
                    Contract contractObj = GetDefaultContract();
                    if (contractObj != null && contract.IsDefault)
                    {
                        contractObj.IsDefault = false;
                        contractRep.WithoutTransactSave(contractObj);
                        contractIdChangedIsDefault = contractObj.ID;
                    }
                    contractId = base.SaveChanges(contract, UAT);
                    NHibernateSessionManager.Instance.CommitTransactionOn();
                }

                return(contractId);
            }
            catch (Exception ex)
            {
                NHibernateSessionManager.Instance.RollbackTransactionOn();
                LogException(ex, "BContract", "UpdateContract");
                throw ex;
            }
        }
예제 #14
0
    private void CheckPersonnelReserveFieldsLoadAccess_PersonnelExtraInformation()
    {
        string[] retMessage = new string[4];
        try
        {
            if (HttpContext.Current.Request.QueryString.AllKeys.Contains("PersonnelState"))
            {
                UIActionType UAT = (UIActionType)Enum.Parse(typeof(UIActionType), this.StringBuilder.CreateString(HttpContext.Current.Request.QueryString["PersonnelState"]).ToUpper());
                switch (UAT)
                {
                case UIActionType.ADD:
                    this.PersonnelReservedFieldBusiness.CheckPersonnelReserveFieldsLoadAccess_onPersonnelInsert();
                    break;

                case UIActionType.EDIT:
                    this.PersonnelReservedFieldBusiness.CheckPersonnelReserveFieldsLoadAccess_onPersonnelUpdate();
                    break;
                }
            }
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            Response.Redirect("WhitePage.aspx?" + typeof(IllegalServiceAccess).Name + "=" + retMessage[1]);
        }
    }
예제 #15
0
 /// <summary>
 /// عملیات درج و بروزرسانی انجام میشود
 ///  //  new ShiftPair() { ID = 5, ShiftId = 10 };
 /// </summary>
 /// <param name="pair"></param>
 public decimal SaveChangesShiftPair(ShiftPair pair, UIActionType action)
 {
     try
     {
         this.CheckInterfaceRuleGroup(pair);
         GetReadyBeforeSaveShiftPair(pair, action);
         if (action == UIActionType.EDIT)
         {
             UpdateValidateShiftPair(pair.ShiftId, pair);
             UpdateShiftPair(pair);
         }
         else if (action == UIActionType.ADD)
         {
             InsertValidateShiftPair(pair.ShiftId, pair);
             InsertShiftPair(pair);
         }
         else if (action == UIActionType.DELETE)
         {
             DeleteShiftPair(pair.ID);
         }
         this.UpdateCFP(pair, action);
         return(pair.ID);
     }
     catch (Exception ex)
     {
         LogException(ex, "Shift", "SaveChangesShiftPair");
         throw ex;
     }
 }
예제 #16
0
파일: BUser.cs 프로젝트: ImanRezaeipour/GTS
 protected override void GetReadyBeforeSave(User user, UIActionType action)
 {
     if (!Utility.IsEmpty(user.Password) && (action == UIActionType.ADD || (action == UIActionType.EDIT && user.IsPasswodChanged)))
     {
         user.Password = Utility.GetHashCode(user.Password);
         if (Utility.VerifyHashCode(user.ConfirmPassword, user.Password))
         {
             //این تساوی بعدا در اعتبارسنجی بررسی میشود
             user.ConfirmPassword = user.Password;
         }
     }
     ///ممکن است شخص نخواهد کلمه عبور را ویرایش کند
     else if (action == UIActionType.EDIT && !user.IsPasswodChanged)
     {
         user.Password = userRepository.GetPasswordByUserId(user.ID);
     }
     if (action == UIActionType.ADD)
     {
         user.LastActivityDate = DateTime.Now;
     }
     else if (action == UIActionType.EDIT)
     {
         user.LastActivityDate = userRepository.GetLastActivityDateByUserId(user.ID);
         if (Utility.IsEmpty(user.LastActivityDate))
         {
             user.LastActivityDate = DateTime.Now;
         }
     }
 }
예제 #17
0
 protected override void UpdateCFP(RuleCategory obj, UIActionType action)
 {
     if (action == UIActionType.EDIT)
     {
         Dictionary <decimal, DateTime>  uivalidationGroupIdDic  = new Dictionary <decimal, DateTime>();
         IList <PersonRuleCatAssignment> assignPersonRulCateList = obj.PersonRuleCatAssignList;
         IList <CFP> cfpPersonList = new List <CFP>();
         if (assignPersonRulCateList.Count > 0)
         {
             cfpPersonList = base.GetCFPPersons(assignPersonRulCateList.Select(a => a.Person.ID).ToList <decimal>());
         }
         IList <decimal> UiValidationGroupIdList = uivalidationGroupingRepository.GetUivalidationIdListByRuleCategory(obj.ID);
         IList <decimal> cfpPersonIdInsertList   = new List <decimal>();
         foreach (decimal uiValidateionGrpId in UiValidationGroupIdList)
         {
             if (!uivalidationGroupIdDic.ContainsKey(uiValidateionGrpId))
             {
                 DateTime calculationLockDate = base.UIValidator.GetCalculationLockDateByGroup(uiValidateionGrpId);
                 uivalidationGroupIdDic.Add(uiValidateionGrpId, calculationLockDate);
             }
         }
         base.UpdateCfpByRuleCategory(obj.ID, uivalidationGroupIdDic);
         cfpPersonIdInsertList = assignPersonRulCateList.Where(p => cfpPersonList != null && !cfpPersonList.Select(c => c.PrsId).ToList().Contains(p.Person.ID)).Select(p => p.Person.ID).Distinct().ToList <decimal>();
         if (cfpPersonIdInsertList.Count > 0)
         {
             base.InsertCfpByRuleCategory(cfpPersonIdInsertList, obj.ID, uivalidationGroupIdDic);
         }
     }
 }
예제 #18
0
 protected override void OnSaveChangesSuccess(Shift obj, UIActionType action)
 {
     if (action == UIActionType.ADD)
     {
         new BDataAccess().InsertDataAccess(Infrastructure.DataAccessLevelOperationType.Single, Infrastructure.DataAccessParts.Shift, obj.ID, BUser.CurrentUser.ID, null, "");
     }
 }
예제 #19
0
        protected override void UpdateCFP(CalculationRangeGroup obj, UIActionType action)
        {
            if (action == UIActionType.EDIT)
            {
                IList <CFP> cfpList = new List <CFP>();
                Dictionary <decimal, DateTime> lockDates = new Dictionary <decimal, DateTime>();
                NHibernateSessionManager.Instance.ClearSession();
                CalculationRangeGroup dateRangeGroup = base.GetByID(obj.ID);


                Dictionary <decimal, DateTime> uivalidationGroupIdDic    = new Dictionary <decimal, DateTime>();
                IList <PersonRangeAssignment>  assignPersonDateRangeList = dateRangeGroup.PersonRangeAssignmentList;
                IList <CFP> cfpPersonList = new List <CFP>();
                if (assignPersonDateRangeList.Count > 0)
                {
                    cfpPersonList = base.GetCFPPersons(assignPersonDateRangeList.Select(a => a.Person.ID).ToList <decimal>());
                }
                IList <decimal> UiValidationGroupIdList = uivalidationGroupingRepository.GetUivalidationIdListByCalculationRangeGroup(dateRangeGroup.ID);
                IList <decimal> cfpPersonIdInsertList   = new List <decimal>();
                foreach (decimal uiValidateionGrpId in UiValidationGroupIdList)
                {
                    if (!uivalidationGroupIdDic.ContainsKey(uiValidateionGrpId))
                    {
                        DateTime calculationLockDate = base.UIValidator.GetCalculationLockDateByGroup(uiValidateionGrpId);
                        uivalidationGroupIdDic.Add(uiValidateionGrpId, calculationLockDate);
                    }
                }
                base.UpdateCfpByDateRangeGroup(dateRangeGroup.ID, uivalidationGroupIdDic);
                cfpPersonIdInsertList = assignPersonDateRangeList.Where(p => cfpPersonList != null && !cfpPersonList.Select(c => c.PrsId).ToList().Contains(p.Person.ID)).Select(p => p.Person.ID).Distinct().ToList <decimal>();
                if (cfpPersonIdInsertList.Count > 0)
                {
                    base.InsertCfpByDateRangeGroup(cfpPersonIdInsertList, dateRangeGroup.ID, uivalidationGroupIdDic);
                }
            }
        }
예제 #20
0
        /// <summary>
        ///  بروزرسانی نشانه تغییرات برای پرسنلی که به گروه قانون این سهمیه مرخصی منتسب می باشند
        /// </summary>
        /// <param name="obj">سهمیه مرخصی</param>
        /// <param name="action">نوع عملیات</param>
        protected void UpdateCFP1(Budget obj, UIActionType action)
        {
            if (action == UIActionType.ADD)
            {
                RuleCategory ruleCat = new BRuleCategory().GetByID(obj.RuleCategory.ID);
                foreach (PersonRuleCatAssignment assgn in ruleCat.PersonRuleCatAssignList)
                {
                    decimal  personId   = assgn.Person.ID;
                    CFP      cfp        = base.GetCFP(personId);
                    DateTime newCfpDate = obj.Date;
                    if (cfp.ID == 0 || cfp.Date > newCfpDate)
                    {
                        DateTime calculationLockDate = base.UIValidator.GetCalculationLockDate(personId);

                        //بسته بودن محاسبات
                        if (calculationLockDate > Utility.GTSMinStandardDateTime && calculationLockDate > newCfpDate)
                        {
                            newCfpDate = calculationLockDate.AddDays(1);
                        }

                        base.UpdateCFP(personId, newCfpDate);
                    }
                }
            }
        }
예제 #21
0
파일: BRole.cs 프로젝트: ImanRezaeipour/GTS
 /// <summary>
 /// *حذف نقشهایی که والد آنها حذف شده اند
 /// </summary>
 /// <param name="role"></param>
 /// <param name="action"></param>
 protected override void OnSaveChangesSuccess(Role role, UIActionType action)
 {
     if (action == UIActionType.DELETE)
     {
         DeleteHierarchicalRoles(role.ID);
     }
 }
예제 #22
0
        /// <summary>
        /// به روز رسانی تعداد زیرگره های یک پست سازمانی
        /// </summary>
        /// <param name="obj">پست سازمانی</param>
        /// <param name="action">نوع عملیات</param>
        private void UpdateParentOrganizationPostChildCount(OrganizationUnit obj, UIActionType action)
        {
            if (obj.ParentID != 0)
            {
                OrganizationUnit parentOrganizationUnit = NHSession.QueryOver <OrganizationUnit>()
                                                          .Where(x => x.ID == obj.ParentID)
                                                          .SingleOrDefault <OrganizationUnit>();
                if (parentOrganizationUnit != null)
                {
                    switch (action)
                    {
                    case UIActionType.ADD:
                        parentOrganizationUnit.ChildCount = parentOrganizationUnit.ChildCount + 1;
                        this.SaveChanges(parentOrganizationUnit, UIActionType.EDIT);
                        break;

                    case UIActionType.EDIT:
                        break;

                    case UIActionType.DELETE:
                        if (parentOrganizationUnit.ChildCount > 0)
                        {
                            parentOrganizationUnit.ChildCount = parentOrganizationUnit.ChildCount - 1;
                            this.SaveChanges(parentOrganizationUnit, UIActionType.EDIT);
                        }
                        break;
                    }
                }
            }
        }
예제 #23
0
 protected override void OnSaveChangesSuccess(Flow obj, UIActionType action)
 {
     if (action == UIActionType.DELETE)
     {
         new ManagerRepository(false).SetManagerActivation();
     }
 }
예제 #24
0
        public void OpenAnnounceType(UIActionType uiActionType)
        {
            switch (uiActionType)
            {
            case UIActionType.pickup:
                ac_actionTypeTxt.text = StaticStrings.ui_ac_pick;
                break;

            case UIActionType.interact:
                ac_actionTypeTxt.text = StaticStrings.ui_ac_interact;
                break;

            case UIActionType.open:
                ac_actionTypeTxt.text = StaticStrings.ui_ac_open;
                break;

            case UIActionType.talk:
                ac_actionTypeTxt.text = StaticStrings.ui_ac_talk;
                break;

            default:
                break;
            }

            interactCard.SetActive(true);
        }
예제 #25
0
        /// <summary>
        /// تنظیم تاریخها
        /// </summary>
        /// <param name="substitute"></param>
        /// <param name="action"></param>
        protected override void GetReadyBeforeSave(Substitute substitute, UIActionType action)
        {
            decimal mangerPersonId = substitute.ManagerPersonId;

            substitute.FromDate = Utility.GTSMinStandardDateTime;
            substitute.ToDate   = Utility.GTSMinStandardDateTime;
            if (!Utility.IsEmpty(substitute.TheFromDate) && !Utility.IsEmpty(substitute.TheToDate))
            {
                if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
                {
                    substitute.FromDate = Utility.ToMildiDate(substitute.TheFromDate);
                    substitute.ToDate   = Utility.ToMildiDate(substitute.TheToDate);
                }
                else
                {
                    substitute.FromDate = Utility.ToMildiDateTime(substitute.TheFromDate);
                    substitute.ToDate   = Utility.ToMildiDateTime(substitute.TheToDate);
                }
            }
            if (substitute.ManagerPersonId > 0)
            {
                BManager busManager = new BManager();
                Manager  manager    = busManager.GetManager(substitute.ManagerPersonId);
                substitute.Manager = manager;
            }
            //PrecardList Recover
            if (action == UIActionType.EDIT && !substitute.PrecardAccessIsSet)
            {
                Substitute sub = this.GetByID(substitute.ID);
                substitute.PrecardList = sub.PrecardList;
                NHibernateSessionManager.Instance.ClearSession();
            }
        }
 public BaseUIAction(System.Xml.XmlNode node, UIActionType uiActionType, App.Common.UITest.Runner.IWebDriver webDriver)
 {
     this.WebDriver = webDriver;
     this.Type = uiActionType;
     this.Element = node.Attributes["element"] != null ? node.Attributes["element"].Value : string.Empty;
     this.Status = TestResultType.None;
 }
예제 #27
0
        public string[] UpdatePersonnel_PersonnelPage(string state, string SelectedPersonnelID)
        {
            this.InitializeCulture();

            string[] retMessage = new string[4];

            try
            {
                decimal      PersonnelID         = 0;
                decimal      selectedPersonnelID = decimal.Parse(this.StringBuilder.CreateString(SelectedPersonnelID));
                UIActionType uam = (UIActionType)Enum.Parse(typeof(UIActionType), this.StringBuilder.CreateString(state).ToUpper());

                Person person = new Person();

                switch (uam)
                {
                case UIActionType.DELETE:
                    if (selectedPersonnelID == 0)
                    {
                        retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, new Exception(GetLocalResourceObject("NoPersonnelSelectedforDelete").ToString()), retMessage);
                        return(retMessage);
                    }
                    person.ID   = selectedPersonnelID;
                    PersonnelID = this.PersonBusiness.DeletePerson(person, uam);
                    break;
                }

                retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
                string SuccessMessageBody = string.Empty;
                switch (uam)
                {
                case UIActionType.DELETE:
                    SuccessMessageBody = GetLocalResourceObject("DeleteComplete").ToString();
                    break;

                default:
                    break;
                }
                retMessage[1] = SuccessMessageBody;
                retMessage[2] = "success";
                retMessage[3] = PersonnelID.ToString();
                return(retMessage);
            }
            catch (UIValidationExceptions ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
                return(retMessage);
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                return(retMessage);
            }
            catch (Exception ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
                return(retMessage);
            }
        }
예제 #28
0
    public string[] UpdatePrivateMessageSend_PrivateMessagePage(string state, string SelectedMessageID)
    {
        this.InitializeCulture();

        string[] retMessage = new string[4];

        try
        {
            AttackDefender.CSRFDefender(this.Page);
            string       strSelectedMessages   = this.StringBuilder.CreateString(SelectedMessageID);
            string[]     ArraySelectedMessages = strSelectedMessages.Split(',');
            UIActionType uam = (UIActionType)Enum.Parse(typeof(UIActionType), this.StringBuilder.CreateString(state).ToUpper());

            switch (uam)
            {
            case UIActionType.DELETE:
                if (strSelectedMessages.Length == 0)
                {
                    retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, new Exception(GetLocalResourceObject("NoMessageSelectedforDelete").ToString()), retMessage);
                    return(retMessage);
                }
                this.privateMessageBusiness.CheckDeletePrivateMessageAccess();
                decimal[] SelectedMessages = Array.ConvertAll <string, decimal>(ArraySelectedMessages, Convert.ToDecimal);
                privateMessageBusiness.DeleteFromSentBox(SelectedMessages.ToList());
                break;
            }

            retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
            string SuccessMessageBody = string.Empty;
            switch (uam)
            {
            case UIActionType.DELETE:
                SuccessMessageBody = GetLocalResourceObject("DeleteComplete").ToString();
                break;

            default:
                break;
            }
            retMessage[1] = SuccessMessageBody;
            retMessage[2] = "success";
            retMessage[3] = "";
            return(retMessage);
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            return(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            return(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            return(retMessage);
        }
    }
    public string[] UpdateDefineUiValidation_DefineUiValidationPage(string strListRow, string state)
    {
        this.InitializeCulture();
        string[] retMessage = new string[4];
        IList <UIValidationGroupingProxy> UIValidationGroupingProxyList = this.CreateUIValidationGroupingProxyList(this.StringBuilder.CreateString(strListRow));
        UIActionType uam = UIActionType.EDIT;

        try
        {
            AttackDefender.CSRFDefender(this.Page);
            switch (this.StringBuilder.CreateString(state))
            {
            case "Edit":
                uam = UIActionType.EDIT;
                if (strListRow == "")
                {
                    retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, new Exception(GetLocalResourceObject("nouivalidationselectedforedit").ToString()), retMessage);
                    return(retMessage);
                }
                break;

            default:
                break;
            }
            this.UiValidationBusiness.UpdateRuleList(UIValidationGroupingProxyList);


            retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
            string SuccessMessageBody = string.Empty;
            switch (uam)
            {
            case UIActionType.EDIT:
                SuccessMessageBody = GetLocalResourceObject("EditComplete").ToString();
                break;

            default:
                break;
            }
            retMessage[1] = SuccessMessageBody;
            retMessage[2] = "success";
            // retMessage[3] = uiValidationID.ToString();
            return(retMessage);
        }
        catch (UIValidationExceptions ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
            return(retMessage);
        }
        catch (UIBaseException ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
            return(retMessage);
        }
        catch (Exception ex)
        {
            retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
            return(retMessage);
        }
    }
예제 #30
0
        public string[] UpdateManagersWorkFlow_ManagersWorkFlowPage(string FlowState, string FlowID, string IsActiveFlow, string IsMainFlow, string strFlowPartsList)
        {
            string[] retMessage = new string[4];
            this.InitializeCulture();

            try
            {
                AttackDefender.CSRFDefender(this.Page);
                UIActionType FS           = (UIActionType)Enum.Parse(typeof(UIActionType), this.StringBuilder.CreateString(FlowState).ToUpper());
                decimal      flowID       = decimal.Parse(this.StringBuilder.CreateString(FlowID), CultureInfo.InvariantCulture);
                bool         isActiveFlow = bool.Parse(this.StringBuilder.CreateString(IsActiveFlow).ToLower());
                bool         isMainFlow   = bool.Parse(this.StringBuilder.CreateString(IsMainFlow).ToLower());
                strFlowPartsList = this.StringBuilder.CreateString(strFlowPartsList);
                IList <ManagerProxy> ManagerProxyList = new List <ManagerProxy>();

                JavaScriptSerializer jsSerializer = new JavaScriptSerializer();
                object[]             ParamsBatchs = (object[])jsSerializer.DeserializeObject(strFlowPartsList);
                foreach (object paramBatch in ParamsBatchs)
                {
                    ManagerProxy managerProxy = new ManagerProxy();
                    managerProxy.Level = int.Parse(((Dictionary <string, object>)paramBatch)["Level"].ToString(), CultureInfo.InvariantCulture);
                    ManagerType managerType = (ManagerType)Enum.ToObject(typeof(ManagerType), int.Parse(((Dictionary <string, object>)paramBatch)["Type"].ToString(), CultureInfo.InvariantCulture));
                    managerProxy.ManagerType = managerType;
                    managerProxy.OwnerID     = Int64.Parse(((Dictionary <string, object>)paramBatch)["TypeID"].ToString(), CultureInfo.InvariantCulture);
                    ManagerProxyList.Add(managerProxy);
                }

                switch (FS)
                {
                case UIActionType.ADD:
                    this.FlowBusiness.UpdateManagerFlows_onOrganizationFlowInsert(flowID, isActiveFlow, isMainFlow, ManagerProxyList);
                    break;

                case UIActionType.EDIT:
                    this.FlowBusiness.UpdateManagerFlows_onOrganizationFlowUpdate(flowID, isActiveFlow, isMainFlow, ManagerProxyList);
                    break;
                }

                retMessage[0] = GetLocalResourceObject("RetSuccessType").ToString();
                retMessage[1] = GetLocalResourceObject("OperationComplete").ToString();
                retMessage[2] = "success";
                return(retMessage);
            }
            catch (UIValidationExceptions ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
                return(retMessage);
            }
            catch (UIBaseException ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
                return(retMessage);
            }
            catch (Exception ex)
            {
                retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
                return(retMessage);
            }
        }