Ejemplo n.º 1
0
        protected void btnNewPayment_Click(object sender, EventArgs e)
        {
            //Validate Page
            Page.Validate("NewPayment");

            if (Page.IsValid)
            {
                try
                {
                    MembershipUser = (MembershipUser)Session["MembershipUser"];
                    UserData       = (user)Session["UserData"];

                    payment MyPayment = new payment();

                    user UpdateUser = UserService.GetUserByMemberId(Convert.ToInt32(Membership.GetUser().ProviderUserKey.ToString()));

                    // MyPayment.hours = Convert.ToInt32(item_name.Substring(0, 2));
                    //MyPayment.transaction_date = UTCTransDate;
                    // MyPayment.username = option_selection1;
                    MyPayment.update_user = Membership.GetUser().UserName;
                    // MyPayment.user_id = Convert.ToInt32(option_selection2);
                    MyPayment.item_name          = txtHours.Text + "Hours";
                    MyPayment.payer_email        = PaypalEmail.Text;
                    MyPayment.transaction_id     = TxnId.Text;
                    MyPayment.transaction_status = "Completed";

                    //payment MyPayment = new payment();

                    MyPayment.hours            = Convert.ToInt32(txtHours.Text);
                    MyPayment.transaction_date = App_Code.TimeService.ConvertToUTC(Convert.ToDateTime(TransDate.Value), UserData);
                    MyPayment.username         = MembershipUser.UserName;
                    MyPayment.user_id          = UserData.user_id;

                    App_Code.PaymentService.SaveObject(MyPayment);

                    BindPayments();

                    App_Code.NotificationService.SendNotification("PaymentSuccess", "Payment Sucessfully Added", "success", "4000");

                    txtHours.Text    = "";
                    TransDate.Value  = "";
                    TxnId.Text       = "";
                    PaypalEmail.Text = "";

                    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "SetTransdate", "SetFirstClass();", true);
                }
                catch (Exception ex)
                {
                    App_Code.NotificationService.SendNotification("NewPaymentError", ex.Message, "error", "4000");
                }
            }
            else
            {
                App_Code.NotificationService.SendNotification("NewAccountValidation", "Please complete the required fields", "error", "4000");
            }
        }
Ejemplo n.º 2
0
        public ReturnPagamentoDTO PagamentoCartaoCredito(string cardtoken, string IdUser, string emailUser, string ValorFrete, int tipoFrete, CondicoesParcelamento condicoesParcelamento)
        {
            payment payment = GetPayment(IdUser, emailUser, cardtoken, ValorFrete, tipoFrete, condicoesParcelamento, MeioPagamentoEnum.creditCard, null);

            var URLBase = GlobalConfiguration.CARTAODECREDITO.Replace("{{email}}", GlobalConfiguration.Email).Replace("{{token}}", GlobalConfiguration.TokenSandBox);

            var retorno = ExecutePOSTWebAPI(URLBase, payment);

            return(retorno);
        }
Ejemplo n.º 3
0
        public ReturnPagamentoDTO PagamentoBoleto(string token, string email, string cardToken, string IdUser, string emailUser, string ValorFrete, int tipoFrete)
        {
            payment payment = GetPayment(IdUser, emailUser, cardToken, ValorFrete, tipoFrete, null, MeioPagamentoEnum.boleto, null);

            var URLBase = GlobalConfiguration.CARTAODECREDITO.Replace("{{email}}", email).Replace("{{token}}", token);

            var retorno = ExecutePOSTWebAPI(URLBase, payment);

            return(retorno);
        }
Ejemplo n.º 4
0
        public ActionResult PaymentAdd(payment p)
        {
            models.payments.Add(p);
            user user = models.users.FirstOrDefault(x => x.username == User.Identity.Name);

            user.payment_id = p.payment_id;
            models.SaveChanges();

            return(RedirectToAction("Index", "ProfilUser"));
        }
Ejemplo n.º 5
0
        public ActionResult PaymentDelete(int id)
        {
            payment payment = models.payments.FirstOrDefault(x => x.payment_id == id);
            user    user    = models.users.FirstOrDefault(x => x.username == User.Identity.Name);

            user.payment_id = null;
            models.payments.Remove(payment);
            models.SaveChanges();
            return(RedirectToAction("Index", "ProfilUser"));
        }
