public JsonResult <CommonResponse <ExtendedCardDataModel <CardDataModel> > > GetCardReconciliationList(Guid cardId) { Document document = context.ObjectContext.GetObject <Document>(cardId); // получил документ var response = new CommonResponse <ExtendedCardDataModel <CardDataModel> >(); if (document == null || document?.MainInfo == null) { response.InitializeError(Resources.Error_OperationIsNotAllowed); return(Json(response)); } DocumentHelper dh = new DocumentHelper(document, context); #region Получаем ОБЩУЮ ИНФОРМАЦИЮ по документу var result = new ExtendedCardDataModel <CardDataModel>() { ShortName = dh.Name, //Наименование/ предмет договора NumberItemName = dh.DocumentName, // НомерДокумента Description = dh.Description, //Наименование объекта Author = dh.ResponseStaffName, //Заказчик Partners = string.Join(";", dh.PartnersCompany.Select(x => x.Name).ToArray()), ContractAmount = dh.ContractAmount, //Сумма контракта ContractTotalAmount = dh.ContractTotalAmount, EstimatedCost = dh.EstimatedCost, Deposit = dh.Deposit, ContractNotes = dh.ContractNotes, Deadline = dh.ContractBegin == null || dh.ContractEnd == null ? "" : $"c {dh.ContractBegin.ToShortDateString()} по {dh.ContractEnd.ToShortDateString()}", DeadlineNotes = dh.DeadlineNotes, Guarantee = dh.Guarantee, Content = dh.Content //CardRegistrarName = documentMainInfo?.Registrar?.DisplayName, //CreateDate = document.CreateDate.ToString("dd.MM.yyyy HH:mm:ss"), ////Author = documentMainInfo?.Author?.DisplayName, //State = document.SystemInfo.State.LocalizedName, //ItemName = documentMainInfo?.Item?.Name, }; List <CardDataModel> cardModelList = new List <CardDataModel>(); var cards = dh.Cards; if (cards.Count > 0) { foreach (CardData card in cards) { } } #endregion response.InitializeSuccess(result); return(Json(response)); }
public JsonResult <CommonResponse <ExtendedCardDataModel <string> > > GetExtendedCardClarification(Guid cardId) { Document document = context.ObjectContext.GetObject <Document>(cardId); // получил документ var response = new CommonResponse <ExtendedCardDataModel <string> >(); if (document == null || document?.MainInfo == null) { response.InitializeError(Resources.Error_OperationIsNotAllowed); return(Json(response)); } //var sessionContext = this.serviceHelper.CurrentObjectContextProvider.GetOrCreateCurrentSessionContext(); //var kindId = this.serviceHelper.CardKindService.GetCardKindId(sessionContext, cardId); DocumentHelper dh = new DocumentHelper(document, context); if (dh.AcquaintanceStaff.Count == 0) { response.InitializeError("Не возможно отправить заявку в работу. Не указаны исполнители!"); return(Json(response)); } #region Получаем ОБЩУЮ ИНФОРМАЦИЮ по документу var result = new ExtendedCardDataModel <string>() { Id = dh.Id, CardRegistrarName = dh.RegistrarName, CreateDate = dh.CreatedDate, Author = dh.AuthorName, State = dh.State.LocalizedName, ItemName = dh.ItemName, ShortName = dh.Name, Description = dh.Content }; #endregion response.InitializeSuccess(result); return(Json(response)); }
public JsonResult <CommonResponse <ExtendedCardDataModel <CardStatusLogDataModel> > > GetCardStatusLogs(Guid cardId) { Document document = context.ObjectContext.GetObject <Document>(cardId); // получил документ var response = new CommonResponse <ExtendedCardDataModel <CardStatusLogDataModel> >(); if (document == null || document?.MainInfo == null) { response.InitializeError(Resources.Error_OperationIsNotAllowed); return(Json(response)); } DocumentHelper dh = new DocumentHelper(document, context); #region Получаем ОБЩУЮ ИНФОРМАЦИЮ по документу var result = new ExtendedCardDataModel <CardStatusLogDataModel>() { CardRegistrarName = dh.RegistrarName, CreateDate = dh.CreatedDate, Author = dh.AuthorName, State = dh.State.LocalizedName, ItemName = dh.ItemName, ShortName = dh.Name }; #endregion #region Получаем ЖУРНАЛ ПЕРЕХОДА СОСТОЯНИЙ var processStateSection = dh.GetDocument.GetSection(new Guid("0DBB2B16-C311-49B0-9612-647F7C7A7C31")); if (processStateSection.Count > 0) { foreach (BaseCardSectionRow row in processStateSection) { string labourness = row["Labourness"] as string; if (labourness != null) { labourness = labourness.Remove((labourness.IndexOf(".") + 1) + 2); } else { labourness = ""; } var employeeId = row["Employee"]?.ToString(); string employeeDisplayName = ""; if (!string.IsNullOrEmpty(employeeId)) { var employee = context.ObjectContext.GetObject <StaffEmployee>(new Guid(employeeId)); employeeDisplayName = employee?.DisplayName; } result.ChildList.Add(new CardStatusLogDataModel() { Id = "", EmployeeId = employeeId, EmployeeName = employeeDisplayName, WorkLabel = GetWorkLabelByCode(row["WorkLabel"]?.ToString()), Date = row["Date"] != null ? ((DateTime)row["Date"]).ToString("dd.MM.yyyy HH:mm") : "", EndDate = row["EndDate"] != null ? ((DateTime)row["EndDate"]).ToString("dd.MM.yyyy HH:mm") : "", Labourness = labourness }); } } #endregion response.InitializeSuccess(result); return(Json(response)); }
public JsonResult <CommonResponse <ExtendedCardDataModel <TaskDataModel> > > GetExtendedCardTasks(Guid cardId) { // Первый контекст //var context1 = this.serviceHelper.CurrentObjectContextProvider.GetOrCreateCurrentSessionContext(); //Document document1 = context1.ObjectContext.GetObject<Document>(cardId); // получил документ //var documentMainInfo1 = document1.MainInfo; Document document = context.ObjectContext.GetObject <Document>(cardId); // получил документ var response = new CommonResponse <ExtendedCardDataModel <TaskDataModel> >(); if (document == null || document?.MainInfo == null) { response.InitializeError(Resources.Error_OperationIsNotAllowed); return(Json(response)); } DocumentHelper dh = new DocumentHelper(document, context); //if (dh.State.DefaultName == "Is approving") { // //На согласовании, // response.InitializeError($"Данная функция недоступна для статуса документа: {dh.State.LocalizedName}"); // return Json(response); //} #region Получаем ОБЩУЮ ИНФОРМАЦИЮ по документу var result = new ExtendedCardDataModel <TaskDataModel>() { CardRegistrarName = dh.RegistrarName, CreateDate = dh.CreatedDate, Author = dh.AuthorName, CurrentPerformers = dh.CurrentAcquaintanceStaff, State = dh.State.LocalizedName, ItemName = dh.ItemName, ShortName = dh.Name, Description = dh.Content // СОДЕРЖАНИЕ (ОПИСАНИЕ) }; #endregion #region Получаем список ЗАДАНИЙ foreach (TaskListTask taskItem in dh.GetMainInfo.Tasks?.Tasks) { var task = taskItem?.Task; if (task != null) { var taskMainInfo = task?.MainInfo; //var tableSection = task.GetSection(new Guid("0FF89689-9B90-4C38-A3EF-4BEC8AE11A86")); //Отметка о начале и окончания работы задачи //foreach (BaseCardSectionRow tableRow in tableSection) { // var vv = tableRow["DateStart"] + " " + tableRow["DateEnd"]; //} result.ChildList.Add(new TaskDataModel() { Id = task?.GetObjectId().ToString(), Name = taskMainInfo.Name, Kind = task.SystemInfo?.CardKind.Name, Author = taskMainInfo.Author.DisplayName, State = task?.SystemInfo.State.LocalizedName, EndDate = taskMainInfo.EndDateActual?.ToString("dd.MM.yyyy HH:mm"), Performers = taskMainInfo?.SelectedPerformers?.FirstOrDefault()?.Employee.DisplayName, CurrentPerformers = task.CurrentPerformers?.FirstOrDefault()?.Employee.DisplayName, StartDate = taskMainInfo.StartDate?.ToString("dd.MM.yyyy HH:mm"), Laboriousness = taskMainInfo.Laboriousness, PercentCompleted = taskMainInfo.PercentCompleted.ToString() }); } } #endregion response.InitializeSuccess(result); return(Json(response)); }