protected void rptData_ItemCommand(object source, RepeaterCommandEventArgs e) { if (e.CommandArgument != null) { Int64 RuleIDP = Int64.Parse(e.CommandArgument.ToString()); switch (e.CommandName) { case "cEdit": hfID.Value = RuleIDP.ToString(); DataTable dtGetCity = KnowYourRuleClass.GetKnowYourRule_ByID(RuleIDP); if (dtGetCity.Rows.Count > 0) { DataRow dr = dtGetCity.Rows[0]; tbRuleName.Text = dr["Rules"].ToString(); txtsource.Text = dr["sourcename"].ToString(); cbIsActive.Checked = bool.Parse(dtGetCity.Rows[0]["IsActive"].ToString()); cbIsShow.Checked = bool.Parse(dtGetCity.Rows[0]["IsShow"].ToString()); pnC.Visible = true; pnG.Visible = false; btAddNew.Visible = false; } break; case "cDelete": MEMBERS.SQLReturnValue mRes = KnowYourRuleClass.DeleteKnowYourRule_ByID(RuleIDP); ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('<b>" + mRes.MessageFromSQL + "</b>',1);", true); ClearControls(); BindData(); break; } } }
protected void btSave_Click(object sender, EventArgs e) { KnowYourRuleClass obj = new KnowYourRuleClass(); obj.Rules = tbRuleName.Text; obj.IsActive = cbIsActive.Checked; obj.IsShow = cbIsShow.Checked; obj.sourcename = txtsource.Text; MEMBERS.SQLReturnValue mRes; if (hfID.Value == string.Empty) { obj.Flag = "ADD"; mRes = KnowYourRuleClass.Insert_Update_KnowYourRule(obj); } else { obj.Flag = "EDIT"; obj.RuleIDP = Int64.Parse(hfID.Value); mRes = KnowYourRuleClass.Insert_Update_KnowYourRule(obj); } ScriptManager.RegisterStartupScript(this, this.GetType(), "noti", "setMessage('<b>" + mRes.MessageFromSQL + "</b>',1);", true); ClearControls(); BindData(); pnC.Visible = false; pnG.Visible = true; btAddNew.Visible = true; }
public void BindData() { rptData.DataSource = KnowYourRuleClass.GetAllKnowYourRule(); rptData.DataBind(); }