Exemplo n.º 1
0
        private void OtherOpportunityDataBind()
        {
            Opportunity opp = new Opportunity();

            ddlOtherOpportunity.DataSource     = opp.GetAllOpportunities();
            ddlOtherOpportunity.DataTextField  = "Name";
            ddlOtherOpportunity.DataValueField = "OpportunityID";
            ddlOtherOpportunity.DataBind();
        }
Exemplo n.º 2
0
        protected void DataBind(Opportunity opp)
        {
            if (opp != null)
            {
                tbName.Text                     = opp.Name;
                tbThisLocation.Text             = opp.Location;
                tbJobDescription.Text           = opp.JobDescription;
                tbRequirement.Text              = opp.Requirement;
                ddlType.SelectedValue           = opp.OpportunityTypeId.ToString();
                ddlSupervisor.SelectedValue     = opp.CPPId.ToString();
                ddlQuarter.SelectedValue        = opp.QuarterId.ToString();
                tbJobHours.Text                 = opp.JobHours;
                tbRequirementAge.Text           = opp.MinimumAge;
                rblResume.SelectedValue         = opp.ResumeRequired;
                rblCRC.SelectedValue            = opp.CrcRequiredByPartner;
                tbDistance.Text                 = opp.DistanceFromSU;
                tbLink.Text                     = opp.LinkToOnlineApp;
                tbDate.Text                     = opp.OrientationDate.ToString();
                tbSlot.Text                     = opp.TotalNumberSlots.ToString();
                ddlTimeCommitment.SelectedValue = opp.TimeCommittment;
                adminOppStatus                  = opp.Status;
                if (adminOppStatus == "Open")
                {
                    btnApproval.Text = "Close";
                }
            }

            if (Session["AdminOppId"] != null)
            {
                //tbName.Enabled = false;
                //tbDate.Enabled = false;
                //tbSlot.Enabled = false;
                //ddlSupervisor.Enabled = false;
                //tbThisLocation.Enabled = false;
                //tbJobDescription.Enabled = false;
                //tbRequirement.Enabled = false;
                //ddlType.Enabled = false;
                //ddlQuarter.Enabled = false;
                //tbJobHours.Enabled = false;
                //tbRequirementAge.Enabled = false;
                //rblResume.Enabled = false;
                //rblCRC.Enabled = false;
                //tbDistance.Enabled = false;
                //tbLink.Enabled = false;
                //ddlTimeCommitment.Enabled = false;
                //ddlFocusArea.Enabled = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                DataBind_OpportunityType();
                DataBind_FocusArea();
                DataBind_Quarter();
                DataBind_CommunityPartnerPeople();

                if (Session["FacultyOppId"] != null)
                {
                    Opportunity thisOpp = new Opportunity();
                    thisOpp = thisOpp.GetOneOpportunityById(Convert.ToInt32(Session["FacultyOppId"]));
                    DataBind(thisOpp);
                }
            }
        }
Exemplo n.º 4
0
        protected void DeleteOpportunity(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 lblOppId = (Label)gvr.FindControl("lblOppId");

            //datasource
            Opportunity opp = new Opportunity();

            opp.OpportunityId = Convert.ToInt32(lblOppId.Text);
            opp.Delete();

            DataBind();
        }
Exemplo n.º 5
0
        private void DataBind()
        {
            Opportunity        opp     = new Opportunity();
            List <Opportunity> oppList = opp.GetOpportunityListForFaculty();

            if (oppList.Count == 0)
            {
                Opportunity oppS = new Opportunity();
                oppList.Add(oppS);
                gvOpportunityFaculty.DataSource = oppList;
                gvOpportunityFaculty.DataBind();
                gvOpportunityFaculty.Rows[0].Visible = false;
            }
            else
            {
                gvOpportunityFaculty.DataSource = oppList;
                gvOpportunityFaculty.DataBind();
            }
        }
