Example #1
0
        protected void BuSearche_Click(object sender, EventArgs e)
        {
            String password = "******";
            string imgPath;

            try
            {
                password = Convert.ToString(Session["adminID"]) + StringGeneration.getString(30);
                imgPath  = ("/attachments/"
                            + (password + Path.GetExtension(FileUpload1.PostedFile.FileName)));
                //  selct path before post back check nesa becose name file will dispose after poastback
                //   MsgBox(Server.MapPath(imgPath))
                FileUpload1.SaveAs(Server.MapPath(imgPath));
                ColoumnParam[] Coloumns1 = new ColoumnParam[5];
                Coloumns1[0] = new ColoumnParam("AttachmentTypeID", ColoumnType.Int, 2); // 1 for admin add news
                Coloumns1[1] = new ColoumnParam("AttachmentPath", ColoumnType.NVarChar, imgPath);
                Coloumns1[2] = new ColoumnParam("AttachmentDateIN", ColoumnType.DateTime, DateTime.Now.ToString());
                Coloumns1[3] = new ColoumnParam("AttachmentID", ColoumnType.Int, HiddenField1.Value);
                Coloumns1[4] = new ColoumnParam("AddedBy", ColoumnType.Int, Convert.ToString(Session["adminID"]));

                DBop.cobject.InsertRow("Attachments", Coloumns1);

                SqlDataSource1.DataBind();
                GridView2.DataBind();
            }
            catch (Exception ex)
            {
            }
        }
        protected void BuAddData_Click(object sender, EventArgs e)
        {
            string DatIN = DateTime.Now.ToString();

            ColoumnParam[] Coloumns = new ColoumnParam[8];
            Coloumns[0] = new ColoumnParam("HomeWorkTitle", ColoumnType.NVarChar, txtHomeWorkTitle.Text);
            Coloumns[1] = new ColoumnParam("HomeWorkDetails", ColoumnType.NVarChar, txtHomeWorkDetails.Text);
            Coloumns[2] = new ColoumnParam("Datein", ColoumnType.DateTime, DatIN);
            Coloumns[3] = new ColoumnParam("DeadLineDate", ColoumnType.DateTime, txtDeadLineDate.Text);
            Coloumns[4] = new ColoumnParam("AddedBy", ColoumnType.Int, Convert.ToString(Session["adminID"]));
            Coloumns[5] = new ColoumnParam("TutorialID", ColoumnType.Int, DDLAccounts.SelectedValue);
            Coloumns[6] = new ColoumnParam("Grade", ColoumnType.Float, txtGrade.Text);
            //string qul = Guid.NewGuid().ToString("N");
            Coloumns[7] = new ColoumnParam("HomeWorkUID", ColoumnType.uniqueidenifer, "Ignored");
            if (DBop.cobject.InsertRow("HomeWorks", Coloumns))
            {
                //===================  // uplaod file to attach folder
                DataTable dataTable = new DataTable();
                dataTable = DBop.cobject.SelectDataSet("HomeWorks", "HomeWorkID", "Datein =(select max(Datein) FROM HomeWorks where  AddedBy= " + Convert.ToString(Session["adminID"]) + ")  and AddedBy=" + Convert.ToString(Session["adminID"])).Tables[0];
                int    AttachmentID = Convert.ToInt32(dataTable.Rows[0]["HomeWorkID"]);
                string imgPath;
                String password = "******";
                if (FileUpload1.HasFile)
                {
                    try
                    {
                        password = Convert.ToString(Session["adminID"]) + StringGeneration.getString(30);
                        imgPath  = ("/attachments/"
                                    + (password + Path.GetExtension(FileUpload1.PostedFile.FileName)));
                        FileUpload1.SaveAs(Server.MapPath(imgPath));
                        ColoumnParam[] Coloumns1 = new ColoumnParam[5];
                        Coloumns1[0] = new ColoumnParam("AttachmentTypeID", ColoumnType.Int, 1);      // 1 for admin add home works
                        Coloumns1[1] = new ColoumnParam("AttachmentPath", ColoumnType.NVarChar, imgPath);
                        Coloumns1[2] = new ColoumnParam("AttachmentDateIN", ColoumnType.DateTime, DateTime.Now.ToString());
                        Coloumns1[3] = new ColoumnParam("AttachmentID", ColoumnType.Int, AttachmentID);
                        Coloumns1[4] = new ColoumnParam("AddedBy", ColoumnType.Int, Convert.ToString(Session["adminID"]));

                        //Grade
                        DBop.cobject.InsertRow("Attachments", Coloumns1);
                    }
                    catch (Exception ex)
                    {
                        //   MsgBox(ex.Message)
                        //imgPath = "/Images/AdminImage/defaultAdminImag.png";
                    }
                }



                Response.Redirect("ManageStudent.aspx?S=T");
            }
            else
            {
                LiMessage.Text = "<strong>" + DBop.NewConectionDLL.ErrorMessage + "</strong>  .";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "ShowModalError();", true);
            }
        }
Example #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["adminID"] == null)
            {
                Response.Redirect("AdminLogin.aspx");
            }

            if (!Page.IsPostBack)
            {// generate code for add attachment files
                string TempasaveCode = StringGeneration.getString(30) + Convert.ToString(Session["adminID"]);
                HiddenField1.Value = TempasaveCode.Substring(Convert.ToInt32(TempasaveCode.Length / 2), Convert.ToInt32(TempasaveCode.Length / 2));
                if (!(Request.QueryString["S"] == null))
                {
                    Label1info.Text = Resource1.ADDSuceess;
                }
            }
        }
        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();
                }
            }
        }
