Пример #1
0
        public IHttpActionResult Put(int id, DTO_PRO_PhieuXemXetDaoDuc tbl_PRO_PhieuXemXetDaoDuc)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tbl_PRO_PhieuXemXetDaoDuc.ID)
            {
                return(BadRequest());
            }
            tbl_PRO_PhieuXemXetDaoDuc.JSON_CacCoQuan = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_PhieuXemXetDaoDuc.ListCoQuan);
            tbl_PRO_PhieuXemXetDaoDuc.ListNCV.Insert(0, tbl_PRO_PhieuXemXetDaoDuc.NCVChinh);
            tbl_PRO_PhieuXemXetDaoDuc.JSON_CacNCV = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_PhieuXemXetDaoDuc.ListNCV);
            tbl_PRO_PhieuXemXetDaoDuc.JSON_ChuKy  = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_PhieuXemXetDaoDuc.CanKet_ListChuKy);
            bool result = BS_PRO_PhieuXemXetDaoDuc.put_PRO_PhieuXemXetDaoDuc(db, id, tbl_PRO_PhieuXemXetDaoDuc, Username);


            if (result)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            else
            {
                return(NotFound());
            }
        }
Пример #2
0
        public IHttpActionResult Get(int id)
        {
            DTO_PRO_PhieuXemXetDaoDuc tbl_PRO_PhieuXemXetDaoDuc = BS_PRO_PhieuXemXetDaoDuc.get_PRO_PhieuXemXetDaoDuc(db, id);

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

            return(Ok(tbl_PRO_PhieuXemXetDaoDuc));
        }
Пример #3
0
        public IHttpActionResult Delete(int id)
        {
            bool check = BS_PRO_PhieuXemXetDaoDuc.check_PRO_PhieuXemXetDaoDuc_Exists(db, id);

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

            bool result = BS_PRO_PhieuXemXetDaoDuc.delete_PRO_PhieuXemXetDaoDuc(db, id, Username);

            if (result)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            return(Conflict());
        }
Пример #4
0
        public IHttpActionResult Post(DTO_PRO_PhieuXemXetDaoDuc tbl_PRO_PhieuXemXetDaoDuc)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            DTO_PRO_PhieuXemXetDaoDuc result = BS_PRO_PhieuXemXetDaoDuc.post_PRO_PhieuXemXetDaoDuc(db, tbl_PRO_PhieuXemXetDaoDuc, Username);

            result.JSON_CacCoQuan = Newtonsoft.Json.JsonConvert.SerializeObject(result.ListCoQuan);
            result.ListNCV.Insert(0, result.NCVChinh);
            result.JSON_CacNCV = Newtonsoft.Json.JsonConvert.SerializeObject(result.ListNCV);
            result.JSON_ChuKy  = Newtonsoft.Json.JsonConvert.SerializeObject(result.CanKet_ListChuKy);

            if (result != null)
            {
                return(CreatedAtRoute("get_PRO_PhieuXemXetDaoDuc", new { id = result.ID }, result));
            }
            return(Conflict());
        }
Пример #5
0
        public IHttpActionResult GetCustom(int idDeTai, bool?isInput = false)
        {
            DTO_PRO_PhieuXemXetDaoDuc tbl_PRO_PhieuXemXetDaoDuc = BS_PRO_PhieuXemXetDaoDuc.get_PRO_PhieuXemXetDaoDucCustom(db, idDeTai);

            string html      = "";
            string htmlPrint = "";

            using (System.IO.StreamReader r = new System.IO.StreamReader(System.Web.Hosting.HostingEnvironment.MapPath("~/Content/FormTemplate/PhieuXemXetDaoDuc.html")))
            {
                htmlPrint = r.ReadToEnd();
            }
            using (System.IO.StreamReader r = new System.IO.StreamReader(System.Web.Hosting.HostingEnvironment.MapPath("~/Content/FormTemplate/PhieuXemXetDaoDuc_Input.html")))
            {
                html = r.ReadToEnd();
            }

            tbl_PRO_PhieuXemXetDaoDuc.HTML      = html;
            tbl_PRO_PhieuXemXetDaoDuc.HTMLPrint = htmlPrint;

            return(Ok(tbl_PRO_PhieuXemXetDaoDuc));
        }
Пример #6
0
 public IQueryable <DTO_PRO_PhieuXemXetDaoDuc> Get()
 {
     return(BS_PRO_PhieuXemXetDaoDuc.get_PRO_PhieuXemXetDaoDuc(db, QueryStrings));
 }