public void SendSMS03(long workFlowID, string RequestID, IList <long> ReciverList) { try { if (ParameterServices.EnableSMS) { Document document = WorkFlowQueryProvider.WorkFlowQuery.GetDocumentByWorkFlowID(workFlowID); SCGDocument scgDocument = ScgeAccountingQueryProvider.SCGDocumentQuery.FindByIdentity(document.DocumentID); FnAutoPayment autoPayment = ScgeAccountingQueryProvider.FnAutoPaymentQuery.GetFnAutoPaymentByDocumentID(document.DocumentID); foreach (long userID in ReciverList) { SuUser sendToUser = QueryProvider.SuUserQuery.FindByIdentity(userID); if (sendToUser.SMSReadyToReceive) { string ToPhoneNo = sendToUser.MobilePhoneNo.ToString(); SMSDTO smsDto = new SMSDTO(); string Mobile = "66" + ToPhoneNo.ToString().Remove(0, 1); smsDto.To = Mobile; smsDto.PaymentDate = autoPayment.PaymentDate.Value; smsDto.Amount = autoPayment.Amount.ToString(); smsDto.Requestor = RequestID; smsDto.DocumentNo = scgDocument.DocumentNo; smsDto.UseProxy = true; smsDto.Content = BuildContentBody(smsDto, SMSContenFormat.SMS03, SMSBusinessCase.Cheque); this.sendSMSStatus = SMSService.Send(smsDto); } } } } catch (Exception ex) { Utilities.WriteLogs("SendSMS03 : ==> " + ex.Message, "smslog", "Logs", "txt"); } }
public void ShowPaymentInfo() { ExpenseDataSet expDS = (ExpenseDataSet)TransactionService.GetDS(this.TransactionId); ExpenseDataSet.FnExpenseDocumentRow expRow = expDS.FnExpenseDocument.FindByExpenseID(this.ExpDocumentID); long tempDocumentID = expRow.DocumentID; int status = 2; // FnAutoPayment Success -> Status = 2 FnAutoPayment payment = ScgeAccountingQueryProvider.FnAutoPaymentQuery.GetFnAutoPaymentSuccessByDocumentID(tempDocumentID, status); StringBuilder paymentInfo = new StringBuilder(); if (payment != null) { if (ctlDdlPaymentType.SelectedValue.Equals(PaymentType.TR)) { if (payment.PaymentDate.HasValue) { ctlDateLabel.Visible = true; } ctlDate.Text = String.Format(" :{0} ,", UIHelper.BindDate(payment.PaymentDate)); if (!string.IsNullOrEmpty(payment.ChequeBankName)) { ctlBankNameLabel.Visible = true; } ctlBankName.Text = String.Format(" :{0} ,", payment.ChequeBankName); if (!string.IsNullOrEmpty(payment.PayeeBankAccountNumber)) { ctlAccountBankNameLabel.Visible = true; } ctlAccountBankName.Text = String.Format(" :{0} ", payment.PayeeBankAccountNumber); } if (ctlDdlPaymentType.SelectedValue.Equals(PaymentType.CQ)) { if (payment.ChequeDate.HasValue) { ctlDateLabel.Visible = true; } ctlDate.Text = String.Format(" :{0} ,", UIHelper.BindDate(payment.ChequeDate)); if (!string.IsNullOrEmpty(payment.ChequeBankName)) { ctlBankNameLabel.Visible = true; } ctlBankName.Text = String.Format(" :{0} ,", payment.ChequeBankName); if (!string.IsNullOrEmpty(payment.ChequeNumber.Trim())) { ctlAccountBankNameLabel.Visible = true; } ctlAccountBankName.Text = String.Format(" :{0} ", payment.ChequeNumber); } } }
public void SendSMS02(long workFlowID, string RequestID, IList <long> ReciverList, bool isAutoPayment) { double netAmount = 0; try { if (ParameterServices.EnableSMS) { Document document = WorkFlowQueryProvider.WorkFlowQuery.GetDocumentByWorkFlowID(workFlowID); SCGDocument scgDocument = ScgeAccountingQueryProvider.SCGDocumentQuery.FindByIdentity(document.DocumentID); if (!isAutoPayment) // Cash { #region Cash if (scgDocument.DocumentType.DocumentTypeID.Equals(DocumentTypeID.ExpenseDomesticDocument) || (scgDocument.DocumentType.DocumentTypeID.Equals(DocumentTypeID.ExpenseForeignDocument))) { FnExpenseDocument expense = ScgeAccountingQueryProvider.FnExpenseDocumentQuery.GetExpenseDocumentByDocumentID(scgDocument.DocumentID); if (expense != null) { netAmount = expense.DifferenceAmount; } } else if (scgDocument.DocumentType.DocumentTypeID.Equals(DocumentTypeID.AdvanceDomesticDocument) || (scgDocument.DocumentType.DocumentTypeID.Equals(DocumentTypeID.AdvanceForeignDocument))) { AvAdvanceDocument advance = ScgeAccountingQueryProvider.AvAdvanceDocumentQuery.GetAvAdvanceByDocumentID(scgDocument.DocumentID); if (advance != null) { netAmount = advance.Amount; } } #endregion Cash foreach (long userID in ReciverList) { SuUser sendToUser = QueryProvider.SuUserQuery.FindByIdentity(userID); if (sendToUser.SMSReadyToReceive) { string ToPhoneNo = sendToUser.MobilePhoneNo.ToString(); SMSDTO smsDto = new SMSDTO(); string Mobile = "66" + ToPhoneNo.ToString().Remove(0, 1); smsDto.Requestor = RequestID; smsDto.DocumentNo = scgDocument.DocumentNo; smsDto.Amount = netAmount.ToString(); smsDto.To = Mobile; smsDto.UseProxy = true; smsDto.Content = BuildContentBody(smsDto, SMSContenFormat.SMS02, SMSBusinessCase.Cash); this.sendSMSStatus = SMSService.Send(smsDto); } } } else // Cheque { #region Cheque FnAutoPayment autoPayment = ScgeAccountingQueryProvider.FnAutoPaymentQuery.GetFnAutoPaymentByDocumentID(document.DocumentID); netAmount = autoPayment.Amount; #endregion Cheque foreach (long userID in ReciverList) { SuUser sendToUser = QueryProvider.SuUserQuery.FindByIdentity(userID); if (sendToUser.SMSReadyToReceive) { string ToPhoneNo = sendToUser.MobilePhoneNo.ToString(); SMSDTO smsDto = new SMSDTO(); string Mobile = "66" + ToPhoneNo.ToString().Remove(0, 1); smsDto.Requestor = RequestID; smsDto.DocumentNo = scgDocument.DocumentNo; smsDto.PaymentDate = autoPayment.PaymentDate.Value; smsDto.Amount = netAmount.ToString(); smsDto.To = Mobile; smsDto.UseProxy = true; smsDto.Content = BuildContentBody(smsDto, SMSContenFormat.SMS02, SMSBusinessCase.Cheque); this.sendSMSStatus = SMSService.Send(smsDto); } } } } } catch (Exception ex) { Utilities.WriteLogs("SendSMS02 : ==> " + ex.Message, "smslog", "Logs", "txt"); } }
private static void Export() { Console.WriteLine("Export to fidoc to sap."); IList <SapInstanceData> sapInstances = Factory.DbSapInstanceQuery.GetSapInstanceList(); foreach (SapInstanceData sapInstance in sapInstances) { //bat file set ExportPath = root directory. etc: C:\SAPUpload\eXpense\ string newExportPath = RootPath + sapInstance.AliasName + "\\" + ExportPath + "\\"; DateTime dt = DateTime.Now; StreamWriter writer; #region Export Autopayment Console.WriteLine("Creating Batch AutoPayment Clearing Logfile (SAP : " + sapInstance.AliasName + ")."); IList <ExportClearing> clearingList = Factory.FnAutoPaymentQuery.GetExportClearingListByDate(sapInstance.Code); try { writer = new StreamWriter(newExportPath + ExportFileName + ".txt"); } catch (Exception) { Console.WriteLine("Program was terminated. Because directory is not existing."); return; } string FormatLine = "{0}|{1}|{2}"; foreach (ExportClearing clearing in clearingList) { string textLine; textLine = String.Format(FormatLine, clearing.CompanyCode, clearing.FIDOC, clearing.Year); writer.WriteLine(textLine); FnAutoPayment autoPayment; autoPayment = Factory.FnAutoPaymentQuery.GetFnAutoPaymentByDocumentID(string.IsNullOrEmpty(clearing.DocumentID) ? 0 : SS.Standard.Utilities.Utilities.ParseLong(clearing.DocumentID)); if (autoPayment != null) { FnAutoPayment _autoPayment = new FnAutoPayment(); _autoPayment.AutoPaymentID = autoPayment.AutoPaymentID; Factory.FnAutoPaymentService.Delete(_autoPayment); } autoPayment = new FnAutoPayment(); autoPayment.Active = true; autoPayment.Document = new SCGDocument(); autoPayment.Document.DocumentID = string.IsNullOrEmpty(clearing.DocumentID) ? 0 : SS.Standard.Utilities.Utilities.ParseLong(clearing.DocumentID);//UIHelper.ParseLong(clearing.DocumentID); autoPayment.FIDoc = clearing.FIDOC; autoPayment.companycode = clearing.CompanyCode; autoPayment.year = clearing.Year; autoPayment.CreDate = DateTime.Now; autoPayment.UpdDate = DateTime.Now; autoPayment.Status = 1; autoPayment.CreBy = SS.DB.Query.ParameterServices.ImportSystemUserID; autoPayment.UpdBy = SS.DB.Query.ParameterServices.ImportSystemUserID; autoPayment.UpdPgm = "Interface"; Factory.FnAutoPaymentService.Save(autoPayment); } writer.Close(); Console.WriteLine("Create log finish (SAP : " + sapInstance.AliasName + ")."); } Console.WriteLine("Create log finish."); //DateTime dt = DateTime.Now; //StreamWriter writer; //#region Export Autopayment //Console.WriteLine("Creating Batch AutoPayment Clearing Logfile."); //IList<ExportClearing> clearingList = Factory.FnAutoPaymentQuery.GetExportClearingListByDate(); //try //{ // writer = new StreamWriter(ExportPath + ExportFileName + ".txt"); //} //catch (Exception) //{ // Console.WriteLine("Program was terminated. Because directory is not existing."); // return; //} //string FormatLine = "{0}|{1}|{2}"; //foreach (ExportClearing clearing in clearingList) //{ // string textLine; // textLine = String.Format(FormatLine, clearing.CompanyCode, clearing.FIDOC, clearing.Year); // writer.WriteLine(textLine); // FnAutoPayment autoPayment; // autoPayment = Factory.FnAutoPaymentQuery.GetFnAutoPaymentByDocumentID(UIHelper.ParseLong(clearing.DocumentID)); // if (autoPayment != null) // { // FnAutoPayment _autoPayment = new FnAutoPayment(); // _autoPayment.AutoPaymentID = autoPayment.AutoPaymentID; // Factory.FnAutoPaymentService.Delete(_autoPayment); // } // autoPayment = new FnAutoPayment(); // autoPayment.Active = true; // autoPayment.Document = new SCGDocument(); // autoPayment.Document.DocumentID = UIHelper.ParseLong(clearing.DocumentID); // autoPayment.FIDoc = clearing.FIDOC; // autoPayment.companycode = clearing.CompanyCode; // autoPayment.year = clearing.Year; // autoPayment.CreDate = DateTime.Now; // autoPayment.UpdDate = DateTime.Now; // autoPayment.Status = 1; // autoPayment.CreBy = SS.DB.Query.ParameterServices.ImportSystemUserID; // autoPayment.UpdBy = SS.DB.Query.ParameterServices.ImportSystemUserID; // autoPayment.UpdPgm = "Interface"; // Factory.FnAutoPaymentService.Save(autoPayment); //} //writer.Close(); //Console.WriteLine("Create log finish."); #endregion }