コード例 #1
0
        public DataTable GetExpenseDetailList(int approvalStatus)
        {
            var query = _dbView.vwExpenseHqDetailDownloadLists
                        .Where(w => w.ApprovalStatus >= Convert.ToInt32(approvalStatus))
                        .Select(w => w);

            var tempDt = CGlobal.ConvertToDataTable(query);

            return(tempDt);
        }
コード例 #2
0
        public bool SendMail(CConstValue.Approval approvalType, CConstValue.MailStatus mailStatus, int index, string indexNumber, int userId)
        {
            try
            {
                var      requestedUserId = 0;
                DateTime requestedDate   = DateTime.Now;

                var      approvedUserId = 0;
                var      approvedMemo   = string.Empty;
                DateTime approvedDate   = DateTime.Now;

                var approvingUserId = 0;
                var approvalStatus  = string.Empty;

                var currentApproval = new CApprovalHistory().GetCurrentApproval((int)approvalType, index);
                if (currentApproval != null)
                {
                    var approvalStepDict = new CDict().GetDictByTypeAndValue(217, (int)currentApproval.ApprovalStep);
                    approvalStatus = approvalStepDict?.Name;
                    approvedMemo   = currentApproval.ApprovalMemo;
                    approvedDate   = currentApproval.ApprovalDate.Value;
                }

                switch (mailStatus)
                {
                case CConstValue.MailStatus.ToApproveUser:
                    requestedUserId = userId;
                    approvingUserId = new CApproval().GetSupuervisor((int)approvalType, userId);
                    break;

                case CConstValue.MailStatus.ToApproveUserAndRequestUser:
                    var tempRequestedUser1 = new CApprovalHistory().GetApprovalByRequestedUser((int)approvalType, index);
                    if (tempRequestedUser1 != null)
                    {
                        requestedUserId = tempRequestedUser1.ApprovalUser;
                        requestedDate   = tempRequestedUser1.CreatedDate;
                    }
                    approvedUserId  = userId;
                    approvingUserId = new CApproval().GetSupuervisor((int)approvalType, userId);

                    break;

                case CConstValue.MailStatus.ToRequestUser:
                    var tempRequestedUser2 = new CApprovalHistory().GetApprovalByRequestedUser((int)approvalType, index);
                    if (tempRequestedUser2 != null)
                    {
                        requestedUserId = tempRequestedUser2.ApprovalUser;
                        requestedDate   = tempRequestedUser2.CreatedDate;
                    }
                    approvedUserId = userId;
                    break;
                }

                var cUser         = new CUser();
                var requestedUser = cUser.Get(requestedUserId);
                var approvedUser  = cUser.Get(approvedUserId);
                var approvingUser = cUser.Get(approvingUserId);

                if (indexNumber == string.Empty)
                {
                    indexNumber = index.ToString();
                }

                // todo : temp to change mail should be removed before lunching.
                if (requestedUser != null)
                {
                    requestedUser.Email = "*****@*****.**";
                }
                if (approvedUser != null)
                {
                    approvedUser.Email = "*****@*****.**";
                }
                if (approvingUser != null)
                {
                    approvingUser.Email = "*****@*****.**";
                }

                var bodyToApprovingUser = $@"Dear <u><i>{cUser.GetUserName(approvingUser)}</i></u>,
                                            <p></p><br /><br />
                                            A new request is waiting for your approval.
                                            <br /><br />
                                            Please check it out.
                                            <p></p><br /><br />                                            
                                            <b>{approvalType}</b>
                                            <br /><br />
                                            &nbsp;&nbsp;&nbsp;- No : <b>{indexNumber}</b>
                                            <br />
                                            &nbsp;&nbsp;&nbsp;- Status : <b>{approvalStatus}</b>
                                            <br />
                                            &nbsp;&nbsp;&nbsp;- Requested by : <b>{cUser.GetUserName(requestedUser)}</b>
                                            <br />
                                            &nbsp;&nbsp;&nbsp;- Requested Date : <b>{CGlobal.GetDateFormat(requestedDate)}</b>";

                var bodyToRequestedUser = $@"Dear <u><i>{cUser.GetUserName(requestedUser)}</i></u>,
                                            <p></p><br /><br />
                                            Your request has been updated.
                                            <br /><br />
                                            Please check it out.
                                            <p></p><br /><br />
                                            <b>{approvalType}</b>
                                            <br /><br />
                                            &nbsp;&nbsp;&nbsp;- No : <b>{indexNumber}</b>
                                            <br />
                                            &nbsp;&nbsp;&nbsp;- Status : <b>{approvalStatus}</b>
                                            <br />
                                            &nbsp;&nbsp;&nbsp;- Approved by : <b>{cUser.GetUserName(approvedUser)}</b>
                                            <br />
                                            &nbsp;&nbsp;&nbsp;- Approved Date : <b>{CGlobal.GetDateFormat(approvedDate)}</b>
                                            <br />
                                            &nbsp;&nbsp;&nbsp;- Approved Memo : <b>{approvedMemo}</b>";

                switch (mailStatus)
                {
                case CConstValue.MailStatus.ToApproveUser:
                    SendMailPost(approvalType.ToString(), approvingUser.Email, bodyToApprovingUser);
                    break;

                case CConstValue.MailStatus.ToApproveUserAndRequestUser:
                    SendMailPost(approvalType.ToString(), requestedUser.Email, bodyToRequestedUser);
                    SendMailPost(approvalType.ToString(), approvingUser.Email, bodyToApprovingUser);
                    break;

                case CConstValue.MailStatus.ToRequestUser:
                    SendMailPost(approvalType.ToString(), requestedUser.Email, bodyToRequestedUser);
                    break;
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.Message);
                return(false);
            }
            return(true);
        }
