protected void ddlUnit_SelectedIndexChanged(object sender, EventArgs e) { if (ddlUnit.SelectedValue == "-Select-") { clearInfo(); ddlUnit.Focus(); BtnSubmit.Visible = true; BtnUpdate.Visible = false; } try { if (ddlUnit.SelectedValue != "-Select-") { int code = Converter.GetInteger(ddlUnit.SelectedValue); A2ZUNITDTO getDTO = (A2ZUNITDTO.GetInformation(code)); if (getDTO.UnitNo > 0) { hdnGrpCode.Text = Converter.GetString(getDTO.UnitNo); txtDescription.Text = Converter.GetString(getDTO.UnitDesc); txtDescription.Focus(); BtnSubmit.Visible = false; BtnUpdate.Visible = true; } } } catch (Exception ex) { throw ex; } }
protected void BtnSubmit_Click(object sender, EventArgs e) { try { if (txtDescription.Text != string.Empty) { gvDetail(); gvDetailInfo.Visible = false; int totrec = gvDetailInfo.Rows.Count; int lastGrpCode = (totrec + 1); if (lastGrpCode < 10) { hdnGrpCode.Text = Converter.GetString("0" + lastGrpCode); } A2ZUNITDTO objDTO = new A2ZUNITDTO(); objDTO.UnitNo = Converter.GetInteger(hdnGrpCode.Text); objDTO.UnitDesc = Converter.GetString(txtDescription.Text); int roweffect = A2ZUNITDTO.InsertInformation(objDTO); if (roweffect > 0) { UnitDropdown(); clearInfo(); BtnUpdate.Visible = false; BtnSubmit.Visible = true; gvDetail(); gvDetailInfo.Visible = false; txtDescription.Text = string.Empty; txtDescription.Focus(); } } } catch (Exception ex) { throw ex; } }
protected void BtnUpdate_Click(object sender, EventArgs e) { if (ddlUnit.SelectedValue != "-Select-") { A2ZUNITDTO UpDTO = new A2ZUNITDTO(); UpDTO.UnitNo = Converter.GetInteger(hdnGrpCode.Text); UpDTO.UnitDesc = Converter.GetString(txtDescription.Text); int roweffect = A2ZUNITDTO.UpdateInformation(UpDTO); if (roweffect > 0) { UnitDropdown(); clearInfo(); BtnUpdate.Visible = false; BtnSubmit.Visible = true; gvDetail(); gvDetailInfo.Visible = false; txtDescription.Text = string.Empty; txtDescription.Focus(); } } }