/// <summary> /// get smtp details for mail sending /// </summary> /// <param name="emailTo">email will send to</param> /// <param name="password">password </param> /// <param name="body">message body</param> public static void GetSmtpDetail(string emailTo, string body, string subject) { try { DecisionPointRepository objdecisionPointRepository = new DecisionPointRepository(); // return objdecisionPointRepository.Getsmtpdetails(); DecisionPointMailMatixBAL.Request.SMTPDetail objSMTPDetail = new DecisionPointMailMatixBAL.Request.SMTPDetail();//objdecisionPointRepository.Getsmtpdetails(); //Set Mail credentials BusinessEmail objBusinessEmail = new BusinessEmail(); objBusinessEmail.EmailBody = body; objBusinessEmail.EmailFrom = objdecisionPointRepository.Getsmtpdetails().EmailSmtpServer;//objSMTPDetail.EmailSmtpServer; objBusinessEmail.EmailTo = emailTo; objBusinessEmail.EmailSubject = subject; objBusinessEmail.EmailSmtpServerHost = objdecisionPointRepository.Getsmtpdetails().EmailSmtpServerHost; objBusinessEmail.EmailSmtpServerPort = objdecisionPointRepository.Getsmtpdetails().EmailSmtpServerPort; objBusinessEmail.EmailSmtpServerSSL = objdecisionPointRepository.Getsmtpdetails().EmailSmtpServerSSL; objBusinessEmail.EmailPassword = objdecisionPointRepository.Getsmtpdetails().PasswordSmtpServer; objBusinessEmail.PasswordSmtpServer = objdecisionPointRepository.Getsmtpdetails().PasswordSmtpServer; objBusinessEmail.EmailSmtpServer = objdecisionPointRepository.Getsmtpdetails().EmailSmtpServer; SendMail(objBusinessEmail); } catch { throw; } }
/// <summary> /// Decision Point Registration Charge /// </summary> /// <param name="payment">StripePayment</param> /// <param name="paymentResponse">PaymentResponse</param> /// <createdby>Sumit Saurav</createdby> /// <createdDate>may/22/2014</createdDate> /// <returns>string type result.</returns> public static string DecisionPointRegistrationCharge(StripePayment payment, PaymentResponse paymentResponse) { RecurringPaymentResponseParam objRecurring = null; DecisionPointRepository decisionPointRepository = null; #region Create Customer //create customer and set annual plan. string AnnualCustomerId = CreateCustomer(payment, paymentResponse); //save customer details in the database objRecurring = new RecurringPaymentResponseParam() { UserId = paymentResponse.UserId, CustomerId = AnnualCustomerId, Amount = Convert.ToInt32(paymentResponse.CompanyFee), Remark = "Annual and Monthly Plans", Type = "insert" }; decisionPointRepository = new DecisionPointRepository(); decisionPointRepository.MakeRecurringPayment(objRecurring); #endregion #region Make Registration payment //get credit card details StripeCreditCardInfo cc = GetCC(paymentResponse); //make first time payment. StripeCharge charge = payment.Charge(Convert.ToInt32(paymentResponse.Amount), "usd", cc, paymentResponse.TransactionType); string charge_id = charge.ID; StripeCharge charge_info = payment.GetCharge(charge_id); #endregion return(charge_id); }
/// <summary> /// Contracts Mail reminder /// </summary> /// <createdBy>Bobis</createdBy> /// <createdDate>Apr 15 2014</createdDate> public static void ContractsMailSending() { List <MailMatrixResponseParam> lstreceipentUserID = new List <MailMatrixResponseParam>(); try { string url = DecisionPointRepository.GetSiteUrl(); var location = System.Reflection.Assembly.GetEntryAssembly().Location; var directoryPath = Path.GetDirectoryName(location); DecisionPointRepository objdecisionPointRepository = new DecisionPointRepository(); lstreceipentUserID = objdecisionPointRepository.ContractsMailSending().Select(x => new MailMatrixResponseParam { Recevier = x.OwnerName, RecevierEmail = x.EmailId, Sender = x.ManagerName, TblId = x.Id, SenderId = x.CreatedBy }).ToList(); string body = string.Empty; string subject = string.Empty; for (int iCounter = 0; iCounter < lstreceipentUserID.Count; iCounter++) { string signature = objdecisionPointRepository.GetSignature(lstreceipentUserID[iCounter].SenderId); if (signature != null) { string[] sign = signature.Split(new string[] { "body>" }, StringSplitOptions.None); subject = "Contract Reminder Mail"; signature = sign[1].Substring(0, sign[1].Length - 2); MailInviteFormat objMailInviteFormat = new MailInviteFormat() { PersonName = lstreceipentUserID[iCounter].Recevier, Signature = signature, InviteeCompanyName = lstreceipentUserID[iCounter].Sender, DueDate = Convert.ToString(lstreceipentUserID[iCounter].DueDate, CultureInfo.InvariantCulture), DomainUrl = url }; objMailInviteFormat.FilePath = directoryPath + Convert.ToString(ConfigurationManager.AppSettings["StaffInviteMailAlert"], CultureInfo.InvariantCulture); if (!string.IsNullOrEmpty(lstreceipentUserID[iCounter].Recevier)) { objMailInviteFormat.Action = "You have received " + subject + " from " + lstreceipentUserID[iCounter].Sender + ". Please complete it."; body = DPInviteMailFormat.PersonInviteMailFormat(objMailInviteFormat); //body = "<div style='line-height:25px'>To: " + lstreceipentUserID[iCounter].Recevier + "<br/>From: " + // lstreceipentUserID[iCounter].Sender + "<br/>Subject: '" + subject + "'<br/><br/>" + lstreceipentUserID[iCounter].Recevier + // "Dear " + lstreceipentUserID[iCounter].Recevier + ",<br/> you have received a '" + subject + "' from " + lstreceipentUserID[iCounter].Sender + ". Please log at compliance tracker and review.<br/><br/></br></br>" + // signature + "</div>"; } BusinessCore.GetSmtpDetail(lstreceipentUserID[iCounter].RecevierEmail, body, subject); //update last invite date and next mail sending date in contracts log UpdateContractLogInviteDate(lstreceipentUserID[iCounter].TblId); } } } catch { throw; } }
/// <summary> /// Used for send the retake JCR /// </summary> /// <returns>int</returns> /// <createdby>Bobi</createdby> /// <createdDate>3 Nov 2014</createdDate> public static int JCRRetake() { try { DecisionPointRepository objdecisionPointRepository = new DecisionPointRepository(); return(objdecisionPointRepository.SetRetakeJCR()); } catch { throw; } }
/// <summary> /// Used for send the retake communications /// </summary> /// <returns>int</returns> /// <createdby>Bobi</createdby> /// <createdDate>14 july 2014</createdDate> public static int CommunicationRetake() { try { DecisionPointRepository objdecisionPointRepository = new DecisionPointRepository(); return(objdecisionPointRepository.SetRetakeDocument()); } catch { throw; } }
/// <summary> /// used for update last invite date and next mail sending date in contracts log /// </summary> /// <param name="tblId"></param> private static void UpdateContractLogInviteDate(int tblId) { try { DecisionPointRepository objdecisionPointRepository = new DecisionPointRepository(); objdecisionPointRepository.UpdateContractLogInviteDate(tblId); } catch (Exception) { throw; } }
/// <summary> /// used for Set the contracts events in alert section /// </summary> /// <returns>int</returns> /// <createdBy>Bobi</createdBy> /// <createdDate>Jan 3 2015</createdDate> public static int SetContractEventsAlerts() { try { DecisionPointRepository objdecisionPointRepository = new DecisionPointRepository(); return(objdecisionPointRepository.SetContractEventsAlerts()); } catch (Exception) { throw; } }
/// <summary> /// Annual Monthly Payment Charge deduction method /// </summary> /// <param name="payment">StripePayment</param> /// <param name="paymentResponse"><RecurringPaymentResponseParam/param> /// <createdby>Sumit Saurav</createdby> /// <createdDate>july/19/2014</createdDate> /// <returns>string result</returns> public static int AnnualMonthlyPaymentFailCharge(StripePayment payment, RecurringPaymentResponseParam paymentResponse) { RecurringPaymentResponseParam objRecurring = null; DecisionPointRepository decisionPointRepository = null; StripeCharge charge = payment.Charge(Convert.ToInt32(paymentResponse.Amount), "usd", paymentResponse.CustomerId, paymentResponse.Remark); string charge_id = charge.ID; StripeCharge charge_info = payment.GetCharge(charge_id); //save customer details in the database objRecurring = new RecurringPaymentResponseParam() { UserId = paymentResponse.UserId, CustomerId = paymentResponse.CustomerId, Amount = Convert.ToInt32(paymentResponse.Amount), Remark = paymentResponse.Remark, ChargeId = charge_id, }; decisionPointRepository = new DecisionPointRepository(); return(decisionPointRepository.MakeRecurringPaymentTransaction(objRecurring)); }
public static int UpdateCustomerDetails(StripePayment payment, PaymentResponse paymentResponse) { RecurringPaymentResponseParam objRecurring = null; DecisionPointRepository decisionPointRepository = null; #region Create Customer //create customer and set annual plan. string AnnualCustomerId = CreateCustomer(payment, paymentResponse); //save customer details in the database objRecurring = new RecurringPaymentResponseParam() { UserId = paymentResponse.UserId, CustomerId = AnnualCustomerId, Amount = Convert.ToInt32(paymentResponse.CompanyFee), Remark = "Annual and Monthly Plans", Type = "update" }; decisionPointRepository = new DecisionPointRepository(); return(decisionPointRepository.MakeRecurringPayment(objRecurring)); #endregion }
/// <summary> /// Mail reminder /// </summary> /// <createdBy>Bobis</createdBy> /// <createdDate>Apr 15 2014</createdDate> public static void DocumentMailSending() { List <MailMatrixResponseParam> lstreceipentUserID = new List <MailMatrixResponseParam>(); try { var location = System.Reflection.Assembly.GetEntryAssembly().Location; var directoryPath = Path.GetDirectoryName(location); string url = DecisionPointRepository.GetSiteUrl(); DecisionPointRepository objdecisionPointRepository = new DecisionPointRepository(); lstreceipentUserID = objdecisionPointRepository.DocumentMailSending().Select(x => new MailMatrixResponseParam { Recevier = x.Recevier, RecevierEmail = x.RecevierEmail, Sender = x.Sender, Category = x.Category, Flow = x.Flow, DocId = x.DocId, TblId = x.TblId, SenderId = x.SenderId, RecevierId = x.RecevierId, DueDate = x.DueDate, UserType = x.UserType }).ToList(); string body = string.Empty; string subject = string.Empty; for (int iCounter = 0; iCounter < lstreceipentUserID.Count; iCounter++) { // if (!objdecisionPointRepository.CheckDocumentMailSentOrNotToUser(lstreceipentUserID[iCounter])) // { string signature = objdecisionPointRepository.GetSignature(lstreceipentUserID[iCounter].SenderId); if (signature != null) { string[] sign = signature.Split(new string[] { "body>" }, StringSplitOptions.None); if (!string.IsNullOrEmpty(lstreceipentUserID[iCounter].Category)) { subject = "New " + lstreceipentUserID[iCounter].Category; } else { subject = "New Category"; } signature = sign[1].Substring(0, sign[1].Length - 2); if (!string.IsNullOrEmpty(lstreceipentUserID[iCounter].Recevier)) { MailInviteFormat objMailInviteFormat = new MailInviteFormat() { PersonName = lstreceipentUserID[iCounter].Recevier, Signature = signature, InviteeCompanyName = lstreceipentUserID[iCounter].Sender, DueDate = Convert.ToString(lstreceipentUserID[iCounter].DueDate, CultureInfo.InvariantCulture), DomainUrl = url }; if (!string.IsNullOrEmpty(lstreceipentUserID[iCounter].UserType)) { if (string.Equals(lstreceipentUserID[iCounter].UserType, Shared.IC)) { objMailInviteFormat.FilePath = directoryPath + Convert.ToString(ConfigurationManager.AppSettings["ICInviteMailAlert"], CultureInfo.InvariantCulture); } else { objMailInviteFormat.FilePath = directoryPath + Convert.ToString(ConfigurationManager.AppSettings["StaffInviteMailAlert"], CultureInfo.InvariantCulture); } } else { objMailInviteFormat.FilePath = directoryPath + Convert.ToString(ConfigurationManager.AppSettings["StaffInviteMailAlert"], CultureInfo.InvariantCulture); } objMailInviteFormat.Action = "You have received " + subject + " from " + lstreceipentUserID[iCounter].Sender + ". Please complete it."; body = DPInviteMailFormat.PersonInviteMailFormat(objMailInviteFormat); //if (lstreceipentUserID[iCounter].Flow.Equals(2)) //{ // body = "<div style='line-height:25px'>To: " + lstreceipentUserID[iCounter].Recevier + "<br/>From: " + lstreceipentUserID[iCounter].Sender + "<br/>Subject: '" + subject + "'<br/><br/>" + lstreceipentUserID[iCounter].Sender + "A '" + subject + "' has been assigned to you. Please log and complete.<br/><br/></br></br>" + signature + "</div>"; //} //else { body = "<div style='line-height:25px'>To: " + lstreceipentUserID[iCounter].Recevier + "<br/>From: " + lstreceipentUserID[iCounter].Sender + "<br/>Subject: '" + subject + "'<br/><br/>" + lstreceipentUserID[iCounter].Recevier + " you have received a '" + subject + "' from " + lstreceipentUserID[iCounter].Sender + ". Please log in and review.<br/><br/></br></br>" + signature + "</div>"; } } BusinessCore.GetSmtpDetail(lstreceipentUserID[iCounter].RecevierEmail, body, subject); lstreceipentUserID[iCounter].Type = 0; //Insert mail log into database objdecisionPointRepository.DocumentMailSndLog(lstreceipentUserID[iCounter]); } //} } } catch { throw; } finally { } }
/// <summary> /// make company monthly payment means recurring payments /// </summary> /// <createdby>Sumit Saurav</createdby> /// <createddate>09/july/2014</createddate> public static void MakeCompanyRecurringMonthlyPayment() { try { #region Valiables DecisionPointRepository objDecisionPointRepository = null; RecurringPaymentResponseParam planDetails = null; objDecisionPointRepository = new DecisionPointRepository(); IList <int> lstStaff = new List <int>(); IList <int> lstBusinessPartner = new List <int>(); IList <int> lstWePayIc = new List <int>(); IList <CompanyIdResponseParam> lstCompany = objDecisionPointRepository.getAllPayeeCompanyId(); IList <PaymentAmountResponseParam> PaymentAmount = null; int amount = 0; #endregion if (lstCompany != null && lstCompany.Count > 0) { foreach (var item in lstCompany) { try { #region Company Payment Calculation // get payment amount of a compnay inclusing staff, business, IC rates PaymentAmount = objDecisionPointRepository.getPaymentAmount(item.CompanyId).ToList(); planDetails = new RecurringPaymentResponseParam(); //get recurring payment customer details planDetails = objDecisionPointRepository.getPlanDetails(Convert.ToInt32(item.Id)); if (planDetails != null) { int IsPaymentDone = objDecisionPointRepository.IsRecurringPaymentDone(planDetails.CustomerId, remarkMonthlyPlan); if (IsPaymentDone == 0) { //check wether is invoice is false or not?? if (!Convert.ToBoolean(PaymentAmount[0].IsInvoice)) { // code for staff calculation and deduction lstStaff = objDecisionPointRepository.GetAllStaff(item.CompanyId); // code for business partner calculation and deduction lstBusinessPartner = objDecisionPointRepository.GetAllBusinessPartners(item.CompanyId); // code for we pay IC calculation and deduction lstWePayIc = objDecisionPointRepository.GetAllWePayIc(item.CompanyId); if (PaymentAmount != null && PaymentAmount.Count > 0) { decimal staffamount = Convert.ToDecimal(lstStaff.Count()) * Convert.ToDecimal(PaymentAmount[0].PerFieldStaffFee); decimal businessAmount = Convert.ToDecimal(lstBusinessPartner.Count()) * Convert.ToDecimal(PaymentAmount[0].PerOfficeStaffFee); decimal IcAmount = Convert.ToDecimal(lstWePayIc.Count()) * Convert.ToDecimal(PaymentAmount[0].PerIcFee); amount = Convert.ToInt32(((staffamount + businessAmount + IcAmount) * 100)); } planDetails.Amount = amount; planDetails.Remark = remarkMonthlyPlan; planDetails.UserId = item.Id; //update plan in stripe. StripePayment payment = new StripePayment(Convert.ToString(ConfigurationManager.AppSettings["StripeKey"])); XamarinStripeCore.AnnualMonthlyPaymentCharge(payment, planDetails); } } } #endregion } catch { } } } } catch { throw; } finally { } }
/// <summary> /// make company monthly payment means recurring payment /// </summary> /// <createdby>Sumit Saurav</createdby> /// <createddate>09/july/2014</createddate> public static void MakeCompanyRecurringAnnualPayment() { try { #region Valiables DecisionPointRepository objDecisionPointRepository = null; RecurringPaymentResponseParam planDetails = null; objDecisionPointRepository = new DecisionPointRepository(); IList <CompanyIdResponseParam> lstCompany = objDecisionPointRepository.getAllAnnualPaymentCompanyId(); IList <PaymentAmountResponseParam> PaymentAmount = null; int amount = 0; #endregion if (lstCompany != null && lstCompany.Count > 0) { foreach (var item in lstCompany) { try { #region Company Annual Payment Calculation & Deductions // get payment amount of a compnay PaymentAmount = objDecisionPointRepository.getPaymentAmount(item.CompanyId).ToList(); planDetails = new RecurringPaymentResponseParam(); planDetails = objDecisionPointRepository.getPlanDetails(Convert.ToInt32(item.Id)); if (planDetails != null) { int IsPaymentDone = objDecisionPointRepository.IsRecurringPaymentDone(planDetails.CustomerId, remarkAnnualPlan); // check is payment already done for this year or not?? if (IsPaymentDone == 0) { //check wether is invoice is false or not?? if (!Convert.ToBoolean(PaymentAmount[0].IsInvoice)) { if (PaymentAmount != null && PaymentAmount.Count > 0) { decimal annualAmount = Convert.ToDecimal(PaymentAmount[0].CompanyFee); amount = Convert.ToInt32((annualAmount * 100)); } planDetails.Amount = amount; planDetails.Remark = remarkAnnualPlan; planDetails.UserId = item.Id; //update plan in stripe. StripePayment payment = new StripePayment(Convert.ToString(ConfigurationManager.AppSettings["StripeKey"])); XamarinStripeCore.AnnualMonthlyPaymentCharge(payment, planDetails); } } } #endregion } catch { } } } } catch { throw; } finally { } }