public IHttpActionResult Post(DTO_PRO_ThuyetMinhDeTai tbl_PRO_ThuyetMinhDeTai)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            tbl_PRO_ThuyetMinhDeTai.A8_JSON_CoQuanPhoiHopThucHien          = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListCoQuanPhoiHop);
            tbl_PRO_ThuyetMinhDeTai.A9_JSON_NhanLucNghienCuu_ChuNhiemDeTai = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ChuNhiemDeTai);
            tbl_PRO_ThuyetMinhDeTai.A9_JSON_NhanLucNghienCuu      = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListNhanLucNghienCuu);
            tbl_PRO_ThuyetMinhDeTai.B2_JSON_GioiThieuChuyenGia    = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListGioiThieuChuyenGia);
            tbl_PRO_ThuyetMinhDeTai.B326_JSON_CacBienSoCanThuThap = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListBienSo);
            tbl_PRO_ThuyetMinhDeTai.B313_JSON_KeHoachThucHien     = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListKeHoachThucHien);
            tbl_PRO_ThuyetMinhDeTai.B52_JSON_TongHopKinhPhi       = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListKinhPhiTongHop);
            tbl_PRO_ThuyetMinhDeTai.PhuLuc_JSON_NguyenVatLieu     = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListKinhPhiNguyenVatLieu);
            tbl_PRO_ThuyetMinhDeTai.PhuLuc_JSON_KhoanCongLaoDong  = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListKinhPhiCongLaoDong);
            tbl_PRO_ThuyetMinhDeTai.PhuLuc_JSON_ThietBi           = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListKinhPhiThietBi);
            tbl_PRO_ThuyetMinhDeTai.PhuLuc_JSON_ChiKhac           = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListKinhPhiKhac);

            DTO_PRO_ThuyetMinhDeTai result = BS_PRO_ThuyetMinhDeTai.post_PRO_ThuyetMinhDeTai(db, tbl_PRO_ThuyetMinhDeTai, Username);

            if (result != null)
            {
                BS_HelperReference.PRO_ThuyetMinhDeTai_Update(db, tbl_PRO_ThuyetMinhDeTai.IDDeTai);
                return(CreatedAtRoute("get_PRO_ThuyetMinhDeTai", new { id = result.ID }, result));
            }
            return(Conflict());
        }
Esempio n. 2
0
        public IHttpActionResult Post(DTO_PRO_DonXinDanhGiaDaoDuc tbl_PRO_DonXinDanhGiaDaoDuc)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            DTO_PRO_DonXinDanhGiaDaoDuc result = BS_PRO_DonXinDanhGiaDaoDuc.save_PRO_DonXinDanhGiaDaoDuc(db, tbl_PRO_DonXinDanhGiaDaoDuc, Username);

            if (result != null)
            {
                BS_HelperReference.PRO_DonXinDanhGiaDaoDuc_Update(db, tbl_PRO_DonXinDanhGiaDaoDuc.IDDeTai);
                return(CreatedAtRoute("get_PRO_DonXinDanhGiaDaoDuc", new { id = result.ID }, result));
            }
            return(Conflict());
        }
        public IHttpActionResult Put(int id, DTO_CUS_HRM_STAFF_NhanSu tbl_CUS_HRM_STAFF_NhanSu)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tbl_CUS_HRM_STAFF_NhanSu.ID || PartnerID != tbl_CUS_HRM_STAFF_NhanSu.IDPartner)
            {
                return(BadRequest());
            }

            string checkData = BS_CUS_HRM_STAFF_NhanSu.check_CUS_HRM_STAFF_NhanSu(db, id, tbl_CUS_HRM_STAFF_NhanSu);

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

            bool   isChangeCode = false;
            string oldCode      = "";
            bool   result       = BS_CUS_HRM_STAFF_NhanSu.put_CUS_HRM_STAFF_NhanSu_Custom(db, PartnerID, id, tbl_CUS_HRM_STAFF_NhanSu, Username, out isChangeCode, out oldCode);

            if (result)
            {
                BS_HelperReference.STAFF_Info_Update(db, id);

                // Đổi code => đổi avt
                if (isChangeCode)
                {
                    string mapPath          = System.Web.HttpContext.Current.Server.MapPath("~/");
                    string uploadPath       = "Uploads/HRM/Staffs/Avatars/" + oldCode + ".jpg";
                    string strDirectoryPath = mapPath + uploadPath;
                    if (System.IO.File.Exists(strDirectoryPath))
                    {
                        string strFilePath = mapPath + "Uploads/HRM/Staffs/Avatars/" + tbl_CUS_HRM_STAFF_NhanSu.Code + ".jpg";
                        System.IO.File.Move(strDirectoryPath, strFilePath);
                    }
                }

                return(StatusCode(HttpStatusCode.NoContent));
            }
            else
            {
                return(NotFound());
            }
        }