Ejemplo n.º 6
0
 public ActionResult Edit([Bind(Include = "id,paymentType,isActive,createdAT")] payment payment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(payment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(payment));
 }
Ejemplo n.º 7
0
        private void toolBar_btnEdit_Click(object sender)
        {
            payment payment = payment_detailReceive.View.CurrentItem as payment;

            payment.State = EntityState.Modified;
            cntrl.Curd.PaymentEdit PaymentEdit = new cntrl.Curd.PaymentEdit(cntrl.Curd.PaymentEdit.Modes.Recievable, payment, PaymentDB);

            crud_modal.Visibility = System.Windows.Visibility.Visible;
            crud_modal.Children.Add(PaymentEdit);
        }
Ejemplo n.º 8
0
        private void SaveChanges()
        {
            paymentpayment_detailViewSource.View.Refresh();
            payment payment = paymentViewSource.View.CurrentItem as payment;

            //entity.Brillo.Logic.AccountReceivable AccountReceivable = new entity.Brillo.Logic.AccountReceivable();


            PaymentDB.SaveChanges();
        }
Ejemplo n.º 9
0
        public IHttpActionResult AddData(payment paymentobj)
        {
            AuthDetails authdet = LoginUserDetails();

            paymentobj.UpdatedBy = authdet.UserId;
            paymentobj.CreatedBy = authdet.UserId;
            var result = service.Add(paymentobj);

            return(Ok(result));
        }
Ejemplo n.º 10
0
    protected void ButtonDoPayment_Click(object sender, EventArgs e)
    {
        // Retrieve first item informations
        var myPayment1 = new payment();

        myPayment1.amount             = TextBoxPaymentAmount1.Text;
        myPayment1.currency           = TextBoxPaymentCurrency1.Text;
        myPayment1.action             = DropDownListPaymentFunction1.SelectedValue;
        myPayment1.mode               = DropDownListPaymentMode1.SelectedValue;;
        myPayment1.contractNumber     = TextBoxPaymentContract1.Text;
        myPayment1.differedActionDate = TextBoxPaymentDifferedDate1.Text;

        capture myCapture1 = new capture();

        myCapture1.payment       = myPayment1;
        myCapture1.transactionID = TextBoxTransactionID1.Text;

        // Retrieve seconde item informations
        var myPayment2 = new payment();

        myPayment2.amount             = TextBoxPaymentAmount2.Text;
        myPayment2.currency           = TextBoxPaymentCurrency2.Text;
        myPayment2.action             = DropDownListPaymentFunction2.SelectedValue;
        myPayment2.mode               = DropDownListPaymentMode2.SelectedValue;;
        myPayment2.contractNumber     = TextBoxPaymentContract2.Text;
        myPayment2.differedActionDate = TextBoxPaymentDifferedDate2.Text;

        capture myCapture2 = new capture();

        myCapture2.payment       = myPayment2;
        myCapture2.transactionID = TextBoxTransactionID2.Text;

        capture[] myCaptureList = new capture[] { myCapture1, myCapture2 };

        string massTreatmentID = "";
        string date            = "";

        try
        {
            var client = PaymentApiFactory.GetMassPaymentAPIClient();
            var Result = client.doMassCapture(GlobalVariables.APIVersion, myCaptureList, TextBoxComment.Text, out massTreatmentID, out date);

            //Returned datas
            TextBoxResultCode.Text         = Result.code;
            TextBoxResultShortMessage.Text = Result.shortMessage;
            TextBoxResultLongMessage.Text  = Result.longMessage;

            TextBoxMassTreatmentID.Text = massTreatmentID;
        }
        catch (Exception E)
        {
            LabelError.Visible = true;
            LabelError.Text    = "Error : " + E.ToString();
        }
    }
        public ActionResult Create([Bind(Include = "Transactioid,TransactionType")] payment payment)
        {
            if (ModelState.IsValid)
            {
                db.payment.Add(payment);
                db.SaveChanges();
            }


            return(View(payment));
        }
