/// <summary> /// Update Company /// </summary> /// <param name="company"></param> /// <returns></returns> public int UpdateClient(Companies company) { using (ClientParam <Companies> c = new ClientParam <Companies>(_file)) { var result = c.UpdateCompany(company); //c.Commit(); return(result); } }
private void Authenticate(String userid, String password, bool UseCompression) { ClientParam clientParam = ClientParam.CLIENT_FOUND_ROWS | ClientParam.CLIENT_LONG_FLAG; if ((serverCaps & (int)ClientParam.CLIENT_COMPRESS) != 0 && UseCompression) { clientParam |= ClientParam.CLIENT_COMPRESS; } clientParam |= ClientParam.CLIENT_LONG_PASSWORD; clientParam |= ClientParam.CLIENT_LOCAL_FILES; // if (serverVersion.isAtLeast(4,1,0)) // clientParam |= ClientParam.CLIENT_PROTOCOL_41; // if ( (serverCaps & (int)ClientParam.CLIENT_SECURE_CONNECTION ) != 0 && password.Length > 0 ) // clientParam |= ClientParam.CLIENT_SECURE_CONNECTION; int packetLength = userid.Length + 16 + 6 + 4; // Passwords can be 16 chars long Packet packet = CreatePacket(null); if ((clientParam & ClientParam.CLIENT_PROTOCOL_41) != 0) { packet.WriteInteger((int)clientParam, 4); packet.WriteInteger((256 * 256 * 256) - 1, 4); } else { packet.WriteInteger((int)clientParam, 2); packet.WriteInteger(255 * 255 * 255, 3); } packet.WriteString(userid, encoding); if ((clientParam & ClientParam.CLIENT_SECURE_CONNECTION) != 0) { // use the new authentication system AuthenticateSecurely(packet, password); } else { // use old authentication system packet.WriteString(EncryptPassword(password, encryptionSeed, protocol > 9), encoding); // pad zeros out to packetLength for auth for (int i = 0; i < (packetLength - packet.Length); i++) { packet.WriteByte(0); } SendPacket(packet); } packet = ReadPacket(); if ((clientParam & ClientParam.CLIENT_COMPRESS) != 0) { useCompression = true; } }
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); } } } } }
/// <summary> /// Get all companies /// </summary> /// <returns></returns> public IQueryable <Companies> GetClient() { ClientParam <Companies> c = new ClientParam <Companies>(_file); return(c.GetClientParams()); }
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 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); //} } } }