protected void saveObject() { try { //validate if (!validate()) { return; } saveTimesheet(); int intTimesheetID = Convert.ToInt32(txtTimeSheetID.Text); TBL_BAO_CAO_CV obj = new TBL_BAO_CAO_CV(); if (String.IsNullOrEmpty(txtObjectID.Text)) //Create new item { obj.NGAY_TAO = DateTime.Now; obj.ID_NGUOI_TAO = (int)Commons.CheckUserInfo.GetUserId(); obj.TT_XOA = false; entities.TBL_BAO_CAO_CV.Add(obj); } else //Edit the item { int intObjID = Convert.ToInt32(txtObjectID.Text); obj = entities.TBL_BAO_CAO_CV.Find(intObjID); } obj.ID_TIMESHEET = intTimesheetID; obj.TEN_CONG_VIEC = txtTenCongViec_1.Text; obj.MO_TA = txtMoTaChiTiet_1.Text; obj.TONG_THOI_GIAN = Convert.ToDouble(txtThoiGIan_1.Text); //Set Loai Cong Viec if (!Commons.CommonFuncs.BLANK_ITEM_VALUE.Equals(drpLoaiCongViec_1.SelectedValue)) { obj.ID_LOAI_CONG_VIEC = Convert.ToInt32(drpLoaiCongViec_1.SelectedValue); } obj.NGAY_SUA = DateTime.Now; obj.ID_NGUOI_SUA = (int)Commons.CheckUserInfo.GetUserId(); //Update Info entities.SaveChanges(); //refresh GridView getBaoCaoCV(); //Close Popup DIV_BACKGROUND_POP_UP.Visible = false; } catch (Exception ex) { throw ex; } }
protected void saveObject_Row_5() { try { //validate if (!validate_Row_5()) { return; } TBL_BAO_CAO_CV obj = new TBL_BAO_CAO_CV(); if (String.IsNullOrEmpty(txtObjectID.Text)) //Create new item { obj.NGAY_TAO = DateTime.Now; obj.ID_NGUOI_TAO = (int)Commons.CheckUserInfo.GetUserId(); obj.TT_XOA = false; entities.TBL_BAO_CAO_CV.Add(obj); } else //Edit the item { int intObjID = Convert.ToInt32(txtObjectID.Text); obj = entities.TBL_BAO_CAO_CV.Find(intObjID); } obj.TEN_CONG_VIEC = txtTenCongViec_5.Text; obj.MO_TA = txtMoTaChiTiet_5.Text; obj.TONG_THOI_GIAN = Convert.ToDouble(txtThoiGIan_5.Text); //Set Loai Cong Viec if (!Commons.CommonFuncs.BLANK_ITEM_VALUE.Equals(drpLoaiCongViec_5.SelectedValue)) { obj.ID_LOAI_CONG_VIEC = Convert.ToInt32(drpLoaiCongViec_5.SelectedValue); } obj.NGAY_SUA = DateTime.Now; obj.ID_NGUOI_SUA = (int)Commons.CheckUserInfo.GetUserId(); //Update Info entities.SaveChanges(); } catch (Exception ex) { throw ex; } }