Example #1
0
    /// <summary>
    /// Gets the project details.
    /// </summary>
    /// <returns></returns>
    private BusinessEntities.RaveHRCollection GetProjectDetails(int employeeID)
    {
        Rave.HR.BusinessLayer.Employee.ProjectDetails objProjectDetailsBAL;
        BusinessEntities.ProjectDetails objProjectDetails;

        // Initialise Collection class object
        BusinessEntities.RaveHRCollection raveHRCollection = new BusinessEntities.RaveHRCollection();

        try
        {
            objProjectDetailsBAL = new Rave.HR.BusinessLayer.Employee.ProjectDetails();
            objProjectDetails    = new BusinessEntities.ProjectDetails();

            objProjectDetails.EMPId = employeeID;

            raveHRCollection = objProjectDetailsBAL.GetProjectDetails(objProjectDetails);
        }
        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "GetProjectDetails", EventIDConstants.RAVE_HR_EMPLOYEE_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }

        return(raveHRCollection);
    }
Example #2
0
    /// <summary>
    /// Handles the Click event of the btnAdd control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        BusinessEntities.ProjectDetails objProjectDetails = new BusinessEntities.ProjectDetails();

        if (gvProjectDetails.Rows[0].Cells[0].Text == NO_RECORDS_FOUND_MESSAGE)
        {
            ProjectDetailsCollection.Clear();
        }
        objProjectDetails.ProjectName     = txtProjectName.Text;
        objProjectDetails.Organisation    = txtCompanyName.Text;
        objProjectDetails.Role            = txtRole.Text;
        objProjectDetails.ProjectLocation = ddlLocation.SelectedItem.Text;
        objProjectDetails.OnsiteDuration  = txtDuration.Text;
        objProjectDetails.Description     = txtProjectDescription.Text;
        objProjectDetails.LocationId      = Convert.ToInt32(ddlLocation.SelectedValue);
        objProjectDetails.ClientName      = txtClientName.Text;
        objProjectDetails.ProjectSize     = Convert.ToInt32(txtProjectSiZe.Text);
        objProjectDetails.Resposibility   = txtResponsibility.Text;
        objProjectDetails.ProjectDoneName = ddlBifurcation.SelectedItem.Text;
        objProjectDetails.ProjectDone     = Convert.ToInt32(ddlBifurcation.SelectedValue);

        objProjectDetails.Mode = 1;

        ProjectDetailsCollection.Add(objProjectDetails);

        this.DoDataBind();

        this.ClearControls();

        if (gvProjectDetails.Rows.Count != 0)
        {
            btnSave.Visible = true;
        }
    }
Example #3
0
    /// <summary>
    /// Handles the RowDeleting event of the gvProjectDetails control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.Web.UI.WebControls.GridViewDeleteEventArgs"/> instance containing the event data.</param>
    protected void gvProjectDetails_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        int deleteRowIndex = 0;
        int rowIndex       = -1;

        BusinessEntities.ProjectDetails objProjectDetails = new BusinessEntities.ProjectDetails();

        deleteRowIndex = e.RowIndex;

        objProjectDetails      = (BusinessEntities.ProjectDetails)ProjectDetailsCollection.Item(deleteRowIndex);
        objProjectDetails.Mode = 3;

        if (ViewState[PROJECTDETAILSDELETE] != null)
        {
            BusinessEntities.RaveHRCollection objDeleteProjectDetailsCollection = (BusinessEntities.RaveHRCollection)ViewState[PROJECTDETAILSDELETE];
            objDeleteProjectDetailsCollection.Add(objProjectDetails);

            ViewState[PROJECTDETAILSDELETE] = objDeleteProjectDetailsCollection;
        }
        else
        {
            BusinessEntities.RaveHRCollection objDeleteProjectDetailsCollection1 = new BusinessEntities.RaveHRCollection();

            objDeleteProjectDetailsCollection1.Add(objProjectDetails);

            ViewState[PROJECTDETAILSDELETE] = objDeleteProjectDetailsCollection1;
        }

        ProjectDetailsCollection.RemoveAt(deleteRowIndex);

        ViewState[DELETEROWINDEX] = deleteRowIndex;

        DoDataBind();

        if (ViewState[ROWINDEX] != null)
        {
            rowIndex = Convert.ToInt32(ViewState[ROWINDEX].ToString());
            //check edit index with deleted index if edit index is greater than or equal to delete index then rowindex decremented.
            if (rowIndex != -1 && deleteRowIndex <= rowIndex)
            {
                rowIndex--;
                //store the rowindex in viewstate.
                ViewState[ROWINDEX] = rowIndex;
            }

            ImageButton btnImg = (ImageButton)gvProjectDetails.Rows[rowIndex].FindControl(IMGBTNDELETE);
            btnImg.Enabled = false;

            //Disabling all the edit buttons.
            for (int i = 0; i < gvProjectDetails.Rows.Count; i++)
            {
                if (rowIndex != i)
                {
                    ImageButton btnImgEdit = (ImageButton)gvProjectDetails.Rows[i].FindControl(IMGBTNEDIT);
                    btnImgEdit.Enabled = false;
                }
            }
        }
    }
