Пример #1
0
        protected void BuAddData_Click(object sender, EventArgs e)
        {
            DataTable dataTable = new DataTable();

            dataTable = DBop.cobject.SelectDataSet("MyStudents", "StudentID", "StudentEmail like '" + txtEmail.Text + "'  and IsActive=1").Tables[0];
            if ((dataTable != null) && (dataTable.Rows.Count > 0))
            {
                Encryptions Myenc    = new Encryptions(); // encript password
                string      PassCode = Myenc.GetMD5Data(Encoding.Default.GetBytes(Convert.ToString(dataTable.Rows[0]["StudentID"]) + StringGeneration.getString(30)));

                ColoumnParam[] Coloumns = new ColoumnParam[3];
                Coloumns[0] = new ColoumnParam("PersonID", ColoumnType.Int, Convert.ToString(dataTable.Rows[0]["StudentID"]));
                Coloumns[1] = new ColoumnParam("PassCode", ColoumnType.Char1, PassCode);
                Coloumns[2] = new ColoumnParam("DateIn", ColoumnType.DateTime, DateTime.Now.ToString());

                if (DBop.cobject.InsertRow("PeoplePassCode", Coloumns))
                {
                    Contacting sendwelcome = new Contacting();

                    string subject = "Ask for password";
                    string body    = "Dear  ,";
                    body = body + "\n Recently you asked for your password please click the link bellow to complete your request";
                    body = body + "\n   please login here<a href=' http://www.alrubaye.com/ForgetPassWord.aspx?id=" + PassCode.Trim() + "'> Link </a> and change this password as soon as you login on \n";
                    sendwelcome.SendWelcome(txtEmail.Text, subject, body);
                }
            }

            theDiv.Visible = true;
        }