Esempio n. 4
0
        public IHttpActionResult Put(int id, DTO_PRO_DonXinDanhGiaDaoDuc tbl_PRO_DonXinDanhGiaDaoDuc)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            var result = BS_PRO_DonXinDanhGiaDaoDuc.save_PRO_DonXinDanhGiaDaoDuc(db, tbl_PRO_DonXinDanhGiaDaoDuc, Username);

            if (result != null)
            {
                BS_HelperReference.PRO_DonXinDanhGiaDaoDuc_Update(db, tbl_PRO_DonXinDanhGiaDaoDuc.IDDeTai);
                return(StatusCode(HttpStatusCode.NoContent));
            }
            else
            {
                return(NotFound());
            }
        }
        public IHttpActionResult Put(int id, DTO_PRO_ThuyetMinhDeTai tbl_PRO_ThuyetMinhDeTai)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

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

            tbl_PRO_ThuyetMinhDeTai.A8_JSON_CoQuanPhoiHopThucHien          = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListCoQuanPhoiHop);
            tbl_PRO_ThuyetMinhDeTai.A9_JSON_NhanLucNghienCuu_ChuNhiemDeTai = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ChuNhiemDeTai);
            tbl_PRO_ThuyetMinhDeTai.A9_JSON_NhanLucNghienCuu      = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListNhanLucNghienCuu);
            tbl_PRO_ThuyetMinhDeTai.B2_JSON_GioiThieuChuyenGia    = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListGioiThieuChuyenGia);
            tbl_PRO_ThuyetMinhDeTai.B326_JSON_CacBienSoCanThuThap = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListBienSo);
            tbl_PRO_ThuyetMinhDeTai.B313_JSON_KeHoachThucHien     = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListKeHoachThucHien);
            tbl_PRO_ThuyetMinhDeTai.B52_JSON_TongHopKinhPhi       = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListKinhPhiTongHop);
            tbl_PRO_ThuyetMinhDeTai.PhuLuc_JSON_NguyenVatLieu     = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListKinhPhiNguyenVatLieu);
            tbl_PRO_ThuyetMinhDeTai.PhuLuc_JSON_KhoanCongLaoDong  = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListKinhPhiCongLaoDong);
            tbl_PRO_ThuyetMinhDeTai.PhuLuc_JSON_ThietBi           = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListKinhPhiThietBi);
            tbl_PRO_ThuyetMinhDeTai.PhuLuc_JSON_ChiKhac           = Newtonsoft.Json.JsonConvert.SerializeObject(tbl_PRO_ThuyetMinhDeTai.ListKinhPhiKhac);

            bool result = BS_PRO_ThuyetMinhDeTai.put_PRO_ThuyetMinhDeTai(db, id, tbl_PRO_ThuyetMinhDeTai, Username);

            if (result)
            {
                BS_HelperReference.PRO_ThuyetMinhDeTai_Update(db, tbl_PRO_ThuyetMinhDeTai.IDDeTai);
                return(StatusCode(HttpStatusCode.NoContent));
            }
            else
            {
                return(NotFound());
            }
        }