Esempio n. 1
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);
                    }
                }
            }
        }
Esempio n. 2
0
 IList <decimal> IDataAccess.GetAccessibleRuleGroups()
 {
     if (userRepository.HasAllRuleGroupAccess(this.CurrentUserId) > 0)
     {
         IList <RuleCategory> list = new EntityRepository <RuleCategory>().GetAll();
         var ids = from obj in list
                   select obj.ID;
         return(ids.ToList <decimal>());
     }
     else
     {
         //return userRepository.GetUserRuleGroupIdList(this.CurrentUserId);
         BRuleCategory  bRuleCat            = new BRuleCategory();
         List <decimal> ruleCatList         = new List <decimal>();
         List <decimal> childAndParentsList = new List <decimal>();
         ruleCatList.AddRange(userRepository.GetUserRuleGroupIdList(this.CurrentUserId));
         foreach (decimal ruleCatId in ruleCatList)//اضافه کردن بچه ها و والد ها
         {
             IList <RuleCategory> childs = new List <RuleCategory>();
             //childs = bRuleCat.GetReportChildsByParentPath(ruleCatId);
             childAndParentsList.Add(bRuleCat.GetByID(ruleCatId).Parent.ID);
             var ids = from child in childs
                       select child.ID;
             childAndParentsList.AddRange(ids.ToList <decimal>());
         }
         ruleCatList.AddRange(childAndParentsList);
         return(ruleCatList);
     }
 }
Esempio n. 3
0
        protected void Button43_Click(object sender, EventArgs e)
        {
            BRuleCategory bus = new BRuleCategory();
            RuleCategory  cat = new RuleCategory();

            cat.Name = "sadfdsfsd";
            cat.InsertedTemplateIDs = new decimal[] { 1 };
            bus.SaveChanges(cat, UIActionType.ADD);
        }
