public static MAG_ZamProdPoz InsertNagZamPoz(int _Zpp_zpnid, bool _Zpp_AlertTwr, int _Zpp_TwrGIDXL, int _Zpp_NR_POZ, string _Zpp_ID_ASO, string _Zpp_EAN, string _Zpp_NAZWA, decimal _Zpp_ILOSC_SZT
                                              , decimal _Zpp_ILOSC, string _Zpp_ID_JED, decimal?_Zpp_ILOSC_NZ, DateTime?_Zpp_DATA_NZ, decimal?_Zpp_CENA_NETTO, decimal?_Zpp_CENA_NETTO_RABAT
                                              , decimal?_Zpp_RABAT, int?_Zpp_UKRYJ_RABAT, int?_Zpp_WSK_GRATIS, int?_Zpp_WSK_PRM, int?_Zpp_ID_PRM_EBI, int?_Zpp_ID_PRM_DYS)
 {
     using (CDNXL_MAGEntities context = new CDNXL_MAGEntities(MAGConnectionString, true, true, false))
     {
         MAG_ZamProdPoz newElement = new MAG_ZamProdPoz()
         {
             Zpp_zpnid            = _Zpp_zpnid,
             Zpp_AlertTwr         = _Zpp_AlertTwr,
             Zpp_TwrGIDXL         = _Zpp_TwrGIDXL,
             Zpp_NR_POZ           = _Zpp_NR_POZ,
             Zpp_ID_ASO           = _Zpp_ID_ASO,
             Zpp_EAN              = _Zpp_EAN,
             Zpp_NAZWA            = _Zpp_NAZWA,
             Zpp_ILOSC_SZT        = _Zpp_ILOSC_SZT,
             Zpp_ILOSC            = _Zpp_ILOSC,
             Zpp_ID_JED           = _Zpp_ID_JED,
             Zpp_ILOSC_NZ         = _Zpp_ILOSC_NZ,
             Zpp_DATA_NZ          = _Zpp_DATA_NZ,
             Zpp_CENA_NETTO       = _Zpp_CENA_NETTO,
             Zpp_CENA_NETTO_RABAT = _Zpp_CENA_NETTO_RABAT,
             Zpp_RABAT            = _Zpp_RABAT,
             Zpp_UKRYJ_RABAT      = _Zpp_UKRYJ_RABAT,
             Zpp_WSK_GRATIS       = _Zpp_WSK_GRATIS,
             Zpp_WSK_PRM          = _Zpp_WSK_PRM,
             Zpp_ID_PRM_EBI       = _Zpp_ID_PRM_EBI,
             Zpp_ID_PRM_DYS       = _Zpp_ID_PRM_DYS
         };
         context.MAG_ZamProdPoz.Add(newElement);
         context.SaveChanges();
         return(newElement);
     }
 }
 public void WeryfikacjaZamowien()
 {
     using (var context = new CDNXL_MAGEntities(SQL.MAGConnectionString, true, true, false))
     {
         UpdateDocumentStatistics();
     }
 }
 public static Task <List <MAG_EBIZAM_Konfig> > ReturnConfig()
 {
     return(Task.Run(() =>
     {
         using (CDNXL_MAGEntities context = new CDNXL_MAGEntities(MAGConnectionString, true, true, false))
         {
             return context.MAG_EBIZAM_Konfig.Where(x => x.EZam_Archiwalny == false).ToList();
         }
     }));
 }
 public static void UpdateDocumentMailStatus(int id)
 {
     using (var context = new CDNXL_MAGEntities(MAGConnectionString, true, true, false))
     {
         try
         {
             context.Database.ExecuteSqlCommand(" UPDATE [CDN].[MAG_ZamProdNag] SET [Zpn_EmailSent]=1 where zpn_id=" + id.ToString());
         }
         catch (Exception ಠ_ಠ)
         {
         }
     }
 }
 public static void UpdateDocumentStatistics()
 {
     using (var context = new CDNXL_MAGEntities(MAGConnectionString, true, true, false))
     {
         try
         {
             context.Database.ExecuteSqlCommand("EXEC [CDN].[MAG_EDIZam_WeryfikacjaZamowien]");
         }
         catch (Exception ಠ_ಠ)
         {
         }
     }
 }
 public static MAG_ZamProdNag InsertNagZamNag(string _Zpn_nazwa_pliku, string _Zpn_Sciezka, string _Zpn_Producent, int _Zpn_Status, bool _Zpn_Alert, bool _Zpn_AlertKnt, int _Zpn_KntXL
                                              , string _Zpn_ZRODLO_CEL, string _Zpn_ID_MAG, string _Zpn_NR_ZAM, string _Zpn_ID_PRAC, string _Zpn_NAZWISKO, string _Zpn_IMIE, string _Zpn_ID_KLT
                                              , string _Zpn_NAZWA, string _Zpn_MIASTO, string _Zpn_ULICA, string _Zpn_NR_LOK, string _Zpn_NIP, string _Zpn_TYP_ZAM, DateTime _Zpn_DATA_ZAM
                                              , DateTime _Zpn_DATA_DOST, Decimal _Zpn_RABAT_ZAM, string _Zpn_UWAGI, int _Zpn_WSK_PRM, int _Zpn_ID_PRM_EBI, string _Zpn_NAZWA_PRM, int _Zpn_EmailSent, DateTime filedate)
 {
     using (CDNXL_MAGEntities context = new CDNXL_MAGEntities(MAGConnectionString, true, true, false))
     {
         MAG_ZamProdNag newElement = new MAG_ZamProdNag()
         {
             Zpn_nazwa_pliku = _Zpn_nazwa_pliku,
             Zpn_Sciezka     = _Zpn_Sciezka,
             Zpn_Producent   = _Zpn_Producent,
             Zpn_Status      = _Zpn_Status,
             Zpn_Alert       = _Zpn_Alert,
             Zpn_AlertKnt    = _Zpn_AlertKnt,
             Zpn_KntXL       = _Zpn_KntXL,
             Zpn_ZRODLO_CEL  = _Zpn_ZRODLO_CEL,
             Zpn_ID_MAG      = _Zpn_ID_MAG,
             Zpn_NR_ZAM      = _Zpn_NR_ZAM,
             Zpn_ID_PRAC     = _Zpn_ID_PRAC,
             Zpn_NAZWISKO    = _Zpn_NAZWISKO,
             Zpn_IMIE        = _Zpn_IMIE,
             Zpn_ID_KLT      = _Zpn_ID_KLT,
             Zpn_NAZWA       = _Zpn_NAZWA,
             Zpn_MIASTO      = _Zpn_MIASTO,
             Zpn_ULICA       = _Zpn_ULICA,
             Zpn_NR_LOK      = _Zpn_NR_LOK,
             Zpn_NIP         = _Zpn_NIP,
             Zpn_TYP_ZAM     = _Zpn_TYP_ZAM,
             Zpn_DATA_ZAM    = _Zpn_DATA_ZAM,
             Zpn_DATA_DOST   = _Zpn_DATA_DOST,
             Zpn_RABAT_ZAM   = _Zpn_RABAT_ZAM,
             Zpn_UWAGI       = _Zpn_UWAGI,
             Zpn_WSK_PRM     = _Zpn_WSK_PRM,
             Zpn_ID_PRM_EBI  = _Zpn_ID_PRM_EBI,
             Zpn_NAZWA_PRM   = _Zpn_NAZWA_PRM,
             Zpn_EmailSent   = _Zpn_EmailSent,
             Zpn_DataPliku   = filedate
         };
         context.MAG_ZamProdNag.Add(newElement);
         context.SaveChanges();
         return(newElement);
     }
 }