示例#1
0
        Int64 IAPPanelForwardMemberDataAccess.Add(APPanelForwardMemberEntity aPPanelForwardMemberEntity, DatabaseOperationType option, TransactionRequired reqTran)
        {
            try
            {
                long retValues = -99;

                switch (reqTran)
                {
                case TransactionRequired.No:
                {
                    retValues = Add(aPPanelForwardMemberEntity, option);
                    break;
                }

                case TransactionRequired.Yes:
                {
                    retValues = AddTran(aPPanelForwardMemberEntity, option);
                    break;
                }

                default:
                {
                    retValues = -99;
                    break;
                }
                }

                return(retValues);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        private void PrepareEditView()
        {
            APPanelForwardMemberEntity aPPanelForwardMemberEntity = CurrentAPPanelForwardMemberEntity;


            if (!aPPanelForwardMemberEntity.IsNew)
            {
                if (ddlAPPanelID.Items.Count > 0 && aPPanelForwardMemberEntity.APPanelID != null)
                {
                    ddlAPPanelID.SelectedValue = aPPanelForwardMemberEntity.APPanelID.ToString();
                }

                if (ddlEmployeeID.Items.Count > 0 && aPPanelForwardMemberEntity.EmployeeID != null)
                {
                    ddlEmployeeID.SelectedValue = aPPanelForwardMemberEntity.EmployeeID.ToString();
                }

                if (ddlDepartmentID.Items.Count > 0 && aPPanelForwardMemberEntity.DepartmentID != null)
                {
                    ddlDepartmentID.SelectedValue = aPPanelForwardMemberEntity.DepartmentID.ToString();
                }


                btnSubmit.Text    = "Update";
                btnAddNew.Visible = true;
            }
        }
        private void SaveAPPanelForwardMemberEntity()
        {
            if (IsValid)
            {
                try
                {
                    APPanelForwardMemberEntity aPPanelForwardMemberEntity = BuildAPPanelForwardMemberEntity();

                    Int64 result = -1;

                    if (aPPanelForwardMemberEntity.IsNew)
                    {
                        result = FCCAPPanelForwardMember.GetFacadeCreate().Add(aPPanelForwardMemberEntity, DatabaseOperationType.Add, TransactionRequired.No);
                    }
                    else
                    {
                        String filterExpression = SqlExpressionBuilder.PrepareFilterExpression(APPanelForwardMemberEntity.FLD_NAME_APPanelForwardMemberID, aPPanelForwardMemberEntity.APPanelForwardMemberID.ToString(), SQLMatchType.Equal);
                        result = FCCAPPanelForwardMember.GetFacadeCreate().Update(aPPanelForwardMemberEntity, filterExpression, DatabaseOperationType.Update, TransactionRequired.No);
                    }

                    if (result > 0)
                    {
                        _APPanelForwardMemberID     = 0;
                        _APPanelForwardMemberEntity = new APPanelForwardMemberEntity();
                        PrepareInitialView();
                        BindAPPanelForwardMemberList();

                        if (aPPanelForwardMemberEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "A PPanel Forward Member Information has been added successfully.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "A PPanel Forward Member Information has been updated successfully.", false);
                        }
                    }
                    else
                    {
                        if (aPPanelForwardMemberEntity.IsNew)
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to add A PPanel Forward Member Information.", false);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to update A PPanel Forward Member Information.", false);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                }
            }
        }
示例#4
0
        private Int64 UpdateTran(APPanelForwardMemberEntity aPPanelForwardMemberEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.APPanelForwardMember_SET";

            Database db = DatabaseFactory.CreateDatabase();

            using (DbCommand cmd = db.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option, db);
                AddOutputParameter(cmd, db);
                AddFilterExpressionParameter(cmd, filterExpression, db);

                db.AddInParameter(cmd, "@APPanelForwardMemberID", DbType.Int64, aPPanelForwardMemberEntity.APPanelForwardMemberID);
                db.AddInParameter(cmd, "@APPanelID", DbType.Int64, aPPanelForwardMemberEntity.APPanelID);
                db.AddInParameter(cmd, "@EmployeeID", DbType.Int64, aPPanelForwardMemberEntity.EmployeeID);
                db.AddInParameter(cmd, "@DepartmentID", DbType.Int64, aPPanelForwardMemberEntity.DepartmentID);

                DbConnection connection = db.CreateConnection();
                connection.Open();
                DbTransaction transaction = connection.BeginTransaction();

                try
                {
                    using (IDataReader reader = db.ExecuteReader(cmd, transaction))
                    {
                        returnCode = GetReturnCodeFromParameter(cmd);
                    }

                    if (returnCode > 0)
                    {
                        transaction.Commit();
                    }
                    else
                    {
                        throw new ArgumentException("Error Code." + returnCode.ToString());
                    }
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    throw ex;
                }
                finally
                {
                    transaction.Dispose();
                    connection.Close();
                    connection = null;
                }
            }

            return(returnCode);
        }
        protected void lvAPPanelForwardMember_ItemCommand(object sender, ListViewCommandEventArgs e)
        {
            Int64 APPanelForwardMemberID;

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

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

                    PrepareEditView();

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

                        String fe = SqlExpressionBuilder.PrepareFilterExpression(APPanelForwardMemberEntity.FLD_NAME_APPanelForwardMemberID, APPanelForwardMemberID.ToString(), SQLMatchType.Equal);

                        APPanelForwardMemberEntity aPPanelForwardMemberEntity = new APPanelForwardMemberEntity();


                        result = FCCAPPanelForwardMember.GetFacadeCreate().Delete(aPPanelForwardMemberEntity, fe, DatabaseOperationType.Delete, TransactionRequired.No);

                        if (result == 0)
                        {
                            _APPanelForwardMemberID     = 0;
                            _APPanelForwardMemberEntity = new APPanelForwardMemberEntity();
                            PrepareInitialView();
                            BindAPPanelForwardMemberList();

                            MiscUtil.ShowMessage(lblMessage, "A PPanel Forward Member has been successfully deleted.", true);
                        }
                        else
                        {
                            MiscUtil.ShowMessage(lblMessage, "Failed to delete A PPanel Forward Member.", true);
                        }
                    }
                    catch (Exception ex)
                    {
                        MiscUtil.ShowMessage(lblMessage, ex.Message, true);
                    }
                }
            }
        }