コード例 #3
0
 public string GetTableNameForVwScholarshipApprovalList()
 {
     return(CGlobal.GetTableName(_dbView.vwScholarshipApprovalLists.ToString()));
 }
コード例 #4
0
 public string GetTableNameForVwScholarship()
 {
     return(CGlobal.GetTableName(_dbView.vwScholarships.ToString()));
 }
コード例 #5
0
 public string GetTableNameForvwCreditMemoPayoutApprovalList()
 {
     return(CGlobal.GetTableName(_dbView.vwCreditMemoPayoutApprovalLists.ToString()));
 }
コード例 #6
0
        public DataTable GetVwCreditMemoExcel(StringBuilder filterExpressionSb)
        {
            var tempDt = _dbView.ExecuteQuery <vwCreditMemoExcel>("SELECT * FROM " + nameof(vwCreditMemoExcel) + (filterExpressionSb.Length == 0 ? string.Empty : " WHERE " + filterExpressionSb));

            return(CGlobal.ConvertToDataTable(tempDt));
        }
コード例 #7
0
 public string GetTableNameForVwRefundApprovalList()
 {
     return(CGlobal.GetTableName(_dbView.vwRefundApprovalLists.ToString()));
 }
コード例 #8
0
 public string GetTableNameForVwRefund()
 {
     return(CGlobal.GetTableName(_dbView.vwRefunds.ToString()));
 }
コード例 #9
0
 public string GetTableNameForVwPackageProgramApprovalList()
 {
     return(CGlobal.GetTableName(_dbView.vwPackageProgramApprovalLists.ToString()));
 }
コード例 #10
0
 public string GetTableNameForVwPromotionApprovalList()
 {
     return(CGlobal.GetTableName(_dbView.vwPromotionApprovalLists.ToString()));
 }
コード例 #11
0
 public string GetTableNameForVwPromotion()
 {
     return(CGlobal.GetTableName(_dbView.vwPromotions.ToString()));
 }
コード例 #12
0
 public string GetTableNameForVwAgency()
 {
     return(CGlobal.GetTableName(_dbView.vwAgencies.ToString()));
 }