Exemplo n.º 1
0
        public IActionResponse <int> Insert(UserInRole model)
        {
            var currentDate = DateTime.Now.Date;
            var userInRole  = _userInRole.FirstOrDefault(x => x.RoleId == model.RoleId && x.UserId == model.UserId && x.ExpireDateMi >= currentDate);

            if (userInRole.IsNotNull())
            {
                return new ActionResponse <int>
                       {
                           Message = BusinessMessage.CanNotAddNewRoleDueToActiveRole
                       }
            }
            ;

            model.ExpireDateMi = PersianDateTime.Parse(model.ExpireDateSh).ToDateTime();
            _userInRole.Add(model);
            var result = _uow.SaveChanges();

            return(new ActionResponse <int>
            {
                IsSuccessful = result.ToSaveChangeResult(),
                Message = result.ToSaveChangeMessageResult(BusinessMessage.Success, BusinessMessage.Error),
                Result = model.UserInRoleId
            });
        }
        public JsonResult Edit(EditInvoiceViewModel viewModel)
        {
            var invoice = new Invoice
            {
                Id         = viewModel.Id,
                Number     = viewModel.Number,
                CustomerId = viewModel.CustomerId,
                CreatedOn  = PersianDateTime.Parse(viewModel.CreatedOnString).ToDateTime(),
                Version    = viewModel.Version
            };

            invoice.Items = new List <InvoiceItem>();
            foreach (var item in viewModel.Items)
            {
                var invoiceItem = new InvoiceItem
                {
                    Id        = item.Id,
                    ProductId = item.ProductId,
                    Price     = item.Price,
                    Quantity  = item.Quantity,
                    InvoiceId = item.InvoiceId
                };
                invoice.Items.Add(invoiceItem);
            }
            try
            {
                ServiceFactory.Create <IInvoiceService>().UpdateInvoice(invoice);
                return(Json(new { success = true }));
            }
            catch (DbUpdateConcurrencyException)
            {
                // ModelState.AddModelError("", "این فاکتور قبلا در سیستم توسط فرد دیگری ویرایش شده است.صفحه را رفرش کنید.");
                return(Json(new { success = false }));
            }
        }
Exemplo n.º 3
0
        public IActionResponse <int> Insert(Transaction model)
        {
            var result = new ActionResponse <int>();

            model.Authority    = "2";
            model.Status       = "2";
            model.InsertDateMi = PersianDateTime.Parse(model.InsertDateSh).ToDateTime();

            _transaction.Add(model);
            var saveChange = _uow.SaveChanges();

            if (saveChange.ToSaveChangeResult())
            {
                _orderBusiness.UpdateOrderDeliverFiles(model.OrderId);
                var pg = _paymentGatewayBusiness.Find(model.PaymentGatewayId);

                _observerManager.Value.Notify(ConcreteKey.Offline_Payment, new ObserverMessage
                {
                    SmsContent = string.Format(_smsTemplateBusiness.Value.GetText(MessagingType.Sms, ConcreteKey.Offline_Payment), model.OrderId, model.Price.ToString("N0") + BusinessMessage.MoneyCurrency),
                    BotContent = string.Format(_smsTemplateBusiness.Value.GetText(MessagingType.RoboTele, ConcreteKey.Offline_Payment), (HttpContext.Current.User as ICurrentUserPrincipal).FullName,
                                               model.OrderId, pg.PaymentGatewayType.GetLocalizeDescription(),
                                               model.Price.ToString("0,0"),
                                               model.TrackingId.ToString(),
                                               PersianDateTime.Now.ToString(PersianDateTimeFormat.FullDateFullTime)),
                    Key    = nameof(Transaction),
                    UserId = (HttpContext.Current.User as ICurrentUserPrincipal).UserId,
                });
            }
            result.Result       = model.TransactionId;
            result.IsSuccessful = saveChange.ToSaveChangeResult();
            result.Message      = saveChange.ToSaveChangeMessageResult(BusinessMessage.Success, BusinessMessage.Error);
            return(result);
        }
