/// <summary>
        /// Guarda la ultima actualización sobre el customer
        /// </summary>
        /// <param name="customer">codigo de cliente</param>
        /// <returns></returns>
        public int Customer_UpdateLastUpdate(ST_CLIENT_TABLE_SYNC customer)
        {
            var contexto = new ATLANEntities();
            int updated;

            try
            {
                var customerORI = contexto.ST_CLIENT_TABLE_SYNC.Find(customer.CUSTNMBR);
                //customerORI.LAST_GP_UPDATE = DateTime.Now;


                if (customerORI != null)
                {
                    contexto.ST_CLIENT_TABLE_SYNC.Attach(customerORI);
                    contexto.Entry(customerORI).State = System.Data.Entity.EntityState.Modified;
                    contexto.Entry(customerORI).Property(x => x.LAST_GP_UPDATE).IsModified = true;
                    updated = contexto.SaveChanges();
                    log.escribirLog(0, "Customer Actualizado " + customer.CUSTNMBR);
                }
                else
                {
                    customerORI                = new ST_CLIENT_TABLE_SYNC();
                    customerORI.CUSTNMBR       = customer.CUSTNMBR;
                    customerORI.LAST_GP_UPDATE = DateTime.Now;
                    contexto.ST_CLIENT_TABLE_SYNC.Add(customerORI);
                    updated = contexto.SaveChanges();
                    log.escribirLog(0, "Customer Agregado " + customer.CUSTNMBR);
                }

                return(updated);
            }
            catch (EntityException ex)
            {
                log.LogExeption("Ocurrió un error: EntityException ", 2, ex);
                throw;
            }
            catch (Exception ex)
            {
                log.LogExeption("Ocurrió un error: Exception", 2, ex);
                throw;
            }
            finally
            {
                contexto.Dispose();
            }
        }
Exemple #2
0
        public void DeleteExistingRenewDistributionNC(string ncnumber)
        {
            var context = new ATLANEntities();

            try
            {
                var deletelist = (from renew in context.ST_SYSFLEX_POLICY_RENEW_NC
                                  where renew.NCNUMBER == ncnumber.Trim()
                                  select renew).ToList();

                context.ST_SYSFLEX_POLICY_RENEW_NC.RemoveRange(deletelist);

                context.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemple #3
0
        public void SaveRenewDistribution(DateTime INITIAL_DATE, TRANSACTION_INVOICE transaction, RMClass.RMTransactionDist[] DistributionList)
        {
            var contexto = new ATLANEntities();

            try
            {
                foreach (RMClass.RMTransactionDist item in DistributionList)
                {
                    var distrib = new ST_SYSFLEX_POLICY_RENEW_NC();

                    distrib.INITIAL_DATE    = INITIAL_DATE;
                    distrib.TRANSACTION_SEQ = transaction.TRANSACTION_SEQUENCE.GetValueOrDefault();
                    distrib.DOCUMENT_NUMBER = Convert.ToDecimal(transaction.DOCUMENT_NUMBER);
                    distrib.CUSTNMBR        = item.CUSTNMBR;
                    distrib.NCNUMBER        = item.DOCNUMBR;
                    distrib.DISTTYPE        = item.DISTTYPE;
                    distrib.DistRef         = item.DistRef;
                    distrib.ACTNUMST        = item.ACTNUMST;
                    distrib.DEBITAMT        = item.DEBITAMT.GetValueOrDefault();
                    distrib.CRDTAMNT        = item.CRDTAMNT.GetValueOrDefault();
                    distrib.CREATE_DATE     = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                    distrib.PROCESS         = false;

                    contexto.ST_SYSFLEX_POLICY_RENEW_NC.Add(distrib);

                    contexto.SaveChanges();
                }
            }
            catch (EntityException ex)
            {
                log.LogExeption("Ocurrió un error: ", 2, ex);
                throw;
            }
            catch (Exception ex)
            {
                log.LogExeption("Ocurrió un error: ", 2, ex);
                throw;
            }
            finally
            {
                contexto.Dispose();
            }
        }
Exemple #4
0
        public void DeleteExistingRenewDistribution(string sopnumbe)
        {
            var context = new ATLANEntities();

            try
            {
                var deletelist = (from renew in context.ST_SYSFLEX_POLICY_RENEW
                                  where renew.SOPNUMBE == sopnumbe.Trim()
                                  select renew).ToList();

                context.ST_SYSFLEX_POLICY_RENEW.RemoveRange(deletelist);

                context.SaveChanges();
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                context.Dispose();
            }
        }