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

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

                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = APForwardInfoEntity.FLD_NAME_APForwardInfoID + " " + SQLConstants.SORT_ORDER_DESCENDING;
                }

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

                aPForwardInfoEntityList = FCCAPForwardInfo.GetFacadeCreate().GetIL(startRowIndex, pageSize, sortExpression, null, DatabaseOperationType.LoadPagedWithSortExpression);

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

            return(aPForwardInfoEntityList ?? new List <APForwardInfoEntity>());
        }
예제 #2
0
        private void SaveAPForwardInfoEntity()
        {
            if (IsValid)
            {
                try
                {
                    APForwardInfoEntity aPForwardInfoEntity = BuildAPForwardInfoEntity();

                    Int64 result = -1;

                    if (aPForwardInfoEntity.IsNew)
                    {
                        result = FCCAPForwardInfo.GetFacadeCreate().Add(aPForwardInfoEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(APForwardInfoEntity.FLD_NAME_APForwardInfoID, aPForwardInfoEntity.APForwardInfoID.ToString(), SQLMatchType.Equal);
                        result = FCCAPForwardInfo.GetFacadeCreate().Update(aPForwardInfoEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _APForwardInfoID     = 0;
                        _APForwardInfoEntity = new APForwardInfoEntity();
                        PrepareInitialView();
                        BindAPForwardInfoList();

                        if (aPForwardInfoEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "A PForward Info Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "A PForward Info Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (aPForwardInfoEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add A PForward Info Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update A PForward Info Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
예제 #3
0
        protected void lvAPForwardInfo_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 APForwardInfoID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(APForwardInfoEntity.FLD_NAME_APForwardInfoID, APForwardInfoID.ToString(), SQLMatchType.Equal);

                        APForwardInfoEntity aPForwardInfoEntity = new APForwardInfoEntity();


                        result = FCCAPForwardInfo.GetFacadeCreate().Delete(aPForwardInfoEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _APForwardInfoID     = 0;
                            _APForwardInfoEntity = new APForwardInfoEntity();
                            PrepareInitialView();
                            BindAPForwardInfoList();

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

            try
            {
                aPForwardInfoEntityList = FCCAPForwardInfo.GetFacadeCreate().GetIL(null, null, null, null, DatabaseOperationType.Load);

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

            return(aPForwardInfoEntityList ?? new List <APForwardInfoEntity>());
        }
        protected void btnForward_Click(object sender, EventArgs e)
        {
            btnForward.Enabled = false;

            if (ddlRejectTo.Items.Count > 0)
            {
                APRobot.UpdateMemberFeedbackFeedback(APMemberFeedbackID, MasterDataConstants.APFeedback.FORWARDED);
                APRobot.UpdateMemberFeedbackLastResponseDate(APMemberFeedbackID, DateTime.Now);

                String remarks = txtRemarks.Text.Trim();

                if (remarks.IsNullOrEmpty())
                {
                    remarks = "Forwarded";
                }

                remarks = AddProxyMemberInfo(remarks);

                Int64 aPMemberFeedbackRemarksID = APRobot.AddAPMemberFeedbackRemarks(APMemberFeedbackID, remarks);

                Int64 aPPanelForwardMemberID = Int64.Parse(ddlForwardTo.SelectedValue);

                APPanelForwardMemberEntity aPPanelForwardMemberEntity = APRobot.GetAPPanelForwardMemberByID(aPPanelForwardMemberID);

                APForwardInfoEntity aPForwardInfoEntity = new APForwardInfoEntity();

                aPForwardInfoEntity.APMemberFeedbackID        = APMemberFeedbackID;
                aPForwardInfoEntity.APApprovalProcessID       = APApprovalProcessID;
                aPForwardInfoEntity.APMemberFeedbackRemarksID = aPMemberFeedbackRemarksID;
                aPForwardInfoEntity.DepartmentID           = aPPanelForwardMemberEntity.DepartmentID;
                aPForwardInfoEntity.EmployeeID             = aPPanelForwardMemberEntity.EmployeeID;
                aPForwardInfoEntity.CommentRequestDate     = DateTime.Now;
                aPForwardInfoEntity.CommentSubmitDate      = null;
                aPForwardInfoEntity.APMemberComment        = txtForwardRemarks.Text.Trim();
                aPForwardInfoEntity.APForwardMemberComment = String.Empty;

                FCCAPForwardInfo.GetFacadeCreate().Add(aPForwardInfoEntity, DatabaseOperationType.Add, TransactionRequired.No);

                MiscUtil.ShowMessage(lblMessage, "You have forwarded the thread successfully", UIConstants.MessageType.GREEN);

                PrepareInitialView();
                BindList();

                #region Forwarded Mail

                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("A Requisition Forwarded Request is waiting for your approval");
                sb.Append("<br/>");
                sb.Append("-");
                sb.Append("<br/>");
                sb.Append("Thanks");
                sb.Append("<br/>");
                sb.Append("ERP System");
                MailBody = sb.ToString();
                Subject  = "ERP, Requsition, Forwarded";

                HREmployeeEntity _hREmployeeEntity = FCCHREmployee.GetFacadeCreate().GetByID(aPForwardInfoEntity.EmployeeID);

                if (_hREmployeeEntity != null)
                {
                    String[] sendToMail = new String[] { _hREmployeeEntity.PrimaryEmail };
                    MiscUtil.SendMail(sendToMail, Subject, MailBody);
                }

                #endregion

                RedirectPageToForwardList();
            }
            else
            {
                MiscUtil.ShowMessage(lblMessage, "Failed to forward", UIConstants.MessageType.RED);
            }
        }
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            btnApprove.Enabled = false;

            APRobot.UpdateApprovalProcessFeedback(APMemberFeedbackID, MasterDataConstants.APFeedback.APPROVED, MasterDataConstants.APType.AGREEMENT, OverviewAgreementID);

            String remarks = txtRemarks.Text.Trim();

            if (remarks.IsNullOrEmpty())
            {
                remarks = "Approved";
            }

            remarks = AddProxyMemberInfo(remarks);

            APRobot.AddAPMemberFeedbackRemarks(APMemberFeedbackID, remarks);

            EnableDisableApprovalButtons();

            MiscUtil.ShowMessage(lblMessage, "You Have Approved Successfully", UIConstants.MessageType.GREEN);

            String fe = SqlExpressionBuilder.PrepareFilterExpression(APForwardInfoEntity.FLD_NAME_APMemberFeedbackID, APMemberFeedbackID.ToString(), SQLMatchType.Equal);
            IList <APForwardInfoEntity> lstForwardedInfo = FCCAPForwardInfo.GetFacadeCreate().GetIL(null, null, String.Empty, fe, DatabaseOperationType.LoadWithFilterExpression);

            if (lstForwardedInfo != null && lstForwardedInfo.Count > 0)
            {
                #region Forwarded Reply Mail

                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("A Forwarded Requisition is Processed By Senior");
                sb.Append("<br/>");
                sb.Append("-");
                sb.Append("<br/>");
                sb.Append("Thanks");
                sb.Append("<br/>");
                sb.Append("ERP System");
                MailBody = sb.ToString();
                Subject  = "ERP, Requsition, Forwarded Reply";

                String[] sendToMail = new String[lstForwardedInfo.Count];

                Int64 count = 0;

                foreach (APForwardInfoEntity aPForwardInfoEntity in lstForwardedInfo)
                {
                    HREmployeeEntity _hREmployeeEntity = FCCHREmployee.GetFacadeCreate().GetByID(aPForwardInfoEntity.EmployeeID);

                    if (_hREmployeeEntity != null)
                    {
                        sendToMail[count] = _hREmployeeEntity.PrimaryEmail;
                        count++;
                    }
                }

                MiscUtil.SendMail(sendToMail, Subject, MailBody);

                #endregion
            }

            PrepareInitialView();
            BindList();
            RedirectPageToPendingList();
        }
예제 #7
0
        protected void btnForward_Click(object sender, EventArgs e)
        {
            if (chbxAutoForwardTo.Checked)
            {
                APApprovalProcessEntity aPApprovalProcessEntity = APRobot.GetApprovalProcessByTypeAndReference(MasterDataConstants.APType.BILL, CMBillID);

                IList <APMemberFeedbackEntity> feedbackList = APRobot.GetAllMemberFeedbacks(aPApprovalProcessEntity.APApprovalProcessID);

                IList <APMemberFeedbackEntity> ordered_list = feedbackList.OrderBy(x => x.SequenceNo).ToList();

                APPanelForwardMemberEntity aPPanelForwardMemberEntity = APRobot.GetAPPanelForwardMemberByID(Int64.Parse(ddlForwardTo.SelectedValue));

                var existsInfo = (from s in ordered_list
                                  where s.EmployeeID.ToString() == aPPanelForwardMemberEntity.EmployeeID.ToString()
                                  select s);

                if (existsInfo != null && existsInfo.Count() > 0)
                {
                    MiscUtil.ShowMessage(lblMessage, "Member Already Exists in the Approval Panel", true);
                    return;
                }

                APMemberFeedbackEntity currentEmployeeInfo = (from r in ordered_list
                                                              where r.EmployeeID.ToString() == MiscUtil.GetCurrentEmployeeByMemberID(CurrentMember).ToString()
                                                              select r).FirstOrDefault();

                if (currentEmployeeInfo != null)
                {
                    ordered_list = (from m in ordered_list
                                    where m.SequenceNo > currentEmployeeInfo.SequenceNo
                                    select m).ToList();



                    APMemberFeedbackEntity aPMemberFeedbackEntity = new APMemberFeedbackEntity();

                    aPMemberFeedbackEntity.APApprovalProcessID      = aPApprovalProcessEntity.APApprovalProcessID;
                    aPMemberFeedbackEntity.DepartmentID             = aPPanelForwardMemberEntity.DepartmentID;
                    aPMemberFeedbackEntity.EmployeeID               = aPPanelForwardMemberEntity.EmployeeID;
                    aPMemberFeedbackEntity.SequenceNo               = currentEmployeeInfo.SequenceNo + 1;
                    aPMemberFeedbackEntity.APFeedbackID             = MasterDataConstants.APFeedback.NOT_YET_REQUESTED;
                    aPMemberFeedbackEntity.FeedbackRequestDate      = DateTime.Now;
                    aPMemberFeedbackEntity.FeedbackLastResponseDate = null;
                    aPMemberFeedbackEntity.FeedbackSubmitDate       = null;
                    aPMemberFeedbackEntity.IsProxyEmployeeEnabled   = false;
                    aPMemberFeedbackEntity.ProxyEmployeeID          = null;

                    Int64 aPMemberFeedbackID = FCCAPMemberFeedback.GetFacadeCreate().Add(aPMemberFeedbackEntity, DatabaseOperationType.Add, TransactionRequired.No);

                    foreach (APMemberFeedbackEntity ent in ordered_list)
                    {
                        String fe = SqlExpressionBuilder.PrepareFilterExpression(APMemberFeedbackEntity.FLD_NAME_APMemberFeedbackID, ent.APMemberFeedbackID.ToString(), SQLMatchType.Equal);
                        ent.SequenceNo += 1;
                        FCCAPMemberFeedback.GetFacadeCreate().Update(ent, fe, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    APRobot.UpdateApprovalProcessFeedback(APMemberFeedbackID, MasterDataConstants.APFeedback.APPROVED, MasterDataConstants.APType.BILL, CMBillID);

                    String remarks = txtRemarks.Text.Trim();

                    if (remarks.IsNullOrEmpty())
                    {
                        remarks = "Approved";
                    }

                    remarks = AddProxyMemberInfo(remarks);

                    APRobot.AddAPMemberFeedbackRemarks(APMemberFeedbackID, remarks);

                    EnableDisableApprovalButtons();

                    MiscUtil.ShowMessage(lblMessage, "You have Approved Successfully", UIConstants.MessageType.GREEN);

                    PrepareInitialView();
                    BindList();
                    RedirectPageToPendingList();
                }
            }

            //Previous Code

            else
            {
                if (ddlRejectTo.Items.Count > 0)
                {
                    APRobot.UpdateMemberFeedbackFeedback(APMemberFeedbackID, MasterDataConstants.APFeedback.FORWARDED);
                    APRobot.UpdateMemberFeedbackLastResponseDate(APMemberFeedbackID, DateTime.Now);

                    String remarks = txtRemarks.Text.Trim();

                    if (remarks.IsNullOrEmpty())
                    {
                        remarks = "Forwarded";
                    }

                    remarks = AddProxyMemberInfo(remarks);

                    Int64 aPMemberFeedbackRemarksID = APRobot.AddAPMemberFeedbackRemarks(APMemberFeedbackID, remarks);

                    Int64 aPPanelForwardMemberID = Int64.Parse(ddlForwardTo.SelectedValue);

                    APPanelForwardMemberEntity aPPanelForwardMemberEntity = APRobot.GetAPPanelForwardMemberByID(aPPanelForwardMemberID);

                    APForwardInfoEntity aPForwardInfoEntity = new APForwardInfoEntity();

                    aPForwardInfoEntity.APMemberFeedbackID        = APMemberFeedbackID;
                    aPForwardInfoEntity.APApprovalProcessID       = APApprovalProcessID;
                    aPForwardInfoEntity.APMemberFeedbackRemarksID = aPMemberFeedbackRemarksID;
                    aPForwardInfoEntity.DepartmentID           = aPPanelForwardMemberEntity.DepartmentID;
                    aPForwardInfoEntity.EmployeeID             = aPPanelForwardMemberEntity.EmployeeID;
                    aPForwardInfoEntity.CommentRequestDate     = DateTime.Now;
                    aPForwardInfoEntity.CommentSubmitDate      = null;
                    aPForwardInfoEntity.APMemberComment        = txtForwardRemarks.Text.Trim();
                    aPForwardInfoEntity.APForwardMemberComment = String.Empty;

                    FCCAPForwardInfo.GetFacadeCreate().Add(aPForwardInfoEntity, DatabaseOperationType.Add, TransactionRequired.No);

                    MiscUtil.ShowMessage(lblMessage, "You have forwarded the thread successfully", UIConstants.MessageType.GREEN);

                    PrepareInitialView();
                    BindList();

                    #region Forwarded Mail

                    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("A Bill Request is Forwarded Request is waiting for your approval");
                    sb.Append("<br/>");
                    sb.Append("<br/>");
                    sb.Append("-");
                    sb.Append("<br/>");
                    sb.Append("Thanks");
                    sb.Append("<br/>");
                    sb.Append("ERP System");
                    MailBody = sb.ToString();
                    Subject  = "ERP, Bill, Forwarded";
                    MailBody = @"Please note that a Bill is Forwarded.-Thanks ERP System";

                    HREmployeeEntity _hREmployeeEntity = FCCHREmployee.GetFacadeCreate().GetByID(aPForwardInfoEntity.EmployeeID);

                    if (_hREmployeeEntity != null)
                    {
                        String[] sendToMail = new String[] { _hREmployeeEntity.PrimaryEmail };
                        MiscUtil.SendMail(sendToMail, Subject, MailBody);
                    }

                    #endregion


                    //RedirectPageToForwardList();
                }
                else
                {
                    MiscUtil.ShowMessage(lblMessage, "Failed to forward", UIConstants.MessageType.RED);
                }
            }
        }