public void SendRelatedNew(VfsCustomerService.Entities.Customer customer) { var service = new SBSGatewaySoapClient(); if(customer.CustomerId == "094P848586") return; service.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://Svr-06/SBSGateway/SBSGateway.asmx"); PorscheCustomer porscheCustomer = new PorscheCustomer(); porscheCustomer.CustomerId = customer.CustomerId; CustomerInquiryData customerData = service.CustomerInquiry (porscheCredentials, porscheCustomer, GetCustomerType.None.ToString(), CustomerStockInquiryType.Normal.ToString(), CustomerAmountInquiryType.Full.ToString()); if (customerData.ErrorCode != SbsErrorCode.None) { //throw new Exception(customerData.Message); Ultility.Info(customer.CustomerId + ": " + customerData.Message); } else { //dataGridView1.DataSource = customerData.StockItems; CustomerStockInquiryObject[] customerInquiryData; if (customerData != null) { customerInquiryData = customerData.StockItems; string content = string.Empty; string contentSms = string.Empty; int templateID = Convert.ToInt32(ConfigurationManager.AppSettings["RelatedMessageTemplateID"]); int templateIDSms = Convert.ToInt32(ConfigurationManager.AppSettings["RelatedSmsMessageTemplateID"]); int smsCount = 0; int total; foreach (CustomerStockInquiryObject obj in customerInquiryData) { stock_NewCollection stockNewsCollection = stock_NewService.Getstock_NewList(obj.StockCode, customer.CustomerId, stock_NewColumns.NewsID, "DESC", 1, 3, out total); Vfs.WebCrawler.Destination.Entities.RelatedMessagelogCollection relatedMessagelogColl = new Vfs.WebCrawler.Destination.Entities.RelatedMessagelogCollection(); smsCount = 0; foreach (stock_New stock_new in stockNewsCollection) { content += "<a href=\"www.vfs.com.vn/News.aspx?newsid=\"" + stock_new.NewsID.ToString() + "&group=" + SetNewsGroupName(stock_new.NewsID) + "\" >" + stock_new.NewsTitle.Normalize() + "</a> <br/>"; if (smsCount == 0) { if (contentSms == string.Empty) contentSms += "(" + Ultility.RemoveSound(stock_new.NewsTitle.Normalize()) + "-www.vfs.com.vn/News.aspx?newsid=" + stock_new.NewsID.ToString() + "&group=" + SetNewsGroupName(stock_new.NewsID) + ")"; else contentSms += ";(" + Ultility.RemoveSound(stock_new.NewsTitle.Normalize()) + "-www.vfs.com.vn/News.aspx?newsid=" + stock_new.NewsID.ToString() + "&group=" + SetNewsGroupName(stock_new.NewsID) + ")"; } smsCount++; Vfs.WebCrawler.Destination.Entities.RelatedMessagelog relatedMessagelog = new Vfs.WebCrawler.Destination.Entities.RelatedMessagelog(); relatedMessagelog.NewsID = stock_new.NewsID; relatedMessagelogColl.Add(relatedMessagelog); } //create messsages to be sent ContentTemplate contentTemplate = ContentTemplateService.GetContentTemplate(templateID); ContentTemplate contentTemplateSms = ContentTemplateService.GetContentTemplate(templateIDSms); VfsCustomerService.Business.ImportService.CreateMessage(customer, content, contentSms, contentTemplate, contentTemplateSms); foreach (Vfs.WebCrawler.Destination.Entities.RelatedMessagelog relatedMessagelog in relatedMessagelogColl) { Vfs.WebCrawler.Destination.Business.RelatedMessagelogService.CreateRelatedMessagelog(relatedMessagelog); } } } } }
public void SendPorfolioSmsMessage(VfsCustomerService.Entities.Customer customer) { var service = new SBSGatewaySoapClient(); if(customer.CustomerId == "094P848586") return; service.Endpoint.Address = new System.ServiceModel.EndpointAddress(endPointAddress); PorscheCustomer porscheCustomer = new PorscheCustomer(); porscheCustomer.CustomerId = customer.CustomerId; ClientParam clientParam = new ClientParam(); CustomerInquiryData customerData = service.CustomerInquiry (porscheCredentials, porscheCustomer, GetCustomerType.None.ToString(), CustomerStockInquiryType.Normal.ToString(), CustomerAmountInquiryType.Full.ToString()); if (customerData.ErrorCode != SbsErrorCode.None) { //throw new Exception(customerData.Message); Ultility.Info(customer.CustomerId + ": " + customerData.Message); } else { Ultility.Info(customer.CustomerId + ": " + customer.CustomerId); //dataGridView1.DataSource = customerData.StockItems; CustomerStockInquiryObject[] customerInquiryData; if (customerData != null) { ExtensionMessageCollection extensionMessageCollection = new ExtensionMessageCollection(); ExtensionMessageLog relatedMessagelog; ExtensionMessageLogCollection relatedMessagelogColl = new ExtensionMessageLogCollection(); customerInquiryData = customerData.StockItems; StringBuilder content = new StringBuilder(); string contentSms = string.Empty; int smsCount = 0; int total; Boolean sentYn = false; smsCount = 0; foreach (CustomerStockInquiryObject obj in customerInquiryData) { Ultility.Info(customer.CustomerId + ": " + obj.StockCode); extensionMessageCollection = ExtensionMessageService.GetExtensionMessageListByTitle(obj.StockCode, customer.CustomerId, ExtensionMessageColumns.ExtensionMessageID, "DESC", 1, 5, out total); if (extensionMessageCollection.Count > 0) sentYn = true; foreach (ExtensionMessage extMessage in extensionMessageCollection) { if (smsCount == 0) { if (contentSms == string.Empty) contentSms += Ultility.RemoveSound(extMessage.Content.Normalize()) ; else contentSms += ";" + Ultility.RemoveSound(extMessage.Content.Normalize()) + ""; } smsCount++; relatedMessagelog = new ExtensionMessageLog(); relatedMessagelog.ExtensionMessageID = extMessage.ExtensionMessageID; relatedMessagelog.CustomerId = customer.CustomerId; relatedMessagelogColl.Add(relatedMessagelog); } } //create messsages to be sent if (sentYn) { //ContentTemplate contentTemplate = ContentTemplateService.GetContentTemplate(templateID); ContentTemplate contentTemplateSms = ContentTemplateService.GetContentTemplate(porfolioSmsMessageTemplateID); VfsCustomerService.Business.ImportService.CreateMessage(customer, contentSms, contentTemplateSms); foreach (ExtensionMessageLog relatedMsglog in relatedMessagelogColl) { ExtensionMessageLogService.CreateExtensionMessageLog(relatedMsglog); } } } } }
public static void SendRelatedNew(VfsCustomerService.Entities.Customer customer) { PorscheCredentials porscheCredentials = GetCrendentials("SBSSystem", "VSSD", "vssd", "123"); var service = new SBSGatewaySoapClient(); service.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://Svr_06/SBSGateway/SBSGateway.asmx"); ClientParam clientParam = new ClientParam(); clientParam.FromDate = new DateTime(2000, 01, 01); clientParam.ToDate = DateTime.Now; clientParam.TransactionDate = DateTime.Now; clientParam.LanguageCode = "vi_VN"; CustomerData customerData01 = service.DoCustomerWithAction(porscheCredentials, clientParam, null, "List"); //(GetCustomerBTP(porscheCredentials, clientParam); UnitTest.SBSWebService. CustomerInquiryData customerData = service.CustomerInquiry (porscheCredentials, new PorscheCustomer { CustomerId = customer.CustomerId }, GetCustomerType.None.ToString(), CustomerStockInquiryType.Normal.ToString(), CustomerAmountInquiryType.Full.ToString()); if (customerData.ErrorCode != SbsErrorCode.None) { throw new Exception(customerData.Message); } else { //dataGridView1.DataSource = customerData.StockItems; CustomerStockInquiryObject[] customerInquiryData; if (customerData != null) { customerInquiryData = customerData.StockItems; string content = string.Empty; string contentSms = string.Empty; int templateID = Convert.ToInt32(ConfigurationManager.AppSettings["RelatedMessageTemplateID"]); int templateIDSms = Convert.ToInt32(ConfigurationManager.AppSettings["RelatedSmsMessageTemplateID"]); int smsCount = 0; //foreach (CustomerStockInquiryObject obj in customerInquiryData) //{ // stock_NewCollection stockNewsCollection = stock_NewService.Getstock_NewList(obj.StockCode, stock_NewColumns.NewsID, "DESC"); // smsCount = 0; // foreach (stock_New stock_new in stockNewsCollection) // { // content += "<a href=\"www.vfs.com.vn/News.aspx?newsid=\"" + stock_new.NewsID.ToString() + "&group=" + SetNewsGroupName(stock_new.NewsID) + "\" >" + stock_new.NewsTitle.Normalize() + "</a> <br/>"; // if (smsCount == 0) // { // if (contentSms == string.Empty) // contentSms += "(" + RemoveSound(stock_new.NewsTitle.Normalize()) + "-www.vfs.com.vn/News.aspx?newsid=" + stock_new.NewsID.ToString() + "&group=" + SetNewsGroupName(stock_new.NewsID) + ")"; // else // contentSms += ";(" + RemoveSound(stock_new.NewsTitle.Normalize()) + "-www.vfs.com.vn/News.aspx?newsid=" + stock_new.NewsID.ToString() + "&group=" + SetNewsGroupName(stock_new.NewsID) + ")"; // } // smsCount++; // RelatedMessagelog relatedMessagelog = new RelatedMessagelog(); // relatedMessagelog.NewsID = stock_new.NewsID; // VfsCustomerService.Business.RelatedMessagelogService.CreateRelatedMessagelog(relatedMessagelog); // } // //create messsages to be sent // ContentTemplate contentTemplate = ContentTemplateService.GetContentTemplate(templateID); // ContentTemplate contentTemplateSms = ContentTemplateService.GetContentTemplate(templateIDSms); // VfsCustomerService.Business.ImportService.CreateMessage(customer, content, contentSms, contentTemplate, contentTemplateSms); //} } } }
public void SendRelatedNew(VfsCustomerService.Entities.Customer customer) { var service = new SBSGatewaySoapClient(); if(customer.CustomerId == "094P848586") return; service.Endpoint.Address = new System.ServiceModel.EndpointAddress(endPointAddress); PorscheCustomer porscheCustomer = new PorscheCustomer(); porscheCustomer.CustomerId = customer.CustomerId; ClientParam clientParam = new ClientParam(); CustomerInquiryData customerData = service.CustomerInquiry (porscheCredentials, porscheCustomer, GetCustomerType.None.ToString(), CustomerStockInquiryType.Normal.ToString(), CustomerAmountInquiryType.Full.ToString()); if (customerData.ErrorCode != SbsErrorCode.None) { //throw new Exception(customerData.Message); Ultility.Info(customer.CustomerId + ": " + customerData.Message); } else { Ultility.Info(customer.CustomerId + ": " + customer.CustomerId); //dataGridView1.DataSource = customerData.StockItems; CustomerStockInquiryObject[] customerInquiryData; if (customerData != null) { stock_NewCollection stockNewsCollection = new stock_NewCollection(); Vfs.WebCrawler.Destination.Entities.RelatedMessagelog relatedMessagelog; Vfs.WebCrawler.Destination.Entities.RelatedMessagelogCollection relatedMessagelogColl = new Vfs.WebCrawler.Destination.Entities.RelatedMessagelogCollection(); customerInquiryData = customerData.StockItems; StringBuilder content = new StringBuilder(); string contentSms = string.Empty; int smsCount = 0; int total; Boolean sentYn = false; smsCount = 0; content.Append("<table>"); foreach (CustomerStockInquiryObject obj in customerInquiryData) { Ultility.Info(customer.CustomerId + ": " + obj.StockCode); stockNewsCollection = stock_NewService.Getstock_NewList(obj.StockCode, customer.CustomerId , stock_NewColumns.NewsID, "DESC", 1, 3, out total); if (stockNewsCollection.Count > 0) sentYn = true; foreach (stock_New stock_new in stockNewsCollection) { content.Append("<tr style=\"height:28px\">"); content.Append("<td style=\"background-color:#FFCC00;font-weight:bold;width:40px; heigh:25px; text-align:left; font:Tahoma;\">" + obj.StockCode + "</td>"); content.Append("<td style=\"background-color:#F5F5F5;text-align:left;font:Tahoma;\"><a style=\"cursor:pointer; text-decoration:none;font:Tahoma;color:#000000;\" href=\"http://www.vfs.com.vn/News.aspx?newsid=" + stock_new.NewsID.ToString() + "&group=" + SetNewsGroupName(stock_new.NewsID) + "\"" + ">" + (stock_new.NewsTitle.Normalize().IndexOf(':') == 3 ? stock_new.NewsTitle.Normalize().Substring(4) : stock_new.NewsTitle.Normalize().Substring(3)) + "</a></td>"); content.Append("</tr>"); if (smsCount == 0) { if (contentSms == string.Empty) contentSms += "(" + Ultility.RemoveSound(stock_new.NewsTitle.Normalize()) + ")"; else contentSms += ";(" + Ultility.RemoveSound(stock_new.NewsTitle.Normalize()) + ")"; } smsCount++; relatedMessagelog = new Vfs.WebCrawler.Destination.Entities.RelatedMessagelog(); relatedMessagelog.NewsID = stock_new.NewsID; relatedMessagelog.CustomerID = customer.CustomerId; relatedMessagelogColl.Add(relatedMessagelog); } } content.Append("</table>"); //create messsages to be sent if (sentYn) { ContentTemplate contentTemplate = ContentTemplateService.GetContentTemplate(templateID); ContentTemplate contentTemplateSms = ContentTemplateService.GetContentTemplate(templateIDSms); VfsCustomerService.Business.ImportService.CreateMessage(customer, content.ToString(), contentSms, contentTemplate, contentTemplateSms); foreach (Vfs.WebCrawler.Destination.Entities.RelatedMessagelog relatedMsglog in relatedMessagelogColl) { Vfs.WebCrawler.Destination.Business.RelatedMessagelogService.CreateRelatedMessagelog(relatedMsglog); } } } } }
public static void LoginWs() { PorscheCredentials objCredentials = new PorscheCredentials(); objCredentials.GatewayPassword = "******"; objCredentials.GatewayUsername = "******"; SBSGatewaySoapClient objClient = new SBSGatewaySoapClient(); objClient.Login("SBSSystem", "123456"); }