Example #4
0
        /// <summary>
        /// get the client name of project by project  code.
        /// </summary>
        /// <param name="projectCode"></param>
        /// <returns></returns>
        public BusinessEntities.ProjectDetails getClientNameByProjectCode(string projectCode)
        {
            DataAccessClass ProjectDetailsDA = new DataAccessClass();

            try
            {
                BusinessEntities.ProjectDetails projectDetails = new BusinessEntities.ProjectDetails();
                SqlDataReader contractDataReader;

                ProjectDetailsDA.OpenConnection(DBConstants.GetDBConnectionString());

                SqlParameter[] sqlParam = new SqlParameter[1];
                sqlParam[0]       = new SqlParameter(SPParameter.ProjectName, DbType.String);
                sqlParam[0].Value = projectCode;

                contractDataReader = ProjectDetailsDA.ExecuteReaderSP(SPNames.Contract_CheckProjectName, sqlParam);

                while (contractDataReader.Read())
                {
                    projectDetails.ClientName = contractDataReader.GetValue(2).ToString();
                }
                return(projectDetails);
            }
            catch (RaveHRException ex)
            {
                throw ex;
            }
            catch (Exception ex)
            {
                throw new RaveHRException(ex.Message, ex, Sources.DataAccessLayer, CLASSNAME, "getClientNameByProjectCode", EventIDConstants.RAVE_HR_CONTRACT_DATA_ACCESS_LAYER);
            }
            finally
            {
                ProjectDetailsDA.CloseConncetion();
            }
        }