Ejemplo n.º 12
0
        private void showbill(object sender, RoutedEventArgs e)
        {
            String name = bname.Text;
            String cnic = bcnic.Text;
            String rno  = brno.Text;

            #region validation
            bool valid = true;
            if (name.Trim() == "")

            {
                bname.BorderBrush     = Brushes.Red;
                bname.BorderThickness = new Thickness(2, 2, 2, 2);
                valid = false;
            }

            if (!bcnic.IsMaskCompleted)
            {
                bcnic.BorderBrush     = Brushes.Red;
                bcnic.BorderThickness = new Thickness(2, 2, 2, 2);
                valid = false;
            }
            if (rno.Trim() == "")
            {
                brno.BorderBrush     = Brushes.Red;
                brno.BorderThickness = new Thickness(2, 2, 2, 2);
                valid = false;
            }
            if (!valid)
            {
                MessageBox.Show("First_name required", "information", MessageBoxButton.OK, MessageBoxImage.Stop);
                return;
            }

            #endregion
            payment pay = new payment();
            pay.customer       = new customer();
            pay.booking        = new booking();
            pay.customer.fname = name;

            pay.customer.cnic = cnic;
            //MessageBox.Show(pay.customer.cnic);
            pay.booking.Room_     = int.Parse(rno);
            rnt.Visibility        = Visibility.Visible;
            plist                 = hrs.getpaymnt(pay);
            bill_grid.ItemsSource = plist;
            bill_grid.Items.Refresh();
            rmsrv.Visibility = Visibility.Visible;

            /*bname.Text=null;
             * bcnic.Text=null;
             * brno.Text=null;*/
            ttl.Visibility = Visibility.Visible;
        }
Ejemplo n.º 13
0
        public IHttpActionResult Getpayment(int id)
        {
            payment payment = db.payments.Find(id);

            if (payment == null)
            {
                return(NotFound());
            }

            return(Ok(payment));
        }
Ejemplo n.º 14
0
        public ActionResult Create([Bind(Include = "id,paymentType,isActive,createdAT")] payment payment)
        {
            if (ModelState.IsValid)
            {
                db.payments.Add(payment);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(payment));
        }
Ejemplo n.º 15
0
 private void sbxContact_Select(object sender, RoutedEventArgs e)
 {
     if (sbxContact.ContactID > 0)
     {
         contact       contact       = SalesInvoiceDB.contacts.Where(x => x.id_contact == sbxContact.ContactID).FirstOrDefault();
         sales_invoice sales_invoice = (sales_invoice)sales_invoiceViewSource.View.CurrentItem as sales_invoice;
         payment       payment       = (payment)paymentViewSource.View.CurrentItem as payment;
         sales_invoice.id_contact = contact.id_contact;
         sales_invoice.contact    = contact;
         payment.id_contact       = contact.id_contact;
     }
 }