Exemplo n.º 6
0
        public List <Opportunity> GetAllOpportunities()
        {
            var reader = dbHelper.GetOpportunityList(Constant.SP_GetOpportunityList);

            List <Opportunity> oppList = new List <Opportunity>();
            Opportunity        opp     = null;

            while (reader.Read())
            {
                opp = new Opportunity();
                opp.OpportunityId       = Convert.ToInt32(reader["OpportunityId"]);
                opp.Name                = reader["Name"].ToString();
                opp.Location            = reader["Location"].ToString();
                opp.OpportunityTypeName = reader["OpportunityTypeName"].ToString();
                opp.Status              = reader["Status"].ToString();
                opp.SupervisorName      = reader["Supervisor"].ToString();
                opp.DateApproved        = Convert.ToDateTime(reader["DateApproved"]);

                oppList.Add(opp);
            }

            return(oppList);
        }
Exemplo n.º 7
0
        protected void gvOpportunity_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            //Get the new Values.
            GridViewRow row        = gvOpportunity.Rows[e.RowIndex];
            TextBox     tbName     = (TextBox)row.FindControl("tbName");
            TextBox     tbLocation = (TextBox)row.FindControl("tbLocation");
            TextBox     tbJobDes   = (TextBox)row.FindControl("tbJobDes");
            Label       lblOppId   = (Label)row.FindControl("lblOppId");

            // Code to update the DataSource.
            Opportunity opp = new Opportunity();

            opp.Name           = tbName.Text;
            opp.Location       = tbLocation.Text;
            opp.JobDescription = tbJobDes.Text;
            opp.OpportunityId  = Convert.ToInt32(lblOppId.Text);

            opp.Update();

            //Reset the edit index.
            gvOpportunity.EditIndex = -1;
            //Bind data to the GridView control.
            DataBind();
        }
Exemplo n.º 8
0
        protected void btnAdd_Click(Object sender, EventArgs e)
        {
            Button clickedButton = (Button)sender;

            if (clickedButton.Text == "Close")
            {
                string close = @"<script type='text/javascript'>
                                window.returnValue = true;
                                window.close();
                                </script>";
                base.Response.Write(close);
            }
            // When the button is clicked,
            // change the button text, and disable it.


            clickedButton.Text    = "...Processing...";
            clickedButton.Enabled = false;

            // Save to database
            Opportunity opp = new Opportunity();

            opp.Name                 = tbName.Text;
            opp.Location             = tbThisLocation.Text;
            opp.JobDescription       = tbJobDescription.Text;
            opp.Requirement          = tbRequirement.Text;
            opp.DateApproved         = DateTime.Now;
            opp.OpportunityTypeId    = Convert.ToInt32(ddlType.SelectedItem.Value);
            opp.CPId                 = 1;
            opp.CPPId                = Convert.ToInt32(ddlSupervisor.SelectedItem.Value);
            opp.QuarterId            = Convert.ToInt32(ddlQuarter.SelectedItem.Value);
            opp.JobHours             = tbJobHours.Text;
            opp.MinimumAge           = tbRequirementAge.Text;
            opp.ResumeRequired       = rblResume.SelectedValue;
            opp.CrcRequiredByPartner = rblCRC.SelectedValue;
            opp.DistanceFromSU       = tbDistance.Text;
            opp.LinkToOnlineApp      = tbLink.Text;
            try
            {
                opp.OrientationDate  = Convert.ToDateTime(tbDate.Text);
                opp.TotalNumberSlots = Convert.ToInt32(tbSlot.Text);
                opp.TimeCommittment  = ddlTimeCommitment.SelectedItem.Value;
            }
            catch
            {
            }

            if (Session["OppId"] != null && Session["IsClone"] == null)
            {
                opp.OpportunityId = Convert.ToInt32(Session["OppId"].ToString());
                opp.Update();
                lblEmpty.Text = "The opportunity was updated successfully. Please refresh the Opportunity page to review. Please close the window.";
            }
            else
            {
                opp.Add();
                lblEmpty.Text = "New opportunity was added successfully. Please refresh the Opportunity page to review. Please close the window.";
            }
            clickedButton.Enabled = true;
            clickedButton.Text    = "Close";
            Session["OppId"]      = null;
            Session["IsClone"]    = null;
        }