protected void BtnSave_Click(object sender, EventArgs e) { int InsertRow = 0; try { DS = Obj_SL.ChkDuplicate(TxtTower.Text.Trim(), out StrError); if (DS.Tables[0].Rows.Count > 0) { obj_Comm.ShowPopUpMsg("Tower Name Already Exist..!", this.Page); TxtTower.Focus(); } else { Entity_SL.TowerName = TxtTower.Text.Trim(); Entity_SL.UserId = Convert.ToInt32(Session["UserId"]); Entity_SL.LoginDate = DateTime.Now; Entity_SL.IsDeleted = false; InsertRow = Obj_SL.InsertRecord(ref Entity_SL, out StrError); if (InsertRow != 0) { obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page); MakeEmptyForm(); Entity_SL = null; obj_Comm = null; } } } catch (Exception ex) { throw new Exception(ex.Message); } }
//User Right Function=========== private void MakeEmptyForm() { if (!FlagAdd) { BtnSave.Visible = true; } BtnUpdate.Visible = false; BtnDelete.Visible = false; TxtTower.Text = string.Empty; TxtSearch.Text = string.Empty; ReportGrid(StrCondition); TxtTower.Focus(); }
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_SL.GetTowerForEdit(Convert.ToInt32(e.CommandArgument), out StrError); if (DS.Tables.Count > 0 && DS.Tables[0].Rows.Count > 0) { TxtTower.Text = DS.Tables[0].Rows[0]["TowerName"].ToString(); } else { MakeEmptyForm(); } DS = null; Obj_SL = null; if (!FlagEdit) { BtnUpdate.Visible = true; } BtnSave.Visible = false; if (!FladDel) { BtnDelete.Visible = true; } TxtTower.Focus(); } break; } } } catch (Exception ex) { throw new Exception(ex.Message); } }