Beispiel #1
0
        private void btnApply_Click(object sender, EventArgs e)
        {
            int flag = 0;

            switch (((PairDataItem)cmbOprType.SelectedItem).Value)
            {
            case "مرخصی":
                flag = 1;
                break;

            case "امورخدمتی":
                flag = 2;
                break;

            case "اعزام‌به‌بهداری":
                flag = 3;
                break;

            case "نهست":
                flag = 4;
                break;
            }

            var biz = new BizProvider();

            foreach (PairDataItem ag in lstMarkedAgnts.Items)
            {
                foreach (var date in lstMarkedDates.Items)
                {
                    switch (flag)
                    {
                    case 1:
                        biz.WriteTheAgentsIteration <OffDay>(ag.Id, DateTime.Parse(date.ToString()));
                        break;

                    case 2:
                        biz.WriteTheAgentsIteration <OnDuty>(ag.Id, DateTime.Parse(date.ToString()));
                        break;

                    case 3:
                        biz.WriteTheAgentsIteration <UndTreat>(ag.Id, DateTime.Parse(date.ToString()));
                        break;

                    case 4:
                        biz.WriteTheAgentsIteration <Absence>(ag.Id, DateTime.Parse(date.ToString()));
                        break;

                    default:
                        break;
                    }
                }
            }

            /*NOTE شاید بهتر باشد یک فرم ثالث برمبنای نوع عملیات انتخاب شده،
             * باز شده و نام شهر مرخصی، نوع آسیب‌دیدگی بهداری و... در آن درج شود*/

            //if (chkGenRpt.Checked)
            //UNDONE چاپ گزارش به تعداد و کیفیت موردنیاز
        }
Beispiel #2
0
        public void Athlete_CannotReceiveOffDay()
        {
            using (ShimsContext.Create())
            {
                var agnt = new Agent("قاسم مهدیانی", 1, "غلام", "1234567890", new DateTime(1397, 1, 1),
                                     "(912)1234567", "(21)12345678", 1, -1);
                agnt.Enbl = false;
                data.access.Fakes.ShimRepository <Agent> .AllInstances.RetExpressionOfFuncOfT0Boolean =
                    delegate { return(null); };

                var biz = new BizProvider("lab");
                biz.WriteTheAgentsIteration <OffDay>(agnt.Id, DateTime.Now.Date);
            }
        }
        public void AgentWhoRegisteredAsOff_CouldNotBeKnownAsAbsent()
        {
            using (ShimsContext.Create())
            {
                var agnt = new Agent("علی کاردان", 1, "امیر", "1234567890", new DateTime(1397, 1, 1),
                                     "(912)1234567", "(21)12345678", 1, -1);
                data.access.Fakes.ShimRepository <Agent> .AllInstances.RetExpressionOfFuncOfT0Boolean =
                    delegate { return(agnt); };
                data.access.Fakes.ShimRepository <OffDay> .AllInstances.RetExpressionOfFuncOfT0Boolean =
                    delegate { return(new OffDay(DateTime.Now.Date, agnt.Id, CrntUser.SesId)); };

                var biz = new BizProvider("lab");
                biz.WriteTheAgentsIteration <Absence>(agnt.Id, DateTime.Now.Date);
            }
        }
Beispiel #4
0
        public void AgentWhoAlreadyAbsent_CannotReceiveOffDay()
        {
            using (ShimsContext.Create())
            {
                var agnt = new Agent("سینا پرنیان", 1, "غلام", "1234567890", new DateTime(1397, 1, 1),
                                     "(912)1234567", "(21)12345678", 1, -1);
                data.access.Fakes.ShimRepository <Agent> .AllInstances.RetExpressionOfFuncOfT0Boolean =
                    delegate { return(agnt); };
                data.access.Fakes.ShimRepository <Absence> .AllInstances.RetExpressionOfFuncOfT0Boolean =
                    delegate { return(new Absence(DateTime.Now.Date, agnt.Id, CrntUser.SesId)); };

                var biz = new BizProvider("lab");
                biz.WriteTheAgentsIteration <Absence>(agnt.Id, DateTime.Now.Date);
            }
        }
        public void Agent_CanReceiveAbsence()
        {
            using (ShimsContext.Create())
            {
                var agnt = new Agent("مبین فانی", 1, "امیر", "1234567890", new DateTime(1397, 1, 1),
                                     "(912)1234567", "(21)12345678", 1, -1);
                data.access.Fakes.ShimRepository <Agent> .AllInstances.RetExpressionOfFuncOfT0Boolean =
                    delegate { return(agnt); };
                data.access.Fakes.ShimRepository <OffDay> .AllInstances.RetExpressionOfFuncOfT0Boolean =
                    delegate { return(null); };
                data.access.Fakes.ShimRepository <OnDuty> .AllInstances.RetExpressionOfFuncOfT0Boolean =
                    delegate { return(null); };
                data.access.Fakes.ShimRepository <Absence> .AllInstances.RetExpressionOfFuncOfT0Boolean =
                    delegate { return(null); };
                data.access.Fakes.ShimRepository <Absence> .AllInstances.AddT0 =
                    delegate { return(true); };

                var biz = new BizProvider("lab");
                biz.WriteTheAgentsIteration <Absence>(agnt.Id, DateTime.Now.Date);
            }
        }