Esempio n. 1
0
 protected void btnSubmit_Click(object sender, EventArgs e)
 {
     DBSQL dbsql = new DBSQL();
     if(!dbsql.TUserInsert(txtUserEmail.Text, txtUserPW.Text,txtUserName.Text,txtUserPhone.Text, ddlUserAuthority.SelectedValue))
     {
         ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "User Creation", "alert('A user is successfully created.');", true);
     }
 }
Esempio n. 2
0
        protected void btnRemoval_Command(object sender, GridViewDeleteEventArgs e)
        {
            GridViewRow row = gvBoardList.Rows[e.RowIndex];

            int iBoardNum = Convert.ToInt16(row.Cells[0].Text);
            string sBoardName = row.Cells[1].Text;
            string sBoardOwner = row.Cells[2].Text;

            DBSQL dbsql = new DBSQL();
            dbsql.TBoardMainRemoval(iBoardNum, sBoardOwner);
            dbsql.RemoveBoard(sBoardName);

            RetrieveBoardList();
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            DBSQL db = new DBSQL();
            System.Data.DataTable dt = new System.Data.DataTable();
            dt=db.TSelect("TBoardMain",null,true);

            foreach (DataRow row in dt.Rows)
            {
                HtmlGenericControl li = new HtmlGenericControl("li");
                navbar.Controls.Add(li);

                HtmlGenericControl anchor = new HtmlGenericControl("a");
                string sBoardName = row["BoardName"].ToString();
                anchor.Attributes.Add("href", "ViewBoard.aspx?BoardName=" + sBoardName);
                anchor.InnerText = sBoardName;

                li.Controls.Add(anchor);
            }
        }
Esempio n. 4
0
        protected void RetrieveBoardList()
        {
            System.Data.DataTable dt = new System.Data.DataTable();
            DBSQL dbsql = new DBSQL();
            dt = dbsql.TSelect("TBoardMain",null, true);

            try
            {
                if (dt.Rows.Count != 0)
                {
                    gvBoardList.DataSource = dt;
                    gvBoardList.DataBind();
                }
            }catch(Exception e)
            {
                gvBoardList.DataSource = dt;
                gvBoardList.EmptyDataText = "No board to retrieve";
                gvBoardList.DataBind();
            }
        }
Esempio n. 5
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            DBSQL dbsql = new DBSQL();
            dbsql.TBoardMainInsert(txtBoardName.Text, ddlBoardOwner.SelectedValue, txtBoardDescription.Text);

            int iLengthOfColumns = Convert.ToInt32(ddlNumberOfColumn.SelectedValue);
            iLengthOfColumns++;
            if (chkAddFileUpload.Checked)
            {
                iLengthOfColumns++;
            }
            if(chkAddImageColumn.Checked)
            {
                iLengthOfColumns++;
            }
            int[] iColumnNum = new int[iLengthOfColumns];
            string[] sColumnName = new string[iLengthOfColumns];
            string[] sColumnType = new string[iLengthOfColumns];
            byte[] bColumnTypeSize = new byte[iLengthOfColumns];
            bool[] bColumnNullable = new bool[iLengthOfColumns];

            for (int i = 1; i <= iLengthOfColumns-1; i++)
            {
                iColumnNum[i] = i;
                sColumnName[i] = Request.Form["txtColumnName" + i];
                sColumnType[i] = Request.Form["ddlColumnType" + i];
                if (sColumnType[i] == "VARCHAR" || sColumnType[i] == "CHAR")
                    bColumnTypeSize[i] = Convert.ToByte(Request.Form["txtColumnTypeSize" + i]);
                else
                    bColumnTypeSize[i] = 0;

                if (Convert.ToBoolean(Request.Form["chkColumnNullable" + i])==true)
                    bColumnNullable[i] = true;
                else
                    bColumnNullable[i] = false;
            }

            dbsql.AddNewBoard(txtBoardName.Text, iColumnNum, sColumnName, sColumnType, bColumnTypeSize, bColumnNullable);
        }