示例#6
0
        private Int64 Update(APPanelForwardMemberEntity aPPanelForwardMemberEntity, String filterExpression, DatabaseOperationType option)
        {
            long         returnCode = -99;
            const string SP         = "dbo.APPanelForwardMember_SET";

            using (DbCommand cmd = Database.GetStoredProcCommand(SP))
            {
                AddOptionParameter(cmd, option);
                AddOutputParameter(cmd);
                AddFilterExpressionParameter(cmd, filterExpression);

                Database.AddInParameter(cmd, "@APPanelForwardMemberID", DbType.Int64, aPPanelForwardMemberEntity.APPanelForwardMemberID);
                Database.AddInParameter(cmd, "@APPanelID", DbType.Int64, aPPanelForwardMemberEntity.APPanelID);
                Database.AddInParameter(cmd, "@EmployeeID", DbType.Int64, aPPanelForwardMemberEntity.EmployeeID);
                Database.AddInParameter(cmd, "@DepartmentID", DbType.Int64, aPPanelForwardMemberEntity.DepartmentID);

                using (IDataReader reader = Database.ExecuteReader(cmd))
                {
                    returnCode = GetReturnCodeFromParameter(cmd);

                    switch (returnCode)
                    {
                    case SqlConstants.DB_STATUS_CODE_DATAALREADYEXIST:
                    {
                        throw new ArgumentException("APPanelForwardMemberEntity already exists. Please specify another APPanelForwardMemberEntity.");
                    }

                    case SqlConstants.DB_STATUS_CODE_DATAUPDATEDFROMOTHERSESSION:
                    {
                        throw new ArgumentException("APPanelForwardMemberEntity data already updated from different session.");
                    }

                    case SqlConstants.DB_STATUS_CODE_FAIL_OPERATION:
                    {
                        throw new ArgumentException("APPanelForwardMemberEntity already exists. Please specify another APPanelForwardMemberEntity.");
                    }
                    }
                }
            }

            return(returnCode);
        }
        private APPanelForwardMemberEntity BuildAPPanelForwardMemberEntity()
        {
            APPanelForwardMemberEntity aPPanelForwardMemberEntity = CurrentAPPanelForwardMemberEntity;

            if (ddlAPPanelID.Items.Count > 0)
            {
                if (ddlAPPanelID.SelectedValue == "0")
                {
                }
                else
                {
                    aPPanelForwardMemberEntity.APPanelID = Int64.Parse(ddlAPPanelID.SelectedValue);
                }
            }

            if (ddlEmployeeID.Items.Count > 0)
            {
                if (ddlEmployeeID.SelectedValue == "0")
                {
                }
                else
                {
                    aPPanelForwardMemberEntity.EmployeeID = Int64.Parse(ddlEmployeeID.SelectedValue);
                }
            }

            if (ddlDepartmentID.Items.Count > 0)
            {
                if (ddlDepartmentID.SelectedValue == "0")
                {
                }
                else
                {
                    aPPanelForwardMemberEntity.DepartmentID = Int64.Parse(ddlDepartmentID.SelectedValue);
                }
            }


            return(aPPanelForwardMemberEntity);
        }
        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);
            }
        }
 Int64 IAPPanelForwardMemberFacade.Delete(APPanelForwardMemberEntity aPPanelForwardMemberEntity, String filterExpression, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateAPPanelForwardMemberDataAccess().Delete(aPPanelForwardMemberEntity, filterExpression, option, reqTran));
 }
 Int64 IAPPanelForwardMemberFacade.Add(APPanelForwardMemberEntity aPPanelForwardMemberEntity, DatabaseOperationType option, TransactionRequired reqTran)
 {
     return(DataAccessFactory.CreateAPPanelForwardMemberDataAccess().Add(aPPanelForwardMemberEntity, option, reqTran));
 }
示例#11
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);
                }
            }
        }
 protected void btnAddNew_Click(object sender, EventArgs e)
 {
     _APPanelForwardMemberID     = 0;
     _APPanelForwardMemberEntity = new APPanelForwardMemberEntity();
     PrepareInitialView();
 }