示例#1
0
        public IList <OTIssueEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression)
        {
            IList <OTIssueEntity> oTIssueEntityList = new List <OTIssueEntity>();

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = OTIssueEntity.FLD_NAME_IssueID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                oTIssueEntityList = FCCOTIssue.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(oTIssueEntityList ?? new List <OTIssueEntity>());
        }
示例#2
0
        protected void Disagree_Click(object sender, EventArgs e)
        {
            try
            {
                OTIssueEntity oTIssueEntity = CurrentOTIssueEntity;

                oTIssueEntity.SupervisorAgreed = false;

                Int64 result = -1;

                String fe = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_IssueID, _IssueID.ToString(), SQLMatchType.Equal);

                result = FCCOTIssue.GetFacadeCreate().Update(oTIssueEntity, fe, DatabaseOperationType.Update, TransactionRequired.No);

                if (result > 0)
                {
                    MiscUtil.ShowMessage(lblMessage, "Issue has been successfully Updated.", true);
                }
                else
                {
                    MiscUtil.ShowMessage(lblMessage, "Failed to Update Issue.", true);
                }
            }
            catch (Exception ex)
            {
                MiscUtil.ShowMessage(lblMessage, ex.Message, true);
            }
        }
        private void BuildTree()
        {
            this.Nodes.Clear();
            String fe1 = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_ReferenceID, ProjectID.ToString(), SQLMatchType.Equal);
            String fe2 = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_IssueIdentityCategoryID, MasterDataConstants.IssueIdentityCategory.PROJECT_TASK.ToString(), SQLMatchType.Equal);

            String fe = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

            nodeList = FCCOTIssue.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

            TreeNode rootNode = new TreeNode();

            if (nodeList != null && nodeList.Count > 0)
            {
                rootNodeList = (from a in nodeList
                                where a.ParentIssueID == null
                                select a).ToList();
                rootNode.Text         = rootNodeList[0].Title;
                rootNode.Value        = "0";
                rootNode.SelectAction = TreeNodeSelectAction.SelectExpand;
                rootNode.Expanded     = true;

                LoadCategories(rootNode, rootNodeList[0].IssueID);

                this.Nodes.Add(rootNode);
            }
        }
        private void SaveOTIssueEntity()
        {
            if (IsValid)
            {
                try
                {
                    OTIssueEntity oTIssueEntity = BuildOTIssueEntity();

                    Int64 result = -1;

                    if (oTIssueEntity.IsNew)
                    {
                        result = FCCOTIssue.GetFacadeCreate().Add(oTIssueEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_IssueID, oTIssueEntity.IssueID.ToString(), SQLMatchType.Equal);
                        result = FCCOTIssue.GetFacadeCreate().Update(oTIssueEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        if (oTIssueEntity.IsNew)
                        {
                            _IssueID       = 0;
                            _OTIssueEntity = new OTIssueEntity();
                            PrepareInitialView();

                            MiscUtil.ShowMessage(lblMessage, "Issue Information has been added successfully.", false);
                        }
                        else
                        {
                            PrepareInitialView();
                            PrepareEditView();

                            MiscUtil.ShowMessage(lblMessage, "Issue Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (oTIssueEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Issue Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Issue Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
示例#5
0
        protected void lvOTIssue_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 IssueID;

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

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

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_IssueID, IssueID.ToString(), SQLMatchType.Equal);

                        OTIssueEntity oTIssueEntity = new OTIssueEntity();


                        result = FCCOTIssue.GetFacadeCreate().Delete(oTIssueEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _IssueID       = 0;
                            _OTIssueEntity = new OTIssueEntity();
                            PrepareInitialView();
                            BindOTIssueList();

                            MiscUtil.ShowMessage(lblMessage, "O TIssue has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete O TIssue.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
示例#6
0
        public IList <OTIssueEntity> GetData()
        {
            IList <OTIssueEntity> oTIssueEntityList = new List <OTIssueEntity>();

            try
            {
                oTIssueEntityList = FCCOTIssue.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(oTIssueEntityList ?? new List <OTIssueEntity>());
        }
        private void SaveNodesToDB(TreeNode parentNode, Int64 parentProjectTaskID)
        {
            if (parentNode.ChildNodes.Count > 0)
            {
                foreach (TreeNode node in parentNode.ChildNodes)
                {
                    if (node.Checked == true)
                    {
                        OTIssueEntity projectTask = new OTIssueEntity();

                        projectTask.Title = node.Text;
                        //
                        projectTask.IssueIdentityCategoryID = MasterDataConstants.IssueIdentityCategory.PROJECT_TASK;

                        //Hard Codeed Member
                        projectTask.CreatedByMemberID = 1;// this.CurrentMember.MemberID;
                        projectTask.CreateDate        = DateTime.Now;
                        projectTask.IsNotifyCompleted = false;
                        projectTask.IsRemoved         = false;

                        projectTask.ParentIssueID    = parentProjectTaskID;
                        projectTask.ReferenceID      = this.OverviewProjectID;
                        projectTask.ReferenceIssueID = null;

                        #region Sensitive Hard Coded Here

                        //Hard Coded Issue Status ID

                        projectTask.IssueStatusID   = 1;
                        projectTask.IssueCategoryID = 2;
                        projectTask.IssuePriorityID = 1;

                        #endregion

                        Int64 result = FCCOTIssue.GetFacadeCreate().Add(projectTask, DatabaseOperationType.Add, TransactionRequired.No);
                        SaveNodesToDB(node, result);
                    }
                }
            }
        }
示例#8
0
        protected void lvOTIssue_Detailed_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 IssueID;

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

            if (IssueID > 0)
            {
                if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_IssueID, IssueID.ToString(), SQLMatchType.Equal);

                        OTIssueEntity oTIssueEntity = new OTIssueEntity();


                        result = FCCOTIssue.GetFacadeCreate().Delete(oTIssueEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _IssueID       = 0;
                            _OTIssueEntity = new OTIssueEntity();
                            PrepareInitialView();
                            BindOTIssueList();

                            MiscUtil.ShowMessage(lblMessage, "Issue has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Issue.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
                else if (string.Equals(e.CommandName, "UpdateItem"))
                {
                    try
                    {
                        _IssueID = IssueID;

                        OTIssueEntity oTIssueEntity = CurrentOTIssueEntity;

                        if (CurrentOTIssueEntity.IssueStatusID == MasterDataConstants.MDIssueStatus.COMPLETED)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Issue Already Completed.", false);
                            return;
                        }

                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_IssueID, IssueID.ToString(), SQLMatchType.Equal);


                        oTIssueEntity.IssueStatusID        = MasterDataConstants.MDIssueStatus.COMPLETED;
                        oTIssueEntity.CompletionPercentage = 100;
                        result = FCCOTIssue.GetFacadeCreate().Update(oTIssueEntity, fe, DatabaseOperationType.Update, TransactionRequired.No);

                        if (result > 0)
                        {
                            _IssueID       = 0;
                            _OTIssueEntity = new OTIssueEntity();
                            PrepareInitialView();
                            BindOTIssueList();

                            MiscUtil.ShowMessage(lblMessage, "Issue has been successfully Updated.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to Update Issue.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
                else if (string.Equals(e.CommandName, "AddToSchedule"))
                {
                    try
                    {
                        OTIssueEntity    oTIssueEntity    = FCCOTIssue.GetFacadeCreate().GetByID(IssueID);
                        OTScheduleEntity oTScheduleEntity = new OTScheduleEntity();
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
        private void UpdateCMProjectScheduleTemplateItemMapEntity()
        {
            try
            {
                Int64 rootTaskID = 0;

                // search in the database....

                String fe1 = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_ParentIssueID, String.Empty, SQLMatchType.IsNull);
                String fe2 = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_ReferenceID, this.OverviewProjectID.ToString(), SQLMatchType.Equal);
                String fe3 = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_IssueIdentityCategoryID, MasterDataConstants.IssueIdentityCategory.PROJECT_TASK.ToString(), SQLMatchType.Equal);

                String fe4 = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);
                String fe  = SqlExpressionBuilder.PrepareFilterExpression(fe3, SQLJoinType.AND, fe4);

                IList <OTIssueEntity> temporaryIssueList = FCCOTIssue.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);


                if (temporaryIssueList != null && temporaryIssueList.Count > 0)
                {
                    rootTaskID = Int64.Parse(temporaryIssueList[0].IssueID.ToString());
                }
                else
                {
                    OTIssueEntity rootTask = new OTIssueEntity();

                    rootTask.Title = OverviewProject.ProjectName + "Project Schedules";
                    rootTask.IssueIdentityCategoryID = MasterDataConstants.IssueIdentityCategory.PROJECT_TASK;

                    //Hard Codeed Member
                    rootTask.CreatedByMemberID = this.CurrentMember.MemberID;
                    rootTask.CreateDate        = DateTime.Now;
                    rootTask.IsNotifyCompleted = false;
                    rootTask.IsRemoved         = false;

                    rootTask.ParentIssueID    = null;
                    rootTask.ReferenceID      = this.OverviewProjectID;
                    rootTask.ReferenceIssueID = null;

                    #region Badly Hard-Coded Here

                    //Hard Coded Issue Status ID
                    rootTask.IssuePriorityID = 1;
                    rootTask.IssueStatusID   = 1;
                    rootTask.IssueCategoryID = 2;

                    #endregion

                    rootTaskID = FCCOTIssue.GetFacadeCreate().Add(rootTask, DatabaseOperationType.Add, TransactionRequired.No);
                }


                foreach (TreeNode rootNode in treeProjectSchedule.Nodes)
                {
                    SaveNodesToDB(rootNode, rootTaskID);
                }
                MiscUtil.ShowMessage(lblMessage, "Project Schedule Template Issue Information has been added successfully.", false);
            }
            catch (Exception ex)
            {
                MiscUtil.ShowMessage(lblMessage, "An Error Occoured.", true);
            }
        }
示例#10
0
        private void SaveOTIssueEntity()
        {
            if (IsValid)
            {
                try
                {
                    OTIssueEntity oTIssueEntity = BuildOTIssueEntity();

                    Int64 result = -1;

                    if (oTIssueEntity.IsNew)
                    {
                        result = FCCOTIssue.GetFacadeCreate().Add(oTIssueEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_IssueID, oTIssueEntity.IssueID.ToString(), SQLMatchType.Equal);
                        result = FCCOTIssue.GetFacadeCreate().Update(oTIssueEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        if (oTIssueEntity.IsNew)
                        {
                            #region Send Notification

                            String   mailSubject = String.Empty;
                            String   mailBody    = String.Empty;
                            String[] mailTo      = new String[1];
                            String   fe          = SqlExpressionBuilder.PrepareFilterExpression("OTIssue." + OTIssueEntity.FLD_NAME_IssueID, result.ToString(), SQLMatchType.Equal);
                            IList <OTIssue_DetailedEntity> lstOTIssueEntity = FCCOTIssue_Detailed.GetFacadeCreate().GetIL(10000, 1, String.Empty, fe);

                            if (lstOTIssueEntity != null && lstOTIssueEntity.Count > 0)
                            {
                                mailSubject = lstOTIssueEntity[0].Title.ToString() + "-" + lstOTIssueEntity[0].SupervisorFullName;
                                mailBody    = lstOTIssueEntity[0].Description.ToString();
                                mailBody   += "<br/>";
                                mailBody   += "<br/>";
                                mailBody   += "Expected Start Date: " + lstOTIssueEntity[0].ExpectedStartDate.ToString(UIConstants.SHORT_DATE_FORMAT);
                                mailBody   += "<br/>";
                                mailBody   += "Expected End Date: " + lstOTIssueEntity[0].ExpectedEndDate.ToString(UIConstants.SHORT_DATE_FORMAT);

                                HREmployeeEntity hREmployeeEntitiy = FCCHREmployee.GetFacadeCreate().GetByID(lstOTIssueEntity[0].AssignedToEmployeeID);

                                if (hREmployeeEntitiy != null && hREmployeeEntitiy.EmployeeID > 0)
                                {
                                    mailTo[0] = hREmployeeEntitiy.PrimaryEmail;
                                    MiscUtil.SendMail(mailTo, mailSubject, mailBody);
                                }
                            }

                            #endregion

                            _IssueID       = 0;
                            _OTIssueEntity = new OTIssueEntity();
                            PrepareInitialView();

                            MiscUtil.ShowMessage(lblMessage, "Issue Information has been added successfully.", false);

                            String NavigationUrl = UrlHelper.BuildSecureUrl("~/OT/OTIssueAssignedResource.aspx", string.Empty, UrlConstants.OVERVIEW_ISSUE_ID, result.ToString()).ToString();
                            Response.Redirect(NavigationUrl);
                        }
                        else
                        {
                            PrepareInitialView();
                            PrepareEditView();

                            MiscUtil.ShowMessage(lblMessage, "Issue Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (oTIssueEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Issue Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Issue Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
示例#11
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 lvOTIssue_Detailed_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 IssueID;

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

            if (IssueID > 0)
            {
                if (string.Equals(e.CommandName, "DeleteItem"))
                {
                    try
                    {
                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_IssueID, IssueID.ToString(), SQLMatchType.Equal);

                        OTIssueEntity oTIssueEntity = new OTIssueEntity();

                        result = FCCOTIssue.GetFacadeCreate().Delete(oTIssueEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _IssueID       = 0;
                            _OTIssueEntity = new OTIssueEntity();
                            PrepareInitialView();
                            BindOTIssueList();

                            MiscUtil.ShowMessage(lblMessage, "Issue has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Issue.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
                else if (string.Equals(e.CommandName, "UpdateItem"))
                {
                    try
                    {
                        _IssueID = IssueID;

                        OTIssueEntity oTIssueEntity = CurrentOTIssueEntity;

                        if (CurrentOTIssueEntity.IssueStatusID == MasterDataConstants.MDIssueStatus.COMPLETED)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Issue Already Completed.", false);
                            return;
                        }

                        Int64 result = -1;

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_IssueID, IssueID.ToString(), SQLMatchType.Equal);


                        oTIssueEntity.IssueStatusID        = MasterDataConstants.MDIssueStatus.COMPLETED;
                        oTIssueEntity.CompletionPercentage = 100;
                        result = FCCOTIssue.GetFacadeCreate().Update(oTIssueEntity, fe, DatabaseOperationType.Update, TransactionRequired.No);

                        if (result > 0)
                        {
                            _IssueID       = 0;
                            _OTIssueEntity = new OTIssueEntity();
                            PrepareInitialView();
                            BindOTIssueList();

                            MiscUtil.ShowMessage(lblMessage, "Issue has been successfully Updated.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to Update Issue.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
                else if (string.Equals(e.CommandName, "EditGrid"))
                {
                    try
                    {
                        _IssueID = IssueID;

                        OTIssueEntity oTIssueEntity = CurrentOTIssueEntity;

                        Label        lblTitleLV           = (Label)e.Item.FindControl("lblTitleLV");
                        Label        lblDurationLV        = (Label)e.Item.FindControl("lblDurationLV");
                        Label        lblIssueCategoryLV   = (Label)e.Item.FindControl("lblIssueCategoryLV");
                        Label        lblIssueStatusLV     = (Label)e.Item.FindControl("lblIssueStatusLV");
                        Label        lblIssueCategoryIDLV = (Label)e.Item.FindControl("lblIssueCategoryIDLV");
                        Label        lblIssueStatusIDLV   = (Label)e.Item.FindControl("lblIssueStatusIDLV");
                        Label        lblProjectLV         = (Label)e.Item.FindControl("lblProjectLV");
                        Label        lblProjectIDLV       = (Label)e.Item.FindControl("lblProjectIDLV");
                        DropDownList ddlIssueCategoryLV   = (DropDownList)e.Item.FindControl("ddlIssueCategoryLV");
                        DropDownList ddlIssueStatusLV     = (DropDownList)e.Item.FindControl("ddlIssueStatusLV");
                        DropDownList ddlProjectIDLV       = (DropDownList)e.Item.FindControl("ddlProjectIDLV");
                        TextBox      txtTitleLV           = (TextBox)e.Item.FindControl("txtTitleLV");
                        TextBox      txtDurationLV        = (TextBox)e.Item.FindControl("txtDurationLV");
                        LinkButton   lnkBtnUpdateGrid     = (LinkButton)e.Item.FindControl("lnkBtnUpdateGrid");
                        LinkButton   lnBtnCancelGrid      = (LinkButton)e.Item.FindControl("lnBtnCancelGrid");
                        LinkButton   lnkBtnEditGrid       = (LinkButton)e.Item.FindControl("lnkBtnEditGrid");

                        txtTitleLV.Visible         = true;
                        txtDurationLV.Visible      = true;
                        ddlIssueCategoryLV.Visible = true;
                        ddlIssueStatusLV.Visible   = true;
                        ddlProjectIDLV.Visible     = true;

                        lblIssueCategoryLV.Visible = false;
                        lblIssueStatusLV.Visible   = false;
                        lblTitleLV.Visible         = false;
                        lblProjectLV.Visible       = false;
                        lblDurationLV.Visible      = false;
                        lnBtnCancelGrid.Visible    = true;
                        lnkBtnUpdateGrid.Visible   = true;
                        lnkBtnEditGrid.Visible     = false;


                        MiscUtil.PopulateMDIssueCategoryForDTL(ddlIssueCategoryLV, false);
                        MiscUtil.PopulateMDIssueStatusForDTL(ddlIssueStatusLV, false);
                        MiscUtil.PopulateBDProjectForDTL(ddlProjectIDLV, true);

                        if (ddlIssueCategoryLV != null && ddlIssueCategoryLV.Items.Count > 0)
                        {
                            ddlIssueCategoryLV.SelectedValue = lblIssueCategoryIDLV.Text;
                        }

                        if (ddlIssueStatusLV != null && ddlIssueStatusLV.Items.Count > 0)
                        {
                            ddlIssueStatusLV.SelectedValue = lblIssueStatusIDLV.Text;
                        }

                        if (ddlProjectIDLV != null && ddlProjectIDLV.Items.Count > 0)
                        {
                            ddlProjectIDLV.SelectedValue = lblProjectIDLV.Text;
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }

                else if (string.Equals(e.CommandName, "AddToSchedule"))
                {
                    try
                    {
                        OTIssueEntity    oTIssueEntity    = FCCOTIssue.GetFacadeCreate().GetByID(IssueID);
                        OTScheduleEntity oTScheduleEntity = new OTScheduleEntity();
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }

                else if (string.Equals(e.CommandName, "UpdateGrid"))
                {
                    try
                    {
                        Label        lblTitleLV           = (Label)e.Item.FindControl("lblTitleLV");
                        Label        lblDurationLV        = (Label)e.Item.FindControl("lblDurationLV");
                        Label        lblIssueCategoryLV   = (Label)e.Item.FindControl("lblIssueCategoryLV");
                        Label        lblIssueStatusLV     = (Label)e.Item.FindControl("lblIssueStatusLV");
                        Label        lblIssueCategoryIDLV = (Label)e.Item.FindControl("lblIssueCategoryIDLV");
                        Label        lblIssueStatusIDLV   = (Label)e.Item.FindControl("lblIssueStatusIDLV");
                        Label        lblProjectLV         = (Label)e.Item.FindControl("lblProjectLV");
                        Label        lblProjectIDLV       = (Label)e.Item.FindControl("lblProjectIDLV");
                        DropDownList ddlIssueCategoryLV   = (DropDownList)e.Item.FindControl("ddlIssueCategoryLV");
                        DropDownList ddlIssueStatusLV     = (DropDownList)e.Item.FindControl("ddlIssueStatusLV");
                        DropDownList ddlProjectIDLV       = (DropDownList)e.Item.FindControl("ddlProjectIDLV");
                        TextBox      txtTitleLV           = (TextBox)e.Item.FindControl("txtTitleLV");
                        TextBox      txtDurationLV        = (TextBox)e.Item.FindControl("txtDurationLV");
                        LinkButton   lnkBtnUpdateGrid     = (LinkButton)e.Item.FindControl("lnkBtnUpdateGrid");
                        LinkButton   lnBtnCancelGrid      = (LinkButton)e.Item.FindControl("lnBtnCancelGrid");
                        LinkButton   lnkBtnEditGrid       = (LinkButton)e.Item.FindControl("lnkBtnEditGrid");

                        TimeSpan durationLV;

                        TimeSpan.TryParse(txtDurationLV.Text.Trim(), out durationLV);

                        OTIssueEntity oTIssueEntity = FCCOTIssue.GetFacadeCreate().GetByID(IssueID);
                        oTIssueEntity.IssueStatusID   = Int64.Parse(ddlIssueStatusLV.SelectedValue);
                        oTIssueEntity.IssueCategoryID = Int64.Parse(ddlIssueCategoryLV.SelectedValue);
                        oTIssueEntity.ReferenceID     = Int64.Parse(ddlProjectIDLV.SelectedValue);
                        oTIssueEntity.Title           = txtTitleLV.Text.Trim().ToString();
                        oTIssueEntity.Duration        = 0;
                        oTIssueEntity.DTLDuration     = durationLV.ToString();


                        String fe = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_IssueID, IssueID.ToString(), SQLMatchType.Equal);

                        Int64  result    = -1;
                        String fe_update = SqlExpressionBuilder.PrepareFilterExpression(OTIssueEntity.FLD_NAME_IssueID, IssueID.ToString(), SQLMatchType.Equal);
                        result = FCCOTIssue.GetFacadeCreate().Update(oTIssueEntity, fe, DatabaseOperationType.Update, TransactionRequired.No);

                        if (result > 0)
                        {
                            _IssueID       = 0;
                            _OTIssueEntity = new OTIssueEntity();
                            PrepareInitialView();
                            BindOTIssueList();

                            txtTitleLV.Visible         = false;
                            txtDurationLV.Visible      = false;
                            ddlIssueCategoryLV.Visible = false;
                            ddlIssueStatusLV.Visible   = false;
                            ddlProjectIDLV.Visible     = false;

                            lblIssueCategoryLV.Visible = true;
                            lblIssueStatusLV.Visible   = true;
                            lblTitleLV.Visible         = true;
                            lblDurationLV.Visible      = true;
                            lblProjectLV.Visible       = true;
                            lnBtnCancelGrid.Visible    = false;
                            lnkBtnUpdateGrid.Visible   = false;
                            lnkBtnEditGrid.Visible     = true;

                            MiscUtil.ShowMessage(lblMessage, "Issue has been successfully updated.", false);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }

                else if (string.Equals(e.CommandName, "CancelGridEdit"))
                {
                    try
                    {
                        Label        lblTitleLV           = (Label)e.Item.FindControl("lblTitleLV");
                        Label        lblDurationLV        = (Label)e.Item.FindControl("lblDurationLV");
                        Label        lblIssueCategoryLV   = (Label)e.Item.FindControl("lblIssueCategoryLV");
                        Label        lblIssueStatusLV     = (Label)e.Item.FindControl("lblIssueStatusLV");
                        Label        lblIssueCategoryIDLV = (Label)e.Item.FindControl("lblIssueCategoryIDLV");
                        Label        lblIssueStatusIDLV   = (Label)e.Item.FindControl("lblIssueStatusIDLV");
                        Label        lblProjectLV         = (Label)e.Item.FindControl("lblProjectLV");
                        DropDownList ddlIssueCategoryLV   = (DropDownList)e.Item.FindControl("ddlIssueCategoryLV");
                        DropDownList ddlIssueStatusLV     = (DropDownList)e.Item.FindControl("ddlIssueStatusLV");
                        DropDownList ddlProjectIDLV       = (DropDownList)e.Item.FindControl("ddlProjectIDLV");
                        TextBox      txtTitleLV           = (TextBox)e.Item.FindControl("txtTitleLV");
                        TextBox      txtDurationLV        = (TextBox)e.Item.FindControl("txtDurationLV");
                        LinkButton   lnkBtnUpdateGrid     = (LinkButton)e.Item.FindControl("lnkBtnUpdateGrid");
                        LinkButton   lnBtnCancelGrid      = (LinkButton)e.Item.FindControl("lnBtnCancelGrid");
                        LinkButton   lnkBtnEditGrid       = (LinkButton)e.Item.FindControl("lnkBtnEditGrid");

                        txtTitleLV.Visible         = false;
                        txtDurationLV.Visible      = false;
                        ddlIssueCategoryLV.Visible = false;
                        ddlIssueStatusLV.Visible   = false;
                        ddlProjectIDLV.Visible     = false;

                        lblIssueCategoryLV.Visible = true;
                        lblIssueStatusLV.Visible   = true;
                        lblTitleLV.Visible         = true;
                        lblDurationLV.Visible      = true;
                        lblProjectLV.Visible       = true;
                        lnBtnCancelGrid.Visible    = false;
                        lnkBtnUpdateGrid.Visible   = false;
                        lnkBtnEditGrid.Visible     = true;
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
            if (string.Equals(e.CommandName, "InsertItem"))
            {
                try
                {
                    ListViewItem list = lvOTIssue_Detailed.InsertItem;

                    TextBox      txtTitleLV           = (TextBox)list.FindControl("txtTitleLV");
                    TextBox      txtDurationLV        = (TextBox)list.FindControl("txtDurationLV");
                    DropDownList ddlIssueCategoryIDLV = (DropDownList)list.FindControl("ddlIssueCategoryIDLV");
                    DropDownList ddlIssueStatusIDLV   = (DropDownList)list.FindControl("ddlIssueStatusIDLV");
                    DropDownList ddlProjectIDLV       = (DropDownList)list.FindControl("ddlProjectIDLV");

                    if (ddlIssueCategoryIDLV.SelectedValue == "0")
                    {
                        MiscUtil.ShowMessage(lblMessage, "You have selected Category Head. Please Select Issue Category", true);
                        return;
                    }

                    TimeSpan durationLV;

                    TimeSpan.TryParse(txtDurationLV.Text.Trim(), out durationLV);

                    OTIssueEntity oTIssueEntity = new OTIssueEntity();

                    oTIssueEntity.IssueCategoryID = Int64.Parse(ddlIssueCategoryIDLV.SelectedValue);

                    oTIssueEntity.Title                = txtTitleLV.Text.Trim();
                    oTIssueEntity.Description          = "Daily Log Time";
                    oTIssueEntity.IssuePriorityID      = MasterDataConstants.MDIssuePriority.HIGH;
                    oTIssueEntity.CompletionPercentage = 0;
                    oTIssueEntity.IssueStatusID        = Int64.Parse(ddlIssueStatusIDLV.SelectedValue);
                    oTIssueEntity.Duration             = 0;

                    //String startDate=DateTime.ParseExact(txtStartDate.Text, "ddd MMM dd yyyy HH:mm:ss 'GMT'zzz", System.Globalization.CultureInfo.InvariantCulture).ToString();
                    //String startDate = txtStartDate.Text;

                    DateTime startDate = System.DateTime.Now;
                    DateTime endDate   = System.DateTime.Now;

                    if (txtDate.Text.Trim().IsNotNullOrEmpty())
                    {
                        startDate = MiscUtil.ParseToDateTime(txtDate.Text.Trim().ToString());
                        endDate   = startDate;
                    }

                    oTIssueEntity.ExpectedStartDate            = startDate;
                    oTIssueEntity.ExpectedEndDate              = endDate;
                    oTIssueEntity.SupervisorEmployeeID         = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember);
                    oTIssueEntity.AssignedToEmployeeID         = MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember);
                    oTIssueEntity.ActualStartDate              = null;
                    oTIssueEntity.ActualEndDate                = null;
                    oTIssueEntity.NotifyBeforeMin              = null;
                    oTIssueEntity.SupervisorAgreed             = true;
                    oTIssueEntity.ModifiedBySupervisorDateTime = System.DateTime.Now;
                    oTIssueEntity.IP      = MiscUtil.GetLocalIP();
                    oTIssueEntity.Remarks = String.Empty;

                    oTIssueEntity.IssueIdentityCategoryID = MasterDataConstants.IssueIdentityCategory.ADHOC_ISSUE;
                    oTIssueEntity.CreatedByMemberID       = this.CurrentMember.MemberID;
                    oTIssueEntity.CompletionPercentage    = 0;
                    oTIssueEntity.CreateDate        = DateTime.Now;
                    oTIssueEntity.IsNotifyCompleted = false;
                    oTIssueEntity.IsRemoved         = false;

                    oTIssueEntity.ParentIssueID    = null;
                    oTIssueEntity.ReferenceID      = Int64.Parse(ddlProjectIDLV.SelectedValue);
                    oTIssueEntity.ReferenceIssueID = null;
                    oTIssueEntity.DTLDuration      = durationLV.ToString();

                    Int64 result = -1;

                    result = FCCOTIssue.GetFacadeCreate().Add(oTIssueEntity, DatabaseOperationType.Add, TransactionRequired.No);

                    if (result > 0)
                    {
                        BindList();
                        MiscUtil.ShowMessage(lblMessage, "Event Created Successfully", false);
                    }
                    else
                    {
                        MiscUtil.ShowMessage(lblMessage, "Can't Create Event.", true);
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, "Failed to save Daily Log Information.", true);
                }
            }
        }