public void UpdateFlow_Test()
        {
            IList <UnderManagment> unders = new List <UnderManagment>();
            UnderManagment         under1 = new UnderManagment();

            under1.Department = new Department()
            {
                ID = ADODepartment1.ID
            };
            under1.Contains = true;
            UnderManagment under2 = new UnderManagment();

            under2.Department = new Department()
            {
                ID = ADODepartment2.ID
            };
            under2.Contains = true;
            under2.Person   = new Person()
            {
                ID = ADOPerson4.ID
            };
            unders.Add(under1);
            unders.Add(under2);

            busManager.UpdateFlow(ADOFlow1.ID, ADOAccessGroup2.ID, "FlowTest", unders);
            ClearSession();

            BFlow bflow      = new BFlow();
            Flow  testObject = bflow.GetByID(ADOFlow1.ID);

            Assert.AreEqual(ADOAccessGroup2.ID, testObject.AccessGroup.ID);
            Assert.IsNotNull(testObject.UnderManagmentList);
            Assert.AreEqual(2, testObject.UnderManagmentList.Count);
            Assert.IsTrue(testObject.UnderManagmentList.Where(x => x.Person != null && x.Person.ID == ADOPerson4.ID).Count() == 1);
        }
        public void UpdateFlow_AccessGroupTest()
        {
            try
            {
                IList <UnderManagment> unders = new List <UnderManagment>();
                UnderManagment         under1 = new UnderManagment();
                under1.Department = new Department()
                {
                    ID = ADODepartment1.ID
                };
                under1.Contains = true;
                UnderManagment under2 = new UnderManagment();
                under2.Department = new Department()
                {
                    ID = ADODepartment2.ID
                };
                under2.Contains = true;
                under2.Person   = new Person()
                {
                    ID = ADOPerson4.ID
                };
                unders.Add(under1);
                unders.Add(under2);

                busManager.UpdateFlow(ADOFlow1.ID, 0, "", unders);
                Assert.Fail("گروه دسترسی نباید خالی باشد");
            }
            catch (UIValidationExceptions ex)
            {
                Assert.IsTrue(ex.Exists(ExceptionResourceKeys.FlowAccessGroupRequierd));
            }
        }
 public void InsertFlowByOrgan_FlowNameRepeatedTest()
 {
     try
     {
         IList <UnderManagment> unders = new List <UnderManagment>();
         UnderManagment         under1 = new UnderManagment();
         under1.Department = new Department()
         {
             ID = ADODepartment1.ID
         };
         under1.Contains = true;
         UnderManagment under2 = new UnderManagment();
         under2.Department = new Department()
         {
             ID = ADODepartment2.ID
         };
         under2.Contains = true;
         under2.Person   = new Person()
         {
             ID = ADOPerson4.ID
         };
         unders.Add(under1);
         unders.Add(under2);
         decimal id = busManager.InsertFlowByOrganization(ADOOrgan3.ID, ADOAccessGroup2.ID, ADOFlow1.FlowName, unders);
         Assert.Fail("نام گردش کار نباید تکراری باشد");
     }
     catch (Exception ex)
     {
         Assert.IsTrue(((UIValidationExceptions)ex).Exists(ExceptionResourceKeys.FlowNameRepeated));
     }
 }
        public void InsertFlowByOrgan_ChangeManagerByOrganTest()
        {
            try
            {
                IList <UnderManagment> unders = new List <UnderManagment>();
                UnderManagment         under1 = new UnderManagment();
                under1.Department = new Department()
                {
                    ID = ADODepartment1.ID
                };
                under1.Contains = true;
                UnderManagment under2 = new UnderManagment();
                under2.Department = new Department()
                {
                    ID = ADODepartment2.ID
                };
                under2.Contains = true;
                under2.Person   = new Person()
                {
                    ID = ADOPerson4.ID
                };
                unders.Add(under1);
                unders.Add(under2);
                ADOFlow1.FlowName = ADOFlow1.FlowName + "1";
                decimal id = busManager.InsertFlowByPerson(ADOPerson3.ID, ADOAccessGroup2.ID, ADOFlow1.FlowName, unders);
                id = busManager.InsertFlowByOrganization(ADOOrgan3.ID, ADOAccessGroup2.ID, ADOFlow1.FlowName, unders);
            }
            catch (Exception ex)
            {
                ClearSession();
                Manager mng = busManager.GetManagerByUsername(ADOUser2.UserName);

                Assert.IsTrue(mng.OrganizationUnit.ID > 0);
            }
        }
 public void InsertFlowByOrgan_AccessGroupRequierdTest()
 {
     try
     {
         IList <UnderManagment> unders = new List <UnderManagment>();
         UnderManagment         under1 = new UnderManagment();
         under1.Department = new Department()
         {
             ID = ADODepartment1.ID
         };
         under1.Contains = true;
         UnderManagment under2 = new UnderManagment();
         under2.Department = new Department()
         {
             ID = ADODepartment2.ID
         };
         under2.Contains = true;
         under2.Person   = new Person()
         {
             ID = ADOPerson4.ID
         };
         unders.Add(under1);
         unders.Add(under2);
         decimal id = busManager.InsertFlowByOrganization(ADOOrgan3.ID, 0, "TestInsertedFlow", unders);
         Assert.Fail("گروه دسترسی نباید خالی باشد");
     }
     catch (Exception ex)
     {
         Assert.IsTrue(((UIValidationExceptions)ex).Exists(ExceptionResourceKeys.FlowAccessGroupRequierd));
     }
 }
 public void InsertFlowByOrgan_Test()
 {
     try
     {
         IList <UnderManagment> unders = new List <UnderManagment>();
         UnderManagment         under1 = new UnderManagment();
         under1.Department = new Department()
         {
             ID = ADODepartment1.ID
         };
         under1.Contains = true;
         UnderManagment under2 = new UnderManagment();
         under2.Department = new Department()
         {
             ID = ADODepartment2.ID
         };
         under2.Contains = true;
         under2.Person   = new Person()
         {
             ID = ADOPerson4.ID
         };
         unders.Add(under1);
         unders.Add(under2);
         decimal id = busManager.InsertFlowByOrganization(ADOOrgan3.ID, ADOAccessGroup2.ID, "TestInsertedFlow", unders);
     }
     catch (Exception ex)
     {
         Assert.Fail(ex.Message);
     }
 }
