Exemplo n.º 1
0
        protected void gvSupervisor_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            //Get the values
            GridViewRow row             = gvSupervisor.Rows[e.RowIndex];
            TextBox     tbSupervisor    = (TextBox)row.FindControl("tbSupervisorName");
            TextBox     tbTitle         = (TextBox)row.FindControl("tbTitle");
            TextBox     tbPhone         = (TextBox)row.FindControl("tbPhone");
            TextBox     tbEmailID       = (TextBox)row.FindControl("tbEmailID");
            Label       lblSupervisorID = (Label)row.FindControl("lblSupervisorID");

            //Update the values
            CommunityPartnersPeople cpp = new CommunityPartnersPeople();

            cpp.Title     = tbTitle.Text;
            cpp.FirstName = tbSupervisor.Text;
            cpp.Phone     = tbPhone.Text;
            cpp.EmailID   = tbEmailID.Text;
            cpp.CPPID     = Convert.ToInt32(lblSupervisorID.Text);
            cpp.UpdateSupervisor();
            //Reset the edit index
            gvSupervisor.EditIndex = -1;

            //Bind Data
            DataBind();
        }
Exemplo n.º 2
0
        protected void DataBind_CommunityPartnerPeople()
        {
            CommunityPartnersPeople ccp = new CommunityPartnersPeople();

            ddlSupervisor.DataSource     = ccp.GetAllCommunityPartnerPeople();
            ddlSupervisor.DataTextField  = "FirstName";
            ddlSupervisor.DataValueField = "CPPID";
            ddlSupervisor.DataBind();
        }
Exemplo n.º 3
0
        private void DataBind()
        {
            CommunityPartnersPeople cpp = new CommunityPartnersPeople();

            cpp.CPID = Convert.ToInt32(Session["CPID"]);
            List <CommunityPartnersPeople> cpplist = cpp.GetAllCommunityPartnerPeople();

            gvSupervisor.DataSource = cpplist;
            gvSupervisor.DataBind();
        }
Exemplo n.º 4
0
        protected void DeleteSupervisor(object sender, EventArgs e)
        {
            //Get the button that raised the event
            LinkButton lbtn = (LinkButton)sender;
            //Get the row that contains this button
            GridViewRow gvr = (GridViewRow)lbtn.NamingContainer;

            Label lblSupervisorID = (Label)gvr.FindControl("lblSupervisorID");

            //datasource
            CommunityPartnersPeople cpp = new CommunityPartnersPeople();

            cpp.CPPID = Convert.ToInt32(lblSupervisorID.Text);
            cpp.CPID  = Convert.ToInt32(Session["CPID"]);
            cpp.DeleteSupervisor();

            DataBind();
        }
        public CommunityPartnersPeople GetSupervisor(int cppid)
        {
            var reader = dbHelper.GetSupervisor(Constant.SP_GetSupervisor, cppid);

            CommunityPartnersPeople communityPartnerPeople = null;

            while (reader.Read())
            {
                communityPartnerPeople           = new CommunityPartnersPeople();
                communityPartnerPeople.CPPID     = Convert.ToInt32(reader["SupervisorID"]);
                communityPartnerPeople.FirstName = reader["FirstName"].ToString();
                communityPartnerPeople.LastName  = reader["LastName"].ToString();
                communityPartnerPeople.Title     = reader["Title"].ToString();
                communityPartnerPeople.Phone     = reader["Phone"].ToString();
                communityPartnerPeople.EmailID   = reader["EmailID"].ToString();
            }
            return(communityPartnerPeople);
        }
        public List <CommunityPartnersPeople> GetAllCommunityPartnerPeople()
        {
            var reader = dbHelper.GetCommunityPartnerPeople(Constant.SP_GetCommunityPartnerPeople, this.CPID);

            List <CommunityPartnersPeople> communityPartnerPeopleList = new List <CommunityPartnersPeople>();
            CommunityPartnersPeople        communityPartnerPeople;

            while (reader.Read())
            {
                communityPartnerPeople           = new CommunityPartnersPeople();
                communityPartnerPeople.CPPID     = Convert.ToInt32(reader["SupervisorID"]);
                communityPartnerPeople.FirstName = reader["FirstName"].ToString();
                communityPartnerPeople.LastName  = reader["LastName"].ToString();
                communityPartnerPeople.Title     = reader["Title"].ToString();
                communityPartnerPeople.Phone     = reader["Phone"].ToString();
                communityPartnerPeople.EmailID   = reader["EmailID"].ToString();

                communityPartnerPeopleList.Add(communityPartnerPeople);
            }

            return(communityPartnerPeopleList);
        }