示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblMessage.Visible = false;

            if (Session["UserID"] != null)
            {
                userID = Int32.Parse(Session["UserID"].ToString());

                eRegisterData.DAL DAL  = new eRegisterData.DAL();
                SqlConnection     conn = DAL.getSubject();
                SqlCommand        comm = new SqlCommand();

                try
                {
                    conn.Open();
                    comm.Connection  = conn;
                    comm.CommandText = @" SELECT ActorID
                                      FROM Actors
                                      WHERE UserID='" + userID + "'";

                    adminID = Int32.Parse(comm.ExecuteScalar().ToString());
                    conn.Close();
                }
                catch (Exception ex)
                {
                    lblMessage.Text = ex.Message;
                }
            }
            else
            {
                Response.Redirect("~/eRegister.aspx");
            }
        }
示例#2
0
        protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e)
        {
            if (Wizard1.ActiveStepIndex == 1)
            {
                eRegisterData.DAL oDal = new eRegisterData.DAL();
                try
                {
                    if (ListBoxSubjects.Items.Count > 0)
                    {
                        for (int i = 0; i < ListBoxSubjects.Items.Count; i++)
                        {
                            if (ListBoxSubjects.Items[i].Selected)
                            {
                                string selectedItem = ListBoxSubjects.Items[i].Value;
                                oDal.TeacherSubject_Insert(actorID, Int32.Parse(selectedItem));
                            }
                        }
                    }
                }
                catch (Exception ex) { lblMessage.Text = "Възникнала е грешка!"; Wizard1.ActiveStepIndex = 1; }
                Wizard1.ActiveStepIndex = 2;
            }
            if (Wizard1.ActiveStepIndex == 0)
            {
                try
                {
                    eRegisterData.DAL oDal = new eRegisterData.DAL();

                    actorID = oDal.AddTeacher(((TextBox)FormView1.FindControl("UserNameTextBox")).Text, ((TextBox)FormView1.FindControl("FirstNameTextBox")).Text,
                                              ((TextBox)FormView1.FindControl("MiddleNameTextBox")).Text, ((TextBox)FormView1.FindControl("LastNameTextBox")).Text, bool.Parse(((RadioButtonList)FormView1.FindControl("RadioButtonList1")).SelectedItem.Value),
                                              String.Empty, ((TextBox)FormView1.FindControl("EGNTextBox")).Text, ((TextBox)FormView1.FindControl("emailTextBox")).Text, false, ((TextBox)FormView1.FindControl("PhoneNumberTextBox")).Text,
                                              Int32.Parse(((DropDownList)FormView1.FindControl("DropDownList4")).SelectedItem.Value), 0);

                    if (actorID == 0)
                    {
                        lblMessage.Text         = "Учителят не е добавен успешно.";
                        Wizard1.ActiveStepIndex = 0;
                    }
                    else
                    {
                        lblMessage.Text = "Учителят беше добавен успешно.";
                        teacherName     = ((TextBox)FormView1.FindControl("FirstNameTextBox")).Text + " " + ((TextBox)FormView1.FindControl("MiddleNameTextBox")).Text + " " + ((TextBox)FormView1.FindControl("LastNameTextBox")).Text;
                    }
                }

                catch (Exception ex) { lblMessage.Text = "Възникнала е грешка!"; }

                Wizard1.ActiveStepIndex = 1;
                txtTeacher.Text         = teacherName;
            }
        }
示例#3
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 = "Възникнала е грешка!"; }
        }
示例#4
0
 protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
 {
     try
     {
         eRegisterData.DAL oDal = new eRegisterData.DAL();
         oDal.TeacherClass_Insert(actorID, Int32.Parse(DropDownListAllClasses.SelectedItem.Value));
         teacherName = string.Empty;
         actorID     = 0;
         Response.Redirect("~/Admin/Teachers.aspx");
     }
     catch
     {
         lblMessageClass.Text    = "Възникнала е грешка!";
         Wizard1.ActiveStepIndex = 2;
     }
 }
示例#5
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();
        }
示例#6
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 = "Възникнала е грешка!"; }
        }