protected void btnSubmitBranch_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtInsertBranchID.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ รหัสหน่วยงานในมหาวิทยาลัย')", true); return; } if (string.IsNullOrEmpty(txtInsertBranchName.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณาใส่ ชื่อหน่วยงานในมหาวิทยาลัย')", true); return; } ClassBranch b = new ClassBranch(); b.BRANCH_ID = Convert.ToInt32(txtInsertBranchID.Text); b.BRANCH_NAME = txtInsertBranchName.Text; if (b.CheckUseBranchID()) { b.InsertBranch(); BindData(); ClearData(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('เพิ่มข้อมูลเรียบร้อย')", true); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('มีรหัสหน่วยงานในมหาวิทยาลัยนี้ อยู่ในระบบแล้ว !')", true); } }
public RelicTree(string tsv, Dictionary <int, Relic> relics) { IdToRelics = relics; NameToId = new Dictionary <string, int>(); foreach (var id in IdToRelics.Keys) { NameToId[IdToRelics[id].Name] = id; } Branches = new Dictionary <string, ClassBranch>(); var rows = tsv.Split('\n'); for (int i = 1; i < rows.Length; i++) { var row = rows[i].Split('\t'); var classBranch = row[0]; var level = Int32.Parse(row[1]); var r1 = IdToRelics[Int32.Parse(row[2])]; var r2 = IdToRelics[Int32.Parse(row[4])]; var r3 = IdToRelics[Int32.Parse(row[6])]; var r4 = IdToRelics[Int32.Parse(row[8])]; var r5 = IdToRelics[Int32.Parse(row[10])]; var r6 = IdToRelics[Int32.Parse(row[12])]; if (!Branches.ContainsKey(classBranch)) { Branches[classBranch] = new ClassBranch(); } Branches[classBranch].LevelBranches[level] = new LevelBranch(r1, r2, r3, r4, r5, r6); } }
void BindData1() { ClassBranch b = new ClassBranch(); DataTable dt = b.GetBranchSearch(txtSearchBranchID.Text, txtSearchBranchName.Text); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
void BindData() { ClassBranch b = new ClassBranch(); DataTable dt = b.GetBranch("", ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
protected void btnSearchRefresh_Click(object sender, EventArgs e) { ClearData(); ClassBranch b = new ClassBranch(); DataTable dt = b.GetBranch("", ""); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); }
protected void modDeleteCommand(Object sender, GridViewDeleteEventArgs e) { int id = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value); ClassBranch b = new ClassBranch(); b.BRANCH_ID = id; b.DeleteBranch(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('ลบข้อมูลเรียบร้อย')", true); GridView1.EditIndex = -1; BindData1(); }
protected void modUpdateCommand(Object sender, GridViewUpdateEventArgs e) { TextBox txtBranchIDEdit = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtBranchIDEdit"); TextBox txtBranchNameEdit = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtBranchNameEdit"); ClassBranch b = new ClassBranch(Convert.ToInt32(txtBranchIDEdit.Text) , txtBranchNameEdit.Text); b.UpdateBranch(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('อัพเดทข้อมูลเรียบร้อย')", true); GridView1.EditIndex = -1; BindData1(); }
protected void btnSearchBranch_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtSearchBranchID.Text) && string.IsNullOrEmpty(txtSearchBranchName.Text)) { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('กรุณากรอก คำค้นหา')", true); return; } else { ClassBranch b = new ClassBranch(); DataTable dt = b.GetBranchSearch(txtSearchBranchID.Text, txtSearchBranchName.Text); GridView1.DataSource = dt; GridView1.DataBind(); SetViewState(dt); } }