コード例 #1
0
        public void TestSetup()
        {
            busSubstitute         = new BSubstitute();
            substitute_testObject = new Substitute();

            #region Substitute
            substituteTA.Insert(ADOManager1.ID, ADOPerson4.ID, DateTime.Now, DateTime.Now.AddDays(1), true);
            DatasetGatewayWorkFlow.TA_SubstituteDataTable subTable = substituteTA.GetByManager(ADOManager1.ID, ADOPerson4.ID);
            ADOSubstitute1.ID          = (subTable.Rows[0] as DatasetGatewayWorkFlow.TA_SubstituteRow).sub_ID;
            ADOSubstitute1.TheFromDate = Utility.ToPersianDate(DateTime.Now);
            ADOSubstitute1.TheToDate   = Utility.ToPersianDate(DateTime.Now.AddDays(1));

            substitutePrecardTA.Insert(ADOPrecardHourlyDuty1.ID, ADOSubstitute1.ID);
            substitutePrecardTA.Insert(ADOPrecardHourlyLeave1.ID, ADOSubstitute1.ID);
            substitutePrecardTA.Insert(ADOPrecardHourlyLeave2.ID, ADOSubstitute1.ID);
            substitutePrecardTA.Insert(ADOPrecardDailyLeave1.ID, ADOSubstitute1.ID);
            substitutePrecardTA.Insert(ADOPrecardDailyDuty1.ID, ADOSubstitute1.ID);
            #endregion

            #region Operator
            operatorTA.Insert(ADOPerson1.ID, true, ADOFlow1.ID, "");
            operatorTA.Insert(ADOPerson2.ID, true, ADOFlow2.ID, "");//مدیر و اپراتور

            DatasetGatewayWorkFlow.TA_OperatorDataTable opTable = operatorTA.GetByPesonId(ADOPerson1.ID);
            ADOOperator1.ID = (opTable.Rows[0] as DatasetGatewayWorkFlow.TA_OperatorRow).opr_ID;

            opTable         = operatorTA.GetByPesonId(ADOPerson2.ID);
            ADOOperator2.ID = (opTable.Rows[0] as DatasetGatewayWorkFlow.TA_OperatorRow).opr_ID;


            //operatorManagerTA.Insert(ADOManager1.ID, ADOOperator1.ID);
            //operatorManagerTA.Insert(ADOManager1.ID, ADOOperator2.ID);
            #endregion
        }
コード例 #2
0
        public void GetAllManager_UserAsOperatorAndManagerCount_Test()
        {
            base.UpdateCurrentUserPersonId(ADOPerson2.ID);
            dataAccessMngTA.Insert(BUser.CurrentUser.ID, ADOManager2.ID, false);
            busSubstitute = new BSubstitute(ADOPerson2.ID);
            int count = busSubstitute.GetAllManagerCount();

            Assert.AreEqual(1, count);
        }
コード例 #3
0
        public void GetAllManager_UserAsOperatorAndManager_Test()
        {
            base.UpdateCurrentUserPersonId(ADOPerson2.ID);
            dataAccessMngTA.Insert(BUser.CurrentUser.ID, ADOManager1.ID, false);

            busSubstitute = new BSubstitute(ADOPerson2.ID);
            IList <Person> list = busSubstitute.GetAllManager(0, 10);

            Assert.AreEqual(1, list.Count);
            Assert.IsTrue(list.Where(x => x.ID == ADOPerson2.ID).Count() == 1);
        }
コード例 #4
0
ファイル: MainPage.aspx.cs プロジェクト: ImanRezaeipour/GTS
        protected void Button50_Click(object sender, EventArgs e)
        {
            BSubstitute bus = new BSubstitute();
            Substitute  sub = new Substitute();

            sub.Person = new Person()
            {
                ID = 1436
            };
            sub.ManagerPersonId = 556;
            sub.TheFromDate     = "1392/03/01";
            sub.TheToDate       = "1392/05/01";
            sub.Active          = true;
            bus.SaveChanges(sub, UIActionType.ADD);
        }
コード例 #5
0
        public void GetAllManager_UserAsOperator_ExtraPage_Test()
        {
            try
            {
                base.UpdateCurrentUserPersonId(ADOPerson1.ID);
                dataAccessMngTA.Insert(BUser.CurrentUser.ID, ADOManager1.ID, false);
                dataAccessMngTA.Insert(BUser.CurrentUser.ID, ADOManager2.ID, false);

                busSubstitute = new BSubstitute(ADOPerson1.ID);
                IList <Person> list = busSubstitute.GetAllManager(2, 10);
                Assert.Fail();
            }
            catch (OutOfExpectedRangeException ex)
            {
                Assert.Pass();
            }
        }
コード例 #6
0
        private IList <RoleCustomCodeType> GetCurrentUserBusinessRole()
        {
            try
            {
                IList <RoleCustomCodeType> roles = new List <RoleCustomCodeType>();

                if (!SessionHelper.HasSessionValue(SessionHelper.GTSCurrentUserManagmentState))
                {
                    bool isManager = new BManager().GetManager(personId).ID > 0 ? true : false;

                    bool isSubstitute = new BSubstitute().GetSubstituteManager(personId) > 0 ? true : false;

                    bool isOperator = new BOperator().IsOperator();

                    Dictionary <string, object> ManagementState = new Dictionary <string, object>();


                    if (isManager)
                    {
                        Role role = new BRole().GetRoleByCode(RoleCustomCodeType.Manager);
                        if (role != null)
                        {
                            ManagementState.Add("ManagerRoleId", role.ID);
                        }
                    }
                    if (isOperator)
                    {
                        Role role = new BRole().GetRoleByCode(RoleCustomCodeType.Operator);
                        if (role != null)
                        {
                            ManagementState.Add("OperatorRoleId", role.ID);
                        }
                    }
                    if (isSubstitute)
                    {
                        Role role = new BRole().GetRoleByCode(RoleCustomCodeType.Substitute);
                        if (role != null)
                        {
                            ManagementState.Add("SubstituteRoleId", role.ID);
                        }
                    }

                    ManagementState.Add("IsManager", isManager);
                    ManagementState.Add("IsOperator", isOperator);
                    ManagementState.Add("IsSubstitute", isSubstitute);

                    SessionHelper.SaveSessionValue(SessionHelper.GTSCurrentUserManagmentState, ManagementState);
                }

                Dictionary <string, object> managementState = (Dictionary <string, object>)SessionHelper.GetSessionValue(SessionHelper.GTSCurrentUserManagmentState);

                if (Utility.ToBoolean(managementState["IsManager"]))
                {
                    roles.Add(RoleCustomCodeType.Manager);
                }

                if (Utility.ToBoolean(managementState["IsOperator"]))
                {
                    roles.Add(RoleCustomCodeType.Operator);
                }

                if (Utility.ToBoolean(managementState["IsSubstitute"]))
                {
                    roles.Add(RoleCustomCodeType.Substitute);
                }

                return(roles);
            }
            catch (Exception ex)
            {
                BaseBusiness <GTS.Clock.Model.Entity> .LogException(ex);

                throw ex;
            }
        }
コード例 #7
0
 public void Test222222()
 {
     busSubstitute = new BSubstitute(32688);
     IList <Person> list = busSubstitute.GetAllManager(0, 10);
 }