Example #5
0
    /// <summary>
    /// Handles the Click event of the btnUpdate control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnUpdate_Click(object sender, EventArgs e)
    {
        int rowIndex       = 0;
        int deleteRowIndex = -1;

        if (ViewState[DELETEROWINDEX] != null)
        {
            deleteRowIndex = Convert.ToInt32(ViewState[DELETEROWINDEX].ToString());
        }

        //Update the grid view according the row, which is selected for editing.
        if (ViewState[ROWINDEX] != null)
        {
            rowIndex = Convert.ToInt32(ViewState[ROWINDEX].ToString());
            if (deleteRowIndex != -1 && deleteRowIndex < rowIndex)
            {
                rowIndex--;
            }

            Label ProjectId = (Label)gvProjectDetails.Rows[rowIndex].FindControl(PROJECTID);
            Label Mode      = (Label)gvProjectDetails.Rows[rowIndex].FindControl(MODE);

            gvProjectDetails.Rows[rowIndex].Cells[0].Text = ddlBifurcation.SelectedItem.Text;
            gvProjectDetails.Rows[rowIndex].Cells[1].Text = txtProjectName.Text;
            gvProjectDetails.Rows[rowIndex].Cells[2].Text = txtCompanyName.Text;
            gvProjectDetails.Rows[rowIndex].Cells[3].Text = ddlLocation.SelectedItem.Text;
            gvProjectDetails.Rows[rowIndex].Cells[4].Text = txtClientName.Text;
            gvProjectDetails.Rows[rowIndex].Cells[5].Text = txtProjectSiZe.Text;
            gvProjectDetails.Rows[rowIndex].Cells[6].Text = txtDuration.Text;
            gvProjectDetails.Rows[rowIndex].Cells[7].Text = txtRole.Text;
            gvProjectDetails.Rows[rowIndex].Cells[8].Text = txtProjectDescription.Text;
            gvProjectDetails.Rows[rowIndex].Cells[9].Text = txtResponsibility.Text;


            if (int.Parse(ProjectId.Text) == 0)
            {
                Mode.Text = "1";
            }
            else
            {
                Mode.Text = "2";
            }

            Label LocationId = (Label)gvProjectDetails.Rows[rowIndex].FindControl(ProjectLocationId);
            LocationId.Text = ddlLocation.SelectedValue;

            Label ProjectDoneID = (Label)gvProjectDetails.Rows[rowIndex].FindControl(ProjectDoneStatus);
            ProjectDoneID.Text = ddlBifurcation.SelectedValue;

            ImageButton btnImg = (ImageButton)gvProjectDetails.Rows[rowIndex].FindControl(IMGBTNDELETE);
            btnImg.Enabled            = true;
            ViewState[ROWINDEX]       = null;
            ViewState[DELETEROWINDEX] = null;
        }

        for (int i = 0; i < ProjectDetailsCollection.Count; i++)
        {
            BusinessEntities.ProjectDetails objProjectDetails = new BusinessEntities.ProjectDetails();
            objProjectDetails = (BusinessEntities.ProjectDetails)ProjectDetailsCollection.Item(i);

            Label ProjectId = (Label)gvProjectDetails.Rows[i].FindControl(PROJECTID);
            Label Mode      = (Label)gvProjectDetails.Rows[rowIndex].FindControl(MODE);

            objProjectDetails.ProjectId       = int.Parse(ProjectId.Text);
            objProjectDetails.EMPId           = int.Parse(EMPId.Value);
            objProjectDetails.ProjectDoneName = gvProjectDetails.Rows[i].Cells[0].Text;
            objProjectDetails.ProjectName     = gvProjectDetails.Rows[i].Cells[1].Text;
            objProjectDetails.Organisation    = gvProjectDetails.Rows[i].Cells[2].Text;
            objProjectDetails.ProjectLocation = gvProjectDetails.Rows[i].Cells[3].Text;
            objProjectDetails.ClientName      = gvProjectDetails.Rows[i].Cells[4].Text;
            objProjectDetails.ProjectSize     = Convert.ToInt32(gvProjectDetails.Rows[i].Cells[5].Text);
            objProjectDetails.OnsiteDuration  = gvProjectDetails.Rows[i].Cells[6].Text;
            objProjectDetails.Role            = gvProjectDetails.Rows[i].Cells[7].Text;
            objProjectDetails.Description     = gvProjectDetails.Rows[i].Cells[8].Text;
            objProjectDetails.Resposibility   = gvProjectDetails.Rows[i].Cells[9].Text;
            objProjectDetails.Mode            = int.Parse(Mode.Text);
        }

        //Clear all the fields after inserting row into gridview
        this.ClearControls();

        btnAddRow.Visible    = true;
        btnUpdate.Visible    = false;
        btnCancelRow.Visible = false;

        //Enabling all the edit buttons.
        for (int i = 0; i < gvProjectDetails.Rows.Count; i++)
        {
            ImageButton btnImgEdit = (ImageButton)gvProjectDetails.Rows[i].FindControl(IMGBTNEDIT);
            btnImgEdit.Enabled = true;
        }
    }
