Beispiel #1
0
 public virtual ActionResult DeleteFile(long id)
 {
     try
     {
         using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
         {
             var mypatfile = new AddressUrlFile(Path.Combine("~\\"));
             var attach    = _attachmentService.Find(id);
             if (attach == null)
             {
                 return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
             }
             string fullPath = Request.MapPath(mypatfile.UploadFiles + attach.File + attach.Extention);
             if (System.IO.File.Exists(fullPath))
             {
                 System.IO.File.Delete(fullPath);
             }
             _attachmentService.Delete(id);
             scope.Complete();
             return(Json(new { isError = false, Message = "حذف انجام شد" }));
         }
     }
     catch (Exception exception)
     {
         Elmah.ErrorSignal.FromCurrentContext().Raise(exception);
         return(Json(new { isError = true, Message = "خطا در حذف پیوست" }));
     }
 }
        public virtual ActionResult GetReportCommission()
        {
            var lanFile = new AddressUrlFile(Server.MapPath("~/"));

            if (System.IO.File.Exists(lanFile.Localizationfa))
            {
                StiConfig.LoadLocalization(lanFile.Localizationfa);
            }
            var idrequest = (long)TempData["RequestId"];
            var query     = _reportsService.PrintCommission(idrequest, new AddressUrlFile(Server.MapPath("~/")));

            if (query == null)
            {
                return(View(MVC.Errors.Views.Error));
            }

            //StiReport report = new StiReportCompiledClass();
            var mainreport = new StiReport();

            mainreport.RegBusinessObject("RequestData", query.PRequestDataModel);
            mainreport.RegBusinessObject("Signers", query.PSignersModel);
            mainreport.RegBusinessObject("MemberDetails", query.PMemberDetailsModel.OrderBy(f => f.RowNumber).Take(6).ToList());
            //query.PSpecialEducationModel.Add(new PSpecialEducationModel { Id = 3, Name = "زایمان", State = true });
            mainreport.RegBusinessObject("SpecialEducation", query.PSpecialEducationModel.ToList());
            mainreport.RegBusinessObject("StudentInformation", query.PStudentInformationModel);

            mainreport.Load(Server.MapPath("~/Reports/ReportCommission.mrt"));

            mainreport.Render(true);
            mainreport.Compile();
            mainreport["NumberPrint"] = "1";
            mainreport["LogoPrint"]   = _reportsService.GetLogoUrl(new AddressUrlFile(Server.MapPath("~/")));
            mainreport["DatePrint"]   = DateTime.Now;
            return(StiMvcViewerFx.GetReportSnapshotResult(mainreport));
        }