Ejemplo n.º 16
0
 public ActionResult Edit([Bind(Include = "id,package_id,title,card_number,card_expirydate,csc,created_by,created_at")] payment payment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(payment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.package_id = new SelectList(db.packages, "id", "title", payment.package_id);
     ViewBag.created_by = new SelectList(db.users, "id", "username", payment.created_by);
     return(View(payment));
 }
Ejemplo n.º 17
0
        public ActionResult DeleteConfirmed(int id)
        {
            if (Session["email"] == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            payment payment = db.payments.Find(id);

            db.payments.Remove(payment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Ejemplo n.º 18
0
 public ActionResult DeleteB(long payment_id, payment payment)
 {
     try
     {
         var tokenResponse = httpClient.DeleteAsync(baseAddress + "deleteById/" + payment_id).Result;
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Edit([Bind(Include = "payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update")] payment payment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(payment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.rental_id = new SelectList(db.rental, "rental_id", "rental_id", payment.rental_id);
     ViewBag.staff_id  = new SelectList(db.staff, "staff_id", "first_name", payment.staff_id);
     return(View(payment));
 }
Ejemplo n.º 20
0
 public IHttpActionResult AddNewpayment(payment value)
 {
     if (ModelState.IsValid)
     {
         repo.Createpayment(value);
         return(Ok("Data Entered Successfully"));
     }
     else
     {
         return(NotFound());
     }
 }
 public ActionResult Edit([Bind(Include = "payment_id,student_id,inventory_id,payment_category,payment_amount,payment_date")] payment payment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(payment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.inventory_id = new SelectList(db.inventories, "inventory_id", "inventory_category", payment.inventory_id);
     ViewBag.student_id   = new SelectList(db.students, "student_id", "student_name", payment.student_id);
     return(View(payment));
 }
Ejemplo n.º 22
0
 public PaymentForm(payment p)
 {
     InitializeComponent();
     ControlsUtil.SetBackColor(this.Controls);
     if (p == null)
     {
         p = new payment();
         IsNew = true;
     }
     loadData();
     bdgPayment.DataSource = p;
 }
Ejemplo n.º 23
0
        public HttpResponseMessage DownloadReceipt(payment paymentobj)
        {
            string filename = "Sample";
            //paymentobj.SiteName.Contains("Payment");
            var result       = service.DownloadReceipt(paymentobj);
            var example_html = "<html><body>" + result + "</body></html>";

            byte[] buffer = GetTemplate(paymentobj, example_html);
            HttpResponseMessage response = PDFResponse(filename, buffer);

            return(response);
        }
Ejemplo n.º 24
0
        public IHttpActionResult Postpayment(payment payment)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.payments.Add(payment);
            db.SaveChanges();

            return(CreatedAtRoute("DefaultApi", new { id = payment.paymentID }, payment));
        }
Ejemplo n.º 25
0
 public ActionResult EditB(payment payment)
 {
     try
     {
         var APIResponse = httpClient.PutAsJsonAsync <payment>(baseAddress + "updatepayment/", payment).ContinueWith(postTask => postTask.Result.EnsureSuccessStatusCode());
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Ejemplo n.º 26
0
        /* [Randy] Register as a complementary user without paying */
        public bool complementaryPayment(UserInfo user, string key)
        {
            try
            {
                using (conferenceadminContext context = new conferenceadminContext())
                {
                    payment payment = new payment
                    {
                        paymentTypeID = 2,
                        deleted = false,
                        creationDate = DateTime.Now.Date
                    };

                    context.payments.Add(payment);
                    context.SaveChanges();

                    registration registration = new registration
                    {
                        userID = user.userID,
                        paymentID = payment.paymentID,
                        date1 = user.date1,
                        date2 = user.date2,
                        date3 = user.date3,
                        byAdmin = false,
                        deleted = false,
                        note = user.notes
                    };

                    user saveUser = context.users.Where(u => u.userID == user.userID).FirstOrDefault();
                    saveUser.registrationStatus = "Accepted";

                    complementarykey complementaryKey = context.complementarykeys.Where(k => k.key == key).FirstOrDefault();
                    complementaryKey.isUsed = true;

                    paymentcomplementary complementaryPay = new paymentcomplementary
                    {
                        paymentID = payment.paymentID,
                        deleted = false,
                        complementaryKeyID = complementaryKey.complementarykeyID
                    };

                    context.registrations.Add(registration);
                    context.paymentcomplementaries.Add(complementaryPay);
                    context.SaveChanges();
                    return true;
                }
            }
            catch (Exception ex)
            {
                Console.Write("ProfileAuthorizationManager.complementaryPaymentError error " + ex);
                return false;
            }
        }
Ejemplo n.º 27
0
 public PaymentForm(payment p)
 {
     InitializeComponent();
     ControlsUtil.SetBackColor(this.Controls);
     if (p == null)
     {
         p     = new payment();
         IsNew = true;
     }
     loadData();
     bdgPayment.DataSource = p;
 }
Ejemplo n.º 28
0
 public ActionResult Edit([Bind(Include = "Id,PatientsId,DoctorsId,Amount")] payment payment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(payment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.DoctorsId  = new SelectList(db.Doctors, "Id", "Name", payment.DoctorsId);
     ViewBag.PatientsId = new SelectList(db.Patients, "Id", "Name", payment.PatientsId);
     return(View(payment));
 }
Ejemplo n.º 29
0
 private void GridDoubleClick(object sender, EventArgs e)
 {
     try
     {
         GridControl   grid = (GridControl)sender;
         BindingSource bdg  = (BindingSource)grid.DataSource;
         payment       p    = (payment)bdg.Current;
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show(String.Format("Ocorreu o erro:\n\n{0}\n{1}", ex.Message, ex.InnerException));
     }
 }
Ejemplo n.º 30
0
        public IHttpActionResult DetailOfParticularpayment(int id)
        {
            payment c = repo.GetDetails(id);

            if (c == null)
            {
                return(NotFound());
            }
            else
            {
                return(Ok(c));
            }
        }
Ejemplo n.º 31
0
        private void makebill(object sender, RoutedEventArgs e)
        {
            rnt.Visibility = Visibility.Hidden;

            String name = bname.Text;
            String cnic = bcnic.Text;
            String rno  = brno.Text;

            #region validation
            bool valid = true;
            if (name.Trim() == "")
            {
                bname.BorderBrush     = Brushes.Red;
                bname.BorderThickness = new Thickness(2, 2, 2, 2);
                valid = false;
            }

            if (!bcnic.IsMaskCompleted)
            {
                bcnic.BorderBrush     = Brushes.Red;
                bcnic.BorderThickness = new Thickness(2, 2, 2, 2);
                valid = false;
            }
            if (rno.Trim() == "")
            {
                brno.BorderBrush     = Brushes.Red;
                brno.BorderThickness = new Thickness(2, 2, 2, 2);
                valid = false;
            }
            if (!valid)
            {
                MessageBox.Show("First_name required", "information", MessageBoxButton.OK, MessageBoxImage.Stop);
                return;
            }

            #endregion

            payment pay = new payment();
            pay.customer = new customer();
            pay.booking  = new booking();

            pay.customer.fname = name;
            pay.customer.cnic  = cnic;
            pay.booking.Room_  = int.Parse(rno);
            payment list = hrs.makebill(pay);
            //list = hrs.getpaymnt(pay);
            Switcher.Switch(new bill(list));

            ttl.Visibility   = Visibility.Hidden;
            rmsrv.Visibility = Visibility.Hidden;
        }
Ejemplo n.º 32
0
        public async Task <ActionResult <payment> > Postpayment([FromBody] payment payment, [FromHeader] string api_token)
        {
            AuthController newAuth      = new AuthController(_context);
            var            ActionResult = await newAuth.getId(api_token);

            var OkObjectResult = ActionResult as OkObjectResult;

            int    status           = 0;
            string rejection_reason = null;

            int UserId = (int)OkObjectResult.Value;

            //при проведении платежа добавить его в истроию
            //если на счету не хватает декнег отменяем платеж и меняем статус
            //если хватает списываем деньги, добавляем деньги и меняем статус платежа
            _context.payment.Add(payment);
            await _context.SaveChangesAsync();

            if (_context.Acc.Any(x => x.id_acc == payment.sender_id && x.balance_acc >= payment.sum))
            {
                status = 1;
                //Списать
                var AccSenderBalanceUpdate = _context.Acc.Where(x => x.id_acc == payment.sender_id).ToList();
                AccSenderBalanceUpdate[0].balance_acc -= payment.sum;
                await _context.SaveChangesAsync();

                //добавить
                var AccRecipientBalanceUpdate = _context.Acc.Where(x => x.id_acc == payment.recipient_id).ToList();
                AccRecipientBalanceUpdate[0].balance_acc += payment.sum;
                await _context.SaveChangesAsync();
            }
            else
            {
                status           = 2;
                rejection_reason = "Недостаточно средств на счету!";
            }

            payment_historyController PaymentHistory = new payment_historyController(_context);
            payment_history           new_payment    = new payment_history
            {
                payment_id        = payment.id_payment,
                status_payment_id = status,
                date_check        = DateTime.Now,
                rejection         = rejection_reason
            };
            await PaymentHistory.Postpayment_history(new_payment);

            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getpayment", new { id = payment.id_payment }, payment));
        }
Ejemplo n.º 33
0
        public PaymentInfo userPayment(UserInfo user)
        {
            try
            {
                using (conferenceadminContext context = new conferenceadminContext())
                {
                    PaymentInfo pay = new PaymentInfo();
                    payment payment = new payment();
                    var registrationExist = context.registrations.Where(x => x.userID == user.userID).FirstOrDefault();
                    if (registrationExist == null)
                    {

                        payment.paymentTypeID = 1;
                        payment.deleted = false;
                        payment.creationDate = DateTime.Now.Date;
                        context.payments.Add(payment);
                        context.SaveChanges();
                        //Check if exist a registration then take it and edit it
                        registration registration = new registration
                        {
                            userID = user.userID,
                            paymentID = payment.paymentID,
                            date1 = user.date1,
                            date2 = user.date2,
                            date3 = user.date3,
                            byAdmin = false,
                            deleted = false,
                            note = user.notes,

                        };
                        pay.paymentID = payment.paymentID;
                        context.registrations.Add(registration);

                        context.SaveChanges();

                    }

                    else
                    {

                        registrationExist.date1 = user.date1;
                        registrationExist.date2 = user.date2;
                        registrationExist.date3 = user.date3;
                        registrationExist.byAdmin = false;
                        registrationExist.deleted = false;
                        registrationExist.note = user.notes;
                        context.SaveChanges();
                        pay.paymentID = registrationExist.paymentID;

                    }

                    //add check if is lateregistration o regular registration*****************************************IMPORTANT

                    pay.amount = user.amount;

                    return pay;
                }
            }
            catch (Exception ex)
            {
                Console.Write("ProfileAuthorizationManager.UserPayment error " + ex);
                return null;
            }
        }
Ejemplo n.º 34
0
        public SponsorQuery addSponsor(SponsorQuery x)
        {
            try
            {
                using (conferenceadminContext context = new conferenceadminContext())
                {
                    address address = new address();
                    address.city = x.city;
                    address.country = x.country;
                    address.state = x.state;
                    address.zipcode = x.zipcode;
                    address.line1 = x.line1;
                    address.line2 = x.line2;
                    context.addresses.Add(address);
                    context.SaveChanges();

                    user user = new user();
                    user.membershipID = 1;
                    user.firstName = x.firstName;
                    user.lastName = x.lastName;
                    user.userFax = x.userFax;
                    user.phone = x.phone;
                    user.addressID = address.addressID;
                    user.affiliationName = x.company;
                    user.userTypeID = 7;
                    user.deleted = false;
                    context.users.Add(user);
                    context.SaveChanges();

                    payment payment2 = new payment();
                    payment2.paymentTypeID = 1;
                    payment2.deleted = false;
                    payment2.creationDate = DateTime.Now;
                    context.payments.Add(payment2);
                    context.SaveChanges();

                    paymentbill bill = new paymentbill();
                    bill.AmountPaid = (double)x.amount;
                    bill.paymentID = payment2.paymentID;
                    bill.methodOfPayment = x.method;
                    bill.transactionid = x.transactionID;
                    bill.completed = true;
                    bill.quantity = (int)(x.amount * 100);
                    bill.deleted = false;
                    bill.date = DateTime.Now;
                    context.paymentbills.Add(bill);
                    context.SaveChanges();

                    sponsor2 sponsor = new sponsor2();
                    sponsor.userID = user.userID;
                    sponsor.emailInfo = x.email;
                    sponsor.logo = x.logo;
                    sponsor.sponsorType = x.sponsorType;
                    sponsor.totalAmount = x.amount;
                    sponsor.deleted = false;
                    sponsor.byAdmin = true;
                    sponsor.active = true;
                    sponsor.paymentID = payment2.paymentID;

                    context.sponsor2.Add(sponsor);
                    context.SaveChanges();
                    x.sponsorID = sponsor.sponsorID;
                    x.addressID = address.addressID;
                    x.byAdmin = true;
                    return x;
                }

            }
            catch (Exception ex)
            {
                Console.Write("AdminManager.addSponsor error " + ex);
                return null;
            }
        }
Ejemplo n.º 35
0
        public bool makePaymentFree(UserInfo user)
        {
            try
            {
                using (conferenceadminContext context = new conferenceadminContext())
                {
                    payment payment = new payment
                    {
                        paymentTypeID = 1,
                        deleted = false,
                        creationDate = DateTime.Now.Date
                    };

                    context.payments.Add(payment);
                    context.SaveChanges();

                    registration registration = new registration
                    {
                        userID = user.userID,
                        paymentID = payment.paymentID,
                        date1 = user.date1,
                        date2 = user.date2,
                        date3 = user.date3,
                        byAdmin = false,
                        deleted = false,
                        note = user.notes
                    };

                    user saveUser = context.users.Where(u => u.userID == user.userID).FirstOrDefault();
                    saveUser.registrationStatus = "Accepted";

                    paymentbill bill = new paymentbill
                    {
                        paymentID = payment.paymentID,
                        addressID = saveUser.addressID,
                        deleted = false,
                        AmountPaid = (double)saveUser.usertype.registrationCost,

                        transactionid = "N/A",
                        methodOfPayment = "N/A",
                        tandemID ="N/A",
                        batchID ="N/A",
                        completed=true,
                        date =DateTime.Now,
                        firstName=saveUser.firstName,
                        lastName=saveUser.lastName,
                        email=saveUser.membership.email,
                        telephone =saveUser.phone,

                    };

                    context.registrations.Add(registration);
                    context.paymentbills.Add(bill);
                    context.SaveChanges();
                    return true;
                }
            }
            catch (Exception ex)
            {
                Console.Write("ProfileAuthorizationManager.MakePaymentFree error " + ex);
                return false;
            }
        }
Ejemplo n.º 36
0
        public bool createUser(user user, membership member, address address)
        {
            try
            {
                string key = generateEmailConfirmationKey();
                using (conferenceadminContext context = new conferenceadminContext())
                {
                    //code for password encryption

                    var encrpPass = Security.GetSHA1HashData(member.password);
                    member.password = encrpPass;

                    //end password encryption
                    member.deleted = false;
                    member.emailConfirmation = false;
                    member.deleted = false;
                    member.confirmationKey = key;
                    context.memberships.Add(member);
                    context.SaveChanges();
                    context.addresses.Add(address);
                    context.SaveChanges();

                    user.addressID = address.addressID;
                    user.membershipID = member.membershipID;
                    user.acceptanceStatus = "Pending";
                    user.deleted = false;
                    user.hasApplied = false;
                    user.registrationStatus = "Pending";
                    user.evaluatorStatus = user.evaluatorStatus;

                    context.users.Add(user);
                    context.SaveChanges();

                    if (user.userTypeID == 1)
                    {
                        minor minor = new minor();
                        minor.authorizationStatus = false;
                        minor.deleted = false;
                        minor.userID = user.userID;
                        context.minors.Add(minor);
                        context.SaveChanges();

                    }
                    else if (user.userTypeID == 7)
                    {
                        sponsor2 sponsor = new sponsor2();

                        sponsor.deleted = false;
                        sponsor.userID = user.userID;
                        sponsor.active = false;
                        sponsor.sponsorType = 5;
                        sponsor.byAdmin = false;
                        sponsor.active = false;
                        sponsor.totalAmount = 0;

                        payment payment2 = new payment();
                        payment2.paymentTypeID = 1;
                        payment2.deleted = false;
                        payment2.creationDate = DateTime.Now;
                        context.payments.Add(payment2);

                        context.SaveChanges();
                        sponsor.paymentID = payment2.paymentID;
                        context.sponsor2.Add(sponsor);
                        context.SaveChanges();

                    }
                    else if (user.userTypeID == 6)
                    {
                        companion companion = new companion();
                        companion.deleted = false;
                        companion.userID = user.userID;
                        companion.companionKey = "Companion "+ user.userID + generateEmailConfirmationKey().Substring(0, 9);
                        context.companions.Add(companion);
                        context.SaveChanges();

                    }

                    try { sendEmailConfirmation(member.email, member.confirmationKey); }

                    catch (Exception ex)
                    {
                        Console.Write("SignUpManager.NewConfirmationEmail error " + ex);
                        return false;
                    }

                    return true;

                }

            }
            catch (Exception ex)
            {
                Console.Write("SignUpManager.creatingUser error " + ex);
                return false;
            }
        }