public IList <OTIssue_DetailedEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression, String filterExpression)
        {
            IList <OTIssue_DetailedEntity> oTIssue_DetailedEntityList = new List <OTIssue_DetailedEntity>();

            try
            {
                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = SqlExpressionBuilder.PrepareSortExpression("OTIssue." + OTIssueEntity.FLD_NAME_IssueID, SQLSortOrderType.Decending);
                }

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

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

                oTIssue_DetailedEntityList = FCCOTIssue_Detailed.GetFacadeCreate().GetIL(pageSize, currentPage, sortExpression, filterExpression);

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

            return(oTIssue_DetailedEntityList ?? new List <OTIssue_DetailedEntity>());
        }
Exemplo n.º 2
0
        private void BuildLabel()
        {
            String fe = (String)ViewState["SearchString"];

            if (fe.IsNotNullOrEmpty())
            {
                IList <OTIssue_DetailedEntity> lst = FCCOTIssue_Detailed.GetFacadeCreate().GetIL(1000000, 1, String.Empty, fe);

                if (lst != null && lst.Count > 0)
                {
                    TimeSpan TotalTimeSpan = new TimeSpan(0, 0, 0);

                    foreach (OTIssue_DetailedEntity ent in lst)
                    {
                        TimeSpan DTLtime;
                        TimeSpan.TryParse(ent.DTLDuration.ToString(), out DTLtime);
                        TotalTimeSpan += DTLtime;
                    }

                    lblTotalTimeSpan.Text = "Total Duration: " + TotalTimeSpan;
                }

                else
                {
                    lblTotalTimeSpan.Text = "Total Duration: N/A.";
                }
            }
        }
Exemplo n.º 3
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);
                }
            }
        }