protected void btnThem_Click(object sender, EventArgs e) { DRDTO drn = new DRDTO(); drn.MaClaim = ClaimID.ToString(); drn.MaLoaiDR = int.Parse(drTypeDR.SelectedItem.Value.ToString()); drn.MaItem = int.Parse(drItems.SelectedItem.Value.ToString()); string tendr = txtItem.Text; if (tendr != "") { drn.TenDR = tendr; bool ins = dr.Insert(drn); if (ins == true) { int maGDV = int.Parse(Request.Cookies["MaGDV"].Value); string noidung = gdv.LayTenTheoMa(maGDV) + " created item docsrequest of case " + ClaimID.ToString() + "."; SaveLogTracking(maGDV, noidung, ClaimID.ToString()); txtItem.Text = ""; loadLoaiDR(ClaimID); gvDRUpdate.Visible = false; gvDRList.Visible = true; } } else Response.Write("<script> alert('Enter item document request!');</script>"); }
public bool UpdateDocsRequest(DRDTO dr) { string sql = "sp_DocsRequest_Update"; List<SqlParameter> ds = new List<SqlParameter>(); SqlParameter id = new SqlParameter("@maDR", SqlDbType.Int); id.Value = dr.MaDR; ds.Add(id); SqlParameter ten = new SqlParameter("@tendr", SqlDbType.NVarChar); ten.Value = dr.TenDR; ds.Add(ten); SqlParameter tinhtrang = new SqlParameter("@tinhtrang", SqlDbType.NVarChar); tinhtrang.Value = dr.TinhTrang; ds.Add(tinhtrang); SqlParameter ngaynhan = new SqlParameter("@ngaynhan", SqlDbType.Date); ngaynhan.Value = dr.NgayNhan; ds.Add(ngaynhan); return SqlDataAcessHelper.exNonStoreParas(sql, ds); }
public bool Insert(DRDTO dr) { string sql = "sp_DocsRequest_Insert"; List<SqlParameter> ds = new List<SqlParameter>(); SqlParameter maloaidr = new SqlParameter("@maloaiDR", SqlDbType.Int); maloaidr.Value = dr.MaLoaiDR; ds.Add(maloaidr); SqlParameter maitem = new SqlParameter("@maitem", SqlDbType.Int); maitem.Value = dr.MaItem; ds.Add(maitem); SqlParameter maclaim = new SqlParameter("@maclaim", SqlDbType.NVarChar); maclaim.Value = dr.MaClaim; ds.Add(maclaim); SqlParameter ten = new SqlParameter("@tenDR", SqlDbType.NVarChar); ten.Value = dr.TenDR; ds.Add(ten); return SqlDataAcessHelper.exNonStoreParas(sql, ds); }
protected void gvDRUpdate_RowUpdating(object sender, GridViewUpdateEventArgs e) { GridViewRow row = gvDRUpdate.Rows[e.RowIndex]; TextBox txttendr = row.Cells[2].Controls[0] as TextBox; TextBox txttinhtrang = row.Cells[3].Controls[0] as TextBox; TextBox txtngay = (TextBox)row.FindControl("txtNgay"); DRDTO drdto = new DRDTO(); drdto.MaDR = int.Parse(gvDRUpdate.DataKeys[e.RowIndex].Value.ToString()); drdto.TenDR = txttendr.Text; drdto.TinhTrang = txttinhtrang.Text; string ngaynhan=txtngay.Text; if (ngaynhan != "") drdto.NgayNhan = DateTime.Parse(txtngay.Text); else Response.Write("<script>alert('Enter date received!');</script>"); bool up = dr.UpdateDocsRequest(drdto); if (up == true) { int maGDV = int.Parse(Request.Cookies["MaGDV"].Value); string noidung = gdv.LayTenTheoMa(maGDV) + " edited item docsrequest of case " + ClaimID.ToString() + "."; SaveLogTracking(maGDV, noidung, ClaimID.ToString()); e.Cancel = true; gvDRUpdate.EditIndex = -1; loadLoaiDR(ClaimID); LoadDRUpdate(ClaimID); gvDRUpdate.Visible = true; gvDRList.Visible = false; } else Response.Write("<script>alert('Update failed!');</script>"); }