Exemple #7
0
        private IList <UnderManagment> CreateUnderManagementList_UnderManagementPersonnel(string strUnderManagementList)
        {
            List <UnderManagment> UnderManagementList = new List <UnderManagment>();

            if (strUnderManagementList != string.Empty)
            {
                strUnderManagementList = strUnderManagementList.Replace("Key=", string.Empty).Replace("Type=", string.Empty).Replace("Access=", string.Empty).Replace("SubDep=", string.Empty);
                string[] UnderManagementListParts = strUnderManagementList.Split(new char[] { '#' });
                foreach (string UnderManagementListPartItem in UnderManagementListParts)
                {
                    if (UnderManagementListPartItem != string.Empty)
                    {
                        decimal             departmentID = 0;
                        decimal             personnelID  = 0;
                        UnderManagmentTypes UMT          = UnderManagmentTypes.Department;
                        bool hasAccess = false;
                        bool hasSubDep = false;

                        string[] UnderManagementListPartSections = UnderManagementListPartItem.Split(new char[] { '%' });
                        departmentID = decimal.Parse(UnderManagementListPartSections[0].Substring(3, UnderManagementListPartSections[0].IndexOf("prs") - 3), CultureInfo.InvariantCulture);
                        personnelID  = decimal.Parse(UnderManagementListPartSections[0].Substring(UnderManagementListPartSections[0].IndexOf("prs") + 3, UnderManagementListPartSections[0].Length - UnderManagementListPartSections[0].IndexOf("prs") - 3), CultureInfo.InvariantCulture);
                        UMT          = (UnderManagmentTypes)Enum.Parse(typeof(UnderManagmentTypes), UnderManagementListPartSections[1]);
                        hasAccess    = bool.Parse(UnderManagementListPartSections[2]);
                        hasSubDep    = bool.Parse(UnderManagementListPartSections[3]);

                        UnderManagment underManagment = new UnderManagment();
                        Department     department     = new Department();
                        department.ID             = departmentID;
                        underManagment.Department = department;
                        switch (UMT)
                        {
                        case UnderManagmentTypes.Department:
                            break;

                        case UnderManagmentTypes.Person:
                            Person personnel = new Person();
                            personnel.ID          = personnelID;
                            underManagment.Person = personnel;
                            break;

                        default:
                            break;
                        }
                        underManagment.Contains           = hasAccess;
                        underManagment.ContainInnerChilds = hasSubDep;

                        UnderManagementList.Add(underManagment);
                    }
                }
            }
            return(UnderManagementList);
        }
