public void filldata()
    {
        int id = Convert.ToInt16(Session["EmpId"].ToString());
        //DropDownEmp.DataSource = db.manage_employee(0, "", "", "", "", 0, 0, "", "", "", "", 0, "", "",0, 4);
        //DropDownEmp.DataTextField = "FName";
        //DropDownEmp.DataValueField = "EmpId";
        //DropDownEmp.DataBind();
        //DropDownEmp.Items.Insert(0, "--Select Name--");
        var data = from p in db.AllProjects
                   join e in db.ProjectMasters
                   on p.Pid equals e.Pid
                   where e.EmpId == id
                   select p;

        DropDownProject.DataSource     = data;//db.manage_projectmaster(0, "", "", DateTime.Now, 0, DateTime.Now, DateTime.Now,0, 4);
        DropDownProject.DataTextField  = "ProjectNameAll";
        DropDownProject.DataValueField = "Pid";
        DropDownProject.DataBind();
        DropDownProject.Items.Insert(0, "--Select Name--");
    }
Ejemplo n.º 2
0
    private void selectProjects()
    {
        try
        {
            System.Data.SqlClient.SqlConnection sc = new System.Data.SqlClient.SqlConnection();
            sc.ConnectionString = @"Server =Localhost ;Database=Lab2;Trusted_Connection=Yes;";
            System.Data.SqlClient.SqlCommand insert = new System.Data.SqlClient.SqlCommand();
            insert.CommandText = "select ProjectName from [dbo].[PROJECT]";
            insert.Connection  = sc;
            sc.Open();
            DropDownProject.DataSource    = insert.ExecuteReader();
            DropDownProject.DataTextField = "ProjectName";
            DropDownProject.DataBind();


            sc.Close();
        }
        catch (Exception s)
        {
            Label.Text += "Project Error";
            Label.Text += s.Message;
        }
    }
    public void filldata()
    {
        int id = Convert.ToInt16(Session["Cid"].ToString());
        var data1 = from a in db.AllProjects
                    
                    where id == a.CompanyId
                    select a;
        DropDownProject.DataSource = data1;//db.manage_employee(0, "", "", "", "", 0, 0, "", "", "", "", 0, "", "",id, 4);
        DropDownProject.DataTextField = "ProjectNameAll";
        DropDownProject.DataValueField = "Pid";
        DropDownProject.DataBind();
        DropDownProject.Items.Insert(0, "--Select Name--");


        var data = from e in db.EmployeeMasters
                   where id == e.CompanyId
                   select e;
        DropDownEmp.DataSource = data;//db.manage_employee(0, "", "", "", "", 0, 0, "", "", "", "", 0, "", "",id, 4);
        DropDownEmp.DataTextField = "FName";
        DropDownEmp.DataValueField = "EmpId";
        DropDownEmp.DataBind();
        DropDownEmp.Items.Insert(0, "--Select Name--");

    }