Esempio n. 1
0
    public void getdatauseraccount()
    {
        DataTable dt = new DataTable();

        dt.Columns.Add("Id");
        dt.Columns.Add("FirstName");
        dt.Columns.Add("LastName");
        dt.Columns.Add("Email");
        dt.Columns.Add("Password");
        dt.Columns.Add("MobilePhone");
        dt.Columns.Add("UserGroup");
        dt.Columns.Add("Urlimage");
        string urlImage = "Image/innofood.jpg";

        CommonClassLibrary.CommonDataSet.UserAccountDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.UserAccountTableAdapter().GetDataByStatus100();
        foreach (CommonClassLibrary.CommonDataSet.UserAccountRow item in collection)
        {
            CommonClassLibrary.CommonDataSet.AccountGroupDataTable collection2 = new CommonClassLibrary.CommonDataSetTableAdapters.AccountGroupTableAdapter().GetDataByUserAccount(item.Id);
            if (collection2.Rows.Count > 1)
            {
                string usergroup = "";

                foreach (CommonClassLibrary.CommonDataSet.AccountGroupRow item2 in collection2)
                {
                    CommonClassLibrary.CommonDataSet.UserGroupDataTable collection3 = new CommonClassLibrary.CommonDataSetTableAdapters.UserGroupTableAdapter().GetDataByID(item2.UserGroup);
                    foreach (CommonClassLibrary.CommonDataSet.UserGroupRow item3 in collection3)
                    {
                        usergroup += item3.Name + ", ";
                        if (item.ImageUrl != null)
                        {
                            urlImage = "Image/" + item.ImageUrl;
                        }
                    }
                }
                usergroup = usergroup.Trim();
                if (usergroup.EndsWith(","))
                {
                    usergroup = usergroup.Substring(0, usergroup.Length - 1);
                }
                dt.Rows.Add(item.Id, item.FirstName, item.LastName, item.Email, item.Password, item.MobilePhoneNumber, usergroup, urlImage);
            }
            else
            {
                foreach (CommonClassLibrary.CommonDataSet.AccountGroupRow item2 in collection2)
                {
                    CommonClassLibrary.CommonDataSet.UserGroupDataTable collection3 = new CommonClassLibrary.CommonDataSetTableAdapters.UserGroupTableAdapter().GetDataByID(item2.UserGroup);
                    foreach (CommonClassLibrary.CommonDataSet.UserGroupRow item3 in collection3)
                    {
                        if (item.ImageUrl != null)
                        {
                            urlImage = "Image/" + item.ImageUrl;
                        }
                        dt.Rows.Add(item.Id, item.FirstName, item.LastName, item.Email, item.Password, item.MobilePhoneNumber, item3.Name, urlImage);
                    }
                }
            }
        }
        this.UserAccountRepeater.DataSource = dt;
        this.UserAccountRepeater.DataBind();
    }
Esempio n. 2
0
    public void getdatauseraccount()
    {
        DataTable dt = new DataTable();

        dt.Columns.Add("Id");
        dt.Columns.Add("FirstName");
        dt.Columns.Add("LastName");
        dt.Columns.Add("Email");
        dt.Columns.Add("Password");
        dt.Columns.Add("MobilePhone");
        dt.Columns.Add("Name");
        dt.Columns.Add("Address");
        string commentuser = "";

        CommonClassLibrary.CommonDataSet.UserAccountDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.UserAccountTableAdapter().GetData();
        foreach (CommonClassLibrary.CommonDataSet.UserAccountRow item in collection)
        {
            if (inno.Comments.Where(x => x.Create_By == item.Id).Count() > 0)
            {
                commentuser = inno.Comments.Where(x => x.Create_By == item.Id).OrderByDescending(u => u.Id).FirstOrDefault().Comment1;
            }
            else
            {
                commentuser = "";
            }
            CommonClassLibrary.CommonDataSet.AccountGroupDataTable collection2 = new CommonClassLibrary.CommonDataSetTableAdapters.AccountGroupTableAdapter().GetDataByUserAccount(item.Id);
            if (collection2.Rows.Count > 1)
            {
                string usergroup = "";
                foreach (CommonClassLibrary.CommonDataSet.AccountGroupRow item2 in collection2)
                {
                    CommonClassLibrary.CommonDataSet.UserGroupDataTable collection3 = new CommonClassLibrary.CommonDataSetTableAdapters.UserGroupTableAdapter().GetDataByID(item2.UserGroup);
                    foreach (CommonClassLibrary.CommonDataSet.UserGroupRow item3 in collection3)
                    {
                        usergroup += item3.Name + ", ";
                    }
                }
                usergroup = usergroup.Trim();
                if (usergroup.EndsWith(","))
                {
                    usergroup = usergroup.Substring(0, usergroup.Length - 1);
                }
                dt.Rows.Add(item.Id, item.FirstName, item.LastName, item.Email, item.Password, item.MobilePhoneNumber, usergroup, commentuser);
            }
            else
            {
                foreach (CommonClassLibrary.CommonDataSet.AccountGroupRow item2 in collection2)
                {
                    CommonClassLibrary.CommonDataSet.UserGroupDataTable collection3 = new CommonClassLibrary.CommonDataSetTableAdapters.UserGroupTableAdapter().GetDataByID(item2.UserGroup);
                    foreach (CommonClassLibrary.CommonDataSet.UserGroupRow item3 in collection3)
                    {
                        dt.Rows.Add(item.Id, item.FirstName, item.LastName, item.Email, item.Password, item.MobilePhoneNumber, item3.Name, commentuser);
                    }
                }
            }
        }
        this.UserAccountRepeater.DataSource = dt;
        this.UserAccountRepeater.DataBind();
    }
Esempio n. 3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            System.Web.UI.HtmlControls.HtmlGenericControl Usermanagement = (System.Web.UI.HtmlControls.HtmlGenericControl)Master.FindControl("Li7");
            Usermanagement.Attributes.Add("class", "active");

            System.Web.UI.HtmlControls.HtmlGenericControl Usergroup = (System.Web.UI.HtmlControls.HtmlGenericControl)Master.FindControl("Li8");
            Usergroup.Attributes.Add("class", "active");


            int ID = int.Parse(Request.QueryString["Id"]);
            CommonClassLibrary.CommonDataSet.UserGroupDataTable collection = new CommonClassLibrary.CommonDataSetTableAdapters.UserGroupTableAdapter().GetDataByID(ID);
            if (collection.Rows.Count > 0)
            {
                foreach (CommonClassLibrary.CommonDataSet.UserGroupRow item in collection)
                {
                    this.NameEditUserGroup_TextBox.Text = item.Name;
                }
            }
        }
    }