public IHttpActionResult Get(int id)
        {
            DTO_PRO_BaoCaoTienDoNghienCuu tbl_PRO_BaoCaoTienDoNghienCuu = BS_PRO_BaoCaoTienDoNghienCuu.get_PRO_BaoCaoTienDoNghienCuu(db, id);

            if (tbl_PRO_BaoCaoTienDoNghienCuu == null)
            {
                return(NotFound());
            }

            return(Ok(tbl_PRO_BaoCaoTienDoNghienCuu));
        }
        public IHttpActionResult Delete(int id)
        {
            bool check = BS_PRO_BaoCaoTienDoNghienCuu.check_PRO_BaoCaoTienDoNghienCuu_Exists(db, id);

            if (!check)
            {
                return(NotFound());
            }

            bool result = BS_PRO_BaoCaoTienDoNghienCuu.delete_PRO_BaoCaoTienDoNghienCuu(db, id, Username);

            if (result)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            return(Conflict());
        }
Ejemplo n.º 3
0
        public HttpResponseMessage Get_BaoCaoTienDoNghienCuu()
        {
            string fileurl = "";
            var    package = GetTemplateWorkbook("DS-BaoCaoTienDoNghienCuu.xlsx", "DS-BaoCaoTienDoNghienCuu-" + DateTime.Now.ToString("HHmmss") + ".xlsx", out fileurl);

            ExcelWorkbook workBook = package.Workbook;

            if (workBook != null)
            {
                var ws   = workBook.Worksheets.FirstOrDefault(); //Worksheets["DS"];
                var data = BS_PRO_BaoCaoTienDoNghienCuu.get_PRO_BaoCaoTienDoNghienCuuTheoDeTaiChiTiet(db, QueryStrings);

                int rowid = 3;
                foreach (var item in data)
                {
                    int col = 2;
                    ws.Cells[rowid, col].Value = item.Sort; col++;
                    ws.Cells[rowid, col].Value = item.TenDeTai; col++;
                    ws.Cells[rowid, col].Value = item.ChuNhiemDeTai; col++;
                    ws.Cells[rowid, col].Value = item.NCVChinh; col++;
                    ws.Cells[rowid, col].Value = item.SoNCT; col++;
                    ws.Cells[rowid, col].Value = item.NgayDuyetNghienCuu; col++;
                    ws.Cells[rowid, col].Value = item.ThoiGianTienHanh; col++;
                    ws.Cells[rowid, col].Value = item.CompletePercent; col++;
                    ws.Cells[rowid, col].Value = item.SoLanDaBaoCao; col++;
                    ws.Cells[rowid, col].Value = item.CoMau; col++;
                    ws.Cells[rowid, col].Value = item.SoCaThuThapHopLe; col++;
                    ws.Cells[rowid, col].Value = item.TienDoThuNhanMau; col++;
                    ws.Cells[rowid, col].Value = item.KhoKhan; col++;
                    ws.Cells[rowid, col].Value = item.TinhTrangNghienCuuHienTai; col++;
                    ws.Cells[rowid, col].Value = item.TinhTrangNghienCuu; col++;
                    ws.Cells[rowid, col].Value = item.CreatedDate.ToString("dd/MM/yyy HH:mm:ss"); col++;
                    ws.Cells[rowid, col].Value = item.CreatedBy; col++;

                    rowid++;
                }

                package.Save();
            }

            return(downloadFile(fileurl));
        }
        public IHttpActionResult Post(DTO_PRO_BaoCaoTienDoNghienCuu tbl_PRO_BaoCaoTienDoNghienCuu)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            DTO_PRO_BaoCaoTienDoNghienCuu result = BS_PRO_BaoCaoTienDoNghienCuu.post_PRO_BaoCaoTienDoNghienCuuCustom(db, tbl_PRO_BaoCaoTienDoNghienCuu, Username);

            if (!string.IsNullOrEmpty(result.Error))
            {
                return(BadRequest(result.Error));
            }

            if (result != null)
            {
                return(CreatedAtRoute("get_PRO_BaoCaoTienDoNghienCuu", new { id = result.ID }, result));
            }
            return(Conflict());
        }
        public IHttpActionResult Put(int id, DTO_PRO_BaoCaoTienDoNghienCuu tbl_PRO_BaoCaoTienDoNghienCuu)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tbl_PRO_BaoCaoTienDoNghienCuu.ID)
            {
                return(BadRequest());
            }

            string result = BS_PRO_BaoCaoTienDoNghienCuu.put_PRO_BaoCaoTienDoNghienCuuCustom(db, id, tbl_PRO_BaoCaoTienDoNghienCuu, Username);

            if (string.IsNullOrEmpty(result))
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            else
            {
                return(BadRequest(result));
            }
        }
 public IQueryable <DTO_PRO_BaoCaoTienDoNghienCuu> GetAll()
 {
     return(BS_PRO_BaoCaoTienDoNghienCuu.get_PRO_BaoCaoTienDoNghienCuu(db, QueryStrings));
 }
 public List <DTO_PRO_BaoCaoTienDoNghienCuu_DeTai> GetTheoDeTai()
 {
     return(BS_PRO_BaoCaoTienDoNghienCuu.get_PRO_BaoCaoTienDoNghienCuuTheoDeTai(db, QueryStrings));
 }
 public IQueryable <DTO_PRO_BaoCaoTienDoNghienCuu> GetByDeTai(int deTaiId)
 {
     return(BS_PRO_BaoCaoTienDoNghienCuu.get_PRO_BaoCaoTienDoNghienCuuByDeTai(db, deTaiId, QueryStrings));
 }