Esempio n. 1
0
        void InitDropDownProject()
        {
            RawEnergyDataController ddc = new RawEnergyDataController();
            var projects = ddc.GetAll();
            var pList    = from p
                           in projects
                           select new ProjectDropDownItem
            {
                projectId = p.projectId
                ,
                projectSize = p.projectSize
                ,
                displayField = String.Format("{0} : {1}", p.projectId, p.projectSize)
            };

            var newList = pList.ToList();

            newList.Insert(0, new ProjectDropDownItem {
                projectId = -1, projectSize = 0, displayField = "Select project"
            });

            DropDownListProject.DataSource     = newList;
            DropDownListProject.DataValueField = "projectId";
            DropDownListProject.DataTextField  = "displayField";
            DropDownListProject.DataBind();
        }
        private void load_DdProject()
        {
            DropDownListProject.DataSource = (from project in dbContext.projects
                                              select project).ToList();

            DropDownListProject.DataTextField  = "name";
            DropDownListProject.DataValueField = "projectID";
            DropDownListProject.DataBind();
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                cd = new SqlCommand("select image_url,ename from employee where eemail=@email", con);
                cd.Parameters.AddWithValue("@email", Session["email"].ToString());
                da = new SqlDataAdapter(cd);
                dt = new DataTable();
                da.Fill(dt);

                foreach (DataRow item in dt.Rows)
                {
                    userimage.ImageUrl = item[0].ToString();
                    username.Text      = item[1].ToString();
                }
                int id = 0;
                cd = new SqlCommand("findEid", con);
                cd.Parameters.AddWithValue("@email", Session["email"].ToString());
                string email = Session["email"].ToString();
                cd.CommandType = CommandType.StoredProcedure;
                da             = new SqlDataAdapter(cd);
                dt             = new DataTable();
                da.Fill(dt);

                foreach (DataRow item in dt.Rows)
                {
                    id = Convert.ToInt16(item[0]);
                }


                cd1             = new SqlCommand("getprojectsteamleader", con);
                cd1.CommandType = CommandType.StoredProcedure;
                cd1.Parameters.AddWithValue("@empid", id);
                da1 = new SqlDataAdapter(cd1);
                dt1 = new DataTable();
                da1.Fill(dt1);

                DropDownList1.DataSource     = dt1;
                DropDownList1.DataTextField  = "pname";
                DropDownList1.DataValueField = "pid";
                DropDownList1.DataBind();

                cd2             = new SqlCommand("getJuniors", con);
                cd2.CommandType = CommandType.StoredProcedure;

                da2 = new SqlDataAdapter(cd2);
                dt2 = new DataTable();
                da2.Fill(dt2);

                DropDownList3.DataSource     = dt2;
                DropDownList3.DataTextField  = "ename";
                DropDownList3.DataValueField = "eid";
                DropDownList3.DataBind();

                DropDownListProject.DataSource     = dt1;
                DropDownListProject.DataTextField  = "pname";
                DropDownListProject.DataValueField = "pid";
                DropDownListProject.DataBind();


                ListItem li = new ListItem();
                li.Text  = "Select Project";
                li.Value = 0.ToString();
                DropDownList1.Items.Insert(0, li);

                ListItem li1 = new ListItem();
                li1.Text  = "Select Module";
                li1.Value = 0.ToString();
                DropDownList2.Items.Insert(0, li1);

                ListItem li2 = new ListItem();
                li2.Text  = "Select Junior";
                li2.Value = 0.ToString();
                DropDownList3.Items.Insert(0, li2);

                ListItem li3 = new ListItem();
                li3.Text  = "Select Project";
                li3.Value = 0.ToString();
                DropDownListProject.Items.Insert(0, li3);

                ListItem li4 = new ListItem();
                li4.Text  = "Select Module";
                li4.Value = 0.ToString();
                DropDownListModules.Items.Insert(0, li4);
            }
        }