Exemple #8
0
 private void Fill_GridUnderManagementPersonnel_UnderManagementPersonnel(decimal flowID)
 {
     string[] retMessage = new string[4];
     try
     {
         IList <UnderManagment> UnderManagementsList = this.ManagerBusiness.GetAllUnderManagments(flowID);
         UnderManagment         rootUndermanegment   = UnderManagementsList.Where(x => x.Department.Parent == null).FirstOrDefault();
         if (rootUndermanegment != null)
         {
             string rootDepartmentNodeText = string.Empty;
             if (GetLocalResourceObject("OrgNode_trvPosts_Post") != null)
             {
                 rootDepartmentNodeText = GetLocalResourceObject("OrgNode_trvPosts_Post").ToString();
             }
             else
             {
                 rootDepartmentNodeText = rootUndermanegment.Department.Name;
             }
             rootUndermanegment.Department.Name = rootDepartmentNodeText;
         }
         this.CreateUnderManagementList_UnderManagementPersonnel(UnderManagementsList);
         this.GridUnderManagementPersonnel_UnderManagementPersonnel.DataSource = UnderManagementsList;
         this.GridUnderManagementPersonnel_UnderManagementPersonnel.DataBind();
     }
     catch (UIValidationExceptions ex)
     {
         retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIValidationExceptions, ex, retMessage);
         this.ErrorHiddenField_UnderManagementPersonnel_UnderManagementPersonnel.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
     }
     catch (UIBaseException ex)
     {
         retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.UIBaseException, ex, retMessage);
         this.ErrorHiddenField_UnderManagementPersonnel_UnderManagementPersonnel.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
     }
     catch (Exception ex)
     {
         retMessage = this.exceptionHandler.HandleException(this.Page, ExceptionTypes.Exception, ex, retMessage);
         this.ErrorHiddenField_UnderManagementPersonnel_UnderManagementPersonnel.Value = this.exceptionHandler.CreateErrorMessage(retMessage);
     }
 }
        /// <summary>
        /// تغییر مشخصات سازمانی
        /// </summary>
        /// <param name="personList">لیست پرسنل</param>
        /// <param name="infoProxy">پروکسی مشخصات سازمانی</param>
        /// <param name="errorList">خروجی لیست خطاها</param>
        /// <returns>وضعیت انجام عملیات</returns>
        private bool ChangeInfo(IList <Person> personList, OrganicInfoProxy infoProxy, out IList <ChangeInfoErrorProxy> errorList)
        {
            IList <PersonRuleCatAssignment>  ruleAssgnList      = new List <PersonRuleCatAssignment>();
            IList <PersonRangeAssignment>    rangeAssgnList     = new List <PersonRangeAssignment>();
            IList <AssignWorkGroup>          workGroupAssgnList = new List <AssignWorkGroup>();
            IList <PersonContractAssignment> contractAssgnList  = new List <PersonContractAssignment>();


            #region Validate
            DateTime workGroupFromDate, ruleGroupFromDate, ruleGroupToDate, DateRangeFromDate, contractFromDate, contractToDate;
            if (BLanguage.CurrentSystemLanguage == LanguagesName.Parsi)
            {
                workGroupFromDate = Utility.ToMildiDate(infoProxy.WorkGroupFromDate);
                ruleGroupFromDate = Utility.ToMildiDate(infoProxy.RuleGroupFromDate);
                ruleGroupToDate   = Utility.ToMildiDate(infoProxy.RuleGroupToDate);
                DateRangeFromDate = Utility.ToMildiDate(infoProxy.DateRangeFromDate);
                contractFromDate  = Utility.ToMildiDate(infoProxy.ContractFromDate);
                contractToDate    = Utility.ToMildiDate(infoProxy.ContractToDate);
            }
            else
            {
                workGroupFromDate = Utility.ToMildiDateTime(infoProxy.WorkGroupFromDate);
                ruleGroupFromDate = Utility.ToMildiDateTime(infoProxy.RuleGroupFromDate);
                ruleGroupToDate   = Utility.ToMildiDateTime(infoProxy.RuleGroupToDate);
                DateRangeFromDate = Utility.ToMildiDateTime(infoProxy.DateRangeFromDate);
                contractFromDate  = Utility.ToMildiDateTime(infoProxy.ContractFromDate);
                contractToDate    = Utility.ToMildiDateTime(infoProxy.ContractToDate);
            }


            errorList = new List <ChangeInfoErrorProxy>();
            foreach (Person prs in personList)
            {
                string errorMessage = "";
                if (infoProxy.WorkGroupID > 0)
                {
                    workGroupAssgnList = new BAssignWorkGroup(BLanguage.CurrentSystemLanguage).GetAllByWorkGroupId(infoProxy.WorkGroupID);
                    ValidateWorkGroupAssignment(prs, workGroupFromDate, ref errorMessage);
                }
                if (infoProxy.RuleGroupID > 0)
                {
                    ruleAssgnList = new BAssignRule(BLanguage.CurrentSystemLanguage).GetAllByRuleGroupId(infoProxy.RuleGroupID);
                    ValidateRuleGroupAssignment(prs, ruleGroupFromDate, ruleGroupToDate, ref errorMessage);
                }
                if (infoProxy.DateRangeID > 0)
                {
                    rangeAssgnList = new BAssignDateRange(BLanguage.CurrentSystemLanguage).GetAllByRangeId(infoProxy.DateRangeID);
                    ValidateDateRangeAssignment(prs, DateRangeFromDate, ref errorMessage);
                }
                if (infoProxy.ContractID > 0)
                {
                    contractAssgnList = new BPersonContractAssignment(BLanguage.CurrentSystemLanguage).GetAllByContractId(infoProxy.ContractID);
                    ValidateContractAssignment(prs, contractFromDate, contractToDate, ref errorMessage);
                }
                if (!Utility.IsEmpty(errorMessage))
                {
                    errorList.Add(new ChangeInfoErrorProxy()
                    {
                        ErrorMessage = errorMessage, PersonCode = prs.PersonCode, PersonName = prs.Name
                    });
                    if (errorList.Count > 50)
                    {
                        break;
                    }
                }
            }
            if (errorList.Count > 0)
            {
                return(false);
            }
            #endregion

            using (NHibernateSessionManager.Instance.BeginTransactionOn())
            {
                try
                {
                    UnderManagmentRepository         underMngRep                = new UnderManagmentRepository(false);
                    List <decimal>                   personIdList               = new List <decimal>();
                    IList <OrganizationFeatureProxy> organizationFeatureList    = new List <OrganizationFeatureProxy>();
                    IList <FlowPersonsProxy>         flowPersonList             = new List <FlowPersonsProxy>();
                    List <decimal>                   PersonnelsDepartmentChange = new List <decimal>();
                    bool     cfpUpdateRequierd = false;
                    DateTime minDate           = DateTime.Now;
                    int      counter           = 0;
                    foreach (Person prs in personList)
                    {
                        counter++;
                        bool updatePrs = false;
                        personIdList.Add(prs.ID);
                        IList <OrganizationFeatureProxy> organizationFeatureExist = new List <OrganizationFeatureProxy>();
                        UnderManagment underMng = new UnderManagment();

                        #region Department
                        if (infoProxy.DepartmentID > 0)
                        {
                            if (prs.Department.ID != infoProxy.DepartmentID)
                            {
                                PersonnelsDepartmentChange.Add(prs.ID);
                            }
                            if (organizationFeatureList.Count != 0)
                            {
                                organizationFeatureExist = organizationFeatureList.Where(x => x.DepartmentId == prs.Department.ID).ToList();
                            }

                            if (organizationFeatureExist.Count == 0)
                            {
                                IList <decimal> FlowIds = underMngRep.GetDepartmentFlows(prs.Department.ID);
                                foreach (decimal flowId in FlowIds)
                                {
                                    OrganizationFeatureProxy orgFeatureProxy = new OrganizationFeatureProxy();
                                    FlowPersonsProxy         flowPerson      = new FlowPersonsProxy();
                                    orgFeatureProxy.FlowId       = flowId;
                                    orgFeatureProxy.DepartmentId = prs.Department.ID;
                                    organizationFeatureList.Add(orgFeatureProxy);
                                    flowPerson.FlowId   = flowId;
                                    flowPerson.PersonId = prs.ID;
                                    flowPersonList.Add(flowPerson);
                                }
                            }
                            else
                            {
                                IList <decimal> FlowIds = organizationFeatureExist.Select(x => x.FlowId)
                                                          .ToList <decimal>();
                                foreach (decimal flowId in FlowIds)
                                {
                                    FlowPersonsProxy flowPerson = new FlowPersonsProxy();
                                    flowPerson.FlowId   = flowId;
                                    flowPerson.PersonId = prs.ID;
                                    flowPersonList.Add(flowPerson);
                                }
                            }
                            prs.Department = new GTS.Clock.Model.Charts.Department()
                            {
                                ID = infoProxy.DepartmentID
                            };
                            updatePrs = true;
                        }
                        #endregion

                        #region Employment Type
                        if (infoProxy.EmploymentTypeID > 0)
                        {
                            prs.EmploymentType = new GTS.Clock.Model.BaseInformation.EmploymentType()
                            {
                                ID = infoProxy.EmploymentTypeID
                            };
                            updatePrs = true;
                        }
                        #endregion

                        if (updatePrs)
                        {
                            prsRepository.WithoutTransactUpdate(prs);
                        }

                        #region Rule Category
                        if (infoProxy.RuleGroupID > 0)
                        {
                            cfpUpdateRequierd = true;
                            PersonRuleCatAssignment ruleAssign  = new PersonRuleCatAssignment();
                            BAssignRule             ruleAsgnBus = new BAssignRule();
                            ruleAssgnList = ruleAsgnBus.GetAll(prs.ID);
                            IList <PersonRuleCatAssignment> confilictList =
                                ruleAssgnList.Where(x => ((Utility.ToMildiDateTime(x.FromDate) <= ruleGroupToDate && Utility.ToMildiDateTime(x.ToDate) >= ruleGroupToDate))
                                                    ||
                                                    ((Utility.ToMildiDateTime(x.FromDate) <= ruleGroupFromDate && Utility.ToMildiDateTime(x.ToDate) >= ruleGroupFromDate))
                                                    ||
                                                    ((Utility.ToMildiDateTime(x.FromDate) >= ruleGroupFromDate && Utility.ToMildiDateTime(x.FromDate) <= ruleGroupToDate))
                                                    ).ToList();
                            if (confilictList != null && confilictList.Count > 0)
                            {
                                Range range = new Range()
                                {
                                    From = ruleGroupFromDate, To = ruleGroupToDate, AditionalField = 0
                                };
                                var confilictRanges = from o in confilictList
                                                      select new Range()
                                {
                                    From = Utility.ToMildiDateTime(o.FromDate), To = Utility.ToMildiDateTime(o.ToDate), AditionalField = o.RuleCategory.ID
                                };
                                IList <Range> breakedList = Utility.Differance(confilictRanges.ToList(), range);

                                #region Delete
                                //foreach (PersonRuleCatAssignment asgn in ruleAssgnList)
                                //{
                                //    ruleAsgnBus.SaveChanges(asgn, UIActionType.DELETE);
                                //}
                                foreach (PersonRuleCatAssignment asgn in confilictList)
                                {
                                    ruleAsgnBus.SaveChanges(asgn, UIActionType.DELETE);
                                }
                                #endregion

                                #region add first
                                ruleAssign.FromDate     = Utility.ToString(ruleGroupFromDate);
                                ruleAssign.ToDate       = Utility.ToString(ruleGroupToDate);
                                ruleAssign.Person       = prs;
                                ruleAssign.RuleCategory = new RuleCategory()
                                {
                                    ID = infoProxy.RuleGroupID
                                };
                                busRule.InsertWithoutTransaction(ruleAssign);
                                #endregion

                                #region add breaked List
                                foreach (Range r in breakedList)
                                {
                                    if (r.From == range.To)
                                    {
                                        r.From = r.From.AddDays(1);
                                    }
                                    if (r.To == range.From)
                                    {
                                        r.To = r.To.AddDays(-1);
                                    }
                                    ruleAssign              = new PersonRuleCatAssignment();
                                    ruleAssign.FromDate     = Utility.ToString(r.From);
                                    ruleAssign.ToDate       = Utility.ToString(r.To);
                                    ruleAssign.Person       = prs;
                                    ruleAssign.RuleCategory = new RuleCategory()
                                    {
                                        ID = r.AditionalField
                                    };
                                    busRule.InsertWithoutTransaction(ruleAssign);
                                }
                                #endregion
                            }
                            else
                            {
                                ruleAssign.FromDate     = Utility.ToString(ruleGroupFromDate);
                                ruleAssign.ToDate       = Utility.ToString(ruleGroupToDate);
                                ruleAssign.Person       = prs;
                                ruleAssign.RuleCategory = new RuleCategory()
                                {
                                    ID = infoProxy.RuleGroupID
                                };
                                busRule.InsertWithoutTransaction(ruleAssign);
                            }
                            if (minDate > ruleGroupFromDate)
                            {
                                minDate = ruleGroupFromDate;
                            }
                        }
                        #endregion
                        #region Contract
                        if (infoProxy.ContractID > 0)
                        {
                            cfpUpdateRequierd = true;
                            PersonContractAssignment contractAssign = new PersonContractAssignment();
                            contractAssign.Person   = prs;
                            contractAssign.Contract = new Contract()
                            {
                                ID = infoProxy.ContractID
                            };
                            contractAssign.FromDate = contractFromDate;
                            contractAssign.ToDate   = contractToDate;
                            BPersonContractAssignment contractAsgnBus = new BPersonContractAssignment();
                            contractAssgnList = contractAsgnBus.GetAll(prs.ID);
                            PersonContractAssignment PersonContractAssignmentAlias = null;
                            Person PersonAlias = null;
                            IList <PersonContractAssignment> personContractAssignmentList = NHSession.QueryOver <PersonContractAssignment>(() => PersonContractAssignmentAlias)
                                                                                            .JoinAlias(() => PersonContractAssignmentAlias.Person, () => PersonAlias)
                                                                                            .Where(() => !PersonContractAssignmentAlias.IsDeleted &&
                                                                                                   PersonAlias.ID == prs.ID
                                                                                                   )
                                                                                            .List <PersonContractAssignment>();
                            if (personContractAssignmentList != null && personContractAssignmentList.Count > 0)
                            {
                                personContractAssignmentList.ToList()
                                .ForEach(x =>
                                {
                                    if (x.ToDate == Utility.GTSMinStandardDateTime)
                                    {
                                        x.ToDate = DateTime.MaxValue.Date;
                                    }
                                }
                                         );
                            }

                            if (contractAssign.ToDate == Utility.GTSMinStandardDateTime)
                            {
                                contractAssign.ToDate = DateTime.MaxValue.Date;
                            }
                            if (contractAsgnBus.CheckPersonContractAssignmentConfilct(personContractAssignmentList.ToList(), contractAssign))
                            {
                                errorList.Add(new ChangeInfoErrorProxy()
                                {
                                    ErrorMessage = "تاریخ انتساب قرارداد با تاریخ های قبلی همپوشانی دارد", PersonCode = prs.PersonCode, PersonName = prs.Name
                                });
                            }
                            else
                            {
                                if (prs != null && prs.ID != 0 && contractAssign.FromDate < prs.EmploymentDate)
                                {
                                    errorList.Add(new ChangeInfoErrorProxy()
                                    {
                                        ErrorMessage = "تاریخ انتساب ابتدای قرارداد نباید از تاریخ استخدام کوچکتر باشد", PersonCode = prs.PersonCode, PersonName = prs.Name
                                    });
                                }
                                else
                                {
                                    if (contractAssign.ToDate == DateTime.MaxValue.Date)
                                    {
                                        contractAssign.ToDate = Utility.GTSMinStandardDateTime;
                                    }
                                    busAssignContract.InsertWithoutTransaction(contractAssign);
                                    if (minDate > contractFromDate)
                                    {
                                        minDate = contractFromDate;
                                    }
                                }
                            }
                        }
                        #endregion

                        #region Date Range
                        if (infoProxy.DateRangeID > 0)
                        {
                            cfpUpdateRequierd = true;
                            PersonRangeAssignment prsRangeAssignment = new PersonRangeAssignment();
                            rangeAssgnList     = new BAssignDateRange(BLanguage.CurrentSystemLanguage).GetAll(prs.ID);
                            prsRangeAssignment = rangeAssgnList.Where(x => x.FromDate == DateRangeFromDate).FirstOrDefault();
                            if (prsRangeAssignment != null)
                            {
                                prsRangeAssignment.FromDate           = DateRangeFromDate;
                                prsRangeAssignment.CalcDateRangeGroup = new CalculationRangeGroup()
                                {
                                    ID = infoProxy.DateRangeID
                                };
                            }
                            else
                            {
                                prsRangeAssignment                    = new PersonRangeAssignment();
                                prsRangeAssignment.Person             = prs;
                                prsRangeAssignment.FromDate           = DateRangeFromDate;
                                prsRangeAssignment.CalcDateRangeGroup = new CalculationRangeGroup()
                                {
                                    ID = infoProxy.DateRangeID
                                };
                            }
                            bussDateRange.InsertWithoutTransaction(prsRangeAssignment);

                            if (minDate > DateRangeFromDate)
                            {
                                minDate = DateRangeFromDate;
                            }
                        }
                        #endregion

                        #region Work Group
                        if (infoProxy.WorkGroupID > 0)
                        {
                            cfpUpdateRequierd = true;
                            AssignWorkGroup prsWorkGroupAssignment = new AssignWorkGroup();
                            workGroupAssgnList     = new BAssignWorkGroup(BLanguage.CurrentSystemLanguage).GetAll(prs.ID);
                            prsWorkGroupAssignment = workGroupAssgnList.Where(x => x.FromDate == workGroupFromDate).FirstOrDefault();

                            if (prsWorkGroupAssignment != null)
                            {
                                prsWorkGroupAssignment.Person    = prs;
                                prsWorkGroupAssignment.FromDate  = workGroupFromDate;
                                prsWorkGroupAssignment.WorkGroup = new WorkGroup()
                                {
                                    ID = infoProxy.WorkGroupID
                                };
                            }
                            else
                            {
                                prsWorkGroupAssignment           = new AssignWorkGroup();
                                prsWorkGroupAssignment.Person    = prs;
                                prsWorkGroupAssignment.FromDate  = workGroupFromDate;
                                prsWorkGroupAssignment.WorkGroup = new WorkGroup()
                                {
                                    ID = infoProxy.WorkGroupID
                                };
                            }
                            busWorkGroup.InsertWithoutTransaction(prsWorkGroupAssignment);
                            if (minDate > workGroupFromDate)
                            {
                                minDate = workGroupFromDate;
                            }
                        }
                        #endregion
                    }
                    if (infoProxy.DepartmentID > 0)
                    {
                        IList <decimal> FlowIDs = organizationFeatureList.Select(x => x.FlowId).Distinct().ToList <decimal>();
                        if (FlowIDs.Count != 0)
                        {
                            IList <UnderManagment> UnderManagmentList = underMngRep.GetAllPersonelparticularFlows(FlowIDs);
                            foreach (decimal flowid in FlowIDs)
                            {
                                IList <decimal> PersonIds = flowPersonList.Where(x => x.FlowId == flowid &&
                                                                                 !UnderManagmentList.Where(y => y.Flow.ID == flowid).Select(y => y.Person.ID).ToList <decimal>().Contains(x.PersonId)
                                                                                 ).Select(x => x.PersonId).ToList <decimal>();
                                if (PersonIds.Count != 0)
                                {
                                    underMngRep.DeleteUnderManagmentPersonsWithOrganicInfo(flowid, PersonIds);
                                }
                            }
                        }
                        IList <decimal> NewDepertmentFlowsList = underMngRep.GetDepartmentFlows(personList[0].Department.ID);
                        if (NewDepertmentFlowsList.Count != 0)
                        {
                            underMngRep.InsertUnderManagmentPersons(personIdList, NewDepertmentFlowsList);
                        }

                        BRequestSubstitute rSubstitute = new BRequestSubstitute();
                        if (PersonnelsDepartmentChange.Count != 0)
                        {
                            rSubstitute.UpdateRequestSubstituteOfOrganicInfo(PersonnelsDepartmentChange);
                        }
                    }
                    if (cfpUpdateRequierd)
                    {
                        this.UpdateCFP(personList, minDate);
                    }

                    NHibernateSessionManager.Instance.CommitTransactionOn();
                }
                catch (Exception ex)
                {
                    BaseBusiness <Entity> .LogException(ex, "BChangeOrganicInfo", "ChangeInfo");

                    NHibernateSessionManager.Instance.RollbackTransactionOn();
                    throw ex;
                }
            }


            return(true);
        }