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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = CMNEventEntity.FLD_NAME_EventID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                cMNEventEntityList = FCCCMNEvent.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(cMNEventEntityList ?? new List <CMNEventEntity>());
        }
        private void SaveCMNEventEntity()
        {
            if (IsValid)
            {
                try
                {
                    CMNEventEntity cMNEventEntity = BuildCMNEventEntity();

                    Int64 result = -1;

                    if (cMNEventEntity.IsNew)
                    {
                        result = FCCCMNEvent.GetFacadeCreate().Add(cMNEventEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMNEventEntity.FLD_NAME_EventID, cMNEventEntity.EventID.ToString(), SQLMatchType.Equal);
                        result = FCCCMNEvent.GetFacadeCreate().Update(cMNEventEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _EventID        = 0;
                        _CMNEventEntity = new CMNEventEntity();
                        PrepareInitialView();
                        BindCMNEventList();

                        if (cMNEventEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Event Information has been added successfully.", false);
                            String NavigationUrl = UrlHelper.BuildSecureUrl("~/Common/CMNEventInvitationInformation.aspx", string.Empty, UrlConstants.OVERVIEW_EVENT_ID, result.ToString()).ToString();
                            Response.Redirect(NavigationUrl);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Event Information has been updated successfully.", false);
                            String NavigationUrl = UrlHelper.BuildSecureUrl("~/Common/CMNEventInvitationInformation.aspx", string.Empty, UrlConstants.OVERVIEW_EVENT_ID, result.ToString()).ToString();
                            Response.Redirect(NavigationUrl);
                        }
                    }
                    else
                    {
                        if (cMNEventEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add Event Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update Event Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
Exemple #3
0
        private void SaveCMNEventEntity()
        {
            if (IsValid)
            {
                try
                {
                    CMNEventEntity cMNEventEntity = BuildCMNEventEntity();

                    Int64 result = -1;

                    if (cMNEventEntity.IsNew)
                    {
                        result = FCCCMNEvent.GetFacadeCreate().Add(cMNEventEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(CMNEventEntity.FLD_NAME_EventID, cMNEventEntity.EventID.ToString(), SQLMatchType.Equal);
                        result = FCCCMNEvent.GetFacadeCreate().Update(cMNEventEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        PrepareEditView();

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

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

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

                    PrepareEditView();
                }

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(CMNEventEntity.FLD_NAME_EventID, EventID.ToString(), SQLMatchType.Equal);

                        CMNEventEntity cMNEventEntity = new CMNEventEntity();


                        result = FCCCMNEvent.GetFacadeCreate().Delete(cMNEventEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _EventID        = 0;
                            _CMNEventEntity = new CMNEventEntity();
                            PrepareInitialView();
                            BindCMNEventList();

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

            try
            {
                cMNEventEntityList = FCCCMNEvent.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(cMNEventEntityList ?? new List <CMNEventEntity>());
        }
Exemple #6
0
        protected void btnSendMailToGuest_Click(object sender, EventArgs e)
        {
            //Mail will implement here.

            #region Guest Invitation Mail

            CMNEventEntity cMNEventEntity = FCCCMNEvent.GetFacadeCreate().GetByID(OverviewEventID);

            String MailBody = String.Empty;
            String Subject  = String.Empty;

            StringBuilder sb = new StringBuilder();

            sb.Append("Dear Sir,");
            sb.Append("<br/>");
            sb.Append("This is a auto generated mail from the ERP.");
            sb.Append("<br/>");
            sb.Append("An Event has created.");
            sb.Append("<br/>");
            sb.Append("Dated : " + cMNEventEntity.ExpectedStartDate.ToString(UIConstants.SHORT_DATE_FORMAT));
            sb.Append("<br/>");
            sb.Append("-");
            sb.Append("<br/>");
            sb.Append("Thanks");
            sb.Append("<br/>");
            sb.Append("ERP System");
            MailBody = sb.ToString();
            Subject  = "ERP, Event";

            String fe1 = SqlExpressionBuilder.PrepareFilterExpression(CMNEventInvitationInformationEntity.FLD_NAME_EventID, OverviewEventID.ToString(), SQLMatchType.Equal);
            String fe2 = SqlExpressionBuilder.PrepareFilterExpression(CMNEventInvitationInformationEntity.FLD_NAME_EventInvitatedPersonTypeID, MasterDataConstants.EventInvitationPersonType.GUEST.ToString(), SQLMatchType.Equal);
            String fe  = SqlExpressionBuilder.PrepareFilterExpression(fe1, SQLJoinType.AND, fe2);

            IList <CMNEventInvitationInformationEntity> lstEventInvitationInformationEntity = FCCCMNEventInvitationInformation.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

            if (lstEventInvitationInformationEntity != null && lstEventInvitationInformationEntity.Count > 0)
            {
                String[] sendToMail = new String[10]; // Should change here.
                Int64    i          = 0;

                foreach (CMNEventInvitationInformationEntity ent in lstEventInvitationInformationEntity)
                {
                    HRMemberEntity hRMemberEntity = FCCHRMember.GetFacadeCreate().GetByID(ent.InitationGivenToMemberID);

                    if (hRMemberEntity != null && hRMemberEntity.MemberID > 0)
                    {
                        switch (hRMemberEntity.MemberTypeID)
                        {
                        case MasterDataConstants.MemberType.HR_MEMBER:

                            String fe_member = SqlExpressionBuilder.PrepareFilterExpression(HREmployeeEntity.FLD_NAME_MemberID, ent.InitationGivenToMemberID.ToString(), SQLMatchType.Equal);
                            IList <HREmployeeEntity> lsthREmployeeEntity = FCCHREmployee.GetFacadeCreate().GetIL(null, null, String.Empty, fe_member, DatabaseOperationType.LoadWithFilterExpression);

                            if (lsthREmployeeEntity != null && lsthREmployeeEntity.Count > 0)
                            {
                                sendToMail[i++] = lsthREmployeeEntity[0].PrimaryEmail;
                            }
                            break;

                        //Will Implement Later on...
                        case MasterDataConstants.MemberType.CONSULATANT:
                            break;
                            //case MasterDataConstants.MemberType.CONSULATANT:
                            //    break;
                        }
                    }
                }

                MiscUtil.SendMail(sendToMail, Subject, MailBody);
            }

            #endregion
        }