Beispiel #3
0
        public virtual ActionResult UploadAttachment(AttachmentModel attachmentModel, HttpPostedFileBase fileAttach)
        {
            try
            {
                if (fileAttach == null)
                {
                    return(Json(new { isError = true, Message = @"ورودی نامعتبر!" }));
                }
                attachmentModel.Extention = Path.GetExtension(fileAttach.FileName);
                attachmentModel.Size      = fileAttach.ContentLength;
                if (!ModelState.IsValid)
                {
                    return(Json(new { isError = true, Message = @"ورودی نامعتبر!" }));
                }
                using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
                {
                    var addressUrlFile = new AddressUrlFile(Server.MapPath("~//"));
                    var path           = addressUrlFile.UploadFiles;
                    Useful.CreateFolderIfNeeded(addressUrlFile.UploadFiles);
                    path += Guid.NewGuid() + Path.GetExtension(fileAttach.FileName);
                    fileAttach.SaveAs(path);
                    attachmentModel.File = Path.GetFileName(path);

                    var data = _attachmentService.Add(attachmentModel);
                    scope.Complete();
                    return(Json(new { isError = !data.Item1, Message = data.Item2 }));
                }
            }
            catch (Exception)
            {
                return(Json(new { isError = true, Message = @"خطا در ویرایش اطلاعات پرسنلی" }));
            }
        }
 public virtual ActionResult DeleteAvatar(long profileId)
 {
     try
     {
         var profile = _personManagementService.FindProfile(profileId);
         if (profile == null)
         {
             return(Json(new { isError = true, Message = @"ورودی نامعتبر!" }));
         }
         var addressUrlFile = new AddressUrlFile(Server.MapPath("~//"));
         var path           = addressUrlFile.Image + profile.Avatar;
         profile.Avatar = "";
         var result = _personManagementService.UpdateProfile(profile);
         if (!result.Item1)
         {
             return(Json(new { isError = !result.Item1, Message = result.Item2 }));
         }
         if (System.IO.File.Exists(path))
         {
             System.IO.File.Delete(path);
         }
         return(Json(new { isError = !result.Item1, Message = result.Item2 }));
     }
     catch (Exception)
     {
         return(Json(new { isError = true, Message = @"خطا در حذف تصویر" }));
     }
 }
        public virtual ActionResult DeleteSignature(long personelId)
        {
            try
            {
                var personel = _personManagementService.FindPersonel(personelId);
                if (personel == null)
                {
                    return(Json(new { isError = true, Message = @"ورودی نامعتبر!" }));
                }
                var addressUrlFile = new AddressUrlFile(Server.MapPath("~//"));
                var path           = addressUrlFile.Signature + personel.Signature;
                personel.Signature = "";
                var result = _personManagementService.UpdatePersonel(personel);
                if (!result.Item1)
                {
                    return(Json(new { isError = !result.Item1, Message = result.Item2 }));
                }

                if (System.IO.File.Exists(path))
                {
                    System.IO.File.Delete(path);
                }
                return(Json(new { isError = !result.Item1, Message = result.Item2 }));
            }
            catch (Exception)
            {
                return(Json(new { isError = true, Message = @"خطا در حذف تصویر" }));
            }
        }
        public virtual ActionResult Create(IEnumerable <HttpPostedFileBase> sliderUpload)
        {
            if (sliderUpload == null)
            {
                return(Json(new { Success = false, Msg = "تصویر وارد نشده است" }));
            }
            if (!ModelState.IsValid)
            {
                return(Json(new { Success = false, Msg = ModelState.GetErrors() }));
            }
            var addressUrlFile = new AddressUrlFile(Server.MapPath("~//"));

            Useful.CreateFolderIfNeeded(addressUrlFile.SliderImage);
            var httpPostedFileBases = sliderUpload as HttpPostedFileBase[] ?? sliderUpload.ToArray();

            for (var i = 0; i < httpPostedFileBases.Count(); i++)
            {
                var fileName = Guid.NewGuid() + Path.GetExtension(httpPostedFileBases[i].FileName);
                var slider   = new Slider {
                    ImageName = fileName
                };
                httpPostedFileBases[i].SaveAs(addressUrlFile.SliderImage + fileName);
                _sliderService.Add(slider);
            }
            return(Json(new { Success = true, Msg = "رکورد جدید برای اسلایدر ثبت شد", Html = this.RenderPartialToString("~/Areas/Admin/Views/Slider/_GetSliders.cshtml", _sliderService.GetListSlider()) }));
        }
 public virtual ActionResult DeleteRequest(long requestId)
 {
     try
     {
         using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
         {
             var attach         = _attachmentRepository.Where(a => a.RequestId == requestId).Select(s => s.File).ToList();
             var addressUrlFile = new AddressUrlFile(Server.MapPath("~//"));
             var result         = _requestService.Delete(requestId);
             if (result.Item1)
             {
                 for (int i = 0; i < attach.Count; i++)
                 {
                     if (System.IO.File.Exists(addressUrlFile.UploadFiles + attach[i]))
                     {
                         System.IO.File.Delete(addressUrlFile.UploadFiles + attach[i]);
                     }
                 }
                 scope.Complete();
             }
             return(Json(new { isError = !result.Item1, Message = result.Item2 }));
         }
     }
     catch (Exception)
     {
         return(Json(new { isError = true, Message = "عملیات حذف با مشکل مواجه شده است" }));
     }
 }
        public virtual ActionResult ConfirmOnBehalfof(long userId, long requestId, long postId, int rowNumber, string description)
        {
            var userIdFrom = Convert.ToInt64(User.Identity.GetUserId());
            var result     = _cartableService.Confirmation(userId, userIdFrom, requestId, postId, rowNumber, description);
            var signature  = new AddressUrlFile(Path.Combine("~\\")).Signature + result.Item3;

            return(Json(new { isError = !result.Item1, Message = result.Item2, ImgSigner = signature }));
        }
 public string GetLogoUrl(AddressUrlFile addressUrl)
 {
     try
     {
         var logoname = _universityRepository.All().Select(sel => sel.Logo).FirstOrDefault();
         return(addressUrl.Logo + logoname);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
        public virtual ActionResult SaveProfile(ProfileModel profileModel, HttpPostedFileBase avatarFile)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(Json(new { isError = true, Message = @"ورودی نامعتبر!" }));
                }
                using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
                {
                    var addressUrlFile = new AddressUrlFile(Server.MapPath("~//"));
                    var path           = addressUrlFile.Image;
                    // ذخیره تصویر شخصی
                    if (avatarFile != null)
                    {
                        if (Useful.CreateFolderIfNeeded(addressUrlFile.Image))
                        {
                            // اگر قبلا فایل وجود دارد حذف شود
                            if (System.IO.File.Exists(path + profileModel.Avatar))
                            {
                                System.IO.File.Delete(path + profileModel.Avatar);
                            }

                            if (profileModel.Avatar == null)
                            {
                                path += Guid.NewGuid() + Path.GetExtension(avatarFile.FileName);
                            }
                            else
                            {
                                path += profileModel.Avatar;
                            }

                            avatarFile.SaveAs(path);
                            profileModel.Avatar = Path.GetFileName(path);
                        }
                    }
                    var levelId = Convert.ToInt64(User.LevelId());
                    var data    = _personManagementService.AddOrUpdateProfile(profileModel, levelId);
                    scope.Complete();
                    return(Json(new { isError = !data.Item1, Message = data.Item2 }));
                }
            }
            catch (Exception)
            {
                return(Json(new { isError = true, Message = @"خطا در ویرایش اطلاعات پرسنلی" }));
            }
        }
        public virtual ActionResult RemoveSlider(int sliderId)
        {
            var slider = _sliderService.Find(sliderId);

            if (slider == null)
            {
                return(Json(new { Success = false, Msg = "فایل مورد نظر یافت نشد" }));
            }
            if (!_sliderService.Delete(sliderId).Item1)
            {
                return(Json(new { Success = false, Msg = "خطا در حذف" }));
            }
            var addressUrlFile = new AddressUrlFile(Server.MapPath("~//"));
            var path           = addressUrlFile.SliderImage + slider.ImageName;

            System.IO.File.Delete(path);
            return(Json(new { Success = true, Msg = "تصویر حذف شد" }));
        }
 public virtual ActionResult DeleteFile(long id)
 {
     try
     {
         var mypatfile = new AddressUrlFile(Path.Combine("~\\"));
         var attach    = _attachmentService.Find(id);
         if (attach == null)
         {
             return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
         }
         string fullPath = Request.MapPath(mypatfile.UploadFiles + attach.File + attach.Extention);
         if (System.IO.File.Exists(fullPath))
         {
             System.IO.File.Delete(fullPath);
         }
         _attachmentService.Delete(id);
         return(Json(new { isError = false, Message = "حذف انجام شد" }));
     }
     catch (Exception)
     {
         return(Json(new { isError = true, Message = "خطا در حذف پیوست" }));
     }
 }
        /// <summary>
        /// این متد اطلاعات مربوط به کمیسیون و پروفایل و دانشجویی یک شخص خاص را می دهد
        /// </summary>
        /// <param name="requestId"></param>
        /// <returns></returns>
        public Tuple <bool, string, DetailRequestModel> DetailRequest(long requestId, AddressUrlFile addressUrlFile)
        {
            try
            {
                // جزیات درخواست
                var detailRequest = (from p in _requestRepository.Where(c => c.Id == requestId)
                                     select new DetailRequestModel
                {
                    RequestId = p.Id,
                    RequestType = p.RequestType,
                    RequestStatus = p.RequestStatus,
                    CommissionNumber = p.Commission != null ? (p.Commission.CommissionNumber) : p.Council.CouncilNumber,
                    Date = p.Commission != null ? p.Commission.Date : p.Council.Date,
                    Description = p.Commission != null ? (p.Commission.Description ?? "") : (p.Council.Description ?? ""),
                    NumberofSpentUnits = p.NumberofSpentUnits,
                    NumberofRemainingUnits = p.NumberofRemainingUnits,

                    Name = p.Person.Profile.Name,
                    Family = p.Person.Profile.Family,
                    NationalCode = p.Person.Profile.NationalCode,
                    Gender = p.Person.Profile.Gender,

                    StudentNumber = p.Person.Student.StudentNumber,
                    Grade = p.Person.Student.Grade,
                    MilitaryServiceStatus = p.Person.Student.MilitaryServiceStatus,
                    FieldofStudy = p.Person.Student.FieldofStudy.OrganizationStructureName.Name,
                    FieldofStudyId = p.Person.Student.FieldofStudyId,
                    EducationGroupId = p.Person.Student.FieldofStudy.EducationalGroupId,
                    CollegeId = p.Person.Student.FieldofStudy.EducationalGroup.CollegeId,
                    UniversityId = p.Person.Student.FieldofStudy.EducationalGroup.College.UniversityId,
                    ProblemsCouncil = p.Council != null ? p.Council.ProblemText : " ",

                    VoteText = p.Vote == null ? " " : p.Vote.VoteText
                }).FirstOrDefault();

                if (detailRequest == null)
                {
                    return(new Tuple <bool, string, DetailRequestModel>(false, "رکورد کمیسیون نظر یافت نشد!", null));
                }
                ////var showMilitaryServiceStatus = detailRequest.MilitaryServiceStatus == MilitaryServiceStatus.Included
                ////                                && detailRequest.Gender == Gender.Male;


                bool showRefrenceTo =
                    _cartableRepository.Contains(
                        i =>
                        i.RequestId == requestId &&
                        i.CartableValidation == CartableValidation.Valid && ((detailRequest.RequestType == RequestType.Comision && i.RowNumber == 5 && i.ReferTo) ||
                                                                             (detailRequest.RequestType == RequestType.Council && i.RowNumber == 6 && i.ReferTo)));
                //_cartableRepository.Contains(
                //    i =>
                //        i.RequestId == requestId &&
                //        i.CartableValidation == CartableValidation.Valid && i.RowNumber == 6);


                var signers = (from signer in _signerRepository.Where(i => i.RequestType == detailRequest.RequestType &&
                                                                      (showRefrenceTo || (detailRequest.RequestType == RequestType.Comision && i.RowNumber != 6) ||
                                                                       (detailRequest.RequestType == RequestType.Council && i.RowNumber != 7)))
                               join itemsinger in _cartableRepository.Where(i => i.RequestId == requestId && i.CartableValidation == CartableValidation.Valid)
                               on new { signer.PostId, signer.RowNumber } equals new { itemsinger.PostId, itemsinger.RowNumber } into signerCartablsSiners
                               from data in signerCartablsSiners.DefaultIfEmpty()
                               select new DetailRequestSignerModel
                {
                    PersonId = signer.Post.PostPersons.FirstOrDefault(pp => (signer.Post.PostType == PostType.University ?
                                                                             (pp.UniversityId == detailRequest.UniversityId) :
                                                                             (signer.Post.PostType == PostType.College ? (pp.CollegeId == detailRequest.CollegeId) :
                                                                              (signer.Post.PostType == PostType.EducationalGroup ? (pp.EducationalGroupId == detailRequest.EducationGroupId) :
                                                                               (pp.FieldofStudyId == detailRequest.FieldofStudyId))))) == null ? 440 :
                               signer.Post.PostPersons.FirstOrDefault(pp => (signer.Post.PostType == PostType.University ?
                                                                             (pp.UniversityId == detailRequest.UniversityId) :
                                                                             (signer.Post.PostType == PostType.College ? (pp.CollegeId == detailRequest.CollegeId) :
                                                                              (signer.Post.PostType == PostType.EducationalGroup ? (pp.EducationalGroupId == detailRequest.EducationGroupId) :
                                                                               (pp.FieldofStudyId == detailRequest.FieldofStudyId))))).PersonId,
                    PersonName =
                        signer.Post.PostPersons.FirstOrDefault(pp => (signer.Post.PostType == PostType.University ?
                                                                      (pp.UniversityId == detailRequest.UniversityId) :
                                                                      (signer.Post.PostType == PostType.College ? (pp.CollegeId == detailRequest.CollegeId) :
                                                                       (signer.Post.PostType == PostType.EducationalGroup ? (pp.EducationalGroupId == detailRequest.EducationGroupId) :
                                                                        (pp.FieldofStudyId == detailRequest.FieldofStudyId))))) == null ? "پرسنل وجود ندارد" :
                        signer.Post.PostPersons.Where(pp => (signer.Post.PostType == PostType.University ?
                                                             (pp.UniversityId == detailRequest.UniversityId) :
                                                             (signer.Post.PostType == PostType.College ? (pp.CollegeId == detailRequest.CollegeId) :
                                                              (signer.Post.PostType == PostType.EducationalGroup ? (pp.EducationalGroupId == detailRequest.EducationGroupId) :
                                                               (pp.FieldofStudyId == detailRequest.FieldofStudyId))))).Select(s => new { f = s.Person.Profile.Name + " " + s.Person.Profile.Family }).FirstOrDefault().f,
                    PostId = signer.PostId,
                    RowNumber = signer.RowNumber,
                    Signature = data.Person.Personel.Signature != null ? addressUrlFile.Signature + data.Person.Personel.Signature : string.Empty,
                    PostName = signer.Post.Name,
                    Signed = data.Person.Personel != null
                }).OrderBy(d => d.RowNumber).ToList();
                detailRequest.DetailRequestSignerModels = signers;

                return(new Tuple <bool, string, DetailRequestModel>(true, "", detailRequest));
            }
            catch (Exception e)
            {
                return(new Tuple <bool, string, DetailRequestModel>(false, "خطا در انجام عملیات!", null));
            }
        }
        public Tuple <bool, string, VoteModel> GetVote(long universityId, long voteId, RequestType requestType, AddressUrlFile addressUrlFile)
        {
            try
            {
                //var request = _requestRepository.Where(r => r.Id == voteId).Select(s => new { s.RequestType, s.Commission, s.Council,s.Vote }).FirstOrDefault();
                var detailRequestModel = _requestService.DetailRequest(voteId, addressUrlFile);
                if (!detailRequestModel.Item1)
                {
                    return(new Tuple <bool, string, VoteModel>(false, "عملیات با مشکل مواجه شده است", null));
                }

                DateTime?dateVote;
                if (requestType == RequestType.Comision)
                {
                    detailRequestModel.Item3.CommissionNumber = _commissionService.GetCommissionNumber(universityId).Item1;
                    dateVote =
                        _voteRepository.Where(w => w.Request.Commission.CommissionNumber == detailRequestModel.Item3.CommissionNumber).
                        Select(s => s.DateVote).FirstOrDefault();
                }
                else
                {
                    detailRequestModel.Item3.CommissionNumber = _councilService.GetCouncilNumber(universityId).Item1;
                    dateVote = _voteRepository.Where(w => w.Request.Council.CouncilNumber == detailRequestModel.Item3.CommissionNumber).
                               Select(s => s.DateVote).FirstOrDefault();
                }

                var vote = _requestRepository.Where(x => x.Id == voteId)
                           .Select(v => new VoteModel
                {
                    PersonId           = v.Vote != null ? v.Vote.PersonId : 0,
                    PersonIdOnBehalfof = v.Vote != null ? v.Vote.PersonId : 0,
                    PostId             = v.Vote != null ? v.Vote.PostId : 0,
                    RequestId          = voteId,
                    DateVote           = v.Vote != null ? v.Vote.DateVote : dateVote ?? DateTime.Now,
                    VoteText           = v.Vote != null ? v.Vote.VoteText : "",
                    VoteDescription    = v.Vote != null ? v.Vote.ReferText : "",
                    VoteType           = v.Vote != null ? v.Vote.VoteType : 0,
                    VoteStatus         = v.Vote != null ? v.Vote.VoteStatus : 0,
                    RequestType        = v.RequestType,
                    Included           = (v.RequestType == RequestType.Comision && v.Person.Profile.Gender == Gender.Male &&
                                          v.Person.Student.MilitaryServiceStatus == MilitaryServiceStatus.Included),

                    Name           = v.Person.Profile.Name,
                    Family         = v.Person.Profile.Family,
                    StudentNumber  = v.Person.Student.StudentNumber,
                    FieldofStudy   = v.Person.Student.FieldofStudy.OrganizationStructureName.Name,
                    FieldofStudyId = v.Person.Student.FieldofStudyId,
                    Grade          = v.Person.Student.Grade.ToString(),
                    NationalCode   = v.Person.Profile.NationalCode
                                     //Description = v.Request.Cartables.FirstOrDefault(c =>
                                     //    c.CartableStatus == CartableStatus.Verdict &&
                                     //    c.CartableValidation == CartableValidation.Valid).Description
                }).FirstOrDefault();
                if (vote == null)
                {
                    return(new Tuple <bool, string, VoteModel>(false, "عملیات با مشکل مواجه شده است", null));
                }
                vote.DetailRequestModel = detailRequestModel.Item3;
                return(new Tuple <bool, string, VoteModel>(true, "", vote));
            }
            catch (Exception exception)
            {
                return(new Tuple <bool, string, VoteModel>(false, "عملیات با مشکل مواجه شده است", null));
            }
        }
        /// <summary>
        /// چاپ کمیسیون
        /// </summary>
        /// <param name="commissionId" />
        /// <param name="addressUrlFile">ادرس  عکس های امضا الکترونیکی</param>
        public PCommissionModel PrintCommission(long commissionId, AddressUrlFile addressUrlFile)
        {
            try
            {
                // اگر دانشجو مرد باشد و وضعیت سربازی آن مشمول باشد این متغیر (درست= ترو) خواهد شد
                // وقتی این متغیر (درست = ترو) باشد امضا کنند ردیف اخر نشان داده می شود.
                var query = (_requestRepository.Where(
                                 c => c.RequestType == RequestType.Comision && c.Id == commissionId)
                             .Select(item => new PCommissionModel
                {
                    PRequestDataModel =
                        new PRequestDataModel
                    {
                        RequestId = item.Id,
                        CommissionCouncilNumber = item.Commission.CommissionNumber,
                        Date = item.Vote != null ? item.Vote.DateVote : (DateTime?)null,
                        Description = item.Commission.Description,
                        DescriptionVerdict = item.Cartables.FirstOrDefault(d => d.CartableValidation == CartableValidation.Valid && d.CartableStatus == CartableStatus.Verdict).Description,
                        VoteText = item.Vote != null ? item.Vote.VoteText : "",
                        RowNumber = item.Commission.RowNumber,
                        ////RefertoText = item.Vote.ReferText, قبلا در صدوری رای بوده است
                        /// این متن در واقعی متنی است که در مرحله اخر برای سنوات بررسی شده است
                        RefertoText = item.Cartables.Where(sel => sel.CartableValidation == CartableValidation.Valid && sel.RowNumber == 6).Select(s => s.Description).FirstOrDefault() ?? " "
                    },

                    PMemberDetailsModel =
                        item.MemberMaster.MemberDetails.Select(
                            i =>
                            new PMemberDetailsModel
                    {
                        PostName = i.PostName,
                        FullName = i.PersonName,
                        RowNumber = i.RowNumber
                    }).ToList(),
                    PSpecialEducationModel =
                        item.Commission.CommissionSpecialEducations.Select(
                            i =>
                            new PSpecialEducationModel
                    {
                        Name = i.SpecialEducation.Name,
                        State = true,
                        Id = i.SpecialEducationId
                    }).ToList(),
                    PStudentInformationModel = new PStudentInformationModel
                    {
                        NameFamili = item.Person.Profile.Name + " " + item.Person.Profile.Family,
                        StudentNumber = item.Person.Student.StudentNumber,
                        FieldofStudyName = item.Person.Student.FieldofStudy.OrganizationStructureName.Name,
                        Grade = item.Person.Student.Grade,
                        // GradeName = item.Person.Student.Grade.GetDescription(),
                        NumberofRemainingUnits = item.NumberofRemainingUnits,
                        NumberofSpentUnits = item.NumberofSpentUnits,
                        MilitaryServiceStatus = item.Person.Student.MilitaryServiceStatus,
                        Gender = item.Person.Profile.Gender
                                 // MilitaryServiceStatusName = item.Person.Student.MilitaryServiceStatus.GetDescription()
                    }
                })).FirstOrDefault();
                if (query != null)
                {
                    query.PStudentInformationModel.GradeName = query.PStudentInformationModel.Grade.GetDescription();
                    query.PStudentInformationModel.MilitaryServiceStatusName =
                        query.PStudentInformationModel.MilitaryServiceStatus.GetDescription();
                    // قبلا برای مشمول و مرد بدن استفاده می شد.
                    //////bool showMilitaryServiceStatus = query.PStudentInformationModel.MilitaryServiceStatus == MilitaryServiceStatus.Included
                    //////    && query.PStudentInformationModel.Gender == Gender.Male;
                    // ایا امضا معاون دانشجویی نشان داده شود
                    bool showRefrenceTo =
                        _cartableRepository.Contains(
                            i =>
                            i.RequestId == commissionId &&
                            i.CartableValidation == CartableValidation.Valid && i.RowNumber == 6);



                    var querySigners = (from singer in _signerRepository.Where(i => i.RequestType == RequestType.Comision && (showRefrenceTo || i.RowNumber != 6))
                                        join itemsinger in _cartableRepository.Where(i => i.RequestId == commissionId && i.CartableValidation == CartableValidation.Valid)
                                        on new { singer.PostId, singer.RowNumber } equals new { itemsinger.PostId, itemsinger.RowNumber } into signerCartablsSiners
                                        from data in signerCartablsSiners.DefaultIfEmpty()
                                        select new PSignersListModel
                    {
                        PostId = singer.PostId,
                        RowNumber = singer.RowNumber,
                        SignatureUrl = data.Person.Personel.Signature != null ? addressUrlFile.Signature + data.Person.Personel.Signature : "",
                        PostName = singer.Post.Name
                    }).ToList();
                    query.PSignersModel = new PSignersModel(querySigners);
                    ////query.PSignersModel = new PSignersModel(query.PSignersListModel);
                    return(query);
                }
                return(null);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
        public PCouncilModel PrintCouncil(long councilId, AddressUrlFile addressUrlFile)
        {
            try
            {
                var query = (_requestRepository.Where(
                                 c => c.RequestType == RequestType.Council && c.Id == councilId)
                             .Select(item => new PCouncilModel
                {
                    PRequestDataModel =
                        new PRequestDataModel
                    {
                        RequestId = item.Id,
                        CommissionCouncilNumber = item.Council.CouncilNumber,
                        Date = item.Council.Date,
                        Description = item.Council.Description,
                        ProblemText = item.Council.ProblemText,
                        VoteText = item.Vote.VoteText,
                        RowNumber = item.Council.RowNumber,
                        //  RefertoText = item.Vote.ReferText,
                        RefertoText = item.Cartables.Where(sel => sel.CartableValidation == CartableValidation.Valid && sel.RowNumber == 7).Select(s => s.Description).FirstOrDefault() ?? " "
                    },


                    PMemberDetailsModel =
                        item.MemberMaster.MemberDetails.Select(
                            i =>
                            new PMemberDetailsModel
                    {
                        PostName = i.PostName,
                        FullName = i.PersonName,
                        RowNumber = i.RowNumber
                    }).ToList(),


                    PStudentInformationModel = new PStudentInformationModel
                    {
                        NameFamili = item.Person.Profile.Name + " " + item.Person.Profile.Family,
                        StudentNumber = item.Person.Student.StudentNumber,
                        FieldofStudyName = item.Person.Student.FieldofStudy.OrganizationStructureName.Name,
                        Grade = item.Person.Student.Grade,
                        //GradeName = item.Person.Student.Grade.GetDescription(),
                        NumberofRemainingUnits = item.NumberofRemainingUnits,
                        NumberofSpentUnits = item.NumberofSpentUnits,
                        MilitaryServiceStatus = item.Person.Student.MilitaryServiceStatus,
                        StudentId = item.Person.Id
                                    // MilitaryServiceStatusName = item.Person.Student.MilitaryServiceStatus.GetDescription()
                    }
                })).FirstOrDefault();
                if (query != null)
                {
                    query.PStudentInformationModel.GradeName = query.PStudentInformationModel.Grade.GetDescription();
                    query.PStudentInformationModel.MilitaryServiceStatusName =
                        query.PStudentInformationModel.MilitaryServiceStatus.GetDescription();

                    bool showRefrenceTo =
                        _cartableRepository.Contains(
                            i =>
                            i.RequestId == councilId &&
                            i.CartableValidation == CartableValidation.Valid && i.RowNumber == 6);


                    var querySigners = (from singer in _signerRepository.Where(i => i.RequestType == RequestType.Council && (showRefrenceTo || i.RowNumber != 6))
                                        join itemsinger in _cartableRepository.Where(i => i.RequestId == councilId && i.CartableValidation == CartableValidation.Valid)
                                        on new { singer.PostId, singer.RowNumber } equals new { itemsinger.PostId, itemsinger.RowNumber } into signerCartablsSiners
                                        from data in signerCartablsSiners.DefaultIfEmpty()
                                        select new PSignersListModel
                    {
                        PostId = singer.PostId,
                        RowNumber = singer.RowNumber,
                        SignatureUrl = data.Person.Personel.Signature != null ? addressUrlFile.Signature + data.Person.Personel.Signature : "",
                        PostName = singer.Post.Name
                    }).ToList();
                    query.PSignersModel = new PSignersModel(querySigners);

                    ////query.PSignersModel = new PSignersModel(query.PSignersListModel);

                    query.PStudentInformationModel.CountuseCouncil =
                        _councilService.GetNumberofVotesCouncil(query.PStudentInformationModel.StudentId);
                    return(query);
                }
                return(null);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
 public IList <string> GetListSliderPath(AddressUrlFile addressUrlFile)
 {
     return(_sliderRepository.All().Select(s => addressUrlFile.SliderImage + s.ImageName).ToList());
 }