Exemplo n.º 4
0
        public ActionResult updateNotebook(UpdateDtoForNotebook updateDto)
        {
            var date        = updateDto.examDateForUpdate;
            var persianTime = PersianDateTime.Parse(date);
            var dateTime    = persianTime.ToDateTime();

            var          studentIds = updateDto.studentIdsForUpdate;
            List <float> grades     = new List <float> {
            };

            foreach (var item in updateDto.Grades)
            {
                grades.Add(float.Parse(item));
            }

            for (int i = 0; i < grades.Count(); i++)
            {
                var cid    = studentIds[i];
                var result = _context.Notebooks.SingleOrDefault(s => s.NoteBookDate == dateTime && s.StudentID == cid);
                if (result != null)
                {
                    result.Grade = grades[i];
                    _context.SaveChanges();
                }
            }

            return(Json(new { success = true, responseText = "دفترچه بروزرسانی شد" }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 5
0
        public static DateTime?GetDateTime(object value)
        {
            if (value == null)
            {
                return(null);
            }
            string s;

            if (value is string[])
            {
                s = ((string[])value)[0];
            }
            else
            {
                s = value.ToString();
            }
            if (string.IsNullOrEmpty(s) || s == "null")
            {
                return(null);
            }
            long l;

            if (long.TryParse(s, out l))
            {
                return(new DateTime(1970, 01, 01).AddMilliseconds(l).ToLocalTime());//Convert from javascript Date.getTime()
            }
            return((DateTime?)PersianDateTime.Parse(s));
        }
Exemplo n.º 6
0
        public JsonResult getStudyEvaluation()
        {
            // Initialization.
            var thisYear = new PersianDateTime(PersianDateTime.Now.Year, 01, 01);

            JsonResult result = new JsonResult();

            try
            {
                var data         = db.Borrows.Select(b => new { BorrowingDate = b.BorrowingDate }).ToList().AsEnumerable();
                var thisYearData = (from b in data
                                    select new
                {
                    BorrowingDate = (PersianDateTime.Parse(b.BorrowingDate))
                }
                                    ).Where(b => b.BorrowingDate >= thisYear).ToList();
                var groupByMonth = (from b in thisYearData group b by b.BorrowingDate.Month into mData
                                    select new { monthNo = mData.Key, monthRecords = mData.Count() }).ToList();

                return(Json(new { data = groupByMonth },
                            JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                Console.Write(ex);
            }
            return(result);
        }
Exemplo n.º 7
0
        public ActionResult AddLate(LateClassDto lateDto)
        {
            if (lateDto.studentID != null)
            {
                var persianDate = PersianDateTime.Parse(lateDto.lateDate);

                var late = new Late
                {
                    StudentID = Convert.ToInt32(lateDto.studentID),
                    LateDate  = persianDate.ToDateTime(),
                    LateTime  = Convert.ToInt32(lateDto.howMuch),
                    Problem   = lateDto.problem,
                    IsTrue    = lateDto.isTrue
                };

                try
                {
                    _context.Lates.Add(late);
                    _context.SaveChanges();
                    ModelState.Clear();
                    return(Content("اطلاعات وارد شد"));
                }
                catch (Exception exc)
                {
                    throw;
                }
            }
            else
            {
                return(Content("صحیح نمیباشد"));
            }
        }
Exemplo n.º 8
0
        public async Task <Dictionary <string, int> > GetLossCountLastDaysAsync(int dayCount = 10)
        {
            var fromDate = DateTime.Now.AddDays(-dayCount);
            var result   = new Dictionary <string, int>();

            var userCount = await _dbSet.AsNoTracking().Where(x => x.InsertDateMi >= fromDate)
                            .GroupBy(x => x.InsertDateSh)
                            .Select(g => new
            {
                Date  = g.Key,
                Count = g.Count()
            }).ToListAsync();

            for (int i = dayCount - 1; i >= 0; i--)
            {
                var date      = PersianDateTime.Parse(DateTime.Now.AddDays(-i)).ToString(PersianDateTimeFormat.Date);
                var statistic = userCount.FirstOrDefault(x => x.Date == date);
                if (statistic != null)
                {
                    result.Add(date, statistic.Count);
                }
                else
                {
                    result.Add(date, 0);
                }
            }

            return(result);
        }
Exemplo n.º 9
0
        public void PersianDateTimeTests()
        {
            //PersianDateTime is utility data type for GregorianDateTime to/from PersianDateTime conversions.

            var pNow = PersianDateTime.Now;

            var clrDate = DateTime.Now;
            //Convert an instance of CLR-DateTime to PersianDateTime
            PersianDateTime faDateTime = clrDate.ToPersianDateTime();

            //Convert an instance of PersianDateTime to CLR-DateTime
            clrDate = faDateTime.ToDateTime();

            Debug.WriteLine(faDateTime.Hour12);      // Hour based on 12Hours
            Debug.WriteLine(faDateTime.IsAfternoon); // ...

            //Convert persian date time string to PersianDateTime
            faDateTime = PersianDateTime.Parse("1395/10/1 5:1 ب.ظ");

            //writes name of week day
            Debug.WriteLine("MonthName: {0}\nDayName: {1}", faDateTime.MonthName, faDateTime.DayName);

            //well form date time display :-)
            Debug.WriteLine(PersianDateTime.Parse("1395/10/19").ToString("dddd d MMMM yyyy")); // یکشنبه 19 دی 1395

            Debugger.Break();
        }
Exemplo n.º 10
0
        public int Create(AuditViewModel audit)
        {
            var cmydr = new CarModelYearDetailRepository();
            var item  = new Audit()
            {
                CarManufactureID = audit.CarManufactureID,
                CarDetailID      = audit.CarDetailID,
                CarYearID        = audit.CarYearID,
                CarModelID       = audit.CarModelID,
                RequestDate      = PersianDateTime.Parse(audit.RequestDatePersian).ToDateTime(),
                FirstName        = audit.FirstName,
                LastName         = audit.LastName,
                Phone            = audit.Phone,
                Price            = cmydr.GetPrice(audit.CarModelID, audit.CarYearID, audit.CarDetailID),
                Email            = audit.Email,
                PaymentDate      = audit.PaymentDate,
                ReferID          = audit.ReferID,
                Authority        = audit.Authority,
                PaymentTypeID    = audit.PaymentTypeID,
                IsDone           = false,
                IsRead           = false
            };

            db.Audits.Add(item);
            db.SaveChanges();

            return(item.ID);
        }
Exemplo n.º 11
0
        public ActionResult updatePractice(UpdateDto updateDto)
        {
            var date        = updateDto.examDateForUpdate;
            var persianTime = PersianDateTime.Parse(date);
            var dateTime    = persianTime.ToDateTime();

            var        courseIds = updateDto.courseIdsForUpdate;
            List <int> grades    = new List <int> {
            };

            foreach (var item in updateDto.Grades)
            {
                if (item == "نمره")
                {
                    continue;
                }
                grades.Add(int.Parse(item));
            }

            for (int i = 0; i < grades.Count(); i++)
            {
                var cid    = courseIds[i];
                var result = _context.Practices.SingleOrDefault(s => s.PracticeDate == dateTime && s.CourseID == cid);
                if (result != null)
                {
                    result.PassedNumbers = grades[i];
                    _context.SaveChanges();
                }
            }

            return(Json(new { success = true, responseText = "تکلیف بروزرسانی شد" }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 12
0
        public ActionResult AddDefect(DefectClassDto defectDto)
        {
            if (defectDto.studentID != null)
            {
                var persianDate = PersianDateTime.Parse(defectDto.defectDate);

                var defect = new Defect
                {
                    StudentID   = int.Parse(defectDto.studentID),
                    Type        = (Enums.DefectType)Enum.Parse(typeof(Enums.DefectType), defectDto.defectType, true),
                    Description = defectDto.defectDescription,
                    DefaceDate  = persianDate.ToDateTime()
                };

                try
                {
                    _context.Defects.Add(defect);
                    _context.SaveChanges();
                    ModelState.Clear();
                    return(Content("اطلاعات وارد شد"));
                }
                catch (Exception exc)
                {
                    throw;
                }
            }
            else
            {
                return(Content("صحیح نمیباشد"));
            }
        }
        public virtual async Task <ActionResult> Manage(RelativeSearchFilter filter)
        {
            filter.UserId = User.GetUserId();
            //ViewBag.HasExtraButton = true;
            //ViewBag.ExtraButtonUrl = Url.Action("InsuranceInfo", "User");
            //ViewBag.ExtraButtonText = Strings.PreFactor;
            //ViewBag.ExtraButtonIcon = "zmdi-eye";

            var getUser = await _userSrv.FindAsync(User.GetUserId());

            var startDate = PersianDateTime.Parse(_configuration["CustomSettings:StartLockDate"]).ToDateTime();
            var endDate   = PersianDateTime.Parse(_configuration["CustomSettings:EndLockDate"]).ToDateTime();

            ViewBag.CanEdit          = !(getUser.Result.InsertDateMi >= startDate && getUser.Result.InsertDateMi <= endDate);
            ViewBag.WithoutAddButton = !ViewBag.CanEdit;

            if (!Request.IsAjaxRequest())
            {
                return(View(_MemberRelativeSrv.Get(filter)));
            }
            else
            {
                return(PartialView("Partials/_List", _MemberRelativeSrv.Get(filter)));
            }
        }
Exemplo n.º 14
0
        private static void Test4()
        {
            var persianDateTime = PersianDateTime.Parse("سه شنبه, ۲۵ اسفند ۹۴, 09:20:30");

            Console.WriteLine(persianDateTime.ToShortDateInt());
            Console.WriteLine(persianDateTime.ToTimeInt());
        }
Exemplo n.º 15
0
        public ActionResult AddAbsent(AbsentClassDto absentDto)
        {
            if (absentDto.StudentID != null)
            {
                var persianDateFrom = PersianDateTime.Parse(absentDto.FromDate);
                var persianDateTo   = PersianDateTime.Parse(absentDto.ToDate);

                var absent = new Absent
                {
                    StudentID     = int.Parse(absentDto.StudentID),
                    FromDate      = persianDateFrom.ToDateTime(),
                    ToDate        = persianDateTo.ToDateTime(),
                    IsCertificate = absentDto.IsCertificate,
                    Problem       = absentDto.Problem,
                    IsTrue        = absentDto.IsTrue,
                };

                try
                {
                    _context.Absents.Add(absent);
                    _context.SaveChanges();
                    ModelState.Clear();
                    return(Content("اطلاعات وارد شد"));
                }
                catch (Exception exc)
                {
                    throw;
                }
            }
            else
            {
                return(Content("صحیح نمیباشد"));
            }
        }
Exemplo n.º 16
0
        public static string ConvertPersianToUtc(string StrPersianDate)
        {
            var      ObjPersianDateTime = PersianDateTime.Parse(StrPersianDate);
            DateTime Dt    = new DateTime(ObjPersianDateTime.Year, ObjPersianDateTime.Month, ObjPersianDateTime.Day, ObjPersianDateTime.Hour, ObjPersianDateTime.Minute, ObjPersianDateTime.Second, new PersianCalendar());
            DateTime UtcDt = Dt.ToUniversalTime();

            return(UtcDt.ToString(CultureInfo.InvariantCulture));
        }
 public void Parse_PositiveTwoDigitYearLessThan100As1stParameter_ShouldReturn13xx()
 {
     for (int i = 0; i < 100; i++)
     {
         string date = "چهارشنبه 5 آذر" + " " + i.ToString("00");
         Assert.AreEqual(1300 + i, PersianDateTime.Parse(date).Year);
     }
 }
Exemplo n.º 18
0
        private static void Test8()
        {
            var longDateTime = PersianDateTime.Now.ToLongDateTimeInt();

            Console.WriteLine(longDateTime);
            var persianDateTime = PersianDateTime.Parse(longDateTime);

            Console.WriteLine(persianDateTime.ToString());
        }
Exemplo n.º 19
0
        public static DateTime ToGeorgianDateTimeFromJalali(this string dateTime, double hour, double min)
        {
            var persianDate = PersianDateTime.Parse(dateTime);
            var dt          = persianDate.ToDateTime();

            var addMinutes = dt.AddDays(hour).AddMinutes(min);

            return(addMinutes);
        }
Exemplo n.º 20
0
 public static DateTime ParseIranianDate(string modelFromDate)
 {
     try
     {
         return(PersianDateTime.Parse(modelFromDate).ToDateTime());
     }
     catch (Exception e)
     { SignalRMVCChat.Service.LogService.Log(e);
       throw new Exception("فرمت تاریخ اشتباه است و قاoldListل نیست"); }
 }
Exemplo n.º 21
0
        public string Export(LossSearchFilter filter)
        {
            Expression <Func <Loss, bool> > conditions = x => true;

            if (filter != null)
            {
                if (filter.UserId != null)
                {
                    conditions = conditions.And(x => x.UserId == filter.UserId);
                }
                if (!string.IsNullOrWhiteSpace(filter.LossDateShFrom))
                {
                    var from = PersianDateTime.Parse(filter.LossDateShFrom).ToDateTime();
                    conditions = conditions.And(x => x.InsertDateMi >= from);
                }
                if (!string.IsNullOrWhiteSpace(filter.LossDateShFrom))
                {
                    var to = PersianDateTime.Parse(filter.LossDateShFrom).ToDateTime();
                    conditions = conditions.And(x => x.InsertDateMi <= to);
                }
                if (filter.LossType.IsNotNull())
                {
                    conditions = conditions.And(x => x.LossType == filter.LossType);
                }
                if (!string.IsNullOrWhiteSpace(filter.NationalCode))
                {
                    conditions = conditions.And(x => x.User.NationalCode == filter.NationalCode);
                }
            }
            var result = _LossRepo.Get(conditions, x => x.OrderByDescending(u => u.LossId), new List <Expression <Func <Loss, object> > > {
                i => i.User, i => i.LossAssets
            });
            var      ids          = result.Where(x => x.RelativeId != null).Select(x => x.RelativeId).ToList();
            var      relatives    = _appUow.RelativeRepo.Get(x => ids.Contains(x.RelativeId), o => o.OrderByDescending(x => x.RelativeId));
            var      sb           = new StringBuilder(",User,Mobile Number,National Code,Patient Name,Cost Type,Cost,Date,Status,Description" + Environment.NewLine);
            int      idx          = 1;
            Relative relative     = null;
            string   relativeName = string.Empty;

            foreach (var loss in result)
            {
                if (loss.RelativeId != null)
                {
                    relative     = relatives.FirstOrDefault(x => x.RelativeId == loss.RelativeId);
                    relativeName = relative == null ? ServiceMessage.OriginalInsured : relative.Fullname;
                }
                else
                {
                    relativeName = ServiceMessage.OriginalInsured;
                }
                sb.Append($"{idx},{loss.User.Fullname},{loss.User.MobileNumber},{loss.User.NationalCode},{relativeName},{loss.LossType.GetDescription()},{loss.Cost.ToString("N0")},{loss.LossDateSh},{loss.Status.GetDescription()},{loss.Description}" + Environment.NewLine);
                idx++;
            }
            return(sb.ToString());
        }
Exemplo n.º 22
0
        public ActionResult showNotebook(ShowDtoForNotebook showDto)
        {
            var className   = showDto.calssname;
            var persianDate = PersianDateTime.Parse(showDto.date);
            var examDate    = persianDate.ToDateTime();

            var allStudentInClass = _context.Students.Where(s => s.Class == className).OrderBy(s => s.Id).ToList();

            //all notebook in selected date
            var allNotebook = _context.Notebooks.Where(s => s.NoteBookDate == examDate).ToList();

            List <Notebook> notebooks = new List <Notebook> {
            };

            foreach (var item in allStudentInClass)
            {
                var a = allNotebook.Where(s => s.StudentID == item.Id).SingleOrDefault();
                notebooks.Add(a);
            }
            //////////////////////
            ///
            Dictionary <int, string> students = new Dictionary <int, string> {
            };

            foreach (var item in allStudentInClass)
            {
                students.Add(item.Id, item.FirstName + " " + item.LastName);
            }

            var counter = 0;

            List <float> notebookForView = new List <float> {
            };

            foreach (var item in notebooks)
            {
                counter++;
                notebookForView.Add(item.Grade);
            }

            var result = new List <SendNotebookToViewDtos> {
            };

            result.Add(
                new SendNotebookToViewDtos
            {
                Students  = students,
                Notebooks = notebookForView
            }
                );

            var jsonObj = JsonConvert.SerializeObject(result);

            return(Json(new { success = true, responseText = jsonObj }, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 23
0
 public static string ToDateTimeStr(this string persiandatestr)
 {
     try
     {
         return(PersianDateTime.Parse(persiandatestr, "/").ToDateTime().ToString("yyyy-MM-dd HH:mm:ss"));
     }
     catch
     {
         return(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
     }
 }
Exemplo n.º 24
0
 public static DateTime ToDateTime(this string persiandatestr)
 {
     try
     {
         return(PersianDateTime.Parse(persiandatestr, "/").ToDateTime());
     }
     catch
     {
         return(DateTime.Now);
     }
 }
Exemplo n.º 25
0
        public static PersianDateTime Date()
        {
            var dbMunicipalArchiveEntities = new dbMunicipalArchiveEntities();
            var firstOrDefault             = dbMunicipalArchiveEntities.tblSecurityAccess.FirstOrDefault(); //khandan etela-at file

            if (firstOrDefault == null)
            {
                return(PersianDateTime.Now);
            }
            var saveDate = firstOrDefault.Time.Split(' ');

            return(PersianDateTime.Parse(saveDate[0], saveDate[1]).AddMinutes(+5));
        }
Exemplo n.º 26
0
 public static bool Isdate(string StrPersianDate)
 {
     try
     {
         var      ObjPersianDateTime = PersianDateTime.Parse(StrPersianDate);
         DateTime Dt = new DateTime(ObjPersianDateTime.Year, ObjPersianDateTime.Month, ObjPersianDateTime.Day, ObjPersianDateTime.Hour, ObjPersianDateTime.Minute, ObjPersianDateTime.Second, new PersianCalendar());
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
Exemplo n.º 27
0
        public IActionResponse <int> Insert(View model)
        {
            model.ExpireDateMi = PersianDateTime.Parse(model.ExpireDateSh).ToDateTime();
            _view.Add(model);
            var result = _uow.SaveChanges();

            return(new ActionResponse <int>
            {
                IsSuccessful = result.ToSaveChangeResult(),
                Message = result.ToSaveChangeMessageResult(BusinessMessage.Success, BusinessMessage.Error),
                Result = model.ViewId
            });
        }
Exemplo n.º 28
0
        private static void Test3()
        {
            var persianDateTime = PersianDateTime.Parse("چهارشنبه 5 آذر 58");

            Console.WriteLine(persianDateTime);

            persianDateTime = PersianDateTime.Parse("سه شنبه, ۲۵ اسفند ۹۴, ۰۹:20:30");

            Console.WriteLine(persianDateTime);

            persianDateTime = PersianDateTime.Parse("سه شنبه, ۲۵ اسفند ۹۴ ساعت ۰۹:۰۰");

            Console.WriteLine(persianDateTime);
        }
Exemplo n.º 29
0
        private void ReadText()
        {
            EnsureChildControls();
            if (ReadOnly)
            {
                return;
            }
            if (textBox.Text == PrevText && Mode == DatePickerMode.Date)
            {
                if (textBox.Text != "")
                {
                    ViewState["Date"] = PersianDateTime.Parse(textBox.Text);
                }
                return;
            }
            if (textBox.Text.Trim() == "")
            {
                ViewState["Date"] = null;
                OnValueChanged(EventArgs.Empty);
                return;
            }
            //if (textRead) //|| string.IsNullOrEmpty(textBox.Text.Trim()))
            //    return;
            PersianDateTime p;

            if (Mode != DatePickerMode.Time)
            {
                if (textBox == null || textBox.Text.Trim() == string.Empty)
                {
                    p = new PersianDateTime();
                }
                else
                {
                    p = PersianDateTime.Parse(textBox.Text);
                }
            }
            else
            {
                p = new PersianDateTime();
            }
            if (timePicker != null)
            {
                p.Hour   = timePicker.Date.Hour;
                p.Minute = timePicker.Date.Minute;
                p.Second = timePicker.Date.Second;
            }
            ViewState["Date"] = p;
            PrevText          = textBox.Text;
            OnValueChanged(EventArgs.Empty);
        }
        public async Task <RepResult <MonthVM> > GetMonthData(int personnelId, string shamsiMonthDate)
        {
            if (dbContext != null)
            {
                var monthVm = new MonthVM();
                monthVm.PersonnelId = personnelId;

                PersianDateTime perDt      = PersianDateTime.Parse((shamsiMonthDate + "-01").Replace("-", "/"));
                DateTime        firstDayDt = perDt.ToDateTime();

                PersianCalendar pc = new PersianCalendar();
                monthVm.Year      = pc.GetYear(firstDayDt).ToString();
                monthVm.MonthName = getMonthName(pc.GetMonth(firstDayDt));

                var lenDays = pc.GetDaysInMonth(perDt.Year, perDt.Month);
                monthVm.Days     = new List <DayVM>();
                monthVm.Duration = new DurationVM();
                for (int i = 1; i < lenDays; i++)
                {
                    var dayDate = new DateTime(firstDayDt.Year, firstDayDt.Month, firstDayDt.Day);

                    if (i > 1)
                    {
                        dayDate = dayDate.AddDays(i);
                    }

                    var dayVm = (await dayRep.GetDayData(personnelId, dayDate)).ResultObject;

                    monthVm.Days.Add(dayVm);

                    monthVm.Duration.DurationOfWorkSecends     += dayVm.Duration.DurationOfWorkSecends;
                    monthVm.Duration.DurationOfLeaveSecends    += dayVm.Duration.DurationOfLeaveSecends;
                    monthVm.Duration.DurationOfMisiionSecends  += dayVm.Duration.DurationOfMisiionSecends;
                    monthVm.Duration.DurationOfOverTimeSecends += dayVm.Duration.DurationOfOverTimeSecends;
                }

                monthVm.Duration.DurationOfWork     = Environment.Convert.TimeSpanToReadableString(TimeSpan.FromSeconds(monthVm.Duration.DurationOfWorkSecends));
                monthVm.Duration.DurationOfLeave    = Environment.Convert.TimeSpanToReadableString(TimeSpan.FromSeconds(monthVm.Duration.DurationOfLeaveSecends));
                monthVm.Duration.DurationOfMisiion  = Environment.Convert.TimeSpanToReadableString(TimeSpan.FromSeconds(monthVm.Duration.DurationOfMisiionSecends));
                monthVm.Duration.DurationOfOverTime = Environment.Convert.TimeSpanToReadableString(TimeSpan.FromSeconds(monthVm.Duration.DurationOfOverTimeSecends));


                return(new RepResult <MonthVM> {
                    Successed = true, ResultObject = monthVm
                });
            }

            return(new RepResult <MonthVM>());
        }