Example #1
0
        private void BindUserType()
        {
            UserInfoManager userManager = new UserInfoManager();
            DataTable       dt          = userManager.GetUserTypeList();

            UserType.DataSource     = dt;
            UserType.DataTextField  = "Name";
            UserType.DataValueField = "ID";
            UserType.DataBind();
        }
Example #2
0
    void PopulateFields()
    {
        if (Session["UserIdVendor"].ToString() != "" && Session["UserIdVendor"] != null)
        {
            Label1.Text       = "Edit Vendor User";
            Label2.Text       = "UPDATE";
            deleteBt1.Visible = true;
            string connstring = ConfigurationManager.ConnectionStrings["AVAConnectionString"].ConnectionString;
            //string sCommand = "";

            query = "SELECT t1.* FROM tblUsers t1 WHERE t1.UserId=@UserId ";
            using (conn = new SqlConnection(connstring))
            {
                using (cmd = new SqlCommand(query, conn))
                {
                    conn.Open();
                    cmd.Parameters.AddWithValue("@UserId", Session["UserIdVendor"]);
                    oReader = cmd.ExecuteReader();
                    if (oReader.HasRows)
                    {
                        while (oReader.Read())
                        {
                            UserName.Value     = oReader["UserName"].ToString();
                            UserPassword.Value = EncryptionHelper.Decrypt(oReader["UserPassword"].ToString());
                            EmailAdd.Value     = oReader["EmailAdd"].ToString();
                            //FirstName.Value = oReader["FirstName"].ToString();
                            //LastName.Value = oReader["LastName"].ToString();
                            //CompanyName.Value = oReader["CompanyName"].ToString();
                            CompanyNameTxt.Text = oReader["CompanyName"].ToString();
                            //UserType.SelectedValue = oReader["UserType"].ToString();
                            //CompanyName1.SelectedValue = oReader["VendorId"].ToString();
                        }
                    }
                    conn.Close();
                }
            }
            UserType.DataBind();
            query = "SELECT t1.* FROM tblUserTypes t1 WHERE t1.UserId=@UserId ";
            using (conn = new SqlConnection(connstring))
            {
                using (cmd = new SqlCommand(query, conn))
                {
                    conn.Open();
                    cmd.Parameters.AddWithValue("@UserId", Session["UserIdVendor"]);
                    oReader = cmd.ExecuteReader();
                    if (oReader.HasRows)
                    {
                        while (oReader.Read())
                        {
                            //UserType.SelectedValue = oReader["UserType"].ToString();
                            foreach (ListItem listItem in UserType.Items)
                            {
                                if (listItem.Value == oReader["UserType"].ToString())
                                {
                                    listItem.Selected = true;
                                }
                            }
                        }
                    }
                    conn.Close();
                }
            }
        }
    }