コード例 #1
0
        //Combobox
        private bool ComboboxCustomer(CustomerContract customer)
        {
            var connect = new Connector.Banking.GenericConnect <CustomerResponse>();
            var request = new Types.Banking.CustomerRequest();

            request.customer   = customer;
            request.MethodName = "CustomerAll";

            var response = connect.Execute(request);

            if (response.IsSuccess == true)
            {
                /*
                 * cbAccountCustomer.ItemsSource = response.customers;
                 * cbAccountCustomer.DisplayMemberPath = "Name";
                 * cbAccountCustomer.SelectedValuePath = "Id";
                 * cbAccountCustomer.Items.Refresh();
                 */
            }
            else
            {
                MessageBox.Show("Veriler getirilirken hata oluştu!", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
            }
            return(false);
        }
コード例 #2
0
ファイル: OrderTests.cs プロジェクト: tomkerkhove/sello
        public async Task Orders_CreateForExistingProductWithChoasEnabled_ShouldReturnHttpInternalServerError()
        {
            // Arrange
            const string ordersUrl            = "api/v1/order";
            const string customerFirstName    = "Tom";
            const string customerLastName     = "Kerkhove";
            var          selloService         = new SelloService(unleashChaosMonkeys: true);
            var          customerEmailAddress = $"{Guid.NewGuid().ToString()}@codit.eu";
            var          productToBuy         = await GetProductFromCatalogAsync();

            var customer = new CustomerContract
            {
                FirstName    = customerFirstName,
                LastName     = customerLastName,
                EmailAddress = customerEmailAddress
            };
            var order = new OrderContract
            {
                Customer = customer,
                Product  = productToBuy
            };

            // Act
            var response = await selloService.PostResponseAsync(ordersUrl, order);

            // Assert
            Assert.AreEqual(HttpStatusCode.InternalServerError, response.StatusCode);
        }
コード例 #3
0
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     if (!IsEditingOption)
     {
         customerContract = new CustomerContract();
     }
 }
コード例 #4
0
        public bool AddCustomer(CustomerBasicDetails customer)
        {
            try
            {
                using (var dataContract = new CustomerContract())
                {
                    using (var scope = new TransactionScope())
                    {
                        Guid customerId = Guid.NewGuid();
                        var  isSaved    = dataContract.AddNewCoustomer(customer, customerId);
                        if (isSaved)
                        {
                            new CustomerAttributeServices().AddCustomerAddress(customer, customerId);
                            new PasswordServices().CreateAccountPassword(customerId, customer.Password);
                            new OtpServicescs().SendOTP(new OtpDetailsModel {
                                Email = customer.Email, RefCustomerGuid = customerId, CustomerName = customer.FirstName + " " + customer.LastName, Prupose = "RegisterUser"
                            });
                        }
                        scope.Complete();

                        return(true);
                    }
                }
            }
            catch
            {
                throw;
            }
        }
コード例 #5
0
        public List <CustomerContract> GetCustomers(CustomerContract customer)
        {
            SqlDataReader dr;

            dr = dbOperation.SpGetData("cus.sel_customer", new SqlParameter[] {
                new SqlParameter("@Id", customer.Id),
                new SqlParameter("@Name", customer.Name),
                new SqlParameter("@SurName", customer.SurName),
                new SqlParameter("@TaxNumber", customer.TaxNumber)
            });


            List <CustomerContract> customers = new List <CustomerContract>();

            while (dr.Read())
            {
                //string columname=dr.GetName(0);
                customer            = new CustomerContract();
                customer.Id         = (int)dr[0];
                customer.Name       = dr[1].ToString();
                customer.SurName    = dr[2].ToString();
                customer.TaxNumber  = dr[3].ToString();
                customer.BirthPlace = dr[4].ToString();
                customer.BirthDate  = (DateTime)dr[5];

                customers.Add(customer);
            }

            return(customers);
        }
