Exemplo n.º 1
0
 public FileResult GetResultTable()
 {
     if (Request.Cookies["Login"] == null)
     {
         return(null);
     }
     else
     {
         byte[] data     = PrintedForm.FullTakingBloodExls();
         var    response = new FileContentResult(data, "application/octet-stream")
         {
             FileDownloadName = "Расширенная информация о донорах.xlsx"
         };
         return(response);
     }
 }
Exemplo n.º 2
0
        private void btnGetReport_Click(object sender, EventArgs e)
        {
            btnGetReport.Enabled = false;
            string GetReportRL = string.Format(@"/api/Report/GetReport/");
            var    client      = new ClientConnect();
            var    param       = new Dictionary <string, string>();
            var    header      = new Dictionary <string, string>();

            param.Add("FormsID", "18");
            _Forms.UniqueDataStructure.AcceptChanges();
            DataSet TheData = new DataSet();

            TheData.Tables.Add(_Forms.UniqueDataStructure);
            string JSOResult;

            JSOResult = JsonConvert.SerializeObject(TheData, Formatting.Indented);
            try
            {
                var response = Task.Run(() => client.PostWithBodyAndParameters(GetReportRL, param, JSOResult)).Result;
                _PrintedForm        = JsonConvert.DeserializeObject <PrintedForm>(response);
                txtPDF.Text         = _PrintedForm.PDFLocation;
                txtFormPrintID.Text = _PrintedForm.PrintedFromID;
                if (_PrintedForm.Success)
                {
                    txtError.Text = "NO ERROR";
                }
                else
                {
                    txtError.Text = _PrintedForm.Error;
                }
            }
            catch (Exception error)
            {
                txtError.Text = error.Message;
            }
            btnGetReport.Enabled = true;
        }