Example #5
0
        protected void Buadd_Click(object sender, EventArgs e)
        {
            String password = "******";
            string imgPath  = "";

            try
            {
                if (FileUpload1.HasFile)
                {
                    password = StringGeneration.getString(30);
                    imgPath  = ("/attachments/"
                                + (password + Path.GetExtension(FileUpload1.PostedFile.FileName)));
                    //  selct path before post back check nesa becose name file will dispose after poastback
                    //   MsgBox(Server.MapPath(imgPath))
                    FileUpload1.SaveAs(Server.MapPath(imgPath));
                    imgPath = "http://www.news.alruabye.net/" + imgPath; //my host name
                }
            }
            catch (Exception ex) { imgPath = "~/Images/StylesImage/advestments.png"; }
            DateTime DateCreated = DateTime.Now;

            ColoumnParam[] Coloumns = new ColoumnParam[5];
            Coloumns[0] = new ColoumnParam("InvestmentTitle", ColoumnType.NVarChar, txtInvestmentTitle.Text);
            Coloumns[1] = new ColoumnParam("InvestmentImage", ColoumnType.NVarChar, imgPath);
            Coloumns[2] = new ColoumnParam("InvestmentLink", ColoumnType.NVarChar, txtInvestmentLink.Text);
            Coloumns[3] = new ColoumnParam("InvestmentDate", ColoumnType.DateTime, DateCreated);
            Coloumns[4] = new ColoumnParam("InverstmentPostion", ColoumnType.Int, txtInverstmentPostion.Text);


            if (DBop.cobject.InsertRow("Investments", Coloumns))
            {
                Response.Redirect("AddAdvestments.aspx?S=T");
            }
            else
            {
                LiMessage.Text = "<strong>Warning!</strong> " + DBop.cobject.ErrorMessage;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "ShowModalError();", true);
            }
        }
        protected void BuAddData_Click(object sender, EventArgs e)
        {
            // check the expire date

            DataTable dataTable = new DataTable();

            dataTable = DBop.cobject.SelectDataSet("HomeWorks", "HomeWorkID,DeadLineDate", "HomeWorkUID like '" + HFid.Value + "'").Tables[0];
            DateTime Deadline = Convert.ToDateTime(dataTable.Rows[0]["DeadLineDate"]);;

            if ((DateTime.Now - Deadline).TotalMinutes > 0)
            {
                BuAddData0.Enabled = false;
                LiMessage.Text     = "<strong>The Time of upload file is expired</strong>  .";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "ShowModalError();", true);
                return;
            }

            string timesumit = DateTime.Now.ToString();

            ColoumnParam[] Coloumns = new ColoumnParam[4];
            Coloumns[0] = new ColoumnParam("HomeWorkID", ColoumnType.Int, Convert.ToInt32(dataTable.Rows[0]["HomeWorkID"]));
            Coloumns[1] = new ColoumnParam("StudentNote", ColoumnType.NVarChar, txtMessageTitle.Text);
            Coloumns[2] = new ColoumnParam("SubmitDatein", ColoumnType.DateTime, DateTime.Now);
            Coloumns[3] = new ColoumnParam("StudentID", ColoumnType.Int, Convert.ToInt32(Session["adminID"]));
            if (DBop.cobject.InsertRow("StudentHomeWorkSubmit", Coloumns))
            {
                dataTable = DBop.cobject.SelectDataSet("StudentHomeWorkSubmit", "SubmitHomeWorkID", "SubmitDatein=(SELECT  max([SubmitDatein]) FROM [StudentHomeWorkSubmit] where StudentID=" + Convert.ToInt32(Session["adminID"]) + ") and StudentID=" + Convert.ToInt32(Session["adminID"])).Tables[0];

                // get id othe the message to update the messages in atachments
                // we update all temp attach id
                String password = "******";
                string imgPath;
                try
                {
                    if (FileUpload1.HasFile)
                    {
                        password = Convert.ToString(Session["adminID"]) + StringGeneration.getString(30);
                        imgPath  = ("/attachments/"
                                    + (password + Path.GetExtension(FileUpload1.PostedFile.FileName)));
                        //  selct path before post back check nesa becose name file will dispose after poastback
                        //   MsgBox(Server.MapPath(imgPath))
                        FileUpload1.SaveAs(Server.MapPath(imgPath));
                        ColoumnParam[] Coloumns1 = new ColoumnParam[5];
                        Coloumns1[0] = new ColoumnParam("AttachmentTypeID", ColoumnType.Int, 3); // 1 for admin add news
                        Coloumns1[1] = new ColoumnParam("AttachmentPath", ColoumnType.NVarChar, imgPath);
                        Coloumns1[2] = new ColoumnParam("AttachmentDateIN", ColoumnType.DateTime, DateTime.Now.ToString());
                        Coloumns1[3] = new ColoumnParam("AttachmentID", ColoumnType.Int, Convert.ToInt32(dataTable.Rows[0]["SubmitHomeWorkID"]));
                        Coloumns1[4] = new ColoumnParam("AddedBy", ColoumnType.Int, Convert.ToString(Session["adminID"]));

                        DBop.cobject.InsertRow("Attachments", Coloumns1);

                        SqlDataSource1.DataBind();
                        GridView2.DataBind();
                    }
                }
                catch (Exception ex)
                {
                }
                Response.Redirect("MyHomeWorksdetails.aspx?id=" + HFid.Value + "&S=T");
            }
            else
            {
                LiMessage.Text = "<strong>" + DBop.NewConectionDLL.ErrorMessage + "</strong>  .";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Pop", "ShowModalError();", true);
            }
        }
Example #7
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;
        }