コード例 #6
0
        private void btnKaydet_Click(object sender, RoutedEventArgs e)
        {
            if (IsEditingOption)
            {
                if (MessageBox.Show("Yaptığınız değişlikler müşteri bilgilerine yansısın mı?", "Onay", MessageBoxButton.YesNoCancel, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    if (UpdateCustomer(customerContract) != null)
                    {
                        MessageBox.Show("Değişiklikler uygulandı!", "Başarılı", MessageBoxButton.OK, MessageBoxImage.Information);
                        btnVazgec_Click(new object(), new RoutedEventArgs());
                    }
                }
                return;
            }



            if (MessageBox.Show("Bilgilerini girdiğiniz müşteri veritabanına kaydedilsin mi?", "Kayıt", MessageBoxButton.YesNoCancel, MessageBoxImage.Question) == MessageBoxResult.Yes)
            {
                if (AddCustomer(customerContract) != null)
                {
                    MessageBox.Show($"Müşteri ekleme işlemi başarılı", "Bilgilendirme", MessageBoxButton.OK, MessageBoxImage.Information);
                    customerContract = new CustomerContract();
                }
            }

            //else
            //{
            //    MessageBox.Show("Gerekli alanları doldurunuz", "Bilgilendirme", MessageBoxButton.OK, MessageBoxImage.Warning);
            //}
        }
コード例 #7
0
        public void Update(CustomerContract customerContract)
        {
            var entry = db.Entry(customerContract);

            entry.State = EntityState.Modified;
            db.SaveChanges();
        }
コード例 #8
0
ファイル: OrderTests.cs プロジェクト: tomkerkhove/sello
        public async Task Orders_CreateWithoutProduct_ShouldReturnHttpBadRequest()
        {
            // Arrange
            const string ordersUrl            = "api/v1/order";
            const string customerFirstName    = "Tom";
            const string customerLastName     = "Kerkhove";
            const string customerEmailAddress = "*****@*****.**";
            var          selloService         = new SelloService();

            var customer = new CustomerContract
            {
                FirstName    = customerFirstName,
                LastName     = customerLastName,
                EmailAddress = customerEmailAddress
            };
            var order = new OrderContract
            {
                Customer = customer,
                Product  = null
            };

            // Act
            var response = await selloService.PostResponseAsync(ordersUrl, order);

            // Assert
            Assert.NotNull(response);
            Assert.AreEqual(HttpStatusCode.NotFound, response.StatusCode);
        }
コード例 #9
0
        public ResponseBase <long> CreateCustomer(CustomerContract data)
        {
            var response = new ResponseBase <long>();

            try
            {
                using (var context = new EF_DataBaseEntities())
                {
                    var id = new ObjectParameter("id", typeof(long));
                    context.USP_CUSTOMER_CREATE(data.Name, data.Address, data.BirthDate.ToDateTime(), data.DocumentId, data.DocumentType, data.CityId, id);
                    context.SaveChanges();

                    response.Code    = StatusCode.Ok;
                    response.Data    = long.Parse(id.Value.ToString());
                    response.Message = $"Usuario creado correctamente con ID {response.Data}";
                }
            }
            catch (Exception ex)
            {
                response.Code    = StatusCode.InternalError;
                response.Message = $"Ups! no se pudo crear el usuario: {ex.Message}";
            }

            return(response);
        }
コード例 #10
0
        public HttpResponseMessage Put(CustomerContract contract)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            if (contract.Id <= 0)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Please check, Id of the customer is missing"));
            }

            ValidationResult validationResult = _customerContractValidator.Validate(contract);

            if (!validationResult.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "This request is invalid, please review your request parameters. Errors: " + string.Join(", ", validationResult.Errors)));
            }

            Customer customer = CustomerMapper.Map(contract);

            _customerService.Edit(customer, contract);
            _customerService.Save();
            return(Request.CreateResponse(HttpStatusCode.OK));
        }
コード例 #11
0
        public List <string> Run(CustomerContract customer)
        {
            var validationMessages = new List <string>();

            if (customer == null)
            {
                validationMessages.Add(ValidationMessages.Customer_IsRequired);
            }
            else
            {
                if (string.IsNullOrWhiteSpace(customer.EmailAddress))
                {
                    validationMessages.Add(ValidationMessages.Customer_EmailAddressIsRequired);
                }
                if (string.IsNullOrWhiteSpace(customer.FirstName))
                {
                    validationMessages.Add(ValidationMessages.Customer_FirstNameIsRequired);
                }
                if (string.IsNullOrWhiteSpace(customer.LastName))
                {
                    validationMessages.Add(ValidationMessages.Customer_LastNameIsRequired);
                }
            }

            return(validationMessages);
        }
コード例 #12
0
        public ResponseBase <bool> UpdateCustomer(CustomerContract data)
        {
            var response = new ResponseBase <bool>()
            {
                Data = false
            };

            try
            {
                using (var context = new EF_DataBaseEntities())
                {
                    context.USP_CUSTOMER_UPDATE(data.Id, data.Name, data.Address, data.BirthDate.ToDateTime(), data.DocumentId, data.DocumentType, data.CityId);
                    context.SaveChanges();

                    response.Code    = StatusCode.Ok;
                    response.Data    = true;
                    response.Message = $"Usuario con ID {data.Id} fue actualizado correctamente";
                }
            }
            catch (Exception ex)
            {
                response.Code    = StatusCode.InternalError;
                response.Message = ex.Message;
                response.Message = $"Ups! no se pudo actualizar el usuario {data.Id}: {ex.Message}";
            }

            return(response);
        }
コード例 #13
0
        public void GivenIHaveEnteredCustomerContractObject(Table table)
        {
            contract = table.CreateInstance <CustomerContract>();
            table.CompareToInstance <CustomerContract>(contract);

            contractList = new List <CustomerContract>();
            contractList.Add(contract);
        }
コード例 #14
0
        public void IsValid_ValidCustomer_ReturnsTrue()
        {
            var customer = new CustomerContract {
                Name = "Bob", UserId = 1, Latitude = 58, Longitude = 6
            };

            Assert.IsTrue(customer.IsValid());
        }
コード例 #15
0
        public void IsValid_InvalidCoordinate_ReturnsFalse()
        {
            var customer = new CustomerContract {
                Name = "Bob", UserId = 1, Latitude = 91, Longitude = 6
            };

            Assert.IsFalse(customer.IsValid());
        }
コード例 #16
0
        public void IsValid_EmptyName_ReturnsFalse()
        {
            var customer = new CustomerContract {
                Name = string.Empty, UserId = 1, Latitude = 58, Longitude = 6
            };

            Assert.IsFalse(customer.IsValid());
        }
コード例 #17
0
        public void IsValid_NullName_ReturnsFalse()
        {
            var customer = new CustomerContract {
                Name = null, UserId = 1, Latitude = 58, Longitude = 6
            };

            Assert.IsFalse(customer.IsValid());
        }
コード例 #18
0
        public CustomerComponentUC()
        {
            #region responses
            Customer = new CustomerContract();
            #endregion

            InitializeComponent();
        }
コード例 #19
0
 private void btnClearFilter_Click(object sender, RoutedEventArgs e)
 {
     customer                  = new CustomerContract();
     txtCustomerName.Text      = "";
     txtCustomerSurName.Text   = "";
     txtCustomerNo.Text        = "";
     txtCustomerTaxNumber.Text = "";
     CustomerAll(customer);
 }
コード例 #20
0
 public ActionResult Create(CustomerContract customerContract)
 {
     if (ModelState.IsValid)
     {
         db.Add(customerContract);
         return(RedirectToAction("Details", new { id = customerContract.Id }));
     }
     return(View());
 }
コード例 #21
0
        public static Customer Map(Customer customer, CustomerContract customerContract)
        {
            customer.FirstName   = customerContract.FirstName;
            customer.LastName    = customerContract.LastName;
            customer.Email       = customerContract.Email;
            customer.PhoneNumber = customerContract.PhoneNumber;

            return(customer);
        }
コード例 #22
0
 public ActionResult Edit(CustomerContract customerContract)
 {
     if (ModelState.IsValid)
     {
         db.Update(customerContract);
         TempData["Message"] = "You have saved the customer contract!";
         return(RedirectToAction("Details", new { id = customerContract.Id }));
     }
     return(View(customerContract));
 }
コード例 #23
0
        public GenericResponse <CustomerContract> GetCustomerDetailsById(CustomerRequest request)
        {
            DbOperation dbOperation = new DbOperation();

            SqlParameter[] parameters = new SqlParameter[]
            {
                new SqlParameter("@CustomerId", request.DataContract.CustomerId)
            };

            try
            {
                SqlDataReader reader = dbOperation.GetData("CUS.sel_GetCustomerDetailsById", parameters);

                if (reader.HasRows)
                {
                    CustomerContract customer = new CustomerContract();
                    while (reader.Read())
                    {
                        customer.CustomerId         = Convert.ToInt32(reader["CustomerId"]);
                        customer.CustomerName       = reader["CustomerName"].ToString();
                        customer.CustomerLastName   = reader["CustomerLastName"].ToString();
                        customer.CitizenshipId      = reader["CitizenshipId"].ToString();
                        customer.MotherName         = reader["MotherName"].ToString();
                        customer.FatherName         = reader["FatherName"].ToString();
                        customer.PlaceOfBirth       = reader["PlaceOfBirth"].ToString();
                        customer.DateOfBirth        = (DateTime)reader["DateOfBirth"];
                        customer.EducationLevelName = reader["EducationLevel"].ToString();
                        customer.JobName            = reader["JobName"].ToString();
                        customer.BranchName         = reader["BranchName"].ToString();
                        customer.PhoneNumbers       = GetCustomerPhonesByCustomerId(Convert.ToInt32(reader["CustomerId"]));
                        customer.Emails             = GetCustomerEmailsByCustomerId(Convert.ToInt32(reader["CustomerId"]));
                    }

                    return(new GenericResponse <CustomerContract>()
                    {
                        Value = customer, IsSuccess = true
                    });
                }

                else
                {
                    return(new GenericResponse <CustomerContract>()
                    {
                        IsSuccess = false, ErrorMessage = "Verilen ID ile kayıtlı herhangi bir müşteri bulunamadı!"
                    });
                }
            }
            catch (Exception)
            {
                return(new GenericResponse <CustomerContract>()
                {
                    IsSuccess = false, ErrorMessage = "GetCustomerDetailsById operasyonu başarısız oldu."
                });
            }
        }
コード例 #24
0
        public ActionResult Create()
        {
            var model = new CustomerContract
            {
                Customers = customerDb.GetAll()
            };

            model.StartDate   = DateTime.Today;
            model.PaymentDate = DateTime.Today;
            return(View(model));
        }
コード例 #25
0
 public static Customer Map(CustomerContract customerContract)
 {
     return(new Customer
     {
         FirstName = customerContract.FirstName,
         LastName = customerContract.LastName,
         Email = customerContract.Email,
         PhoneNumber = customerContract.PhoneNumber,
         Status = customerContract.Status
     });
 }
コード例 #26
0
        public void Deserialize_ValidJson_InstantiatesNewObjectFromJson()
        {
            var json = "{\"latitude\": \"52.986375\", \"user_id\": 12, \"name\": \"Christina McArdle\", \"longitude\": \"-6.043701\"}";

            var customer = CustomerContract.Deserialize(json);

            Assert.IsNotNull(customer);
            Assert.AreEqual(52.986375, customer.Latitude);
            Assert.AreEqual(12, customer.UserId);
            Assert.AreEqual("Christina McArdle", customer.Name);
            Assert.AreEqual(-6.043701, customer.Longitude);
        }
コード例 #27
0
 public static Customer ToEntity(this CustomerContract customer)
 {
     return(new Customer
     {
         Id = customer.Id,
         City = customer.City,
         Name = customer.Name,
         Adress = customer.Adress,
         CustNumber = customer.CustNumber,
         CorporateIdentity = customer.CorporateIdentity,
         Tel = customer.Tel
     });
 }
コード例 #28
0
        public void ThenTheResultShouldBeCustomerDetailsOnTheScreen(int statusCode)
        {
            foreach (var restResponse in _restResponseList)
            {
                if (statusCode != (int)restResponse.StatusCode)
                {
                    ScenarioContext.Current.Pending();
                }

                CustomerContract contract = JsonConvert.DeserializeObject <CustomerContract>(restResponse.Content);
                //contract.FirstName.Should().Be("Trupti");
            }
        }
コード例 #29
0
        public void ThenTheResultShowsStatusCode(int statusCode)
        {
            foreach (var restResponse in _restResponseList)
            {
                if (statusCode != (int)restResponse.StatusCode)
                {
                    ScenarioContext.Current.Pending();
                }

                CustomerContract contract = JsonConvert.DeserializeObject <CustomerContract>(restResponse.Content);
                contract.Should().NotBeNull();
            }
        }
コード例 #30
0
ファイル: CustomerController.cs プロジェクト: amital/Hotels
        public async Task <IHttpActionResult> UpdateAsync(CustomerContract customer)
        {
            try
            {
                await customerService.UpdateAsync(customer.ToModel());

                return(Content(HttpStatusCode.Accepted, customer.CustomerId));
            }
            catch (KeyNotFoundException)
            {
                return(NotFound());
            }
        }
コード例 #31
0
ファイル: ConverterTest.cs プロジェクト: Zuxser/Modera
        private int CustomerConverter()
        {
            var reference = "CUSTOMERQWERTY1234";
            var expected = new CustomerContract{
                Address = "Test Address 1",
                FullName = reference,
                Notes = "Not much notes",
                Type = "Test"
            };

            var dao = new CustomerDao();
            dao.ProcessRequest(new CustomerOperationRequest{ Action = DataAction.Create, Customer = expected });
            var result = dao.ProcessRequest(new CustomerOperationRequest{ Action = DataAction.Read, NamePart = reference });

            var actual = result.Customers.FirstOrDefault();
            Assert.IsNotNull(actual);
            Assert.AreEqual(expected.Address, actual.Address);
            Assert.AreEqual(expected.FullName, actual.FullName);
            Assert.AreEqual(expected.Notes, actual.Notes);
            Assert.AreEqual(expected.Type, actual.Type);
            return actual.CustomerId.GetValueOrDefault();
        }
コード例 #32
0
ファイル: TimeUpBase.cs プロジェクト: haithemaraissia/Export
 public static void CustomerContract(CustomerGeneral customer, CustomerGeneral customerposter, ClosedProject cp)
 {
     if (customer == null) return;
     if (cp.HighestBid == null) return;
     var context = new SidejobEntities();
     if (cp.CurrencyID == null) return;
     var customercontract = new CustomerContract
     {
         ContractID = GetNextContractID(),
         BidderID = customer.CustomerID,
         BidderFirstName = customer.FirstName,
         BidderLastName = customer.LastName,
         BidderUsername = customer.UserName,
         ContractDate = DateTime.Now,
         ProjectID = cp.ProjectID,
         CurrencyID = (int)cp.CurrencyID,
         CustomerID = customer.CustomerID,
         HighestBid = (double)cp.HighestBid,
         PosterID = customerposter.CustomerID,
         PosterUsername = customerposter.UserName,
         PosterFirstName = customerposter.FirstName,
         PosterLastName = customerposter.LastName
     };
     context.AddToCustomerContracts(customercontract);
 }
