Exemple #1
0
        public void StoreCallBackResponse(CallBackResponse callBack)
        {
            try
            {
                using (DigitalInvoiceEntities context = new DigitalInvoiceEntities())
                {
                    context.CallBackReceived.Add(new CallBackReceived()
                    {
                        IdCallBack    = Guid.NewGuid().ToString(),
                        clave         = callBack.clave,
                        fecha         = callBack.fecha,
                        indEstado     = callBack.indEstado,
                        respuestaXml  = callBack.respuestaXml,
                        callBackUrl   = callBack.callbackUrl,
                        fechaCallBack = DateTime.Now
                    });

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }
        }
        public void UpdateRequestRecord(RequestRecord requestRecord)
        {
            RequestRecord record;

            try
            {
                using (DigitalInvoiceEntities context = new DigitalInvoiceEntities())
                {
                    record = (from rr in context.RequestRecord
                              where rr.clave.Equals(requestRecord.clave) && rr.callBackReceived == false
                              select rr).FirstOrDefault();

                    if (record != null)
                    {
                        record.docDatetime       = requestRecord.docDatetime;
                        record.indState          = requestRecord.indState;
                        record.responseXML       = requestRecord.responseXML;
                        record.callBacakDatetime = requestRecord.callBacakDatetime;
                        record.callBackReceived  = true;
                        context.SaveChanges();
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Exemple #3
0
        public bool DeleteAccount(string id)
        {
            bool    response = false;
            Account account  = null;

            try
            {
                using (DigitalInvoiceEntities context = new DigitalInvoiceEntities())
                {
                    account = (from a in context.Account
                               where a.accountId.Equals(id)
                               select a).FirstOrDefault();

                    if (account != null)
                    {
                        account.enabled = false;
                        context.SaveChanges();
                    }
                    else
                    {
                        throw new Exception("Account profile can't be deleted");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(response);
        }
Exemple #4
0
        public Account UpsertAccount(Account account)
        {
            Account selectedAccount = null;

            try
            {
                using (DigitalInvoiceEntities context = new DigitalInvoiceEntities())
                {
                    selectedAccount = (from a in context.Account
                                       where a.accountId.Equals(account.accountId)
                                       select a).FirstOrDefault();

                    if (selectedAccount == null)
                    {
                        account.accountId = Guid.NewGuid().ToString();
                        account.enabled   = true;
                        context.Account.Add(account);
                        selectedAccount = account;
                    }
                    else
                    {
                        selectedAccount.certificate     = account.certificate;
                        selectedAccount.certificatePIN  = account.certificatePIN;
                        selectedAccount.certificateExt  = account.certificateExt;
                        selectedAccount.userATV         = account.userATV;
                        selectedAccount.passwordATV     = account.passwordATV;
                        selectedAccount.certificateName = account.certificateName;
                        selectedAccount.logoImage       = account.logoImage;
                    }

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(selectedAccount);
        }
Exemple #5
0
        public static void RegisterCallBackFailToDataBase(string request)
        {
            try
            {
                using (DigitalInvoiceEntities context = new DigitalInvoiceEntities())
                {
                    LogRequest logRequest = new LogRequest()
                    {
                        Id      = Guid.NewGuid().ToString(),
                        Request = request,
                        LogDate = DateTime.Now
                    };

                    context.LogRequest.Add(logRequest);
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public void RegisterRequestRecord(string clave, string accountId, string state)
        {
            try
            {
                RequestRecord newRecord = new RequestRecord()
                {
                    clave        = clave,
                    accountId    = accountId,
                    requestState = state,
                    sentDatetime = DateTime.Now
                };

                using (DigitalInvoiceEntities context = new DigitalInvoiceEntities())
                {
                    context.RequestRecord.Add(newRecord);
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ex.Message.ToString();
            }
        }