/// <summary> /// درج کارتابل /// Savechange /// انجام نمی شود /// </summary> /// <returns></returns> private bool InsertCartable(CartableStatus cartableStatus, long userId, long personIdOnBehalfof, long requestId, long postuserId, int rowNumber, bool referTo, string description) { // بررسی این که درخواست معتبر می باشد یا خیر var requestIsValid = _requestRepository.Where(s => s.Id == requestId && (rowNumber <= 1 || s.RequestStatus != RequestStatus.Returned)).Include(i => i.Person.Profile) .Include(i => i.Person.Student).FirstOrDefault(); if (requestIsValid == null) { return(false); } var newCartable = new Cartable { RequestId = requestId, PersonId = userId, PostId = postuserId, RowNumber = rowNumber, ReferTo = referTo, Series = _cartableRepository.Where(c => c.RequestId == requestId && c.RowNumber == 1).Count() + (rowNumber == 1 ? 1 : 0), CartableStatus = cartableStatus, Description = description, PersonIdOnBehalfof = personIdOnBehalfof, CartableValidation = cartableStatus == CartableStatus.Returned ? CartableValidation.Invalid : CartableValidation.Valid// کلا در خواست ها برگشی در کارتابل نا معتبر باید باشد- در جدول کارتابل درخواست معتبر و برگشت زده نداریم }; //_cartableRepository.AddOrUpdate(c => new { c.RequestId, c.PostId, c.CartableStatus, c.CartableValidation, c.RowNumber, c.Series }, newCartable); _cartableRepository.Add(newCartable); if (cartableStatus == CartableStatus.Verdict) { //if (VoteStatus == VoteStatus.Temporary) // cartableStatus = CartableStatus.Confirmed; //else //{ if (requestIsValid.RequestType == RequestType.Comision) { if (referTo) { cartableStatus = CartableStatus.Confirmed; } } else { cartableStatus = CartableStatus.Confirmed; // چون شورا است باید درخواست در جریان شود } //} } requestIsValid.RequestStatus = new Request().ConvertCartableStatustoRequestStatus(cartableStatus); _requestRepository.Update(requestIsValid); return(true); }
public virtual ActionResult GetFollowByRequestId(long reqId) { var model = _cartableRepository.Where(x => x.RequestId == reqId) .Include(x => x.Person) .Include(x => x.Person.Profile) .Include(x => x.Request) .Include(x => x.Post) .Include(x => x.Request.Commission) .Include(x => x.Request.Council) .ToList(); return(PartialView("_FollowUpDetail", model)); }
/// <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)); } }
/// <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); } }