예제 #1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            bool Result = false;
            //Define Avariable
            int    CourseNum1            = 0;
            int    AlternativeCourseNum1 = 0;
            string TypeCouseNum1         = "";
            string Reason = "";

            int    ID   = Convert.ToInt32(Session["ID"].ToString());
            string Path = "";

            string Data = txtNumberCourse1.Text.ToString() + txtAlternativeNum1C1.Text.ToString() +
                          labHoursCourse1.Text.ToString() + labHoursAlternative.Text.ToString();

            if (fuSignature.HasFile)
            {
                string Private = fuSignature.FileName.ToString();
                Path = System.Web.HttpContext.Current.Server.MapPath("Test") + "/" + Private;
                string Pasword = txtPassSign.Text.ToString();
                fuSignature.SaveAs(Server.MapPath("Test") + "/" + fuSignature.FileName);
                //  Path = "/Test/" + fuSignatureStudent.FileName;
                SignatureStudents newSig     = new SignatureStudents();
                string            strencrypt = newSig.encrypet(Data, Path, Pasword);
                Result = newSig.Decreypt(strencrypt, ID);
            }

            if (Result == true)
            {
                //Check input Data
                if (txtNumberCourse1.Text != String.Empty)
                {
                    CourseNum1 = Convert.ToInt32(txtNumberCourse1.Text.ToString());
                }

                if (txtAlternativeNum1C1.Text != String.Empty)
                {
                    AlternativeCourseNum1 = Convert.ToInt32(txtAlternativeNum1C1.Text.ToString());
                }
                if (labTypeCourse1.Text != String.Empty)
                {
                    TypeCouseNum1 = labTypeCourse1.Text.ToString();
                }

                if (txtReason.Text != String.Empty)
                {
                    Reason = txtReason.Text.ToString();
                }
                AlternativeSub    obj      = new AlternativeSub();
                NowTimeUniversity timee    = new NowTimeUniversity();
                DataRow           T        = timee.drSearchYearANdSemester();
                string            semester = T["NowSemester"].ToString();
                string            Year     = T["NowYear"].ToString();
                string            Date1    = labDate.Text.ToString();
                if (obj.AddAlternativeSubject(ID, Date1, Year, semester, CourseNum1, TypeCouseNum1, AlternativeCourseNum1, Reason, 0, 0, 0, 0, 3) == 1)
                {
                    ddlCourse1.SelectedIndex            = -1;
                    ddlAlternativeCourse1.SelectedIndex = -1;
                    txtReason.Text = "";
                    ddlAlternativeCourse1.SelectedIndex = -1;
                    txtAlternativeNum1C1.Text           = "";
                    txtNumberCourse1.Text    = "";
                    labTypeCourse1.Text      = "";
                    labHoursCourse1.Text     = "";
                    labHoursAlternative.Text = "";
                    SentMail s = new SentMail();
                    s.sendemailAcadimic(ID);
                    Response.Redirect("HomeStudent.aspx");
                }
                errorLabel.Visible = false;
            }
            else
            {
                errorLabel.Text    = "التوقيع المدخل خاطئ أو كلمة المرور";
                errorLabel.Visible = true;
            }
        }
예제 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            bool Result = false;
            //Define Avariable
            int    CourseNum1            = 0;
            int    AlternativeCourseNum1 = 0;
            String TypeCouseNum1         = "";
            String Reason = "";

            int ID = Convert.ToInt32(Session["ID"].ToString());

            string Path = "C:/Users/Dua'a-Orcas/Desktop/WebApplication1/WebApplication1/WebApplication1/PageStudents/Test/";
            string Data = txtNumberCourse1.Text.ToString() + txtAlternativeNum1C1.Text.ToString() + txtReason.Text.ToString() +
                          labHoursCourse1.Text.ToString() + labHoursAlternative.Text.ToString();

            if (fuSignature.HasFile)
            {
                string Private = fuSignature.FileName.ToString();
                Path = Path + Private;
                fuSignature.SaveAs(Server.MapPath("Test") + "/" + fuSignature.FileName);
                //  Path = "/Test/" + fuSignatureStudent.FileName;
                SignatureStudents newSig     = new SignatureStudents();
                string            strencrypt = newSig.encrypet(Data, Path, ID);
                Result = newSig.Decreypt(strencrypt, ID);
            }

            if (Result == true)
            {
                //Check input Data
                if (txtNumberCourse1.Text != String.Empty)
                {
                    CourseNum1 = Convert.ToInt32(txtNumberCourse1.Text.ToString());
                }

                if (txtAlternativeNum1C1.Text != String.Empty)
                {
                    AlternativeCourseNum1 = Convert.ToInt32(txtAlternativeNum1C1.Text.ToString());
                }
                if (labTypeCourse1.Text != String.Empty)
                {
                    TypeCouseNum1 = labTypeCourse1.Text.ToString();
                }

                if (txtReason.Text != String.Empty)
                {
                    Reason = txtReason.Text.ToString();
                }
                AlternativeSub obj = new AlternativeSub();
                if (obj.AddAlternativeSubject(ID, CourseNum1, TypeCouseNum1, AlternativeCourseNum1, Reason, 0, 0, 0, 0, 3) == 1)
                {
                    ddlCourse1.SelectedIndex            = -1;
                    ddlAlternativeCourse1.SelectedIndex = -1;
                    txtReason.Text = "";
                    ddlAlternativeCourse1.SelectedIndex = -1;
                    txtAlternativeNum1C1.Text           = "";
                    txtNumberCourse1.Text    = "";
                    labTypeCourse1.Text      = "";
                    labHoursCourse1.Text     = "";
                    labHoursAlternative.Text = "";
                }
                errorLabel.Visible = false;
            }
            else
            {
                errorLabel.Text    = "التوقيع المدخل خاطئ";
                errorLabel.Visible = true;
            }
        }