コード例 #1
0
        public List <string> SendWorkHours(WorkHourJson workHourJson)//JObject jsonObject
        {
            UnitOfWork       uow         = new UnitOfWork();
            UserManager      userManager = new UserManager(uow);
            TimeSheetManager WHM         = new TimeSheetManager(uow);
            User             currUser    = new UserHelper().GetCurrent();
            Validations      validate    = new Validations();
            var           WorkHours      = WHM.GetBydateAndUserId(workHourJson.Date, currUser.ID);
            List <string> result         = new List <string>();

            foreach (var wh in WorkHours.ToList())
            {
                if (wh.WorkflowStage.IsFirst)
                {
                    result = validate.ValidateRegisterWorkHour(wh);
                    if (result.Count() > 0)
                    {
                        return(result);
                    }

                    WHM.SendWorkHour(wh);
                    HistoryUtilities.RegisterSendHistory(wh);
                    result.Add("عملیات ارسال کارکرد ها با موفقیت انجام گردید");
                }
            }

            return(result);
        }
コード例 #2
0
        public List <string> SendWorkHour(WorkHourJson workHourJson)//JObject jsonObject
        {
            UnitOfWork       uow         = new UnitOfWork();
            UserManager      userManager = new UserManager(uow);
            TimeSheetManager WHM         = new TimeSheetManager(uow);
            User             currUser    = new UserHelper().GetCurrent();
            Validations      validate    = new Validations();
            var           WorkHour       = WHM.GetByID(workHourJson.ID);
            List <string> result         = new List <string>();

            result = validate.ValidateRegisterWorkHour(WorkHour);

            if (result.Count() == 0)
            {
                if (WorkHour.WorkflowStage.IsFirst)
                {
                    WHM.SendWorkHour(WorkHour);
                    HistoryUtilities.RegisterSendHistory(WorkHour);
                    result.Add("ارسال کارکرد با موفقیت انجام گردید");
                }
            }

            return(result);
        }