Beispiel #1
0
 public void removeProduct(string productID, string trID, string clientID)
 {
     try
     {
         if (productID != "")
         {
             int pro_id = Convert.ToInt32(productID);
             MySQLBusinessLogic bl = new MySQLBusinessLogic();
             if (bl.RemoveProduct(pro_id))
             {
                 DataTable dt = new DataTable();
                 dt = bl.GetProductImagePaths(pro_id, 0);
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
                     if (File.Exists(dt.Rows[i].ItemArray[2].ToString()))
                         File.Delete(dt.Rows[i].ItemArray[2].ToString());
                     if (File.Exists(dt.Rows[i].ItemArray[1].ToString()))
                         File.Delete(dt.Rows[i].ItemArray[1].ToString());
                 }
                 Clients.Client(clientID).removedProduct("1", trID);
             }
             else
             {
                 Clients.Client(clientID).removedProduct("0", trID);
             }
         }
     }
     catch (Exception ex)
     {
         Clients.Client(clientID).removedProduct("0", trID);
     }
 }