public int Update(CTDiem ctd) { SqlParameter[] parm = new SqlParameter[] { new SqlParameter(PARM_MACTDIEM, SqlDbType.Int), new SqlParameter(PARM_MABANGDIEM, SqlDbType.Int), new SqlParameter(PARM_MAHOCSINH, SqlDbType.Int), new SqlParameter(PARM_MAMONHOC, SqlDbType.Int), new SqlParameter(PARM_MALOAIDIEM, SqlDbType.Int), new SqlParameter(PARM_DIEM, SqlDbType.Int), new SqlParameter(PARM_DIEMTBMON, SqlDbType.Float), new SqlParameter(PARM_MAGIAOVIEN, SqlDbType.Int), }; parm[0].Value = ctd.Mactdiem; parm[1].Value = ctd.Mabangdiem; parm[2].Value = ctd.Mahocsinh; parm[3].Value = ctd.Mamonhoc; parm[4].Value = ctd.Maloaidiem; parm[5].Value = ctd.Diem; parm[6].Value = ctd.Diemtbmon; parm[7].Value = ctd.Magiaovien; return(DataAccessHelper.ExecuteNonQuery(DataAccessHelper.ConnectionString, CommandType.StoredProcedure, "tbl_CTDiem_Upd", parm)); }
public int Update(CTDiem hs) { //if (checkmaGiaoVien_ID(hs.Magiaovien) != 0) //{ return(dal.Update(hs)); //} //else return -1; }
public int Insert(CTDiem hs) { //if (checkmaGiaoVien_ID(hs.Madiem) == 0) //{ return(dal.Insert(hs)); //} //else return -1; }
//public JsonResult GetHocSinhbyID(int magv) //{ // try // { // JsonSerializerSettings jss = new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }; // var obj = hs.getmaGiaoVien(magv); // var result = JsonConvert.SerializeObject(obj, Formatting.Indented, jss); // return this.Json(result, JsonRequestBehavior.AllowGet); // } // catch (Exception) // { // return Json(-1, JsonRequestBehavior.AllowGet); // } //} public JsonResult AjaxUpdateCTDiem(CTDiem obj) { try { if (obj != null) { int result = hs.Update(obj); return(Json(result, JsonRequestBehavior.AllowGet)); } else { return(Json(-1, JsonRequestBehavior.AllowGet)); } } catch { return(Json(-1, JsonRequestBehavior.AllowGet)); } }
public IHttpActionResult PostDiem(Diem diem) { try { if (diem.MaDiem == 0) { db.Diems.Add(diem); } else { db.Entry(diem).State = EntityState.Modified; } foreach (var item in diem.CTDiems) { if (item.MaCTDiem == 0) { db.CTDiems.Add(item); } else { db.Entry(item).State = EntityState.Modified; } } foreach (var item in diem.DeletedCTBangDiem.Split(',').Where(x => x != "")) { CTDiem x = db.CTDiems.Find(Convert.ToInt64(item)); db.CTDiems.Remove(x); } db.SaveChanges(); return(Ok()); } catch (Exception ex) { throw ex; } }