Page 171 - ระบบสารสนเทศเพื่อการบริหารจัดการเอกสารอิเล็กทรอนิกส์ (e-Document)
P. 171

ห้องสมุดกรมพัฒนาที่ดิน
                                                                                                        ค- 58




                      protected void btnCancel_Click(object sender, EventArgs e)
                      {
                          txtGroupID.Text = "";
                          txtGroupName.Text = "";
                          txtOwner.Text = "";
                          cbActive.Checked = false;
                          hdMode.Value = "AddNew";
                          pnlGroupList.Visible = false;
                      }
                      protected void btnAddMember_Click(object sender, EventArgs e)
                      {
                          DbMgt table = new DbMgt(str);
                          string sSql;
                          SqlString sql = new SqlString();
                          sql.Clear();
                          sql.AddString("GroupID", hdGroupID.Value);
                          sql.AddString("Member", ddlBureau.SelectedValue);
                          sSql = sql.SqlAdd("GroupList");

                          if (table.exNonQuery(sSql) == true)
                          {
                              Response.Write(ut.alert("บันทึกข้อมูลส าเร็จ"));
                              sSql = "SELECT GroupList.GroupID + '|' + GroupList.Member AS
                  Gkey, GroupList.GroupID, GroupList.Member, BureauIntra.Bureau FROM
                  GroupList INNER JOIN BureauIntra ON GroupList.Member = BureauIntra.BureauID
                  WHERE (GroupList.GroupID = N'" + hdGroupID.Value + "')";
                              dsGroupList.SelectCommand = sSql;
                              gvGroupList.DataBind();
                          }
                          else
                          {
                              Response.Write(ut.alert("โปรดเลือกใหม่อีกครั้ง"));
                          }
                      }
                      protected void gvGroupList_SelectedIndexChanged(object sender,
                  EventArgs e)
                      {
                          string sSql;
                          string sKey = gvGroupList.SelectedValue.ToString();
                          string sGroupID = sKey.Split('|')[0];
                          string sMember = sKey.Split('|')[1];
                          sSql = "DELETE FROM GroupList where GroupList.GroupID='" + sGroupID
                  + "' and GroupList.Member='" + sMember + "'";
                          DbMgt table = new DbMgt(str);
                          if (table.exNonQuery(sSql))
                          {
                              Response.Write(ut.alert("ลบข้อมูลส าเร็จ"));
                              sSql = "SELECT GroupList.GroupID + '|' + GroupList.Member AS
                  Gkey, GroupList.GroupID, GroupList.Member, BureauIntra.Bureau FROM
                  GroupList INNER JOIN BureauIntra ON GroupList.Member = BureauIntra.BureauID
                  WHERE (GroupList.GroupID = N'" + sGroupID + "')";
                              dsGroupList.SelectCommand = sSql;
                              gvGroupList.DataBind();
                          }
                          else
                              Response.Write(ut.alert("ลบข้อมูลไม่ส าเร็จ"));
                      }
                  }
   166   167   168   169   170   171   172