/// <summary> /// Модель отчета из БД которая отправится в Open Xml /// </summary> /// <param name="report">Параметры отчета Report</param> /// <returns></returns> public void ReportInvoice(ref EfDatabaseInvoice.Report report) { try { ModelSelect model = new ModelSelect { LogicaSelect = SqlSelectModel(report.ParamRequest.IdSelect) }; report.Main.Formed = Inventory.Database.SqlQuery <Formed>(model.LogicaSelect.SelectUser, new SqlParameter(model.LogicaSelect.SelectedParametr.Split(',')[0], 1), new SqlParameter(model.LogicaSelect.SelectedParametr.Split(',')[1], report.ParamRequest.IdOut), new SqlParameter(model.LogicaSelect.SelectedParametr.Split(',')[2], report.ParamRequest.IdUsers)).ToList()[0]; report.Main.Received = Inventory.Database.SqlQuery <Received>(model.LogicaSelect.SelectUser, new SqlParameter(model.LogicaSelect.SelectedParametr.Split(',')[0], 2), new SqlParameter(model.LogicaSelect.SelectedParametr.Split(',')[1], report.ParamRequest.IdOut), new SqlParameter(model.LogicaSelect.SelectedParametr.Split(',')[2], report.ParamRequest.IdUsers)).ToList()[0]; report.Body = Inventory.Database.SqlQuery <Body>(model.LogicaSelect.SelectUser, new SqlParameter(model.LogicaSelect.SelectedParametr.Split(',')[0], 3), new SqlParameter(model.LogicaSelect.SelectedParametr.Split(',')[1], report.ParamRequest.IdOut), new SqlParameter(model.LogicaSelect.SelectedParametr.Split(',')[2], report.ParamRequest.IdUsers)).ToArray(); report.Main.Organization = Inventory.Database.SqlQuery <EfDatabaseInvoice.Organization>(model.LogicaSelect.SelectUser, new SqlParameter(model.LogicaSelect.SelectedParametr.Split(',')[0], 4), new SqlParameter(model.LogicaSelect.SelectedParametr.Split(',')[1], report.ParamRequest.IdOut), new SqlParameter(model.LogicaSelect.SelectedParametr.Split(',')[2], report.ParamRequest.IdUsers)).ToList()[0]; } catch (Exception e) { Console.WriteLine(e); } }
/// <summary> /// Получение модели из БД /// </summary> /// <param name="report">Отчет</param> public void ReportInvoice(ref EfDatabaseInvoice.Report report) { SelectSql select = new SelectSql(); AddObjectDb.AddObjectDb adddoc = new AddObjectDb.AddObjectDb(); select.ReportInvoice(ref report); report.Main.Barcode = new Barcode(); report.Main.Barcode.Id = adddoc.AddDocument(report.ParamRequest.IdNameDocument, report.Main.Received.NameUser, report.ParamRequest.IdUsers); }