Example #6
0
    /// <summary>
    /// Handles the Click event of the btnSave control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Rave.HR.BusinessLayer.Employee.ProjectDetails objProjectDetailsBAL;

        BusinessEntities.ProjectDetails   objProjectDetails;
        BusinessEntities.RaveHRCollection objSaveProjectDetailsCollection = new BusinessEntities.RaveHRCollection();

        try
        {
            objProjectDetailsBAL = new Rave.HR.BusinessLayer.Employee.ProjectDetails();

            if (gvProjectDetails.Rows[0].Cells[0].Text != NO_RECORDS_FOUND_MESSAGE)
            {
                for (int i = 0; i < gvProjectDetails.Rows.Count; i++)
                {
                    objProjectDetails = new BusinessEntities.ProjectDetails();
                    Label ProjectId = (Label)gvProjectDetails.Rows[i].FindControl(PROJECTID);
                    Label Mode      = (Label)gvProjectDetails.Rows[i].FindControl(MODE);

                    objProjectDetails.ProjectId       = int.Parse(ProjectId.Text);
                    objProjectDetails.EMPId           = int.Parse(EMPId.Value);
                    objProjectDetails.Organisation    = gvProjectDetails.Rows[i].Cells[2].Text;
                    objProjectDetails.ProjectName     = gvProjectDetails.Rows[i].Cells[1].Text;
                    objProjectDetails.ProjectLocation = gvProjectDetails.Rows[i].Cells[3].Text;
                    objProjectDetails.ClientName      = gvProjectDetails.Rows[i].Cells[4].Text;
                    objProjectDetails.ProjectSize     = int.Parse(gvProjectDetails.Rows[i].Cells[5].Text);
                    objProjectDetails.OnsiteDuration  = gvProjectDetails.Rows[i].Cells[6].Text;
                    objProjectDetails.Role            = gvProjectDetails.Rows[i].Cells[7].Text;
                    objProjectDetails.Description     = gvProjectDetails.Rows[i].Cells[8].Text;
                    objProjectDetails.Resposibility   = gvProjectDetails.Rows[i].Cells[9].Text;
                    objProjectDetails.Mode            = int.Parse(Mode.Text);

                    Label LocationId = (Label)gvProjectDetails.Rows[i].FindControl(ProjectLocationId);
                    objProjectDetails.LocationId = Convert.ToInt32(LocationId.Text);

                    Label ProjectDoneID = (Label)gvProjectDetails.Rows[i].FindControl(ProjectDoneStatus);
                    objProjectDetails.ProjectDone = Convert.ToInt32(ProjectDoneID.Text);

                    objSaveProjectDetailsCollection.Add(objProjectDetails);
                }
            }
            BusinessEntities.RaveHRCollection objDeleteProjectDetailsCollection = (BusinessEntities.RaveHRCollection)ViewState[PROJECTDETAILSDELETE];

            if (objDeleteProjectDetailsCollection != null)
            {
                BusinessEntities.ProjectDetails obj = null;

                for (int i = 0; i < objDeleteProjectDetailsCollection.Count; i++)
                {
                    objProjectDetails = new BusinessEntities.ProjectDetails();
                    obj = (BusinessEntities.ProjectDetails)objDeleteProjectDetailsCollection.Item(i);

                    objProjectDetails.ProjectId       = obj.ProjectId;
                    objProjectDetails.EMPId           = obj.EMPId;
                    objProjectDetails.ProjectName     = obj.ProjectName;
                    objProjectDetails.Organisation    = obj.Organisation;
                    objProjectDetails.ClientName      = obj.ClientName;
                    objProjectDetails.ProjectSize     = obj.ProjectSize;
                    objProjectDetails.Role            = obj.Role;
                    objProjectDetails.ProjectLocation = obj.ProjectLocation;
                    objProjectDetails.OnsiteDuration  = obj.OnsiteDuration;
                    objProjectDetails.Description     = obj.Description;
                    objProjectDetails.Resposibility   = obj.Resposibility;
                    objProjectDetails.ProjectSize     = obj.ProjectSize;
                    objProjectDetails.Mode            = obj.Mode;
                    objProjectDetails.LocationId      = objProjectDetails.LocationId;
                    objProjectDetails.ProjectDone     = obj.ProjectDone;
                    objProjectDetails.ProjectDoneName = obj.ProjectDoneName;
                    objSaveProjectDetailsCollection.Add(objProjectDetails);
                }
            }
            objProjectDetailsBAL.Manipulation(objSaveProjectDetailsCollection);

            if (ViewState.Count > 0)
            {
                ViewState.Clear();
            }

            if (EMPId.Value != string.Empty)
            {
                int empID = Convert.ToInt32(EMPId.Value);
                //Refresh the grip after saving
                this.PopulateGrid(empID);
            }

            if (gvProjectDetails.Rows.Count == 0)
            {
                btnSave.Visible = false;
            }

            lblMessage.Text = "Project details saved successfully.";
        }
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "btnSave_Click", EventIDConstants.RAVE_HR_EMPLOYEE_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }