Esempio n. 1
0
        protected void btnRegister_ServerClick(object sender, EventArgs e)
        {
            if (FileImgsave.HasFile)
            {
                lblmsg.Text = "";

                var supportedTypes = new[] { "png", "jpg", "bmp", "jpeg", "tif", "eps", "jfif" };
                var fileExt        = System.IO.Path.GetExtension(FileImgsave.FileName).Substring(1);
                if (!supportedTypes.Contains(fileExt))
                {
                    lblmsg.ForeColor = Color.Red;
                    lblmsg.Text      = "File Extension Is InValid - Only Upload png,jpg,jpeg,bmp,tif,eps,jfif format images";
                }

                else
                {
                    string str = FileImgsave.FileName;
                    FileImgsave.PostedFile.SaveAs(Server.MapPath("~/Images/" + "profile/" + str));
                    string imgPath = "images/" + "profile/" + str;
                    string Query   = "insert into tbl_Users(UserName,Badge,EnrollNo,Department,Year,Email,Password,Photo)Values('" + txtName.Value + "','" + Badge.Text + "','" + EnrollNo.Value + "','" + Department.Text + "','" + year.Text + "','" + txtEmail.Value + "','" + txtPassword.Value + "','" + imgPath + "')";
                    string ExistQ  = "select * from tbl_Users where Email='" + txtEmail.Value + "'";
                    if (!ConnC.IsExist(ExistQ))
                    {
                        if (ConnC.ExecuteQuery(Query))
                        {
                            string CreateTableQuery = "create table if not exists groupsof_" + EnrollNo.Value + "(GroupID varchar(40))";
                            ConnC.ExecuteQuery(CreateTableQuery);
                            if (Badge.Text == "Student" || Badge.Text == "CR")
                            {
                                string InsertGroupQuery = "insert into " + "groupsof_" + EnrollNo.Value + "(GroupID) values('" + year.Text + Department.Text + "')";

                                ConnC.ExecuteQuery(InsertGroupQuery);

                                ConnC.AddToGroup(year.Text + Department.Text, EnrollNo.Value);
                            }
                            ScriptManager.RegisterStartupScript(this, GetType(), "Message", "alert('Congratulations!! You have successfully registered..');", true);
                            FC.FireRegister(new SignalRChat.User()
                            {
                                name     = txtName.Value,
                                enrollno = EnrollNo.Value
                            });
                            Response.Redirect("Login.aspx");
                        }
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this, GetType(), "Message", "alert('Email is already Exists!! Please Try Different Email..');", true);
                    }
                }
            }
            else
            {
                lblmsg.ForeColor = Color.Red;
                lblmsg.Text      = "Please select Image";
            }
        }
Esempio n. 2
0
        protected void btnChangePicModel_Click(object sender, EventArgs e)
        {
            string serverPath = HttpContext.Current.Server.MapPath("~/");

            //path = serverPath + path;
            if (FileUpload1.HasFile)
            {
                string FileWithPat = serverPath + @"images/DP/" + UserName + FileUpload1.FileName;

                FileUpload1.SaveAs(FileWithPat);
                SD.Image img  = SD.Image.FromFile(FileWithPat);
                SD.Image img1 = RezizeImage(img, 151, 150);
                img1.Save(FileWithPat);
                if (File.Exists(FileWithPat))
                {
                    FileInfo fi        = new FileInfo(FileWithPat);
                    string   ImageName = fi.Name;
                    string   query     = "update tbl_Users set Photo='" + ImageName + "' where UserName='******'";
                    if (ConnC.ExecuteQuery(query))
                    {
                        UserImage = "images/DP/" + ImageName;
                    }
                }
            }
        }
Esempio n. 3
0
        protected void btnRegister_ServerClick(object sender, EventArgs e)
        {
            string Query  = "insert into tbl_Users(UserName,Email,Password)Values('" + txtName.Value + "','" + txtEmail.Value + "','" + txtPassword.Value + "')";
            string ExistQ = "select * from tbl_Users where Email='" + txtEmail.Value + "'";

            if (!ConnC.IsExist(ExistQ))
            {
                if (ConnC.ExecuteQuery(Query))
                {
                    ScriptManager.RegisterStartupScript(this, GetType(), "Message", "alert('Congratulations!! You have successfully registered..');", true);
                    Session["UserName"] = txtName.Value;
                    Session["Email"]    = txtEmail.Value;
                    Response.Redirect("Chat.aspx");
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "Message", "alert('Email is already Exists!! Please Try Different Email..');", true);
            }
        }
Esempio n. 4
0
        public void CreateTableFor(string table_name, string fromUserEN, string toUserEN)
        {
            string CreateTableQuery = "CREATE TABLE " + table_name + "(time varchar(30), message text,c" + fromUserEN + " boolean,c" + toUserEN + " boolean)";

            ConnC.ExecuteQuery(CreateTableQuery);
        }
Esempio n. 5
0
 private List <string> GetUsersGroups(string username)
 {
     return(ConnC.ExecuteQuery("SELECT GroupID FROM UsersInGroups WHERE Username = '******'", 1));
 }