Пример #1
0
        protected void ButtonSave_Click(object sender, EventArgs e)
        {
            try
            {
                eRegisterData.DAL oDal = new eRegisterData.DAL();

                oDal.UpdateSchool(Int32.Parse(((DropDownList)FormViewSchoole.FindControl("DropDownSchools")).SelectedItem.Value), ((DropDownList)FormViewSchoole.FindControl("DropDownSchools")).SelectedItem.Text, ((TextBox)FormViewSchoole.FindControl("txtAddress")).Text,
                                  Int32.Parse(((DropDownList)FormViewSchoole.FindControl("DropDownList1")).SelectedItem.Value), ((TextBox)FormViewSchoole.FindControl("txtMission")).Text,
                                  ((TextBox)FormViewSchoole.FindControl("txtStrategy")).Text, ((TextBox)FormViewSchoole.FindControl("txtVision")).Text);
                lblMessage.Visible = true;
                lblMessage.Text    = "Успешна редакция!";
            }
            catch (Exception ex) { lblMessage.Text = "Възникнала е грешка!"; }
        }
Пример #2
0
        protected void ButtonEdit_Click(object sender, EventArgs e)
        {
            FormViewSchoole.ChangeMode(FormViewMode.Edit);
            DataTable scholInfo;

            eRegisterData.DAL oDal = new eRegisterData.DAL();

            scholInfo = oDal.getSchooleInfo(adminID);

            FormViewSchoole.DataSource = scholInfo;
            FormViewSchoole.DataBind();

            System.Data.DataTable schooleInfo = new System.Data.DataTable();



            schooleInfo = oDal.getSchools();
            ((DropDownList)FormViewSchoole.FindControl("DropDownSchools")).DataSource     = schooleInfo.DefaultView;
            ((DropDownList)FormViewSchoole.FindControl("DropDownSchools")).DataTextField  = schooleInfo.Columns["SchooName"].ColumnName.ToString();
            ((DropDownList)FormViewSchoole.FindControl("DropDownSchools")).DataValueField = schooleInfo.Columns["SchoolID"].ColumnName.ToString();
            ((DropDownList)FormViewSchoole.FindControl("DropDownSchools")).DataBind();

            System.Data.DataTable schoolInfo = new System.Data.DataTable();
            eRegisterData.DAL     oDAL1      = new eRegisterData.DAL();
            schoolInfo = oDAL1.getSchooleInfo(adminID);

            ListItem selectedListItem = ((DropDownList)FormViewSchoole.FindControl("DropDownSchools")).Items.FindByValue(schoolInfo.Rows[0][0].ToString());

            if (selectedListItem != null)
            {
                selectedListItem.Selected = true;
                ((DropDownList)FormViewSchoole.FindControl("DropDownSchools")).Enabled = false;
            }
            ListItem selectedListCity = ((DropDownList)FormViewSchoole.FindControl("DropDownList1")).Items.FindByValue(schoolInfo.Rows[0][2].ToString());

            if (selectedListCity != null)
            {
                selectedListCity.Selected = true;
            }

            ((TextBox)FormViewSchoole.FindControl("txtAddress")).Text  = schoolInfo.Rows[0][4].ToString();
            ((TextBox)FormViewSchoole.FindControl("txtMission")).Text  = schoolInfo.Rows[0][5].ToString();
            ((TextBox)FormViewSchoole.FindControl("txtStrategy")).Text = schoolInfo.Rows[0][6].ToString();
            ((TextBox)FormViewSchoole.FindControl("txtVision")).Text   = schoolInfo.Rows[0][7].ToString();
        }
Пример #3
0
        protected void ButtonInsert_Click(object sender, EventArgs e)
        {
            try
            {
                eRegisterData.DAL oDal = new eRegisterData.DAL();

                oDal.insertNewSchool(((TextBox)FormViewSchoole.FindControl("txtSchoole")).Text, ((TextBox)FormViewSchoole.FindControl("txtAddress")).Text,
                                     Int32.Parse(((DropDownList)FormViewSchoole.FindControl("DropDownListCity")).SelectedItem.Value), ((TextBox)FormViewSchoole.FindControl("txtMission")).Text,
                                     ((TextBox)FormViewSchoole.FindControl("txtStrategy")).Text, ((TextBox)FormViewSchoole.FindControl("txtVision")).Text);
                lblMessage.Visible = true;
                lblMessage.Text    = "Успешно въвеждане!";
                ((TextBox)FormViewSchoole.FindControl("txtSchoole")).Text  = string.Empty;
                ((TextBox)FormViewSchoole.FindControl("txtAddress")).Text  = string.Empty;
                ((TextBox)FormViewSchoole.FindControl("txtMission")).Text  = string.Empty;
                ((TextBox)FormViewSchoole.FindControl("txtStrategy")).Text = string.Empty;
                ((TextBox)FormViewSchoole.FindControl("txtVision")).Text   = string.Empty;
            }
            catch (Exception ex) { lblMessage.Text = "Възникнала е грешка!"; }
        }