protected void btn_Login_Click(object sender, EventArgs e)
        {
            profileref.UserProfileServiceClient client = new profileref.UserProfileServiceClient("BasicHttpBinding_IUserProfileService");
            profileref.UserProfile user = new profileref.UserProfile();
            String username             = txt_Username.Text;
            String password             = txt_password.Text;

            if (username == "admin" && password == "admin")
            {
                Response.Redirect("AdminHome.aspx");
            }
            if (username == "" || password == "")
            {
                Label2.Text = "Required";
                Label3.Text = "Required";
            }
            else
            {
                user.Username = username;
                user.Password = password;
                DataSet ds = client.Login(user);

                if (ds.Tables[0].Rows.Count != 0)
                {
                    Session["userid"] = ds.Tables[0].Rows[0]["UserId"];
                    Response.Write(Session["userid"].ToString());
                    Label1.Text = ds.ToString();
                    Response.Redirect("Fileupload.aspx");
                }
                else
                {
                    Label1.Text = "Username or Password is invalid!";
                }
            }
        }
        protected void btn_Message_Click(object sender, EventArgs e)
        {
            profileref.UserProfileServiceClient client = new profileref.UserProfileServiceClient("BasicHttpBinding_IUserProfileService");
            profileref.Message     message             = new profileref.Message();
            profileref.UserProfile user = new profileref.UserProfile();
            string des = msgdes.Text;
            string sub = msgsub.Text;

            if (des == "" || sub == "")
            {
                Label2.Text      = "Required";
                Label3.Text      = "Required";
                Label2.ForeColor = Color.Red;
                Label3.ForeColor = Color.Red;
            }
            else
            {
                message.Msgdes = msgdes.Text;
                message.Msgsub = msgsub.Text;
                user.UserID    = (int)Session["userid"];
                string result = client.SendRequest(user, message);
                Label3.Text      = result;
                Label3.ForeColor = Color.Green;
            }
        }
Ejemplo n.º 3
0
        protected void btn_Login_Click(object sender, EventArgs e)
        {
            profileref.UserProfileServiceClient client = new profileref.UserProfileServiceClient("BasicHttpBinding_IUserProfileService");
            profileref.UserProfile user = new profileref.UserProfile();
            String username             = txt_Username.Text;
            String password             = txt_password.Text;
            String error = "";

            user.Username = username;
            user.Password = password;
            if (username == "" || password == "")
            {
                Label2.Text      = "Required";
                Label3.Text      = "Required";
                Label2.ForeColor = Color.Red;
                Label3.ForeColor = Color.Red;
            }
            else
            {
                DataSet ds = client.Registration(user);
                if (ds != null)
                {
                    Session["userid"] = ds.Tables[0].Rows[0]["UserId"];
                    Response.Redirect("Fileupload.aspx");
                }
                else
                {
                    Label1.Text      = "Something went wrong";
                    Label1.ForeColor = Color.Red;
                }
            }
        }
        void BindGrid()
        {
            profileref.UserProfileServiceClient client = new profileref.UserProfileServiceClient("BasicHttpBinding_IUserProfileService");
            profileref.UserProfile user = new profileref.UserProfile();
            DataSet ds = new DataSet();

            ds = client.GetUserRecords();
            GridView1.DataSource = ds;
            GridView1.DataBind();
        }
        protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            profileref.UserProfileServiceClient client = new profileref.UserProfileServiceClient("BasicHttpBinding_IUserProfileService");
            profileref.UserProfile user = new profileref.UserProfile();

            int ID = (int)e.Keys["UserId"];

            user.UserID = ID;
            client.DeleteRecords(user);

            BindGrid();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            profileref.UserProfileServiceClient client = new profileref.UserProfileServiceClient("BasicHttpBinding_IUserProfileService");
            profileref.UserProfile user = new profileref.UserProfile();

            user.Name   = TextBox1.Text;
            user.Email  = TextBox2.Text;
            user.Gender = TextBox5.Text;
            user.Phone  = TextBox4.Text;
            client.AddUserRecord(user);
            Label1.Text = "Success";
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            profileref.UserProfileServiceClient client = new profileref.UserProfileServiceClient("BasicHttpBinding_IUserProfileService");
            profileref.UserProfile user = new profileref.UserProfile();
            user.Email    = email.Text;
            user.Name     = txt_name.Text;
            user.Phone    = phone.Text;
            user.Username = txt_Username.Text;
            user.Gender   = gender.SelectedItem.Value.ToString();
            user.UserID   = (int)Session["userid"];
            string msg = client.UpdateUserContact(user);

            Label1.Text      = msg;
            Label1.ForeColor = Color.Green;
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     profileref.UserProfile user = new profileref.UserProfile();
 }