Example #1
0
        /// <summary>
        /// method for total count of approval
        /// </summary>
        /// <param name="ProjectId"></param>
        /// <returns></returns>
        public int totalcountapproval(int ProjectId)
        {
            int finalcount    = 0;
            int approvalcount = 0;

            WorkFlowBO   objProjectRoute    = new WorkFlowBO();
            WorkFlowBLL  objProjectRouteBLL = new WorkFlowBLL();
            WorkFlowList objWorkFlowList    = new WorkFlowList();
            WorkFlowBO   objPrintApprovalWF = null;
            WorkFlowList objWorkFlowList_   = null;

            string ChangeRequestCode = UtilBO.WorkflowDataVerification;

            objProjectRoute.WorkFlowApprover = ChangeRequestCode;
            objProjectRoute.Project_Id       = ProjectId;

            objWorkFlowList = objProjectRouteBLL.getTotalcountapproval(objProjectRoute);

            if (objWorkFlowList.Count > 0)
            {
                int totalapprovalCount = Convert.ToInt32(objProjectRoute.CountApproval);
                for (int i = 0; i < objWorkFlowList.Count; i++)
                {
                    //if (Session["HH_ID"] != null)
                    //{
                    //    objProjectRoute.HHID = Convert.ToInt32(Session["HH_ID"].ToString());
                    //}
                    //else
                    //{
                    //    objProjectRoute.HHID = 0;
                    //}
                    objProjectRoute.HHID = 0;
                    //objProjectRoute.HHID = householdID;
                    objProjectRoute.PageCode     = UtilBO.WorkflowDataVerification; // objHouseHold.PageCode = "DATAV";
                    objProjectRoute.WorkflowCode = UtilBO.WorkflowDataVerification;
                    objProjectRoute.LEVEL        = objWorkFlowList[i].CountApproval;

                    objPrintApprovalWF = objProjectRouteBLL.ApprovalStatuscheck(objProjectRoute);

                    //addtional list
                    objWorkFlowList_ = objProjectRouteBLL.ApprovalStatuschecklist(objProjectRoute);

                    if (objPrintApprovalWF != null)
                    {
                        if (objWorkFlowList[i].CountApproval == objPrintApprovalWF.LEVEL)
                        {
                            if (objPrintApprovalWF.ApprovalstatusID == 1)
                            {
                                finalcount = 1;
                                break;
                            }
                            else if (objPrintApprovalWF.ApprovalstatusID == 2)
                            {
                                finalcount    = 2;
                                approvalcount = 0;
                                break;
                            }
                            else if (objPrintApprovalWF.ApprovalstatusID == 3)
                            {
                                finalcount    = 3;
                                approvalcount = 0;
                                break;
                            }
                        }
                        else
                        {
                            //i + 1; addtionl Code
                            if (objWorkFlowList[i].CountApproval == objWorkFlowList_[i].LEVEL)
                            {
                                if (objWorkFlowList_[i].ApprovalstatusID == 3)
                                {
                                    finalcount = 3;
                                    break;
                                }
                                else
                                {
                                    approvalcount = 0;
                                }
                            }
                        }
                    }
                    if (objWorkFlowList.Count == approvalcount)
                    {
                        finalcount = 1;
                    }
                    else
                    {
                        finalcount = 0;
                    }
                }
            }

            return(finalcount);
        }