private object Classified_Billing(string functionName, object parameters) { try { BillingClassified bc = new BillingClassified(); bc.FromOSD((OSDMap)OSDParser.DeserializeJson(parameters.ToString())); IDirectoryServiceConnector DSC = DataManager.RequestPlugin<IDirectoryServiceConnector>(); Classified c = DSC.GetClassifiedByID(bc.ClassifiedID); if (c != null) { if (m_money != null) { if (!m_money.Charge(c.CreatorUUID, c.PriceForListing, "Classified Charge -" + c.Name)) { bc.Tries += 1; if (m_TriesBeforeRemovingClassified >= bc.Tries) { c.ClassifiedFlags = (byte) (c.ClassifiedFlags & ~((int) DirectoryManager.ClassifiedFlags.Enabled)); IProfileConnector profile = DataManager.RequestPlugin<IProfileConnector>("IProfileConnector"); profile.AddClassified(c); m_scheduler.Remove(bc.ClassifiedID.ToString()); if (m_NotifyOnClassifiedRemoval) { NotifyClass(c, bc, "Removal"); } } else { SchedulerItem si = m_scheduler.Get(c.ClassifiedUUID.ToString()); si.FireParams = bc.ToOSD(); m_scheduler.Save(si); if (m_NotifyOnClassifiedFailure) { NotifyClass(c, bc, "Failure"); } } } else if (m_NotifyOnClassifiedSuccess) { NotifyClass(c, bc, "Success"); } } else MainConsole.Instance.Info("[ClassifiedsCollection] Could not find money module."); } else MainConsole.Instance.Info("[ClassifiedsCollection] Could not find classified, might have been deleted"); } catch (Exception ex) { MainConsole.Instance.Error("[ClassifiedsCollection] Error charging for classifieds", ex); } return ""; }
private void NotifyClass(Classified classified, BillingClassified billingClassified, string typeOfNotice) { string NotifycationString = ""; string NotifyTemplate = GetNotifyTemplate(typeOfNotice); if (NotifyTemplate == "") return; if (m_NotifyType == "Email") { IUserAccountService userService = m_registry.RequestModuleInterface<IUserAccountService>(); UserAccount user = userService.GetUserAccount(new UUID(), classified.CreatorUUID); if (user != null) { bool isHTML = (m_EmailFormat == "HTML"); NotifyTemplate = string.Format(NotifyTemplate, classified.Name, classified.PriceForListing, user.Name); Smtp.Send(user.Email, m_EmailFromAddress, string.Format(m_EmailSubjectClassified, typeOfNotice), NotifyTemplate, isHTML, "normal"); } else { MainConsole.Instance.Error("[ClassifiedsCollection] Classified user does not exist"); } } else { NotifyTemplate = string.Format(NotifyTemplate, classified.Name, classified.PriceForListing); SendIM(classified.CreatorUUID, NotifyTemplate); } }
private void NotifyClass(Classified classified, BillingClassified billingClassified, string typeOfNotice) { string NotifycationString = ""; string NotifyTemplate = GetNotifyTemplate(typeOfNotice); if (NotifyTemplate == "") return; if (m_NotifyType == "Email") { //switch (typeOfNotice) //{ // case "Removal": // return File.ReadAllText(m_EmailNotifyTemplateFileClassifiedRemoval); // case "Failure": // return File.ReadAllText(m_EmailNotifyTemplateFileClassifiedFailure); // case "Success": // return File.ReadAllText(m_EmailNotifyTemplateFileClassifiedSuccess); //} } else { switch (typeOfNotice) { //case "Removal": // return m_IMNotifyTemplateClassifiedRemoval; //case "Failure": // return m_IMNotifyTemplateClassifiedFailure; //case "Success": // return m_IMNotifyTemplateClassifiedSucess; } } }