Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.68 KB | None | 0 0
  1. using cpcit.framework.Database;
  2. using cpcit.framework.Helpers;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.Data;
  7. using System.Data.SqlClient;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11.  
  12. namespace cpcit.services.dynamiccode.tables.HC.ITRH_FORMULA
  13. {
  14.     public static class BeforeInsert
  15.     {
  16.         public static string Run(string Tenant, object[] Params, SqlCommand SQLCommand)
  17.         {
  18.             return "";
  19.         }
  20.     }
  21.  
  22.     public static class BeforeUpdate
  23.     {
  24.         public static string Run(string Tenant, object[] Params, SqlCommand SQLCommand)
  25.         {
  26.  
  27.             return "";
  28.         }
  29.     }
  30.  
  31.     public static class BeforeDelete
  32.     {
  33.         public static void Run(string Tenant, SqlCommand sqlCommand)
  34.         {
  35.             Hashtable hashParams = PageHelper.ParametersToHastable(sqlCommand.Parameters);
  36.  
  37.             string code = hashParams["Code"].ToString();
  38.  
  39.             WcfTable tableMovimento = new WcfTable(Tenant, "ITRH_MOVIMENTO");
  40.             DataTable dt = tableMovimento.GetList("Code", new object[] { "FORMULA_ID", code }, "", sqlCommand.Transaction);
  41.  
  42.  
  43.             if (dt.Rows.Count > 0)
  44.             {
  45.                 throw new Exception("Esta Formula Contem Movimentos!");
  46.             }
  47.         }
  48.     }
  49.  
  50.     public class AfterDelete
  51.     {
  52.         public static string Run(string Tenant, object[] Params, SqlCommand SQLCommand)
  53.         {
  54.             Hashtable hashParams = PageHelper.ParamsToHashtable(Params);
  55.  
  56.             string code = hashParams["Code"].ToString();
  57.  
  58.  
  59.             WcfTable tableFormulasDetalhes = new WcfTable(Tenant, "ITRH_FORMULA_DETALHE");
  60.             DataTable dt = tableFormulasDetalhes.GetList("Entry No", new object[] { "FORMULA Code", code }, "", SQLCommand.Transaction);
  61.  
  62.             foreach (DataRow row in dt.Rows)
  63.             {
  64.                 tableFormulasDetalhes.Delete(new object[]{
  65.                     "Original_Entry No",row["Entry No"],
  66.                     "Identity.Name",""
  67.                 }, SQLCommand.Transaction);
  68.             }
  69.  
  70.             return "";
  71.         }
  72.  
  73.     }
  74.  
  75.     public static class AfterInsert
  76.     {
  77.         public static string Run(string Tenant, object[] Params, SqlCommand SQLCommand)
  78.         {
  79.             return "";
  80.         }
  81.     }
  82.  
  83.     public static class AfterUpdate
  84.     {
  85.         public static string Run(string Tenant, object[] Params, SqlCommand SQLCommand)
  86.         {
  87.             return "";
  88.         }
  89.     }
  90.  
  91.  
  92.     public static class VerifyRecord
  93.     {
  94.         public static void Run(string Tenant, Boolean inserting, DataRow row, SqlCommand sqlCommand)
  95.         {
  96.  
  97.         }
  98.     }
  99. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement