//private static IEnumerable<Service.Order> GetOrders(string customerID)
        //{

        //    return order.Select(o => new Service.Order
        //    {
        //        OrderID = o.OrderID,
        //        OrderDate = o.OrderDate,
        //        OrderDetails = GetOrderDetails(o),
        //        Freight = o.Freight,
        //        ShippedDate = o.ShippedDate
        //    }).ToList();
        //}


        //private static IEnumerable<Service.OrderDetails> GetOrderDetails(Data.Order order)
        //{

        //    return Data.Order_Details.Select(
        //    o => new Service.OrderDetail
        //    {
        //        Product
        //        = new Service.Product
        //        {
        //            ProductID
        //            = o.Product.ProductID,
        //            ProductName
        //            = o.Product.ProductName
        //        },
        //        Quantity = o.Quantity,
        //        UnitPrice = o.UnitPrice
        //    }).ToList();
        //}



        public void Update(Customer customer)
        {
            Data.Customer customerEntity = _northwindEntities
                                           .Customers.First(
                c => c.CustomerID == customer.CustomerID);
            _northwindEntities.Customers.Attach(customerEntity);

            customerEntity.CompanyName = customer.CompanyName;
            customerEntity.ContactName = customer.ContactName;
            customerEntity.Address     = customer.Address;
            customerEntity.City        = customer.City;
            customerEntity.Country     = customer.Country;
            customerEntity.Region      = customer.Region;
            customerEntity.PostalCode  = customer.PostalCode;
            customerEntity.Phone       = customer.Phone;
            _northwindEntities.Entry(customerEntity).CurrentValues.SetValues(customerEntity);
            _northwindEntities.Entry(customerEntity).State = EntityState.Modified;

            //Data.Customer customerEntityNew = new Data.Customer();
            //customerEntityNew.CompanyName = customer.CompanyName + "Prova JPP";
            //customerEntityNew.CustomerID = "PIPOO";
            //customerEntityNew.ContactName = customer.ContactName;
            //customerEntityNew.Address = customer.Address;
            //customerEntityNew.City = customer.City;
            //customerEntityNew.Country = customer.Country;
            //customerEntityNew.Region = customer.Region;
            //customerEntityNew.PostalCode = customer.PostalCode;
            //customerEntityNew.Phone = customer.Phone;
            //_northwindEntities.Customers.Add(customerEntityNew);
            //_northwindEntities.Entry(customerEntityNew).State = System.Data.Entity.EntityState.Added;
            _northwindEntities.SaveChanges();
        }
        private void BtnSignIn_Click(object sender, EventArgs e)
        {
            string id = txbID.Text;
            string pw = txbPassword.Text;

            Data.Customer customer = DB.Customer.Check(id, pw);



            if (customer != null)
            {
                //CustomerMainForm customerMain = new CustomerMainForm();
                //customerMain.FormClosed += new FormClosedEventHandler(CustomerMainFormClosed);
                //customerMain.Show();
                //this.Hide();
                LoginSuccessForm loginSuccess = new LoginSuccessForm(customer);
                loginSuccess.FormClosed += new FormClosedEventHandler(LoginSuccessFormClosed);
                loginSuccess.Show();
                this.Hide();
            }
            else
            {
                MessageBox.Show("ID 및 비밀번호가 맞지 않습니다. \n 다시 입력해주십시오.", "알 림");
            }
        }
Example #3
0
        public ActionResult Login(Data.Customer s)
        {
            var User = db.Customers.Where(model => model.EmailAddress == s.EmailAddress && model.Password == s.Password).FirstOrDefault();

            if (User != null)
            {
                if (User.RoleId == "User" || User.RoleId == null)
                {
                    Session["UserEmail"] = s.EmailAddress.ToString();



                    TempData["loginstatus"] = "<script>alert('login succefully !!')</script>";

                    return(RedirectToAction("list", "Display"));
                }

                else
                {
                    Session["UserEmail"] = s.EmailAddress.ToString();

                    return(RedirectToAction("Admin", "Home"));
                }
            }
            return(View());
        }
        Contracts.Customer ICustomerService.Create(Contracts.Customer customer)
        {
            Data.Customer customerEntity = MapCustomer(customer);
            var           customerResult = _customerRepositary.Create(customerEntity);

            customer.CustomerId = customerResult.CustomerId;
            return(customer);
        }
        private DetailToDepartmentEventArgs OnDetailToDepartment(Data.Customer refCustomerClass, CustomerDepartmentChoiceControl refCtmDepChoice)
        {
            DetailToDepartmentEventArgs args = new DetailToDepartmentEventArgs(refCustomerClass, refCtmDepChoice);

            OnDetailToDepartment(args);

            return(args);
        }
        public OrderSheet(Data.Customer customer, UsedBook usedBook)
        {
            InitializeComponent();

            _customer = customer;
            _usedBook = usedBook;
            Icon      = Resources.Purchase1;
        }
Example #7
0
File: Mapper.cs Project: 224107/PT
 public static Customer DatabaseCustomerToServiceCustomer(Data.Customer customer)
 {
     return(new Customer()
     {
         Id = customer.id,
         FirstName = customer.first_name,
         LastName = customer.last_name
     });
 }
Example #8
0
        public void Update(Customer customer)
        {
            var dto = new Data.Customer()
            {
                Id = customer.Id, Name = customer.Name
            };

            customerRepository.Update(dto);
        }
        public LoginSuccessForm(Data.Customer customer)
        {
            InitializeComponent();
            _customer = customer;

            pictureBox1.Image    = Resources.AlaMungoMain;
            pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
            lblComment.Text      = $"{customer.LoginID}님 어서 오세요.";
            Icon = Resources.YesAlaMungoLogo;
        }
Example #10
0
        public void UpdateCustomer(Data.Customer customer)
        {
            Customer customerUpdate = _DataContext.Customers.FirstOrDefault(c => c.Id.Equals(customer.id));

            if (customerUpdate != null)
            {
                customerUpdate.FirstName = customer.first_name;
                customerUpdate.LastName  = customer.last_name;
            }
        }
        public void GetResponseInvalidTokenExceptionTest()
        {
            ServiceContext    serviceContext = Initializer.InitializeServiceContextQbo();
            IRestHandler      handler        = new SyncRestHandler(serviceContext);
            string            resourceUri    = string.Format("v3/company/{0}/customer", AuthorizationKeysQBO.realmIdIAQBO);
            RequestParameters parameters     = new RequestParameters(resourceUri, HttpVerbType.POST, CoreConstants.CONTENTTYPE_APPLICATIONXML);

            Intuit.Ipp.Data.Customer customer = new Data.Customer();
            HttpWebRequest           request  = handler.PrepareRequest(parameters, customer);
            string response = handler.GetResponse(request);
        }
Example #12
0
        public SellBookForm(Data.Customer customer, MetaDataBook metaDataBook)
        {
            InitializeComponent();
            _customer     = customer;
            _metaDataBook = metaDataBook;

            cbbQuality.Items.Add("A");
            cbbQuality.Items.Add("B");
            cbbQuality.Items.Add("C");
            cbbQuality.Items.Add("F");
        }
        public Northwind.Service.Customer GetCustomer(string customerID)
        {
            Data.Customer customer = _northwindEntities.Customers.Single(c => c.CustomerID == customerID);
            return(new Service.Customer
            {
                CustomerID = customer.CustomerID,
                CompanyName = customer.CompanyName,
                ContactName = customer.ContactName,
                Address = customer.Address,
                City = customer.City,
                Country = customer.Country,
                Region = customer.Region,
                PostalCode = customer.PostalCode,
                Phone = customer.Phone,
                Orders = _northwindEntities.Orders.Where(x => x.CustomerID == customer.CustomerID).Select(
                    o => new Service.Order
                {
                    OrderID = o.OrderID,
                    OrderDate = o.OrderDate,
                    OrderDetails = _northwindEntities.Order_Details.Where(x => x.OrderID == o.OrderID).Select(
                        od => new Service.OrderDetails
                    {
                        Product = new Service.Product
                        {
                            ProductID
                                = od.ProductID,
                            ProductName = _northwindEntities.Products.FirstOrDefault(x => x.ProductID == od.ProductID).ProductName
                        },
                        Quantity = od.Quantity,
                        UnitPrice = od.UnitPrice
                    }).ToList(),
                    Freight = o.Freight,
                    ShippedDate = o.ShippedDate
                }).ToList()
            });

            //    Northwind.Data.Customer customer
            //    = _northwindEntities
            //    .Customers.Single(
            //    c => c.CustomerID == customerID);
            //    return new Northwind.Service.Customer
            //    {
            //        CustomerID = customer.CustomerID,
            //        CompanyName = customer.CompanyName,
            //        ContactName = customer.ContactName,
            //        Address = customer.Address,
            //        City = customer.City,
            //        Country = customer.Country,
            //        Region = customer.Region,
            //        PostalCode = customer.PostalCode,
            //        Phone = customer.Phone
            //    };
        }
        public void GetResponseInvalidTokenExceptionTest()
        {
            OAuthRequestValidator validator  = new OAuthRequestValidator("adfas", "afd", "adfas", "asdfa");
            string            realmId        = ConfigurationManager.AppSettings["RealmIAQBO"];
            ServiceContext    serviceContext = new ServiceContext(realmId, IntuitServicesType.QBO, validator);
            IRestHandler      handler        = new SyncRestHandler(serviceContext);
            string            resourceUri    = string.Format("v3/company/{0}/customer", serviceContext.RealmId);
            RequestParameters parameters     = new RequestParameters(resourceUri, HttpVerbType.POST, CoreConstants.CONTENTTYPE_APPLICATIONXML);

            Intuit.Ipp.Data.Customer customer = new Data.Customer();
            HttpWebRequest           request  = handler.PrepareRequest(parameters, customer);
            string response = handler.GetResponse(request);
        }
 private Data.Customer MapCustomer(Contracts.Customer customer)
 {
     Data.Customer customerEntity = new Data.Customer()
     {
         CustomerId  = customer.CustomerId,
         Email       = customer.Email,
         FirstName   = customer.FirstName,
         LastName    = customer.LastName,
         PhoneNumber = customer.PhoneNumber,
         Status      = customer.Status
     };
     return(customerEntity);
 }
Example #16
0
        public void Update(Customer customer)
        {
            Data.Customer customerEntity = _northwindEntities.Customers.Single(
                c => c.CustomerID.Equals(customer.CustomerId));

            customerEntity.CompanyName = customer.CompanyName;
            customerEntity.ContactName = customer.ContactName;
            customerEntity.Address     = customer.Address;
            customerEntity.City        = customer.City;
            customerEntity.Country     = customer.Country;
            customerEntity.Region      = customer.Region;
            customerEntity.PostalCode  = customer.PostalCode;
            customerEntity.Phone       = customer.Phone;
        }
        public NetCoreWebAPIs.Core.Models.Customer SaveCustomer(NetCoreWebAPIs.Core.Models.Customer customer)
        {
            //TODO fix this manual mess.
            var entity = new Data.Customer
            {
                CustomerId   = customer.CustomerId,
                CustomerName = customer.CustomerName,
                UpdateDate   = DateTime.Now
            };

            customerRepository.Save(entity);
            customer.CustomerId = entity.CustomerId;
            return(customer);
        }
Example #18
0
        public void GetResponseInvalidTokenExceptionTest()
        {
            //OAuthRequestValidator validator = new OAuthRequestValidator("adfas", "afd", "adfas", "asdfa");
            OAuth2RequestValidator validator = new OAuth2RequestValidator("bearertoken");
            string            realmId        = AuthorizationKeysQBO.realmIdIAQBO;
            ServiceContext    serviceContext = new ServiceContext(realmId, IntuitServicesType.QBO, validator);
            AsyncRestHandler  handler        = new AsyncRestHandler(serviceContext);
            string            resourceUri    = string.Format("v3/company/{0}/customer", serviceContext.RealmId);
            RequestParameters parameters     = new RequestParameters(resourceUri, HttpVerbType.POST, CoreConstants.CONTENTTYPE_APPLICATIONXML);

            Intuit.Ipp.Data.Customer customer = new Data.Customer();
            HttpWebRequest           request  = handler.PrepareRequest(parameters, customer);

            this.GetResponseHelper(handler, request, true);
        }
 public DomainModels.Customer Map(Data.Customer dbCustomer)
 {
     return(new DomainModels.Customer
     {
         Address = dbCustomer.Address,
         City = dbCustomer.City,
         CompanyName = dbCustomer.CompanyName,
         ContactName = dbCustomer.ContactName,
         ContactTitle = dbCustomer.ContactTitle,
         Country = dbCustomer.Country,
         CustomerId = dbCustomer.CustomerID,
         Fax = dbCustomer.Fax,
         Phone = dbCustomer.Phone,
         PostalCode = dbCustomer.PostalCode,
         Region = dbCustomer.Region,
     });
 }
        public void SaveShouldReturnSavedId()
        {
            ICustomerRepositary customerRepository = new CustomerRepositary();

            Data.Customer customer = new Data.Customer()
            {
                CustomerId  = 0,
                FirstName   = "test name",
                LastName    = "last name",
                Email       = "*****@*****.**",
                PhoneNumber = "123456",
                Status      = true
            };
            int id = customerRepository.Create(customer).CustomerId;

            Assert.AreNotEqual(0, id);
        }
        public void BuyTest()
        {
            DataContext    context = new DataContext();
            DataRepository data    = new DataRepository(context);
            Logic          logic   = new Logic(data);

            Data.Customer new_customer = new Data.Customer("Jon", "Smith", 1);

            data.Add_Product("milk", 5);
            data.Add_State(100, true);

            PurchaseEvent new_event = new PurchaseEvent(1, new_customer, DateTime.Now, new Product("milk"), new State(100, true), 2);

            data.Add_Event(new_event);

            Assert.AreEqual(50, logic.Buy("milk", 10, 5));
        }
Example #22
0
        public Customer GetCustomer(string customerId)
        {
            Data.Customer customer = _northwindEntities.Customers
                                     .Single(c => c.CustomerID.Equals(customerId));

            return(new Customer
            {
                CustomerId = customer.CustomerID,
                CompanyName = customer.CompanyName,
                ContactName = customer.ContactName,
                Address = customer.Address,
                City = customer.City,
                Country = customer.Country,
                Region = customer.Region,
                PostalCode = customer.PostalCode,
                Phone = customer.Phone,
                Orders = GetOrders(customer.Orders),
            });
        }
Example #23
0
 private void SetupDbCustomer()
 {
     dbCustomer = new Data.Customer
     {
         CustomerId        = 1,
         CustomerAuthId    = "fakeauthid1",
         GivenName         = "Fake1",
         FamilyName        = "Name1",
         AddressOne        = "Address1 1",
         AddressTwo        = "Address1 2",
         Town              = "Town1",
         State             = "State1",
         AreaCode          = "Area Code1",
         Country           = "Country1",
         EmailAddress      = "[email protected]",
         TelephoneNumber   = "07123456781",
         RequestedDeletion = false,
         CanPurchase       = true,
         Active            = true
     };
 }
Example #24
0
        private static object convertCustomerToModel(object src)
        {
            p1p.Types.DTO.CustomerDTO dto = (p1p.Types.DTO.CustomerDTO)src;
            p1p.Data.Customer         mdl = new Data.Customer();

            mdl.StreetAddress = dto.StreetAddress;
            mdl.Email         = dto.Email;
            mdl.Id            = dto.Id;
            mdl.BusinessName  = dto.BusinessName;
            mdl.Phone         = dto.Phone;
            mdl.Username      = dto.Username;
            mdl.WebsiteURL    = dto.WebsiteURL;
            mdl.InsertDate    = dto.InsertDate;
            mdl.FirstName     = dto.FirstName;
            mdl.LastName      = dto.LastName;
            mdl.City          = dto.City;
            mdl.State         = dto.State;
            mdl.Zip           = dto.Zip;

            return(mdl);
        }
Example #25
0
        public Models.Customer newCustomer()
        {
            Models.Customer customer  = new Models.Customer();
            var             dCustomer = new Data.Customer {
                birthDay  = customer.birthDay,
                name      = customer.name,
                photoName = customer.photoName,
                timeStamp = customer.timeStamp
            };

            db.customers.Add(dCustomer);
            try
            {
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                httpCtx.Trace.Warn("Database write Error", "Error creating a new Customer", ex);
                return(new Models.Customer());
            }

            customer.customerID = dCustomer.customerID;
            routeDiffs(new[] {
                new {
                    op   = "add",
                    data = new {
                        orders    = new Models.Order[0],
                        products  = new Models.Product[0],
                        blobs     = new Models.Blob[0],
                        customers = new Models.Customer[] {
                            customer
                        }
                    }
                }
            });
            return(customer);
        }
Example #26
0
 private void BtnSignIn_Click(object sender, EventArgs e)
 {
     if (_signUpAble)
     {
         Data.Customer customer = new Data.Customer();
         customer.CustomerID = DB.Customer.GetCount() + 1;
         customer.LoginID    = txbId.Text;
         if (ValidatePassword() == false)
         {
             return;
         }
         customer.PassWord    = txbPw.Text;
         customer.Address     = txbAddress.Text;
         customer.Email       = txbEMail.Text;
         customer.PhoneNumber = txbPhone.Text;
         DB.Customer.Insert(customer);
         MessageBox.Show("가입완료!", "알 림");
         this.Close();
     }
     else
     {
         MessageBox.Show("중복체크를 해주세요", "알 림");
     }
 }
 public BuyListForm(Data.Customer customer)
 {
     InitializeComponent();
     Icon      = Resources.Purchase1;
     _customer = customer;
 }
Example #28
0
        public Models.Customer newCustomer()
        {
            Models.Customer customer = new Models.Customer();
            var dCustomer = new Data.Customer {
                birthDay = customer.birthDay,
                name = customer.name,
                photoName = customer.photoName,
                timeStamp = customer.timeStamp
            };

            db.customers.Add(dCustomer);
            try
            {
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                httpCtx.Trace.Warn("Database write Error", "Error creating a new Customer", ex);
                return new Models.Customer();
            }

            customer.customerID = dCustomer.customerID;
            routeDiffs(new[]{
                new {
                    op = "add",
                    data = new {
                        orders = new Models.Order[0],
                        products = new Models.Product[0],
                        blobs = new Models.Blob[0],
                        customers = new Models.Customer[] {
                            customer
                        }

                    }
                }
            });
            return customer;
        }
 public InvoiceForm(Data.Customer customer)
 {
     InitializeComponent();
     _customer = customer;
 }
 public SellListForm(Data.Customer customer)
 {
     InitializeComponent();
     _customer = customer;
 }
Example #31
0
 private void GetCustomer()
 {
     Data.FactoryManager m = new Data.FactoryManager();
     Data.Customer       i = m.GetCustomerManager().FindByOrder(this.OrderId);
     customer = new Customer(i.CustomerId, i.FirstName, i.LastName);
 }