private void CheckLogins() { ncelsEntities db = new ncelsEntities(); IQueryable <string> logins = db.Employees.Select(x => x.Login); foreach (string login in logins) { if (login != null && Membership.GetUser(login) == null) { Membership.CreateUser(login, "123456"); } } }
// GET: Profile public ActionResult Index() { ncelsEntities db = UserHelper.GetCn(); var employee = db.Employees.FirstOrDefault(x => x.Login == User.Identity.Name); var model = new ProfileModel { Email = employee.Email, Organization = employee.LastName, Position = employee.FirstName, Name = employee.Iin }; return(View(model)); }
public static void Upload(byte[] file, string name, Guid id) { FileHelper.BuildPreview(file, id.ToString(), name); ncelsEntities service = UserHelper.GetCn(); Document document = service.Documents.FirstOrDefault(o => o.Id == id); if (document != null && document.IsAttachments == false) { document.IsAttachments = true; service.SaveChanges(); } }
public ActionResult DeleteIncoming(LetterModelFromEdo model) { using (ncelsEntities db = new ncelsEntities()) { OBK_LetterFromEdo edo = db.OBK_LetterFromEdo.Where(x => x.ID == model.ID).FirstOrDefault(); if (edo != null) { db.OBK_LetterFromEdo.Remove(edo); db.SaveChanges(); } } return(RedirectToAction("Incoming")); }
public static List <DictionaryInfo> GetNomenclatureList() { ncelsEntities entities = UserHelper.GetCn(); var items = entities.Dictionaries.Where(o => o.Type == "Nomenclature").GroupBy(o => o.Year); return(items.Select(o => new DictionaryInfo() { NameRu = o.Key, TypeRu = o.Key, NameKz = o.Key, TypeKz = o.Key }).OrderBy(o => o.NameRu).ToList()); }
public static string GetCurrentName() { if (HttpContext.Current.User == null) { return("Не найден"); } ncelsEntities entities = new ncelsEntities(); var user = entities.Employees.Include("Position"). Where(x => x.Login == HttpContext.Current.User.Identity.Name).FirstOrDefault(); return(user != null ? user.DisplayName : "Не найден"); }
public async Task <object> GetCurrentList(ncelsEntities db, ModelRequest request, Guid id) { try { var employeeId = UserHelper.GetCurrentEmployee().Id.ToString(); //Database query var v = db.Documents.Where(o => o.IsDeleted == false && o.AnswersId == id.ToString() && (o.DocumentType == 0 || o.DocumentType == 1)).AsQueryable(); //search if (!string.IsNullOrEmpty(request.SearchValue)) { v = v.Where( a => a.OutgoingNumber.Contains(request.SearchValue) || a.Summary.Contains(request.SearchValue) ); } //sort if (!(string.IsNullOrEmpty(request.SortColumn) && string.IsNullOrEmpty(request.SortColumnDir))) { //for make sort simpler we will add Syste.Linq.Dynamic reference v = v.OrderBy(request.SortColumn + " " + request.SortColumnDir); } int recordsTotal = await v.CountAsync(); var expertiseViews = v.Skip(request.Skip).Take(request.PageSize); return (new { draw = request.Draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, Data = expertiseViews.Select(m => new { m.Id, m.Summary, m.OutgoingNumber, m.DocumentDate, m.AttachPath }).ToList().Select(m => new { m.Id, m.Summary, Number = m.OutgoingNumber, m.DocumentDate, Items = UploadHelper.GetFilesInfo(m.AttachPath, false) }) }); } catch (Exception e) { return(new { IsError = true, Message = e.Message }); } }
public async Task <object> ReadSigning(ncelsEntities db, ModelRequest request) { try { var employeeId = UserHelper.GetCurrentEmployee().Id.ToString(); //Database query var v = db.Tasks .Join(db.Documents, t => t.DocumentId, d => d.Id, (t, d) => new { t, d }) .Join(db.Contracts, cd => cd.d.Id, c => c.Id, (cd, c) => new { cd, c }) .Where(m => m.cd.t.Type == 6 && m.cd.t.State == 0 && m.cd.t.ExecutorId == employeeId).OrderBy(m => m.cd.t.CreatedDate).AsQueryable(); //search if (!string.IsNullOrEmpty(request.SearchValue)) { v = v.Where( a => a.cd.t.Number.Contains(request.SearchValue) || a.cd.t.Text.Contains(request.SearchValue) ); } //sort //if (!(string.IsNullOrEmpty(request.SortColumn) && string.IsNullOrEmpty(request.SortColumnDir))) //{ // //for make sort simpler we will add Syste.Linq.Dynamic reference // v = v.OrderBy(request.SortColumn + " " + request.SortColumnDir); //} int recordsTotal = await v.CountAsync(); var expertiseViews = v.Skip(request.Skip).Take(request.PageSize); return (new { draw = request.Draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, Data = await expertiseViews.Select(m => new { m.cd.t.Id, m.cd.t.State, m.cd.t.Text, m.cd.t.DocumentId, m.cd.t.CreatedDate, m.cd.t.DocumentValue, m.cd.t.Number, m.c.Type }).ToListAsync() }); } catch (Exception e) { return(new { IsError = true, Message = e.Message }); } }
public ActionResult DocumentRegister(DocumentModel document) { try { if (document != null) { Document baseDocument = db.Documents.Find(document.Id); if (baseDocument == null) { baseDocument = new Document() { Id = document.Id, DocumentType = 1, CreatedDate = DateTime.Now, ModifiedDate = DateTime.Now }; db.Documents.Add(baseDocument); } baseDocument = document.GetDocument(baseDocument); baseDocument.DocumentDate = DateTime.Now; baseDocument.StateType = 1; SetEditDoc(baseDocument); db.SaveChanges(); ncelsEntities dbVew = UserHelper.GetCn(); baseDocument = dbVew.Documents.Find(document.Id); DocumentModel model = new DocumentModel(baseDocument); UploadHelper.ReplaceDocument(baseDocument.Id.ToString(), "Проект.docx", "DocumentNumber", baseDocument.Number); UploadHelper.ReplaceDocument(baseDocument.Id.ToString(), "Проект.docx", "DocumentDate", baseDocument.DocumentDate.Value.ToString("dd.MM.yyyy HH:mm")); return(Content(JsonConvert.SerializeObject(new { State = true, document = model }, Formatting.Indented, new JsonSerializerSettings() { DateFormatString = "dd.MM.yyyy HH:mm" }))); } return(Content(JsonConvert.SerializeObject(new { State = false }, Formatting.Indented, new JsonSerializerSettings() { DateFormatString = "dd.MM.yyyy HH:mm" }))); } catch (Exception) { return(Content(JsonConvert.SerializeObject(new { State = false }, Formatting.Indented, new JsonSerializerSettings() { DateFormatString = "dd.MM.yyyy HH:mm" }))); } }
public ActionResult SignViewStart(LetterModel model) { using (ncelsEntities db = new ncelsEntities()) { var data = db.OBK_LetterAttachments.Where(x => x.LetterId == model.ID).Select(x => new AttachDoc { AttachmentName = x.AttachmentName, ID = x.ID, isSigned = string.IsNullOrEmpty(x.SignXmlBigData) ? false : true, }).ToList(); model.listDoc = data; } return(View(model)); }
public Notification TryGenerateNotification <T>(ncelsEntities dbContext, NotificationTypeKey notificationTypeKey, T sourceObject) where T : class { var contract = sourceObject as Contract; return(new Notification() { CreatedDate = DateTime.Now, ModifiedDate = DateTime.Now, EmployeesId = Guid.NewGuid().ToString(), ObjectId = contract.Id.ToString(), TableName = notificationTypeKey.ObjectType.GetDescription(), Note = "testNotification" }); }
public Notification TryGenerateNotification <T>(ncelsEntities dbContext, NotificationTypeKey notificationTypeKey, T sourceObject) where T : class { var contractRemarkDoc = sourceObject as Document; if (contractRemarkDoc == null) { return(null); } Guid contractDocId; if (contractRemarkDoc.DocumentType == 4 && contractRemarkDoc.StateType == 9 && Guid.TryParse(contractRemarkDoc.AnswersId, out contractDocId)) { var query = from d in dbContext.Documents join c in dbContext.Contracts on d.Id equals c.Id where c.Id == contractDocId select d; if (!query.Any()) { return(null); } var contractDoc = dbContext.Documents.FirstOrDefault(e => e.Id == contractDocId); if (string.IsNullOrEmpty(contractDoc.CorrespondentsId)) { return(null); } var ids = contractDoc.CorrespondentsId.Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); Guid correspondentId; if (ids.Length > 0 && Guid.TryParse(ids[0], out correspondentId)) { var correspondentEmail = dbContext.Employees.Where(e => e.Id == correspondentId).Select(e => e.Email).FirstOrDefault(); return(new Notification() { CreatedDate = DateTime.Now, ModifiedDate = DateTime.Now, EmployeesId = correspondentId.ToString(), TableName = notificationTypeKey.ObjectType.GetDescription(), ObjectId = contractDocId.ToString(), Email = correspondentEmail, Note = "Ваш договор отклонен с замечанием от юрисконсульта ЦОЗ", StateType = contractDoc.StateType, ModifiedUser = UserHelper.GetCurrentEmployee().DisplayName }); } } return(null); }
public Notification TryGenerateNotification <T>(ncelsEntities dbContext, NotificationTypeKey notificationTypeKey, T sourceObject) where T : class { var priceAppComment = sourceObject as Document; if (priceAppComment == null) { return(null); } Guid priceAppDocId; if (priceAppComment.DocumentType == 1 && Guid.TryParse(priceAppComment.AnswersId, out priceAppDocId)) { var query = from d in dbContext.Documents join c in dbContext.PriceProjects on d.Id equals c.Id where c.Id == priceAppDocId select d; if (!query.Any()) { return(null); } var priceDoc = dbContext.Documents.FirstOrDefault(e => e.Id == priceAppDocId); if (string.IsNullOrEmpty(priceDoc.CorrespondentsId)) { return(null); } var ids = priceDoc.CorrespondentsId.Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries); Guid correspondentId; if (ids.Length > 0 && Guid.TryParse(ids[0], out correspondentId)) { var correspondentEmail = dbContext.Employees.Where(e => e.Id == correspondentId).Select(e => e.Email).FirstOrDefault(); return(new Notification() { CreatedDate = DateTime.Now, ModifiedDate = DateTime.Now, EmployeesId = correspondentId.ToString(), TableName = notificationTypeKey.ObjectType.GetDescription(), ObjectId = priceAppDocId.ToString(), Email = correspondentEmail, Note = string.Format("Имеется замечание на заявку №{0}", priceDoc.Number), StateType = priceDoc.StateType, ModifiedUser = UserHelper.GetCurrentEmployee().DisplayName }); } } return(null); }
public ActionResult GetContractAdditionalTemplatePdf(Guid id, string contractAdditionTypeCode) { var db = new ncelsEntities(); string name = "Договор_на_проведение_оценки_безопасности_и_качества.pdf"; StiReport report = new StiReport(); try { report.Load(obkRepo.GetContractAdditionalTemplatePath(id, contractAdditionTypeCode)); foreach (var data in report.Dictionary.Databases.Items.OfType <StiSqlDatabase>()) { data.ConnectionString = UserHelper.GetCnString(); } report.Dictionary.Variables["addContractNumber"].ValueObject = id; report.Render(false); } catch (Exception ex) { LogHelper.Log.Error("ex: " + ex.Message + " \r\nstack: " + ex.StackTrace); } Stream stream = new MemoryStream(); report.ExportDocument(StiExportFormat.Word2007, stream); stream.Position = 0; Aspose.Words.Document doc = new Aspose.Words.Document(stream); try { var signData = db.OBK_ContractSignedDatas.Where(x => x.ContractId == id).FirstOrDefault(); if (signData != null && signData.ApplicantSign != null && signData.CeoSign != null) { doc.InserQrCodesToEnd("ApplicantSign", signData.ApplicantSign); doc.InserQrCodesToEnd("CeoSign", signData.CeoSign); } } catch (Exception ex) { } var file = new MemoryStream(); doc.Save(file, Aspose.Words.SaveFormat.Pdf); file.Position = 0; return(new FileStreamResult(file, "application/pdf")); }
public static int GetType(ncelsEntities db, Guid id) { if (db.PriceProjects.Any(m => m.Id == id)) { return(1); } else if (db.RegisterProjects.Any(m => m.Id == id)) { return(2); } else { return(3); } }
private static void GetEmployeePermissionIfEmpty() { if (_employeePermissions == null) { ncelsEntities ncelsEntities = UserHelper.GetCn(); var permissions = ncelsEntities.EmployeePermissionRoles.Join(ncelsEntities.PermissionRoleKeys, x => x.PermissionRoleId, x => x.PermissionRoleId, (epr, prk) => new EmployeePermission { EmployeeId = epr.EmployeeId, PermissionKey = prk.PermissionKey, PermissionValue = prk.PermissionValue }); _employeePermissions = permissions.ToList(); } }
public static void Upload(Stream fileInput, string name, string id) { var file = FileHelper.ReadFully(fileInput); FileHelper.BuildPreview(file, id.ToString(), name); ncelsEntities service = UserHelper.GetCn(); Document document = service.Documents.FirstOrDefault(o => o.AttachPath == id); if (document != null && document.IsAttachments == false) { document.IsAttachments = true; service.SaveChanges(); } }
public static List <Document> GetFondDocuments(ncelsEntities db, int type) { Guid currentOrganizationId = UserHelper.GetCurrentEmployee().OrganizationId; Guid umcId = Guid.Parse("8f0b91f3-af29-4d3c-96d6-019cbbdfc8be"); var documents = db.Documents .Join(db.Tasks, d => d.Id, t => t.DocumentId, (d, t) => new { t, d }) .Join(db.Employees, te => te.t.ExecutorId, e => e.Id.ToString(), (te, e) => new { te, e }) .Where(m => m.e.OrganizationId == currentOrganizationId && m.te.d.OrganizationId == umcId && m.te.d.DocumentType == type && !m.te.d.IsDeleted) .Select(m => m.te.d).ToList(); var result = documents.Distinct().OrderByDescending(m => m.Number); return(result.ToList()); }
/// <summary> /// может вернуть null, будь бдителен /// </summary> /// <returns></returns> public static Employee GetCurrentEmployee() { ncelsEntities entities = new ncelsEntities(); try { //return entities.Employees.Include("Position").First(); return(entities.Employees.Include("Position"). Where(x => x.Login == HttpContext.Current.User.Identity.Name). FirstOrDefault()); } catch (Exception ex) { LogHelper.Log.Error("GetCurrentEmployee Exception", ex); return(null); } }
public static void ConvertInAdminDocument(Document document, Document project, Employee currentEmployee, string singInfo) { ncelsEntities context = UserHelper.GetCn(); Template template = context.Templates.First(o => o.Id == project.TemplateId); document.QrCode = GetQrCode(GetTextQRcode(singInfo, !string.IsNullOrEmpty(project.Digest))); //Template convTemplate = context.Templates.First(o => o.Id == template.ConvertDictionaryTypeId); //document.DocumentDictionaryTypeId = convTemplate.DictionaryTypeId; //document.DocumentDictionaryTypeValue = convTemplate.DictionaryTypeValue; document.MainTaskId = project.MainTaskId; document.MainDocumentId = project.MainDocumentId; document.SourceId = project.Id.ToString(); document.SourceValue = project.DisplayName; document.RegistratorValue = currentEmployee.DisplayName; document.RegistratorId = currentEmployee.Id.ToString(); document.DocumentType = 3; document.TemplateId = context.Templates.First().Id; document.IsDeleted = false; document.DocumentDate = document.CreatedDate = document.ModifiedDate = DateTime.Now; document.ExecutionDate = document.ExecutionDate.HasValue ? document.ExecutionDate : DateTime.Now.AddDays(15); document.IsAttachments = false; document.AttachPath = FileHelper.GetObjectPathRoot(); CopyFile(project.AttachPath.ToString(), document.AttachPath.ToString()); if (document.ProjectType == 4) { document.StateType = 2; Registrator.SetNumber(document); context.Activities.Add(GetNewActivity(document)); ReplaceText(document.AttachPath.ToString(), "Проект.docx", "DocumentNumber", document.Number); ReplaceText(document.AttachPath.ToString(), "Проект.docx", "DocumentDate", document.DocumentDate.Value.ToString("dd.MM.yyyy")); } if (document.ProjectType == 3) { document.Number = null; document.StateType = 0; } if (document.ProjectType == 6) { document.Number = null; document.StateType = 0; } context.Documents.Add(document); context.SaveChanges(); }
public async Task <object> GetContracts(ncelsEntities db, ModelRequest request, int?code) { try { var employeeId = UserHelper.GetCurrentEmployee().Id; //Database query var v = code != null?db.ContractsViews.Where(m => m.Status == code && m.OwnerId == employeeId).AsQueryable() : db.ContractsViews.Where(m => m.OwnerId == employeeId).AsQueryable(); //search if (!string.IsNullOrEmpty(request.SearchValue)) { v = v.Where( a => a.Number.Contains(request.SearchValue) || a.ManufactureOrgName.Contains(request.SearchValue) ); } //sort if (!(string.IsNullOrEmpty(request.SortColumn) && string.IsNullOrEmpty(request.SortColumnDir))) { //for make sort simpler we will add Syste.Linq.Dynamic reference v = v.OrderBy(request.SortColumn + " " + request.SortColumnDir); } else { v = v.OrderByDescending(m => m.CreatedDate); } int recordsTotal = await v.CountAsync(); var expertiseViews = v.Skip(request.Skip).Take(request.PageSize); return (new { draw = request.Draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, Data = await expertiseViews.ToListAsync() }); } catch (Exception e) { return(new { IsError = true, Message = e.Message }); } }
public ActionResult DeleteOutgoing(LetterModel model) { using (ncelsEntities db = new ncelsEntities()) { OBK_LetterPortalEdo edo = db.OBK_LetterPortalEdo.Where(x => x.ID == model.ID).FirstOrDefault(); if (edo != null) { db.OBK_LetterPortalEdo.Remove(edo); db.SaveChanges(); db.Database.ExecuteSqlCommand(String.Format("delete from OBK_LetterAttachments where LetterId={0}", model.ID)); // db.OBK_LetterRegistration.Remove(db.OBK_LetterRegistration.Where(x=>x.ID==edo.OBKLetterRegID).FirstOrDefault()); db.SaveChanges(); } } return(RedirectToAction("Index")); }
public FileStreamResult ExportFile(Guid id) { var db = new ncelsEntities(); var repo = new DrugPrimaryRepository(); var correspondence = repo.GetCorespondence(id.ToString()); var reportTemplate = ""; switch (correspondence.EXP_DIC_CorespondenceSubject.Code) { case EXP_DIC_CorespondenceSubject.Remarks: switch (correspondence.StageId) { case CodeConstManager.STAGE_PHARMACOLOGICAL: case CodeConstManager.STAGE_SAFETYREPORT: reportTemplate = "~/Reports/DrugPrimary/CorespondencePharmacological.mrt"; break; case CodeConstManager.STAGE_TRANSLATE: reportTemplate = "~/Reports/DrugPrimary/CorespondenceTranslate.mrt"; break; case CodeConstManager.STAGE_PHARMACEUTICAL: reportTemplate = "~/Reports/DrugPrimary/CorespondencePharmaceutical.mrt"; break; default: reportTemplate = "~/Reports/DrugPrimary/Corespondence.mrt"; break; } break; case EXP_DIC_CorespondenceSubject.RefuseByPayment: reportTemplate = "~/Reports/DrugPrimary/RefuseByPaymentLetter.mrt"; break; default: reportTemplate = ""; break; } var reportPath = Server.MapPath(reportTemplate); string fileType; string fileName; var file = repo.GetCorespondenceFilePreview(id, reportPath, out fileType, out fileName); return(File(file, fileType, fileName)); }
public static Unit GetDepartmentUpper() { ncelsEntities entities = new ncelsEntities(); //return entities.Employees.Include("Position").First(); var unit1 = entities.Employees.Include("Position.Parent.Parent"). Where(x => x.Login == HttpContext.Current.User.Identity.Name). FirstOrDefault().Position.Parent; if (unit1 != null) { unit1 = entities.Employees.Include("Position.Parent.Parent"). Where(x => x.Login == HttpContext.Current.User.Identity.Name). FirstOrDefault().Position.Parent.Parent; } return(unit1); }
public async Task <object> GetPriceRework(ncelsEntities db, ModelRequest request, int type) { try { //Database query var employeeId = UserHelper.GetCurrentEmployee().Id; var org = UserHelper.GetCurrentEmployee(); var v = db.ProjectsViews.Where(m => m.Type == type && m.OwnerId == employeeId && (m.Status == 3 || m.Status == 5)).AsQueryable(); //search if (!string.IsNullOrEmpty(request.SearchValue)) { v = v.Where( a => a.Number.Contains(request.SearchValue) || a.NameRu.Contains(request.SearchValue) || a.TypeValue.Contains(request.SearchValue) || a.StausValue.Contains(request.SearchValue) || a.NameRu.Contains(request.SearchValue)); } //sort if (!(string.IsNullOrEmpty(request.SortColumn) && string.IsNullOrEmpty(request.SortColumnDir))) { //for make sort simpler we will add Syste.Linq.Dynamic reference v = v.OrderBy(request.SortColumn + " " + request.SortColumnDir); } int recordsTotal = await v.CountAsync(); var expertiseViews = v.Skip(request.Skip).Take(request.PageSize); return (new { draw = request.Draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, Data = await expertiseViews.ToListAsync() }); } catch (Exception e) { return(new { IsError = true, Message = e.Message }); } }
public ActionResult PrintActReception(Guid contractId, Guid actReceptionId, bool view, bool serial = false) { var db = new ncelsEntities(); StiReport report = new StiReport(); try { if (serial == true) { report.Load(Server.MapPath("~/Reports/Mrts/OBK/OBKSerialActReception.mrt")); } else { report.Load(Server.MapPath("~/Reports/Mrts/OBK/ObkActReception.mrt")); } foreach (var data in report.Dictionary.Databases.Items.OfType <StiSqlDatabase>()) { data.ConnectionString = UserHelper.GetCnString(); } report.Dictionary.Variables["ContractId"].ValueObject = contractId; report.Dictionary.Variables["ActReceptionId"].ValueObject = actReceptionId; report.Render(false); } catch (Exception ex) { LogHelper.Log.Error("ex: " + ex.Message + " \r\nstack: " + ex.StackTrace); } var stream = new MemoryStream(); report.ExportDocument(StiExportFormat.Pdf, stream); stream.Position = 0; string name = "Акт отбора" + DateTime.Now.ToString() + ".pdf"; if (view) { return(new FileStreamResult(stream, "application/pdf")); } else { return(File(stream, "application/pdf", name)); } }
public async Task <object> GetOutgoing(ncelsEntities db, ModelRequest request, int type) { try { var employeeId = UserHelper.GetCurrentEmployee().Id.ToString(); //Database query var v = db.Documents.Where(o => o.IsDeleted == false && type == 0 ? (((o.DocumentType == 0 && o.CreatedUserId == employeeId) || (o.DocumentType == 1 && o.ExecutorsId == employeeId))) : (type == 1 ? o.DocumentType == 1 && o.ExecutorsId == employeeId : (o.DocumentType == 0 && o.CreatedUserId == employeeId))).AsQueryable(); //search if (!string.IsNullOrEmpty(request.SearchValue)) { v = v.Where( a => a.Number.Contains(request.SearchValue) || a.Summary.Contains(request.SearchValue) ); } //sort if (!(string.IsNullOrEmpty(request.SortColumn) && string.IsNullOrEmpty(request.SortColumnDir))) { //for make sort simpler we will add Syste.Linq.Dynamic reference v = v.OrderBy(request.SortColumn + " " + request.SortColumnDir); } int recordsTotal = await v.CountAsync(); var expertiseViews = v.Skip(request.Skip).Take(request.PageSize); return (new { draw = request.Draw, recordsFiltered = recordsTotal, recordsTotal = recordsTotal, Data = await expertiseViews.Select(m => new { m.Id, m.Summary, m.Number, m.DocumentDate }).ToListAsync() }); } catch (Exception e) { return(new { IsError = true, Message = e.Message }); } }
public ActionResult SendDocumentToAgreement(Guid docId, Guid executorId, string documentType, string taskType = null) { taskType = string.IsNullOrEmpty(taskType) ? null : taskType; var db = new ncelsEntities(); var repository = new ActivityRepository(); var activityManager = new ActivityManager(); /* * switch (documentType) * { * case Dictionary.ExpAgreedDocType.DirectionToPay: * var declarationInfo = db.EXP_ExpertiseStageDosage.Where(e => e.Id == docId) * .Select(e => new { e.EXP_DrugDosage.RegNumber, e.EXP_DrugDosage.EXP_DrugDeclaration.CreatedDate }).FirstOrDefault(); * activityManager.SendToExecution(Dictionary.ExpActivityType.FinalDocAgreement, docId, * Dictionary.ExpAgreedDocType.EXP_DrugFinalDocument, taskType ?? Dictionary.ExpTaskType.Agreement, * declarationInfo.RegNumber, declarationInfo.CreatedDate, executorId); * var primaryDocStatus = repository.GetPrimaryFinalDocumentStatus(docId); * return Json(primaryDocStatus.Name, JsonRequestBehavior.AllowGet); * case Dictionary.ExpAgreedDocType.Letter: * var primaryRepo = new DrugPrimaryRepository(); * bool isSigning = taskType == Dictionary.ExpTaskType.Signing; * var letter = primaryRepo.GetCorespondence(docId.ToString()); * if (isSigning) * { * activityManager.SendToExecution(Dictionary.ExpActivityType.ExpertiseLetterSigning, docId, * Dictionary.ExpAgreedDocType.Letter, Dictionary.ExpTaskType.Signing, * letter.NumberLetter, letter.DateCreate, executorId); * return Json( * DictionaryHelper.GetDicItemByCode(CodeConstManager.STATUS_ONSIGNING, * CodeConstManager.STATUS_ONSIGNING).Name, JsonRequestBehavior.AllowGet); * } * else * { * activityManager.SendToExecution(Dictionary.ExpActivityType.ExpertiseLetterAgreement, docId, * Dictionary.ExpAgreedDocType.Letter, Dictionary.ExpTaskType.Agreement, * letter.NumberLetter, letter.DateCreate, executorId); * return Json( * DictionaryHelper.GetDicItemByCode(CodeConstManager.STATUS_ONAGREEMENT, * CodeConstManager.STATUS_ONAGREEMENT).Name, JsonRequestBehavior.AllowGet); * } * * } */ return(null); }
public static List <DictionaryInfo> GetCorRefTypeList() { ncelsEntities entities = UserHelper.GetCn(); var items = entities.Dictionaries.Where(o => o.Type == "DepartmentTypeDictionary").ToList(); var data = items.Select(o => new DictionaryInfo() { NameRu = o.Name, NameKz = o.NameKz, TypeRu = o.Id.ToString(), TypeKz = o.Id.ToString(), }).OrderBy(o => o.NameRu).ToList(); data.Insert(0, new DictionaryInfo() { NameRu = Messages.Property_Все_394__00, NameKz = Messages.Property_Все_394__00, TypeKz = null, TypeRu = null }); return(data); }
public static void SendChangeDateNotifications(int commissionId, DateTime prevDate) { using (var db = new ncelsEntities()) { var dbCommission = db.Commissions.Single(x => x.Id == commissionId); var dbUnits = db.CommissionUnits.Where(x=>x.CommissionId == commissionId).ToList(); var notificationManager = new NotificationManager(); var sendCount = 0; foreach (var dbUnit in dbUnits) { var msg = "Изменилась дата заседания " + dbCommission.FullNumber + " с " + prevDate.ToShortDateString() + " на " + dbCommission.Date.ToShortDateString(); notificationManager.SendNotificationAnonymous(msg, ObjectType.Commission, dbCommission.Id.ToString(), dbUnit.EmployeeId); sendCount++; } ActionLogger.WriteInt(db, (Guid?)null, "Сформировано " + sendCount + " уведомлений участникам коммиссий о изменении даты заседания "+ dbCommission.FullNumber, withoutIp: true); db.SaveChanges(); } }