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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = CMProjectMilestoneEntity.FLD_NAME_ProjectMilestoneID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                cMProjectMilestoneEntityList = FCCCMProjectMilestone.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(cMProjectMilestoneEntityList ?? new List <CMProjectMilestoneEntity>());
        }
        private void SaveCMProjectMilestoneEntity()
        {
            if (IsValid)
            {
                try
                {
                    CMProjectMilestoneEntity cMProjectMilestoneEntity = BuildCMProjectMilestoneEntity();

                    Int64 result = -1;

                    if (cMProjectMilestoneEntity.IsNew)
                    {
                        result = FCCCMProjectMilestone.GetFacadeCreate().Add(cMProjectMilestoneEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMProjectMilestoneEntity.FLD_NAME_ProjectMilestoneID, cMProjectMilestoneEntity.ProjectMilestoneID.ToString(), SQLMatchType.Equal);
                        result = FCCCMProjectMilestone.GetFacadeCreate().Update(cMProjectMilestoneEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _ProjectMilestoneID       = 0;
                        _CMProjectMilestoneEntity = new CMProjectMilestoneEntity();
                        PrepareInitialView();
                        BindCMProjectMilestoneList();

                        if (cMProjectMilestoneEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Project Milestone Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Project Milestone Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (cMProjectMilestoneEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Project Milestone Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Project Milestone Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
        protected void lvCMProjectMilestone_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 ProjectMilestoneID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CMProjectMilestoneEntity.FLD_NAME_ProjectMilestoneID, ProjectMilestoneID.ToString(), SQLMatchType.Equal);

                        CMProjectMilestoneEntity cMProjectMilestoneEntity = new CMProjectMilestoneEntity();


                        result = FCCCMProjectMilestone.GetFacadeCreate().Delete(cMProjectMilestoneEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _ProjectMilestoneID       = 0;
                            _CMProjectMilestoneEntity = new CMProjectMilestoneEntity();
                            PrepareInitialView();
                            BindCMProjectMilestoneList();

                            MiscUtil.ShowMessage(lblMessage, "Project Milestone has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete Project Milestone.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
Example #4
0
        private void PrepareEditView()
        {
            String fe1 = SqlExpressionBuilder.PrepareFilterExpression(CMProjectMilestoneEntity.FLD_NAME_ProjectID, this.OverviewProjectID.ToString(), SQLMatchType.Equal);

            currentMappedMilestone = FCCCMProjectMilestone.GetFacadeCreate().GetIL(null, null, String.Empty, fe1, DatabaseOperationType.LoadWithFilterExpression);

            if (currentMappedMilestone != null && currentMappedMilestone.Count > 0)
            {
                foreach (TreeNode tn in treeProjectSchedule.Nodes)
                {
                    IsMilestoneNode(tn);
                }
            }
            else
            {
                currentMappedMilestone = new List <CMProjectMilestoneEntity>();
            }
        }
        public IList <CMProjectMilestoneEntity> GetData()
        {
            IList <CMProjectMilestoneEntity> cMProjectMilestoneEntityList = new List <CMProjectMilestoneEntity>();

            try
            {
                cMProjectMilestoneEntityList = FCCCMProjectMilestone.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(cMProjectMilestoneEntityList ?? new List <CMProjectMilestoneEntity>());
        }
Example #6
0
        private void SaveNodesToDB()
        {
            foreach (TreeNode tn in treeProjectSchedule.CheckedNodes)
            {
                Int64 issueID = Int64.Parse(tn.Value.ToString());
                if (issueID > 0)
                {
                    CMProjectMilestoneEntity projectMilestone = new CMProjectMilestoneEntity();

                    projectMilestone.ProjectID = this.OverviewProjectID;
                    projectMilestone.IssueID   = Int64.Parse(tn.Value.ToString());
                    newMappedMilestones.Add(projectMilestone);
                }
            }

            IList <CMProjectMilestoneEntity> deleteList = currentMappedMilestone.Except(newMappedMilestones, new CustomerComparer()).ToList();
            IList <CMProjectMilestoneEntity> addNewList = newMappedMilestones.Except(currentMappedMilestone, new CustomerComparer()).ToList();

            if (deleteList != null && deleteList.Count > 0)
            {
                foreach (CMProjectMilestoneEntity ent in deleteList)
                {
                    String fe1 = SqlExpressionBuilder.PrepareFilterExpression(CMProjectMilestoneEntity.FLD_NAME_ProjectID, ent.ProjectID.ToString(), SQLMatchType.Equal);
                    String fe2 = SqlExpressionBuilder.PrepareFilterExpression(CMProjectMilestoneEntity.FLD_NAME_IssueID, ent.IssueID.ToString(), SQLMatchType.Equal);
                    String fe  = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

                    FCCCMProjectMilestone.GetFacadeCreate().Delete(ent, fe, DatabaseOperationType.Delete, TransactionRequired.No);
                }
            }

            if (addNewList != null && addNewList.Count > 0)
            {
                foreach (CMProjectMilestoneEntity ent in addNewList)
                {
                    FCCCMProjectMilestone.GetFacadeCreate().Add(ent, DatabaseOperationType.Add, TransactionRequired.No);
                }
            }
        }