コード例 #33
0
        public string Create(CustomerContractViewModel c)
        {
            string ret = "false";

            try
            {
                CustomerContract contract = new CustomerContract();
                contract.CallToArrivalRangeTime = c.CallToArrivalRangeTime;
                contract.CallToRepairRangeTime = c.CallToRepairRangeTime;
                contract.ContractAutoEndDate = c.ContractAutoEndDate;
                contract.ContractAutoSW = c.ContractAutoSW;
                contract.ContractCharDay = c.ContractCharDay;
                contract.ContractMark = c.ContractMark;
                contract.ContractMode = c.ContractMode;
                contract.ContractName = c.ContractName;
                contract.ContractNum = c.ContractNum;
                contract.ContractPeriod = c.ContractPeriod;
                contract.ContractSeq = c.ContractSeq;
                contract.ContractStatus = c.ContractStatus;
                contract.ContractSW = c.ContractSW;
                contract.CreateDateTime = DateTime.Now;
                contract.CreateUserID = c.CreateUserID;
                contract.CustomerRef = c.CustomerRef;
                contract.DeliveryDT = c.DeliveryDT;
                contract.MaintainBetweenDay = c.MaintainBetweenDay;
                contract.MaintainCoverageMemo = c.MaintainCoverageMemo;
                contract.MaintainEndDT = c.MaintainEndDT;
                contract.MaintainEndMonth = c.MaintainEndMonth;
                contract.MaintainEndMonthMemo = c.MaintainEndMonthMemo;
                contract.MaintainMonth01 = c.MaintainMonth01;
                contract.MaintainMonth02 = c.MaintainMonth02;
                contract.MaintainMonth03 = c.MaintainMonth03;
                contract.MaintainMonth04 = c.MaintainMonth04;
                contract.MaintainMonth05 = c.MaintainMonth05;
                contract.MaintainMonth06 = c.MaintainMonth06;
                contract.MaintainMonth07 = c.MaintainMonth07;
                contract.MaintainMonth08 = c.MaintainMonth08;
                contract.MaintainMonth09 = c.MaintainMonth09;
                contract.MaintainMonth10 = c.MaintainMonth10;
                contract.MaintainMonth11 = c.MaintainMonth11;
                contract.MaintainMonth12 = c.MaintainMonth12;
                contract.MaintainMonthDay = c.MaintainMonthDay;
                contract.MaintainMonthMemo = c.MaintainMonthMemo;
                contract.MaintainNum = c.MaintainNum;
                contract.MaintainReportOnly = c.MaintainReportOnly;
                contract.MaintainReportRuleMemo = c.MaintainReportRuleMemo;
                contract.MaintainStartDT = c.MaintainStartDT;
                contract.MaintainWholeMonthSW = c.MaintainWholeMonthSW;
                contract.ModifyDateTime = DateTime.Now;
                contract.ModifyUserID = c.CreateUserID;
                //contract.ProductClassID = c.ProductClassID;
                contract.ProductID = c.ProductID;
                contract.ProductQuantity = c.ProductQuantity;
                contract.ReceiptMemo = c.ReceiptMemo;
                contract.ReceiptMonth = c.ReceiptMonth;
                contract.ReceiptMonthMemo = c.ReceiptMonthMemo;
                contract.ReceiptPriceMemo = c.ReceiptPriceMemo;
                contract.ReceiptSW = c.ReceiptSW;
                contract.ReplaceOlderMemo = c.ReplaceOlderMemo;
                contract.SalesMemo = c.SalesMemo;
                contract.StandardMemo = c.StandardMemo;
                
                db.CustomerContract.Add(contract);
                db.SaveChanges();
                ret = "true";
            }
            catch
            {
            }
            return ret;
        }