Esempio n. 4
0
        protected override void UpdateCFP(Budget obj, UIActionType action)
        {
            if (action == UIActionType.ADD)
            {
                IList <CFP> cfpList = new List <CFP>();
                Dictionary <decimal, DateTime> lockDates = new Dictionary <decimal, DateTime>();
                RuleCategory ruleCat       = new BRuleCategory().GetByID(obj.RuleCategory.ID);
                IList <CFP>  personCfpList = new CFPRepository().GetCFPListByRuleCategory(ruleCat.ID);
                foreach (PersonRuleCatAssignment assign in ruleCat.PersonRuleCatAssignList)
                {
                    DateTime calculationLockDate = DateTime.Now;
                    decimal  personId            = assign.Person.ID;
                    if (assign.Person.PersonTASpec.UIValidationGroup != null)
                    {
                        decimal uiValidateionGrpId = assign.Person.PersonTASpec.UIValidationGroup.ID;
                        if (!lockDates.ContainsKey(uiValidateionGrpId))
                        {
                            calculationLockDate = base.UIValidator.GetCalculationLockDateByGroup(assign.Person.PersonTASpec.UIValidationGroup.ID);
                            lockDates.Add(uiValidateionGrpId, calculationLockDate);
                        }
                        else
                        {
                            calculationLockDate = lockDates[uiValidateionGrpId];
                        }
                    }
                    //CFP cfp = base.GetCFP(personId);
                    CFP      cfp        = personCfpList.Where(x => x.PrsId == personId).FirstOrDefault();
                    DateTime newCfpDate = Utility.ToMildiDateTime(assign.FromDate);


                    //بسته بودن محاسبات
                    if (calculationLockDate > Utility.GTSMinStandardDateTime && calculationLockDate > newCfpDate)
                    {
                        newCfpDate = calculationLockDate.AddDays(1);
                    }
                    if (cfp == null || cfp.ID == 0 || cfp.Date > newCfpDate)
                    {
                        cfp.Date  = newCfpDate.Date;
                        cfp.PrsId = personId;
                        cfpList.Add(cfp);
                    }
                }
                base.UpdateCFP(cfpList, false);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// لیستی از گروههای قوانین را برمیگرداند
 /// </summary>
 /// <returns>لیست گروه قوانین</returns>
 public IList <RuleCategory> GetAllRuleCategories()
 {
     try
     {
         BRuleCategory        busRule = new BRuleCategory();
         IList <RuleCategory> list    = busRule.GetAll();
         if (list != null && list.Count > 0)
         {
             list = list.Where(x => !x.IsRoot).OrderBy(x => x.Name).ToList();
         }
         return(list);
     }
     catch (Exception ex)
     {
         LogException(ex, "BAssignRule", "GetAllRuleCategories");
         throw ex;
     }
 }
Esempio n. 6
0
        public void TestSetup()
        {
            businessCategory   = new BRuleCategory();
            ruleCat_testObject = new RuleCategory();

            Convert.ToInt32(personTA.InsertQuery("0000", "Ali", true, null));
            int personId = Convert.ToInt32(personTA.GetDataByBarcode("0000").Rows[0]["prs_ID"]);


            ruleCatTA.Insert("دسته قانون000", "0000", false, "00-00test1");
            table           = ruleCatTA.GetDataByName("دسته قانون000");
            AdoRuleCat.ID   = (Decimal)table[0]["RuleCat_ID"];
            AdoRuleCat.Name = (String)table[0]["RuleCat_Name"];

            prsRleCatAsgTA.Insert(personId, AdoRuleCat.ID, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortDateString(), DateTime.Now);

            ruleCAtPartTA.Insert(businessCategory.GetRoot().ID, AdoRuleCat.ID, true);

            ClearSession();
        }
Esempio n. 7
0
        /// <summary>
        ///  بروزرسانی نشانه تغییرات برای پرسنلی که به گروه قانون این سهمیه مرخصی منتسب می باشند
        /// </summary>
        /// <param name="obj">سهمیه مرخصی</param>
        /// <param name="action">نوع عملیات</param>
        protected override void UpdateCFP(Budget obj, UIActionType action)
        {
            if (action == UIActionType.ADD)
            {
                //IList<CFP> cfpList = new List<CFP>();
                //Dictionary<decimal, DateTime> lockDates = new Dictionary<decimal, DateTime>();
                //RuleCategory ruleCat = new BRuleCategory().GetByID(obj.RuleCategory.ID);
                //IList<CFP> personCfpList = new CFPRepository().GetCFPListByRuleCategory(ruleCat.ID);
                RuleCategory ruleCat = new BRuleCategory().GetByID(obj.RuleCategory.ID);
                Dictionary <decimal, DateTime>  uivalidationGroupIdDic  = new Dictionary <decimal, DateTime>();
                IList <PersonRuleCatAssignment> assignPersonRulCateList = ruleCat.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(ruleCat.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(ruleCat.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, ruleCat.ID, uivalidationGroupIdDic);
                }



                //foreach (PersonRuleCatAssignment assign in ruleCat.PersonRuleCatAssignList)
                //{
                //    DateTime calculationLockDate = DateTime.Now;
                //    decimal personId = assign.Person.ID;
                //    if (assign.Person.PersonTASpec.UIValidationGroup != null)
                //    {
                //        decimal uiValidateionGrpId = assign.Person.PersonTASpec.UIValidationGroup.ID;
                //        if (!lockDates.ContainsKey(uiValidateionGrpId))
                //        {
                //            calculationLockDate = base.UIValidator.GetCalculationLockDateByGroup(assign.Person.PersonTASpec.UIValidationGroup.ID);
                //            lockDates.Add(uiValidateionGrpId, calculationLockDate);
                //        }
                //        else
                //        {
                //            calculationLockDate = lockDates[uiValidateionGrpId];
                //        }
                //    }
                //    //CFP cfp = base.GetCFP(personId);
                //    CFP cfp = personCfpList.Where(x => x.PrsId == personId).FirstOrDefault();
                //    DateTime newCfpDate = Utility.ToMildiDateTime(assign.FromDate);


                //    //بسته بودن محاسبات
                //    if (calculationLockDate > Utility.GTSMinStandardDateTime && calculationLockDate > newCfpDate)
                //    {
                //        newCfpDate = calculationLockDate.AddDays(1);
                //    }
                //    if (cfp == null || cfp.ID == 0 || cfp.Date > newCfpDate)
                //    {
                //        cfp.Date = newCfpDate.Date;
                //        cfp.PrsId = personId;
                //        cfpList.Add(cfp);
                //    }
                //}
                //base.UpdateCFP(cfpList, false);
            }
        }
Esempio n. 8
0
        private Person GetReadyForUpdate(decimal personid, SysLanguageResource sys, LocalLanguageResource local)
        {
            try
            {
                busPerson = new BPerson(sys, local);
                if (personid == 0)
                {
                    person_testObject.ID = busPerson.CreateWorkingPerson2();
                    ClearSession();
                }
                else
                {
                    person_testObject.ID = personid;
                }
                person_testObject.PersonDetail = new PersonDetail();

                #region Assigns

                BAssignWorkGroup bAssginWorkGroup = new BAssignWorkGroup(SysLanguageResource.Parsi);
                BWorkgroup       workgroup        = new BWorkgroup();
                decimal          wID = workgroup.SaveChanges(new WorkGroup()
                {
                    Name = "WorkGroupTest3", CustomCode = "0-3"
                }, UIActionType.ADD);
                AssignWorkGroup aw = new AssignWorkGroup();
                aw.UIFromDate = Utility.ToPersianDate(DateTime.Now);
                aw.WorkGroup  = new WorkGroup()
                {
                    ID = wID, Name = "WorkGroupTest3"
                };
                aw.Person = new Person()
                {
                    ID = person_testObject.ID
                };
                bAssginWorkGroup.SaveChanges(aw, UIActionType.ADD);

                BAssignRule   bAssginRule = new BAssignRule(SysLanguageResource.Parsi);
                BRuleCategory bruleCat    = new BRuleCategory();
                bruleCat.EnableInsertValidate = false;
                decimal rID = bruleCat.SaveChanges(new RuleCategory()
                {
                    Name = "RuleCatTest3", CustomCode = "00-00test2"
                }, UIActionType.ADD);
                PersonRuleCatAssignment pa = new PersonRuleCatAssignment();
                pa.UIFromDate   = Utility.ToPersianDate(new DateTime(2016, 1, 1));
                pa.UIToDate     = Utility.ToPersianDate(new DateTime(2017, 1, 1));
                pa.RuleCategory = new RuleCategory()
                {
                    ID = rID, Name = "RuleCatTest3"
                };
                pa.Person = new Person()
                {
                    ID = person_testObject.ID
                };
                bAssginRule.SaveChanges(pa, UIActionType.ADD);

                BAssignDateRange      bDateRange  = new BAssignDateRange(SysLanguageResource.Parsi);
                PersonRangeAssignment rangeAssign = new PersonRangeAssignment();
                BDateRange            bdate       = new BDateRange();

                decimal rangeId = bdate.SaveChanges(new CalculationRangeGroup()
                {
                    Name = "CalcGroup3"
                }, UIActionType.ADD);

                ClearSession();

                rangeAssign.CalcDateRangeGroup = new CalculationRangeGroup()
                {
                    ID = rangeId
                };
                if (sys == SysLanguageResource.Parsi)
                {
                    rangeAssign.UIFromDate = "1390/01/01";
                }
                else
                {
                    rangeAssign.UIFromDate = "1390/01/01"; //Utility.ToString(Utility.ToMildiDate("1390/01/01"));
                }
                rangeAssign.Person = new Person()
                {
                    ID = person_testObject.ID
                };
                bDateRange.SaveChanges(rangeAssign, UIActionType.ADD);
                //جهت درج
                //person_testObject.PersonRangeAssignList = new List<PersonRangeAssignment>();
                //person_testObject.PersonRangeAssignList.Add(rangeAssign);

                #endregion

                #region Dep
                DatabaseGatewayTableAdapters.TA_DepartmentTableAdapter departmentTA = new GTSTestUnit.Clock.Business.DatabaseGatewayTableAdapters.TA_DepartmentTableAdapter();
                decimal departmentId = Convert.ToDecimal(departmentTA.InsertQuery("Level1", "123", 1, ",1,", ""));

                DatabaseGatewayTableAdapters.TA_OrganizationUnitTableAdapter organTA = new GTSTestUnit.Clock.Business.DatabaseGatewayTableAdapters.TA_OrganizationUnitTableAdapter();
                organTA.InsertQuery("OrganTestLevel1", "0-0Test", null, 1, String.Format(",{0},", 1));
                decimal organId = Convert.ToDecimal(organTA.GetDataByCustomCode("0-0Test")[0]["organ_ID"]);

                DatabaseGatewayTableAdapters.TA_ControlStationTableAdapter sataionTA = new GTSTestUnit.Clock.Business.DatabaseGatewayTableAdapters.TA_ControlStationTableAdapter();
                sataionTA.Insert("StationTest1", "0-0Test");
                decimal stationId = Convert.ToDecimal(sataionTA.GetDataByCustomCode("0-0Test")[0]["station_ID"]);

                DatabaseGatewayTableAdapters.TA_EmploymentTypeTableAdapter emplTA = new GTSTestUnit.Clock.Business.DatabaseGatewayTableAdapters.TA_EmploymentTypeTableAdapter();
                emplTA.Insert("EmploymentTypeTest1", "0-0Test");
                decimal employeeId = Convert.ToDecimal(emplTA.GetDataByCustomCode("0-0Test")[0]["emply_ID"]);
                #endregion

                #region UIValidatinGroup
                DatabaseGatewayTableAdapters.TA_UIValidationGroupTableAdapter validationGroupTA = new GTSTestUnit.Clock.Business.DatabaseGatewayTableAdapters.TA_UIValidationGroupTableAdapter();
                UIValidationGroup ADOUIValidationGroupEmpty = new UIValidationGroup();
                validationGroupTA.InsertQuery("TestGroup00");
                DatabaseGateway.TA_UIValidationGroupDataTable groupTable = validationGroupTA.GetDataByName("TestGroup00");
                ADOUIValidationGroupEmpty.ID        = (groupTable.Rows[0] as DatabaseGateway.TA_UIValidationGroupRow).UIValGrp_ID;
                person_testObject.UIValidationGroup = ADOUIValidationGroupEmpty;
                #endregion

                person_testObject.FirstName = "Iraj";
                person_testObject.LastName  = "Bahadori";
                person_testObject.PersonDetail.FatherName       = "Gholzoom";
                person_testObject.PersonDetail.FatherName       = "0082111098";
                person_testObject.PersonDetail.BirthCertificate = "22777";
                person_testObject.PersonDetail.BirthPlace       = "Sorhe";
                person_testObject.Education            = "لیسانس";
                person_testObject.PersonDetail.Status  = "رو هوا";
                person_testObject.PersonDetail.Tel     = "23444343";
                person_testObject.PersonDetail.Address = "";
                person_testObject.PersonCode           = "00001222";
                person_testObject.CardNum       = "4345554";
                person_testObject.EmploymentNum = "123A342-ad";
                person_testObject.Sex           = PersonSex.Male;
                person_testObject.MaritalStatus = MaritalStatus.Motaleghe;
                person_testObject.PersonDetail.MilitaryStatus = MilitaryStatus.HeineKhedmat;
                person_testObject.Department = new global::GTS.Clock.Model.Charts.Department()
                {
                    ID = departmentId
                };
                person_testObject.OrganizationUnit = new global::GTS.Clock.Model.Charts.OrganizationUnit()
                {
                    ID = organId, PersonID = person_testObject.ID, Name = "OrganTestLevel1", CustomCode = "0-0", ParentID = 1
                };
                person_testObject.ControlStation = new global::GTS.Clock.Model.BaseInformation.ControlStation()
                {
                    ID = stationId
                };
                person_testObject.EmploymentType = new global::GTS.Clock.Model.BaseInformation.EmploymentType()
                {
                    ID = employeeId
                };
                if (sys == SysLanguageResource.Parsi)
                {
                    person_testObject.UIEmploymentDate         = "1380/05/03";
                    person_testObject.UIEndEmploymentDate      = "1390/05/03";
                    person_testObject.PersonDetail.UIBirthDate = "1390/05/03";
                }
                else
                {
                    person_testObject.UIEmploymentDate         = Utility.ToString(Utility.ToMildiDate("1380/05/03"));
                    person_testObject.UIEndEmploymentDate      = Utility.ToString(Utility.ToMildiDate("1390/05/03"));
                    person_testObject.PersonDetail.UIBirthDate = Utility.ToString(Utility.ToMildiDate("1390/05/03"));
                }

                ClearSession();

                return(person_testObject);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }