/// <summary>
    /// Binds The Grid for Filter.
    /// </summary>
    /// <param name="Mode"></param>
    private void BindGrid()
    {
        BusinessEntities.ContractProject objGridDetail = new BusinessEntities.ContractProject();

        if (Session[SessionNames.PROJECT_SUMMARY_PROJECT_NAME] != null)
        {
            objGridDetail.ProjectName = Session[SessionNames.PROJECT_SUMMARY_PROJECT_NAME].ToString();
        }

        if (Session[SessionNames.CLIENT_NAME] != null)
        {
            objGridDetail.ClientName = Session[SessionNames.CLIENT_NAME].ToString();
        }

        if (Session[SessionNames.STATUS] != null)
        {
            objGridDetail.StatusID = Convert.ToInt32(Session[SessionNames.STATUS].ToString());
        }


        //Declare contractproject class object.
        Rave.HR.BusinessLayer.Contracts.ContractProject projectDetails = new Rave.HR.BusinessLayer.Contracts.ContractProject();
        BusinessEntities.RaveHRCollection CollectionGridDetail         = new BusinessEntities.RaveHRCollection();
        //Declare list of contractproject class object.
        List <BusinessEntities.ContractProject> objListOfProjects = new List <BusinessEntities.ContractProject>();

        objListOfProjects = projectDetails.GetProjectsDetailsForFilter(objGridDetail, GetCriteriaForPageload());

        BindData(objListOfProjects);
    }
    /// <summary>
    /// Populate the grid according to sorting criteria.
    /// </summary>
    /// <param name="Mode"></param>
    private void populateGridWithPRojectDetails(int Mode)
    {
        try
        {
            BusinessEntities.ContractProject objGridDetail = new BusinessEntities.ContractProject();
            //Declare contractproject class object.
            Rave.HR.BusinessLayer.Contracts.ContractProject projectDetails = new Rave.HR.BusinessLayer.Contracts.ContractProject();
            BusinessEntities.RaveHRCollection CollectionGridDetail         = new BusinessEntities.RaveHRCollection();
            //Declare list of contractproject class object.
            List <BusinessEntities.ContractProject> objListOfProjects = new List <BusinessEntities.ContractProject>();

            //On pageload get the data with default sorting.
            if (Mode == 1)
            {
                CollectionGridDetail = projectDetails.GetProjectsListDetails(GetCriteriaForPageload());
                for (int i = 0; i < CollectionGridDetail.Count; i++)
                {
                    foreach (List <BusinessEntities.ContractProject> con in CollectionGridDetail)
                    {
                        foreach (BusinessEntities.ContractProject c in con)
                        {
                            objGridDetail = (BusinessEntities.ContractProject)c;
                            objListOfProjects.Add(objGridDetail);
                        }
                    }
                }
            }
            else
            {
                //Get the data with paging & sorting.

                CollectionGridDetail = projectDetails.GetProjectsListDetails(GetCriteriaForPagingAndSorting());

                for (int i = 0; i < CollectionGridDetail.Count; i++)
                {
                    foreach (List <BusinessEntities.ContractProject> con in CollectionGridDetail)
                    {
                        foreach (BusinessEntities.ContractProject c in con)
                        {
                            objGridDetail = (BusinessEntities.ContractProject)c;
                            objListOfProjects.Add(objGridDetail);
                        }
                    }
                }
            }

            //Bind the grid with respective data.
            BindData(objListOfProjects);
        }


        catch (RaveHRException ex)
        {
            throw ex;
        }
        catch (Exception ex)
        {
            throw new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME_LISTOFPROJECT, "populateGridWithPRojectDetails", EventIDConstants.RAVE_HR_CONTRACT_PRESENTATION_LAYER);
        }
    }
Beispiel #3
0
    /// <summary>
    /// grdvListofProjects_RowCommand event handler
    /// </summary>
    protected void grdvListofProjects_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            //--Add sort image in header
            if ((int.Parse(Session[SessionNames.PageCount].ToString()) == 1) && (grdvListofProjects.Rows.Count > PAGE_SIZE))
            {
                AddSortImage(grdvListofProjects.HeaderRow);
            }

            if (e.CommandName == "ChildGridContractsForProject")
            {
                GridViewRow  grv = (GridViewRow)(((ImageButton)e.CommandSource).NamingContainer);
                ImageButton  imgbtnExpandCollaspeChildGrid = (ImageButton)grv.FindControl("imgbtnExpandCollaspeChildGrid");
                GridView     grdContractGrid = (GridView)grv.FindControl("grdContractGrid");
                HtmlTableRow tr_ContractGrid = (HtmlTableRow)grv.FindControl("tr_ContractGrid");

                //--Collaspe
                if ((imgbtnExpandCollaspeChildGrid != null) && (tr_ContractGrid != null))
                {
                    if (imgbtnExpandCollaspeChildGrid.ImageUrl == Common.CommonConstants.IMAGE_MINUSSIGNPATH)
                    {
                        tr_ContractGrid.Style.Add(HtmlTextWriterStyle.Display, "none");
                        imgbtnExpandCollaspeChildGrid.ImageUrl = Common.CommonConstants.IMAGE_PLUSSIGNPATH;
                        return;
                    }
                }

                //--Set entity
                BusinessEntities.ContractProject objBEGetContractsForProject = new BusinessEntities.ContractProject();
                objBEGetContractsForProject.ProjectID = int.Parse(e.CommandArgument.ToString());

                //--Get contracts for project
                Rave.HR.BusinessLayer.Contracts.ContractProject objBLLGetContractsForProject  = new Rave.HR.BusinessLayer.Contracts.ContractProject();
                List <BusinessEntities.ContractProject>         objListGetContractsForProject = new List <BusinessEntities.ContractProject>();

                objListGetContractsForProject = objBLLGetContractsForProject.GetContractsForProject(objBEGetContractsForProject);

                //--Collaspe the child grids
                foreach (GridViewRow grvRow in grdvListofProjects.Rows)
                {
                    //create imagebutton and assign imagebutton value as "+" icon of gridviewrow.
                    ImageButton imgbtn = (ImageButton)grvRow.FindControl("imgbtnExpandCollaspeChildGrid");

                    //create htmltablerow and assign child resource plan row value to it.
                    HtmlTableRow tr_RP = (HtmlTableRow)grvRow.FindControl("tr_ContractGrid");

                    //display none when user clicks "-" icon
                    tr_RP.Style.Add(HtmlTextWriterStyle.Display, "none");

                    //replace "-" icon with "+" when user clicks on collapse("-")image button.
                    imgbtn.ImageUrl = Common.CommonConstants.IMAGE_PLUSSIGNPATH;
                }

                //--Display child grid
                if (grdContractGrid != null)
                {
                    //--Bind
                    grdContractGrid.DataSource = objListGetContractsForProject;
                    grdContractGrid.DataBind();
                }

                //--Expand child grid
                if ((imgbtnExpandCollaspeChildGrid != null) && (tr_ContractGrid != null))
                {
                    imgbtnExpandCollaspeChildGrid.ImageUrl = Common.CommonConstants.IMAGE_MINUSSIGNPATH;
                    //Name: Sanju:Issue Id 50201  Removed display property so that it should display grid properly in IE10,Chrome and mozilla browser.
                    //  tr_ContractGrid.Style.Add(HtmlTextWriterStyle.Display, "block");
                    tr_ContractGrid.Style.Add(HtmlTextWriterStyle.Display, "");
                    imgbtnExpandCollaspeChildGrid.ToolTip = "Collapse";
                }
            }
        }
        catch (RaveHRException ex)
        {
            LogErrorMessage(ex);
        }
        catch (Exception ex)
        {
            RaveHRException objEx = new RaveHRException(ex.Message, ex, Sources.PresentationLayer, CLASS_NAME, "grdvListofProjects_RowCommand", EventIDConstants.RAVE_HR_PROJECTS_PRESENTATION_LAYER);
            LogErrorMessage(objEx);
        }
    }