DeleteMySqlDataService.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Linq;
  3. using MySystem.Models;
  4. using Library;
  5. namespace MySystem
  6. {
  7. public class DeleteMySqlDataService
  8. {
  9. public readonly static DeleteMySqlDataService Instance = new DeleteMySqlDataService();
  10. private DeleteMySqlDataService()
  11. { }
  12. public void Start(string TableString)
  13. {
  14. WebCMSEntities db = new WebCMSEntities();
  15. try
  16. {
  17. string[] data = TableString.Split(':');
  18. int Id = int.Parse(function.CheckInt(data[1]));
  19. string Table = data[0];
  20. dbconn.op("delete from " + Table + " where Id=" + Id);
  21. OtherMySqlConn.connstr = Library.ConfigurationManager.AppSettings["SqlConnStr"].ToString();
  22. OtherMySqlConn.op("delete from " + Table + " where Id=" + Id);
  23. // OtherMySqlConn.connstr = ;
  24. }
  25. catch (Exception ex)
  26. {
  27. ErrorMsg msg = new ErrorMsg();
  28. msg.Time = DateTime.Now;
  29. msg.ErrorContent = ex.ToString();
  30. LogHelper.Instance.WriteLog(Newtonsoft.Json.JsonConvert.SerializeObject(msg), "Pop:MerchantInfo:Error");
  31. }
  32. db.Dispose();
  33. }
  34. }
  35. }