コード例 #1
0
        protected void BtnLogin_ServerClick(object sender, EventArgs e)
        {
            Dictionary <string, string> condition = new Dictionary <string, string>();

            condition.Add("UserName", txtUserName.Value.Clean());
            condition.Add("Password", txtPassword.Value.Clean());
            user = jobs.User(condition).FirstOrDefault();


            if (user != null)
            {
                Session["USER"] = user;
                Response.Redirect("~/index.aspx");
            }
            else
            {
                Session["USER"] = null;
                //ErrorMessage = Resources.Index.signingerror;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (ddlYetki.Items.Count >= 0)
            {
                roless = jobs.Role();
                foreach (var item in roless)
                {
                    ddlYetki.Items.Add(item.PkID.ToString());
                    ddlYetki.Items[ddlYetki.Items.Count - 1].Value = item.PkID.ToString();
                }
            }
            btnUpdate.ServerClick += BtnUpdate_ServerClick;
            btnClear.ServerClick  += BtnClear_ServerClick;
            btnClear.Value         = Resources.Index.Clean;
            btnUpdate.Value        = Resources.Index.Save;
            users = jobs.User();

            if (!Page.IsPostBack)
            {
                lblid.Text               = users[0].id.ToString().Clean();
                txtUserName.Value        = users[0].UserName.ToString().Clean();
                txtPassword.Value        = users[0].Password.ToString().Clean();
                txtConfirmPassword.Value = users[0].ConfirmPassword.ToString().Clean();
                txtNameSurname.Value     = users[0].UserName.ToString().Clean();
                txtEmail.Value           = users[0].Email.ToString().Clean();
                string UserRole = users[0].RoleID.ToString().Clean();
                ddlYetki.SelectedValue = UserRole;
                if (users[0].ProfilePhoto == "")
                {
                    image1.ImageUrl = "Content\\img\\user2-160x160.jpg";
                }
                else
                {
                    image1.ImageUrl = users[0].ProfilePhoto.ToString().Clean();
                }
            }
        }