public IList <ResourceEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <ResourceEntity> resourceEntityList = new List <ResourceEntity>();

            try
            {
                if (pageSize == -1)
                {
                    pageSize = 1000000000;
                }

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = ResourceEntity.FLD_NAME_ResourceID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

                startRowIndex = Convert.ToInt32(startRowIndex / pageSize) + 1;

                resourceEntityList = FCCResource.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

                if (resourceEntityList != null && resourceEntityList.Count > 0)
                {
                    totalRowCount = resourceEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(resourceEntityList ?? new List <ResourceEntity>());
        }
Esempio n. 2
0
        private void SaveResourceEntity()
        {
            if (IsValid)
            {
                try
                {
                    ResourceEntity resourceEntity = BuildResourceEntity();

                    Int64 result = -1;

                    if (resourceEntity.IsNew)
                    {
                        result = FCCResource.GetFacadeCreate().Add(resourceEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceID, resourceEntity.ResourceID.ToString(), SQLMatchType.Equal);
                        result = FCCResource.GetFacadeCreate().Update(resourceEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _ResourceID     = 0;
                        _ResourceEntity = new ResourceEntity();
                        PrepareInitialView();
                        BindResourceList();

                        if (resourceEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Resource Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Resource Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (resourceEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Resource Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Resource Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Esempio n. 3
0
        protected void lvResource_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ResourceID;

            Int64.TryParse(e.CommandArgument.ToString(), out ResourceID);

            if (ResourceID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _ResourceID = ResourceID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceID, ResourceID.ToString(), SQLMatchType.Equal);

                        ResourceEntity resourceEntity = new ResourceEntity();


                        result = FCCResource.GetFacadeCreate().Delete(resourceEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _ResourceID     = 0;
                            _ResourceEntity = new ResourceEntity();
                            PrepareInitialView();
                            BindResourceList();

                            MiscUtil.ShowMessage(lblMessage, "Resource has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Resource.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        public IList <ResourceEntity> GetData()
        {
            IList <ResourceEntity> resourceEntityList = new List <ResourceEntity>();

            try
            {
                resourceEntityList = FCCResource.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

                if (resourceEntityList != null && resourceEntityList.Count > 0)
                {
                    totalRowCount = resourceEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(resourceEntityList ?? new List <ResourceEntity>());
        }
Esempio n. 5
0
        protected void lvCMConsultant_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ConsultantID;

            Int64.TryParse(e.CommandArgument.ToString(), out ConsultantID);

            if (ConsultantID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _ConsultantID = ConsultantID;
                    _MemberID     = CurrentCMConsultantEntity.MemberID.Value;


                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        CMConsultantEntity tempConsultant = FCCCMConsultant.GetFacadeCreate().GetByID(ConsultantID);

                        #region Resource Delete

                        Int64 resultOne = -1;

                        String fe1_re = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ReferenceID, ConsultantID.ToString(), SQLMatchType.Equal);
                        String fe2_re = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceCategoryID, MasterDataConstants.ResourceCategory.CONSULTANT.ToString(), SQLMatchType.Equal);
                        String fe_re  = SqlExpressionBuilder.PrepareFilterExpression(fe1_re, SQLJoinType.AND, fe2_re);

                        IList <ResourceEntity> resourceList = FCCResource.GetFacadeCreate().GetIL(null, null, String.Empty, fe_re, DatabaseOperationType.LoadWithFilterExpression);

                        foreach (ResourceEntity ent in resourceList)
                        {
                            String fe_re_delete = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceID, ent.ResourceID.ToString(), SQLMatchType.Equal);

                            resultOne = FCCResource.GetFacadeCreate().Delete(ent, fe_re_delete, DatabaseOperationType.Delete, TransactionRequired.No);
                        }

                        #endregion

                        #region Consultant Delete

                        Int64 resultTwo = -1;

                        if (resultOne == 0)
                        {
                            String fe_con_delete = SqlExpressionBuilder.PrepareFilterExpression(CMConsultantEntity.FLD_NAME_ConsultantID, ConsultantID.ToString(), SQLMatchType.Equal);

                            CMConsultantEntity cMConsultantEntity = new CMConsultantEntity();

                            resultTwo = FCCCMConsultant.GetFacadeCreate().Delete(cMConsultantEntity, fe_con_delete, DatabaseOperationType.Delete, TransactionRequired.No);
                        }

                        #endregion

                        #region Member Delete

                        Int64 resultThree = -1;

                        if (resultTwo == 0)
                        {
                            String fe_mem_delete = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, tempConsultant.MemberID.ToString(), SQLMatchType.Equal);

                            HRMemberEntity hRMemberEntity = new HRMemberEntity();

                            resultThree = FCCHRMember.GetFacadeCreate().Delete(hRMemberEntity, fe_mem_delete, DatabaseOperationType.Delete, TransactionRequired.No);
                        }

                        #endregion

                        if (resultOne == 0 && resultTwo == 0 && resultThree == 0)
                        {
                            _ConsultantID       = 0;
                            _CMConsultantEntity = new CMConsultantEntity();
                            _MemberID           = 0;
                            _HRMemberEntity     = new HRMemberEntity();

                            PrepareInitialView();
                            BindCMConsultantList();

                            MiscUtil.ShowMessage(lblMessage, "Consultant has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Consultant.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Esempio n. 6
0
        private void SaveCMConsultantEntity()
        {
            if (IsValid)
            {
                try
                {
                    #region Member

                    HRMemberEntity hRMemberEntity = BuildHRMemberEntity();

                    Int64 result = -1;

                    if (hRMemberEntity.IsNew)
                    {
                        result = FCCHRMember.GetFacadeCreate().Add(hRMemberEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, hRMemberEntity.MemberID.ToString(), SQLMatchType.Equal);
                        result = FCCHRMember.GetFacadeCreate().Update(hRMemberEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    #endregion

                    if (result > 0)
                    {
                        _MemberID       = 0;
                        _HRMemberEntity = new HRMemberEntity();
                    }

                    if (result > 0)
                    {
                        CMConsultantEntity cMConsultantEntity = BuildCMConsultantEntity();

                        Int64 resultC = -1;

                        if (cMConsultantEntity.IsNew)
                        {
                            cMConsultantEntity.MemberID = result;
                            resultC = FCCCMConsultant.GetFacadeCreate().Add(cMConsultantEntity, DatabaseOperationType.Add, TransactionRequired.No);
                        }
                        else
                        {
                            String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMConsultantEntity.FLD_NAME_ConsultantID, cMConsultantEntity.ConsultantID.ToString(), SQLMatchType.Equal);
                            resultC = FCCCMConsultant.GetFacadeCreate().Update(cMConsultantEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                        }

                        if (resultC > 0)
                        {
                            _ConsultantID       = 0;
                            _CMConsultantEntity = new CMConsultantEntity();
                            PrepareInitialView();
                            BindCMConsultantList();

                            if (cMConsultantEntity.IsNew)
                            {
                                ResourceEntity resourceEntity = new ResourceEntity();

                                resourceEntity.ReferenceID        = resultC; // means new contractor id
                                resourceEntity.ResourceCategoryID = MasterDataConstants.ResourceCategory.CONSULTANT;

                                FCCResource.GetFacadeCreate().Add(resourceEntity, DatabaseOperationType.Add, TransactionRequired.No);
                            }

                            if (cMConsultantEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Consultant Information has been added successfully.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Consultant Information has been updated successfully.", false);
                            }
                        }
                        else
                        {
                            if (cMConsultantEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to add Consultant Information.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to update Consultant Information.", false);
                            }
                        }
                    }
                    else
                    {
                        if (hRMemberEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Member Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Member Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Esempio n. 7
0
        protected void odsOTIssue_Detailed_Selecting(object sender, ObjectDataSourceSelectingEventArgs e)
        {
            String fe = String.Empty;

            switch (PageAPType)
            {
            case MasterDataConstants.IssuePageType.ADHOC_ISSUE:
                fe = SqlExpressionBuilder.PrepareFilterExpression("OTIssue." + OTIssueEntity.FLD_NAME_IssueIdentityCategoryID, MasterDataConstants.IssueIdentityCategory.ADHOC_ISSUE.ToString(), SQLMatchType.Equal);
                lblIssueList.Text = "Adhoc Issue List";
                break;

            case MasterDataConstants.IssuePageType.PROJECT_ADHOC_ISSUE:
                fe = SqlExpressionBuilder.PrepareFilterExpression("OTIssue." + OTIssueEntity.FLD_NAME_IssueIdentityCategoryID, MasterDataConstants.IssueIdentityCategory.PROJECT_ADHOC_ISSUE.ToString(), SQLMatchType.Equal);
                lblIssueList.Text = "Project Issue List";
                break;

            case MasterDataConstants.IssuePageType.MY_ISSUE_LIST:
                fe = SqlExpressionBuilder.PrepareFilterExpression("OTIssue." + OTIssueEntity.FLD_NAME_CreatedByMemberID, CurrentMember.MemberID.ToString(), SQLMatchType.Equal);

                Int64 employeeID = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember);

                if (employeeID > 0)
                {
                    String fe_assignToEmployee = SqlExpressionBuilder.PrepareFilterExpression("OTIssue." + OTIssueEntity.FLD_NAME_AssignedToEmployeeID, employeeID.ToString(), SQLMatchType.Equal);

                    fe = SqlExpressionBuilder.PrepareFilterExpression(fe, SQLJoinType.OR, fe_assignToEmployee);

                    String fe_resource1 = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceCategoryID, MasterDataConstants.ResourceCategory.EMPLOYEE.ToString(), SQLMatchType.Equal);
                    String fe_resource2 = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ReferenceID, employeeID.ToString(), SQLMatchType.Equal);

                    String fe_resource = SqlExpressionBuilder.PrepareFilterExpression(fe_resource1, SQLJoinType.AND, fe_resource2);

                    IList <ResourceEntity> lstResource = FCCResource.GetFacadeCreate().GetIL(null, null, String.Empty, fe_resource, DatabaseOperationType.LoadWithFilterExpression);

                    if (lstResource != null && lstResource.Count > 0)
                    {
                        String fe_Assigned_Issue = SqlExpressionBuilder.PrepareFilterExpression(OTIssueAssignedResourceEntity.FLD_NAME_ResourceID, lstResource[0].ResourceID.ToString(), SQLMatchType.Equal);

                        IList <OTIssueAssignedResourceEntity> lstIssueAssignedResource = FCCOTIssueAssignedResource.GetFacadeCreate().GetIL(null, null, String.Empty, fe_Assigned_Issue, DatabaseOperationType.LoadWithFilterExpression);

                        if (lstIssueAssignedResource != null && lstIssueAssignedResource.Count > 0)
                        {
                            String compositeIssueID = String.Empty;

                            foreach (OTIssueAssignedResourceEntity ent in lstIssueAssignedResource)
                            {
                                compositeIssueID += ent.IssueID + ",";
                            }

                            if (compositeIssueID.IsNotNullOrEmpty())
                            {
                                compositeIssueID = compositeIssueID.Substring(0, compositeIssueID.Length - 1);
                                String fe_issue = "OTIssue.IssueID in(" + compositeIssueID + ")";

                                fe = SqlExpressionBuilder.PrepareFilterExpression(fe, SQLJoinType.OR, fe_issue);
                            }
                        }
                    }
                }

                lblIssueList.Text = "My Issue List";
                break;

            default:
                fe = SqlExpressionBuilder.PrepareFilterExpression("OTIssue." + OTIssueEntity.FLD_NAME_IssueIdentityCategoryID, MasterDataConstants.IssueIdentityCategory.PROJECT_ADHOC_ISSUE.ToString(), SQLMatchType.Equal);
                break;
            }

            if (chbxFilter.Checked)
            {
                String fe1 = SqlExpressionBuilder.PrepareFilterExpression("OTIssue.Title", txtSearchText.Text.ToString(), SQLMatchType.LikeWithBothMath);
                String fe2 = SqlExpressionBuilder.PrepareFilterExpression("MDIssuePriority.Name", txtSearchText.Text.ToString(), SQLMatchType.LikeWithSuffixMath);
                String fe3 = SqlExpressionBuilder.PrepareFilterExpression("MDIssueStatus.Name", txtSearchText.Text.ToString(), SQLMatchType.LikeWithSuffixMath);
                Int64  issueID;
                Int64.TryParse(txtSearchText.Text.Trim().ToString(), out issueID);
                String fe6 = SqlExpressionBuilder.PrepareFilterExpression("OTIssue.IssueID", issueID.ToString(), SQLMatchType.Equal);
                String fe4 = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.OR, fe2);
                String fe5 = SqlExpressionBuilder.PrepareFilterExpression(fe3, SQLJoinType.OR, fe4);
                String fe7 = SqlExpressionBuilder.PrepareFilterExpression(fe5, SQLJoinType.OR, fe6);
                fe = SqlExpressionBuilder.PrepareFilterExpression(fe, SQLJoinType.AND, fe7);
            }

            e.InputParameters["filterExpression"] = fe;
        }
Esempio n. 8
0
        private void SaveHREmployeeEntity()
        {
            if (IsValid)
            {
                try
                {
                    #region Member

                    HRMemberEntity hRMemberEntity = BuildHRMemberEntity();

                    Int64 result = -1;

                    if (hRMemberEntity.IsNew)
                    {
                        result = FCCHRMember.GetFacadeCreate().Add(hRMemberEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HRMemberEntity.FLD_NAME_MemberID, hRMemberEntity.MemberID.ToString(), SQLMatchType.Equal);
                        result = FCCHRMember.GetFacadeCreate().Update(hRMemberEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    #endregion

                    if (result > 0)
                    {
                        _MemberID       = 0;
                        _HRMemberEntity = new HRMemberEntity();
                    }

                    if (result > 0)
                    {
                        HREmployeeEntity hREmployeeEntity = BuildHREmployeeEntity();

                        Int64 resultC = -1;

                        if (hREmployeeEntity.IsNew)
                        {
                            hREmployeeEntity.MemberID = result;

                            resultC = FCCHREmployee.GetFacadeCreate().Add(hREmployeeEntity, DatabaseOperationType.Add, TransactionRequired.No);
                        }
                        else
                        {
                            String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeEntity.FLD_NAME_EmployeeID, hREmployeeEntity.EmployeeID.ToString(), SQLMatchType.Equal);
                            resultC = FCCHREmployee.GetFacadeCreate().Update(hREmployeeEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                        }

                        #region Create Six Task For HR

                        try
                        {
                            StringBuilder xmlStr      = new StringBuilder();
                            Int64         employeeID  = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember);
                            Int64         referenceID = 49;
                            DateTime      joinDate    = (DateTime)hREmployeeEntity.JoinDate;
                            String        fe          = "DepartmentID = " + MasterDataConstants.MDDepartment.HR_DEPARTMENTID + "";

                            IList <HREmployeeEntity> lst = FCCHREmployee.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

                            #region Delete Old Task

                            String filter = "IssueIdentityCategoryID = " + MasterDataConstants.MDIssueIdentityCategory.HRMETTINGWITHEMPLOYEE + " and SupervisorEmployeeID = " + hREmployeeEntity.EmployeeID + "";
                            IList <OTIssueEntity> issueList = FCCOTIssue.GetFacadeCreate().GetIL(null, null, String.Empty, filter, DatabaseOperationType.LoadWithFilterExpression);
                            if (issueList != null && issueList.Count > 0)
                            {
                                OTIssueEntity oTIssueEntity = new OTIssueEntity();
                                FCCOTIssue.GetFacadeCreate().Delete(oTIssueEntity, filter, DatabaseOperationType.Delete, TransactionRequired.No);
                            }

                            #endregion

                            String title = "Employee Name: " + hRMemberEntity.FirstName + " " + hRMemberEntity.MiddleName + " " + hRMemberEntity.LastName + ", Code: " + hREmployeeEntity.EmployeeCode + " join Date: " + hREmployeeEntity.JoinDate + " has metting with you";

                            xmlStr.Append("<m>");
                            if (lst != null && lst.Count > 0)
                            {
                                foreach (HREmployeeEntity e in lst)
                                {
                                    for (int i = 1; i <= 6; i++)
                                    {
                                        String subXmlStr = null;
                                        subXmlStr = subXmlStr + "<i><a>" + title + "</a><b>" + hREmployeeEntity.EmployeeID + "</b><c>" + e.EmployeeID + "</c><d>" + CurrentMember.MemberID + "</d><e>" + referenceID + "</e><f>" + joinDate.AddDays(i * 30) + "</f><g>" + joinDate.AddDays((i * 30) + 1) + "</g></i>";
                                        xmlStr.Append(subXmlStr.ToString());
                                    }
                                }
                            }
                            xmlStr.Append("</m>");

                            FCCBulkInsertXML.GetFacadeCreate().GetIL(xmlStr.ToString(), CommonConstants.CreateSixTaskForHR);

                            MiscUtil.ShowMessage(lblMessage, "Six Task has created for HR Successfully.", false);
                        }
                        catch (Exception ex)
                        {
                            MiscUtil.ShowMessage(lblMessage, "An Error Occoured.", true);
                        }

                        #endregion

                        if (resultC > 0)
                        {
                            _EmployeeID       = 0;
                            _HREmployeeEntity = new HREmployeeEntity();
                            PrepareInitialView();
                            BindHREmployeeList();

                            if (hREmployeeEntity.IsNew)
                            {
                                ResourceEntity resourceEntity = new ResourceEntity();

                                resourceEntity.ReferenceID        = resultC; // means new employee id
                                resourceEntity.ResourceCategoryID = MasterDataConstants.ResourceCategory.EMPLOYEE;

                                FCCResource.GetFacadeCreate().Add(resourceEntity, DatabaseOperationType.Add, TransactionRequired.No);
                            }

                            if (hREmployeeEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Employee Information has been added successfully.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Employee Information has been updated successfully.", false);
                            }
                        }
                        else
                        {
                            if (hREmployeeEntity.IsNew)
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to add Employee Information.", false);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to update Employee Information.", false);
                            }
                        }
                    }
                    else
                    {
                        if (hRMemberEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Member Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Member Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvCMConstructionToolDetail_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ConstructionToolDetailID;

            Int64.TryParse(e.CommandArgument.ToString(), out ConstructionToolDetailID);

            if (ConstructionToolDetailID > 0)
            {
                if (string.Equals(e.CommandName, "EditItem"))
                {
                    _ConstructionToolDetailID = ConstructionToolDetailID;

                    PrepareEditView();

                    cpeEditor.Collapsed   = false;
                    cpeEditor.ClientState = "false";
                }
                else if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        #region Resource Delete

                        Int64 resultOne = -1;

                        String fe1_re = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ReferenceID, ConstructionToolDetailID.ToString(), SQLMatchType.Equal);
                        String fe2_re = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceCategoryID, MasterDataConstants.ResourceCategory.TOOL.ToString(), SQLMatchType.Equal);
                        String fe_re  = SqlExpressionBuilder.PrepareFilterExpression(fe1_re, SQLJoinType.AND, fe2_re);

                        IList <ResourceEntity> resourceList = FCCResource.GetFacadeCreate().GetIL(null, null, String.Empty, fe_re, DatabaseOperationType.LoadWithFilterExpression);

                        foreach (ResourceEntity ent in resourceList)
                        {
                            String fe_re_delete = SqlExpressionBuilder.PrepareFilterExpression(ResourceEntity.FLD_NAME_ResourceID, ent.ResourceID.ToString(), SQLMatchType.Equal);

                            resultOne = FCCResource.GetFacadeCreate().Delete(ent, fe_re_delete, DatabaseOperationType.Delete, TransactionRequired.No);
                        }

                        #endregion

                        if (resultOne == 0)
                        {
                            Int64 result = -1;

                            String fe = SqlExpressionBuilder.PrepareFilterExpression(CMConstructionToolDetailEntity.FLD_NAME_ConstructionToolDetailID, ConstructionToolDetailID.ToString(), SQLMatchType.Equal);

                            CMConstructionToolDetailEntity cMConstructionToolDetailEntity = new CMConstructionToolDetailEntity();


                            result = FCCCMConstructionToolDetail.GetFacadeCreate().Delete(cMConstructionToolDetailEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                            if (result == 0)
                            {
                                _ConstructionToolDetailID       = 0;
                                _CMConstructionToolDetailEntity = new CMConstructionToolDetailEntity();
                                PrepareInitialView();
                                BindCMConstructionToolDetailList();

                                MiscUtil.ShowMessage(lblMessage, "Construction Tool Detail has been successfully deleted.", true);
                            }
                            else
                            {
                                MiscUtil.ShowMessage(lblMessage, "Failed to delete Construction Tool Detail.", true);
                            }
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Construction Tool Detail and Resource Information.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }