protected void BtnSave_Click(object sender, EventArgs e) { int InsertRow = 0; try { DS = Obj_PR.ChkDuplicate(TxtPropertyType.Text.Trim(), out StrError); if (DS.Tables[0].Rows.Count > 0) { obj_Comm.ShowPopUpMsg("PropertyTypeDesc Name Already Exist..!", this.Page); TxtPropertyType.Focus(); } else { Entity_PR.PropertyTypeDesc = TxtPropertyType.Text.Trim(); Entity_PR.LoginId = Convert.ToInt32(Session["UserId"]); Entity_PR.LoginDate = DateTime.Now; InsertRow = Obj_PR.InsertRecord(ref Entity_PR, out StrError); if (InsertRow != 0) { obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page); MakeEmptyForm(); Entity_PR = null; obj_Comm = null; } } } catch (Exception ex) { throw new Exception(ex.Message); } }
private void MakeEmptyForm() { TxtPropertyType.Focus(); if (!FlagAdd) { BtnSave.Visible = true; } BtnUpdate.Visible = false; BtnDelete.Visible = false; TxtPropertyType.Text = string.Empty; TxtSearch.Text = string.Empty; ReportGrid(StrCondition); }
protected void GrdReport_ItemCommand(object source, RepeaterCommandEventArgs e) { try { switch (e.CommandName) { case ("Select"): { if (Convert.ToInt32(e.CommandArgument) != 0) { ViewState["EditID"] = Convert.ToInt32(e.CommandArgument); DS = Obj_PR.GetPropertyTypeForEdit(Convert.ToInt32(e.CommandArgument), out StrError); if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0) { TxtPropertyType.Text = DS.Tables[0].Rows[0]["PropertyTypeDesc"].ToString(); } else { MakeEmptyForm(); } DS = null; Obj_PR = null; if (!FlagEdit) { BtnUpdate.Visible = true; } BtnSave.Visible = false; if (!FlagDel) { BtnDelete.Visible = true; } TxtPropertyType.Focus(); } break; } } } catch (Exception ex) { throw new Exception(ex.Message); } }
private void GetEditRecord() { if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0) { TxtPropertyType.Text = DS.Tables[0].Rows[0]["PropertyTypeDesc"].ToString(); } else { MakeEmptyForm(); } DS = null; Obj_PR = null; if (!FlagEdit) { BtnUpdate.Visible = true; } BtnSave.Visible = false; if (!FlagDel) { BtnDelete.Visible = true; } TxtPropertyType.Focus(); }