Пример #2
0
        protected void BuAddData_Click(object sender, EventArgs e)
        {
            // check if the email is active;
            DataTable dataTable = new DataTable();

            dataTable = DBop.NewConectionDLL.SelectDataSet("MyStudents", "StudentEmail", "StudentEmail like '" + txtEmail.Text + "'").Tables[0];
            if ((dataTable != null) && (dataTable.Rows.Count > 0))
            {
                LiMessage.Text = "<strong>" + Resources.Resource1.Warning + "</strong> " + Resources.Resource1.emailalreadyregistered;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "ShowModalError();", true);
                return;
            }
            ColoumnParam[] Coloumns = new ColoumnParam[7];
            Coloumns[0] = new ColoumnParam("StudentFirstName", ColoumnType.NVarChar, txtFirstName.Text);
            Coloumns[1] = new ColoumnParam("StudentLastName", ColoumnType.NVarChar, txtMiddleName.Text);
            Coloumns[2] = new ColoumnParam("StudentEmail", ColoumnType.NVarChar, txtEmail.Text);
            Coloumns[3] = new ColoumnParam("TutorialID", ColoumnType.Int, DDLAccounts.SelectedValue);
            Coloumns[4] = new ColoumnParam("DataRegister", ColoumnType.DateTime, DateTime.Now);
            Coloumns[5] = new ColoumnParam("StudentComment", ColoumnType.NVarChar, txtState.Text);
            Coloumns[6] = new ColoumnParam("SkypeID", ColoumnType.NVarChar, txtSkypeID.Text);
            if (DBop.NewConectionDLL.InsertRow("MyStudents", Coloumns))
            {
                // add tutorila to my list
                //password = Myenc.GetMD5Data(Encoding.Default.GetBytes(password));
                dataTable = DBop.cobject.SelectDataSet("MyStudents", "StudentID", "StudentEmail like '" + txtEmail.Text + "'").Tables[0];
                ColoumnParam[] Coloumns2 = new ColoumnParam[2];
                Coloumns2[0] = new ColoumnParam("TutorialID", ColoumnType.Int, DDLAccounts.SelectedValue);
                Coloumns2[1] = new ColoumnParam("StudentID", ColoumnType.Int, dataTable.Rows[0]["StudentID"]);
                if (DBop.NewConectionDLL.InsertRow("StudentTutorial", Coloumns2))
                {
                    Contacting sendwelcome = new Contacting();
                    string     message     = "عزيزي " + txtFirstName.Text + "\n   نحن نقدر جدا انظمامك للدورات وسوف نحاول قصارى جهدنا ان نوصل لك ماتسعى لتعلمه. لذالك سوف نرسل لك بريد يحتوي على معلومات الدخول الى الدورات قريبا لذالك قم بفحص صندوق الوراد والرسائل سبام بشكل دائم  ";
                    sendwelcome.SendWelcome(txtEmail.Text, "شكرا لتسجيلك في نظام الدورات", message);
                    Response.Redirect("Education.aspx?S=T");
                }
                else
                {
                    LiMessage.Text = "<strong>" + DBop.NewConectionDLL.ErrorMessage + "</strong>  .";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "ShowModalError();", true);
                }
            }

            else
            {
                LiMessage.Text = "<strong>" + DBop.NewConectionDLL.ErrorMessage + "</strong>  ";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "ShowModalError();", true);
            }
        }
        protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "GradeIt")
            {
                GridViewRow row = (GridViewRow)(((Button)e.CommandSource).NamingContainer);


                HiddenField HFStudentID        = (HiddenField)row.FindControl("HFStudentID");
                HiddenField HFSubmitHomeWorkID = (HiddenField)row.FindControl("HFSubmitHomeWorkID");
                TextBox     txtGrade           = (TextBox)row.FindControl("txtGrade");
                Label       LaStudentEmail     = (Label)row.FindControl("LaStudentEmail");
                TextBox     txtAdminComment    = (TextBox)row.FindControl("txtAdminComment");
                LinkButton  LinkButton1        = (LinkButton)row.FindControl("LinkButton1");
                //  DateTime dt=Convert.ToDateTime( LinkButton1.Text);
                // string s = dt .ToString("yyyy-MM-dd-HH:mm:ss"); // String.Format("{yyyy-MM-dd h:mm:ss tt}", dt);
                ColoumnParam[] Coloumns1 = new ColoumnParam[2];
                Coloumns1[0] = new ColoumnParam("Grade", ColoumnType.Float, txtGrade.Text); // 1 for admin add home works
                Coloumns1[1] = new ColoumnParam("AdminComment", ColoumnType.NVarChar, txtAdminComment.Text);
                DBop.cobject.UpdateRow("StudentHomeWorkSubmit", Coloumns1, "SubmitHomeWorkID=" + HFSubmitHomeWorkID.Value);

                GridView3.DataBind();

                // ntify student
                Contacting sendwelcome = new Contacting();
                string     message     = "عزيزي  </br>  تم تحديث درجتك  لواجب </br> ";
                message = message + DDLHomeWorkID.SelectedItem.Text;
                message = message + "</br>   الدرجة   " + txtGrade.Text + "</br>    التعليق  </br>  " + txtAdminComment.Text;
                sendwelcome.SendWelcome(LaStudentEmail.Text, "تنبيه بخصوص الواجب", message);
            }
            else if (e.CommandName == "DownloadIt")
            {
                GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);

                string filepath      = ((HiddenField)row.FindControl("HFAttachmentPath")).Value;
                string downloadsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads");

                string   fileName = filepath.Substring(("/attachments/").Length, (filepath.Length - ("/attachments/").Length));
                String[] splitd   = fileName.Split('.');
                //byte[] fileBytes = System.IO.File.ReadAllBytes(splitd[1]);

                Response.ContentType = GetMimeTypeByFileName(splitd[1]);
                Response.AppendHeader("Content-Disposition", "attachment; filename=" + fileName);
                Response.TransmitFile(Server.MapPath("~" + filepath));
                Response.End();
            }
        }
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //
            if (e.CommandName == "ChangeStatus")
            {
                GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer);


                Label Label1           = (Label)row.FindControl("Label1");
                Label Label2AcountType = ( Label )row.FindControl("Label2AcountType");
                Label txtFirstName     = (Label)row.FindControl("LaStudentFirstName");
                Label txtEmail         = (Label)row.FindControl("txtEmail");
                if ((Label2AcountType.Text == Resources.Resource1.Active))
                {
                    try
                    {
                        SDSSDegress2013.UpdateCommand = "UPDATE MyStudents SET IsActive =0  WHERE StudentID =" + Label1.Text + " ";

                        SDSSDegress2013.Update();
                    }
                    catch (Exception ex) { }
                }
                else
                {
                    string     password    = Convert.ToString(Session["adminID"]) + StringGeneration.getString(30);
                    Contacting sendwelcome = new Contacting();
                    string     message     = " عزيزي  " + txtFirstName.Text;
                    message = message + "\n نحن نرسل لك هذا البريد لنعلمك انه قد تم تفعيل حسابك على ماي كورسس  في موقعنا  يمكنك الدخول  الان ومتابعة الدروس ومواعيدها           ";
                    message = message + "\nقم بالدخول على هذا الرابط";
                    message = message + "\n http://alruabye.net/AdminLogin.aspx                       ";
                    message = message + "\n وقم بادخال كلمة المرور المؤقتة التالية";
                    message = message + password;
                    message = message + "  \n   Hussein alrubaye  ,  email [email protected]";
                    sendwelcome.SendWelcome(txtEmail.Text, "تم تغعيل حسابك في نظام الدورات", message);
                    SDSSDegress2013.UpdateCommand = "UPDATE MyStudents SET IsActive =1, Password="******" WHERE (StudentID =" + Label1.Text + ")";

                    SDSSDegress2013.Update();
                }
            }
        }