Inheritance: System.Web.Services.WebService
Beispiel #1
0
        /// <summary>
        /// 获取一段时间内热销产品列表
        /// </summary>
        public static byte[] GetTopSellGoodsByTime(byte[] itemBuffer)
        {
            byte[] objRet = null;
            string beginDate = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, ParamFieldLength.BEGINDATE).Trim('\0');
            string endDate = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD + ParamFieldLength.BEGINDATE, ParamFieldLength.ENDDATE).Trim('\0');

            IList<TopSellGoods> topSellGoodsList = CustomersService.GetInstance().GetTopSellGoodsByTime(DateTime.Parse(beginDate), DateTime.Parse(endDate));
            if (topSellGoodsList == null || topSellGoodsList.Count == 0)
            {
                //获取单子失败
                objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            }
            else
            {
                //成功
                string json = JsonConvert.SerializeObject(topSellGoodsList);
                byte[] jsonByte = Encoding.UTF8.GetBytes(json);

                int transCount = BasicTypeLength.INT32 + BasicTypeLength.INT32 + jsonByte.Length;
                objRet = new byte[transCount];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
                Array.Copy(jsonByte, 0, objRet, 2 * BasicTypeLength.INT32, jsonByte.Length);
            }
            return objRet;
        }
Beispiel #2
0
        public void Setup()
        {
            var builder = new DbContextOptionsBuilder <BikesContext>().UseSqlServer(ConnectionString);

            _context = new BikesContext(builder.Options);
            _service = new CustomersService(_context);

            using (var transaction = _context.Database.BeginTransaction())
            {
                _context.Customers.Add(new Customer
                {
                    Id        = 1,
                    FirstName = "First",
                    LastName  = "Last",
                    Address   = "1 Street",
                    Phone     = "123-123-1234",
                    StartDate = DateTime.UtcNow
                });

                _context.Database.ExecuteSqlCommand(@"SET IDENTITY_INSERT [Customers] ON");
                _context.SaveChanges();
                _context.Database.ExecuteSqlCommand(@"SET IDENTITY_INSERT [Customers] OFF");
                transaction.Commit();
            }
        }
Beispiel #3
0
 public RevenuesController()
 {
     revenueService  = new RevenueService();
     accountService  = new AccountService();
     categoryService = new CategoryService();
     customerService = new CustomersService();
 }
        // GET: Customers
        public ActionResult CustomersList()
        {
            List <Customer> customerList = new CustomersService().GetAllCustomer();

            ViewBag.list = customerList;
            return(View("Customers"));
        }
Beispiel #5
0
        private void btnIgnore_Click(object sender, EventArgs e)
        {
            int  status    = 2; //忽略
            bool hasChange = false;

            foreach (DataGridViewRow dgvRow in dgvCallRecord.Rows)
            {
                if ((bool)dgvRow.Cells[0].Value)
                {
                    CallRecord callRecord = new CallRecord();
                    callRecord.CallRecordID = new Guid(dgvRow.Cells[4].Value.ToString());
                    callRecord.Status       = status;
                    hasChange = CustomersService.GetInstance().CreateOrUpdateCallRecord(callRecord);
                }
            }
            if (hasChange)
            {
                status = 0; //未接来电
                IList <CallRecord> callRecordList = CustomersService.GetInstance().GetCallRecordByStatus(status);
                if (callRecordList != null && callRecordList.Count > 0)
                {
                    dgvCallRecord.Rows.Clear();
                    foreach (CallRecord item in callRecordList)
                    {
                        int index = dgvCallRecord.Rows.Add();
                        dgvCallRecord.Rows[index].Cells[0].Value = false;
                        dgvCallRecord.Rows[index].Cells[1].Value = item.Telephone;
                        dgvCallRecord.Rows[index].Cells[2].Value = item.CustomerName;
                        dgvCallRecord.Rows[index].Cells[3].Value = item.CallTime.ToString("yyyy-MM-dd HH:mm");
                        dgvCallRecord.Rows[index].Cells[4].Value = item.CallRecordID;
                    }
                }
            }
        }
 public CustomersServiceTests()
 {
     _service = new CustomersService(_customerProfileClientMock.Object, _mapperMock.Object,
                                     _privateBlockchainFacadeClientMock.Object, _partnerAndLocationHelperMock.Object,
                                     _tiersMock.Object, EmptyLogFactory.Instance, _partnerManagementClientMock.Object,
                                     _eligibilityEngineClientMock.Object);
 }
Beispiel #7
0
        /// <summary>
        /// 获取最近一个月特定状态通话记录
        /// </summary>
        public static byte[] GetCallRecordByStatus(byte[] itemBuffer)
        {
            byte[] objRet = null;
            int    status = BitConverter.ToInt32(itemBuffer, ParamFieldLength.PACKAGE_HEAD);

            IList <CallRecord> callRecordList = CustomersService.GetInstance().GetCallRecordByStatus(status);

            if (callRecordList == null || callRecordList.Count == 0)
            {
                //获取单子失败
                objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            }
            else
            {
                //成功
                string json     = JsonConvert.SerializeObject(callRecordList);
                byte[] jsonByte = Encoding.UTF8.GetBytes(json);

                int transCount = BasicTypeLength.INT32 + BasicTypeLength.INT32 + jsonByte.Length;
                objRet = new byte[transCount];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
                Array.Copy(jsonByte, 0, objRet, 2 * BasicTypeLength.INT32, jsonByte.Length);
            }
            return(objRet);
        }
 public MusterilerController()
 {
     if (customersService == null)
     {
         customersService = new CustomersService();
     }
 }
Beispiel #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            ReminderOrder reminderOrder = new ReminderOrder
            {
                OrderID            = new Guid("15629db5-f2bc-4d01-9142-064886f4fdad"),
                OrderDetailsIDList = new List <Guid>
                {
                    new Guid("C5D49437-D8D5-44D0-B4DC-21D7ECB2D813"),
                    new Guid("8191C8C9-10C2-43E7-98B1-CE13343DFFB0")
                },
                EmployeeNo = "999999",
                ReasonName = "加紧"
            };
            bool success = ReminderOrderService.GetInstance().CreateReminderOrder(reminderOrder);

            var customers = CustomersService.GetInstance().GetAllCustomerInfo();
            var basicData = SysBasicDataService.GetInstance().GetSysBasicData();

            Employee employee = null;
            int      result   = EmployeeService.GetInstance().GetEmployee(this.textBox1.Text, this.textBox2.Text, out employee);

            if (result == 1)
            {
            }
        }
        public void should_call_CreateNote()
        {
            //arrange
            var result = new CustomersService(Config).CreateCustomer(new Customer
            {
                Company   = "Test Company Name",
                BillAddr1 = "16 Dog Lane",
                BillAddr2 = "Suite D",
                BillCity  = "Storrs",
                BillState = "CT",
            });

            var request = new Note
            {
                NoteDetails = "Here is my test note",
                ObjType     = "customer",
                ObjId       = result.Id
            };
            //act
            var actual = Sut.CreateNote(request);

            //assert
            Assert.AreEqual(201, actual.Code);
            Assert.IsEmpty(actual.Message);
            Assert.AreEqual("OK", actual.Status);
        }
Beispiel #11
0
 public SalesController()
 {
     this.saleService      = new SalesService(new EfGenericRepository <Sale>(Data.Context()));
     this.customersService = new CustomersService(new EfGenericRepository <Customer>(Data.Context()));
     this.carsService      = new CarsService(new EfGenericRepository <Car>(Data.Context()),
                                             new PartsService(new EfGenericRepository <Part>(Data.Context())));
 }
Beispiel #12
0
        public async Task UserTriesToChangePassword_EverythingValid_Successful()
        {
            var customerProfileClient = new Mock <ICustomerProfileClient>();

            customerProfileClient.Setup(c => c.CustomerProfiles.GetByCustomerIdAsync(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <bool>()))
            .ReturnsAsync(
                new CustomerProfileResponse
            {
                Profile = new CustomerProfile
                {
                    Email = "*****@*****.**"
                }
            });

            var credentialsClient = new Mock <ICredentialsClient>();

            credentialsClient.Setup(c => c.Api.ChangePasswordAsync(It.IsAny <CredentialsUpdateRequest>()))
            .ReturnsAsync(new CredentialsUpdateResponse());


            var postProcessService = new Mock <IPostProcessService>();

            var customerFlagsRepository = new Mock <ICustomerFlagsRepository>();

            customerFlagsRepository
            .Setup(c => c.GetByCustomerIdAsync(It.IsAny <string>()))
            .ReturnsAsync(new CustomerFlagsEntity {
                IsBlocked = false
            });

            var sessionsServiceClient = new Mock <ISessionsServiceClient>();

            CustomersService customersService;

            using (var logFactory = LogFactory.Create().AddUnbufferedConsole())
            {
                customersService = new CustomersService(
                    credentialsClient.Object,
                    postProcessService.Object,
                    customerProfileClient.Object,
                    customerFlagsRepository.Object,
                    sessionsServiceClient.Object,
                    _passwordSuccessfulChangeEmailTemplateId,
                    _passwordSuccessfulChangeEmailSubjectTemplateId,
                    logFactory,
                    MaxBatchValue,
                    _publisher.Object,
                    _customerBlockEmailTemplateId,
                    _customerUnBlockEmailTemplateId,
                    _customerBlockSubjectTemplateId,
                    _customerUnBlockSubjectTemplateId,
                    _customerSupportPhoneNumber);
            }

            var expected = new ChangePasswordResultModel();
            var actual   = await customersService.ChangePasswordAsync("customerId", "password");


            Assert.Equal(expected.Error, actual.Error);
        }
Beispiel #13
0
        public async Task BlockingCustomer_CustomerAlreadyBlocked_BusinessErrorIsReturned()
        {
            var customerProfileClient = new Mock <ICustomerProfileClient>();

            customerProfileClient.Setup(c => c.CustomerProfiles.GetByCustomerIdAsync(It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <bool>()))
            .ReturnsAsync(
                new CustomerProfileResponse
            {
                ErrorCode = CustomerProfileErrorCodes.None,
                Profile   = new CustomerProfile
                {
                    Email = "*****@*****.**"
                }
            });

            var credentialsClient = new Mock <ICredentialsClient>();

            var postProcessService = new Mock <IPostProcessService>();

            var customerFlagsRepository = new Mock <ICustomerFlagsRepository>();

            customerFlagsRepository
            .Setup(x => x.GetByCustomerIdAsync(It.IsAny <string>()))
            .ReturnsAsync(new CustomerFlagsEntity {
                IsBlocked = true
            });

            var sessionsServiceClient = new Mock <ISessionsServiceClient>();

            CustomersService customersService;

            using (var logFactory = LogFactory.Create().AddUnbufferedConsole())
            {
                customersService = new CustomersService(
                    credentialsClient.Object,
                    postProcessService.Object,
                    customerProfileClient.Object,
                    customerFlagsRepository.Object,
                    sessionsServiceClient.Object,
                    _passwordSuccessfulChangeEmailTemplateId,
                    _passwordSuccessfulChangeEmailSubjectTemplateId,
                    logFactory,
                    MaxBatchValue,
                    _publisher.Object,
                    _customerBlockEmailTemplateId,
                    _customerUnBlockEmailTemplateId,
                    _customerBlockSubjectTemplateId,
                    _customerUnBlockSubjectTemplateId,
                    _customerSupportPhoneNumber);
            }

            var expectedCode = CustomerBlockErrorCode.CustomerAlreadyBlocked;
            var actualCode   = await customersService.BlockCustomerAsync(Guid.NewGuid().ToString());

            Assert.Equal(expectedCode, actualCode);

            sessionsServiceClient
            .Verify(x => x.SessionsApi.DeleteSessionIfExistsAsync(It.IsAny <string>()),
                    Times.Never);
        }
Beispiel #14
0
        public static byte[] GetCustomerInfoByPhone(byte[] itemBuffer)
        {
            byte[] objRet    = null;
            string telephone = Encoding.UTF8.GetString(itemBuffer, ParamFieldLength.PACKAGE_HEAD, ParamFieldLength.TELEPHONE).Trim('\0');

            CustomerInfo customerInfo = CustomersService.GetInstance().GetCustomerInfoByPhone(telephone);

            if (customerInfo == null)
            {
                //根据联系电话获取客户信息失败
                objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            }
            else
            {
                //成功
                string json     = JsonConvert.SerializeObject(customerInfo);
                byte[] jsonByte = Encoding.UTF8.GetBytes(json);

                int transCount = BasicTypeLength.INT32 + BasicTypeLength.INT32 + jsonByte.Length;
                objRet = new byte[transCount];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
                Array.Copy(jsonByte, 0, objRet, 2 * BasicTypeLength.INT32, jsonByte.Length);
            }
            return(objRet);
        }
Beispiel #15
0
        public static byte[] GetAllCustomerInfo()
        {
            byte[] objRet = null;

            IList <CustomerInfo> customerInfoList = CustomersService.GetInstance().GetAllCustomerInfo();

            if (customerInfoList == null || customerInfoList.Count == 0)
            {
                //根据客户名字获取客户信息失败
                objRet = new byte[ParamFieldLength.PACKAGE_HEAD];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.ERROR_DB), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(ParamFieldLength.PACKAGE_HEAD), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
            }
            else
            {
                //成功
                string json     = JsonConvert.SerializeObject(customerInfoList);
                byte[] jsonByte = Encoding.UTF8.GetBytes(json);

                int transCount = BasicTypeLength.INT32 + BasicTypeLength.INT32 + jsonByte.Length;
                objRet = new byte[transCount];
                Array.Copy(BitConverter.GetBytes((int)RET_VALUE.SUCCEEDED), 0, objRet, 0, BasicTypeLength.INT32);
                Array.Copy(BitConverter.GetBytes(transCount), 0, objRet, BasicTypeLength.INT32, BasicTypeLength.INT32);
                Array.Copy(jsonByte, 0, objRet, 2 * BasicTypeLength.INT32, jsonByte.Length);
            }
            return(objRet);
        }
        public CustomersServiceTest()
        {
            CustomersRepositoryMock = new Mock <ICustomersRepository>();
            VehiclesRepositoryMock  = new Mock <IVehiclesRepository>();
            UnitOfWorkFactoryMock   = new Mock <IUnitOfWorkFactory>();
            UnitOfWorkMock          = new Mock <IUnitOfWork>();

            ServiceUnderTest = new CustomersService(CustomersRepositoryMock.Object, UnitOfWorkFactoryMock.Object);

            UnitOfWorkFactoryMock
            .Setup(x => x.GetInstance())
            .Returns(UnitOfWorkMock.Object);

            UnitOfWorkMock
            .Setup(x => x.CustomersRepository)
            .Returns(CustomersRepositoryMock.Object);

            UnitOfWorkMock
            .Setup(x => x.VehiclesRepository)
            .Returns(VehiclesRepositoryMock.Object);

            pagingOptions = new PagingOptions {
                Offset = 0, Limit = 5
            };
        }
Beispiel #17
0
        public ActionResult Index(int pageSize = 5, int pageIndex = 1)
        {
            try
            {
                var userId = CurrentMember.MemberId.ToString();
                var user   = new CustomersService().GetById(userId);
                //var model = new OrderService().GetOrdersByCustomerId(userId);

                ViewBag.FullName     = CurrentMember.DisplayName;
                ViewBag.CustomerType = user.CustomerType;
                if (user == null)
                {
                    user = new Customers();
                }
                ViewBag.Member      = user;
                ViewBag.MemberLevel = _memberLevelService.GetMemberLevelByLevelVal(user.MemberLevelValue);

                int count = 0;
                var data  = new OrderService().GetOrdersByCustomerId(userId, out count, pageSize, pageIndex);
                PageHelper.PagerInfo pager = new PageHelper.PagerInfo();
                pager.CurrentPageIndex = pageIndex;
                pager.PageSize         = pageSize;
                pager.RecordCount      = count;

                PageHelper.PagerQuery <PageHelper.PagerInfo, List <FCake.Domain.Entities.Orders> > pageInfo = new PageHelper.PagerQuery <PageHelper.PagerInfo, List <FCake.Domain.Entities.Orders> >(pager, data);
                return(View(pageInfo));
            }
            catch
            {
                return(View());
            }
        }
Beispiel #18
0
        public async Task CreateCustomerShouldUpdateExistingCustomer()
        {
            var options = new DbContextOptionsBuilder <WHMSDbContext>().UseInMemoryDatabase(databaseName: Guid.NewGuid().ToString()).Options;

            using var context = new WHMSDbContext(options);
            context.Customers.Add(new Customer {
                Email = "*****@*****.**", FirstName = "Pesho", LastName = "Peshov", PhoneNumber = "000000"
            });
            await context.SaveChangesAsync();

            var service = new CustomersService(context);
            var model   = new CustomerViewModel {
                Email = "*****@*****.**", FirstName = "Test", LastName = "Testov", PhoneNumber = "123451234"
            };

            await service.CreateOrUpdateCustomerAsync(model);

            var dbCustomer = context.Customers.FirstOrDefault();

            Assert.NotNull(dbCustomer);
            Assert.Equal("*****@*****.**", dbCustomer.Email);
            Assert.Equal("Test", dbCustomer.FirstName);
            Assert.Equal("Testov", dbCustomer.LastName);
            Assert.Equal("123451234", dbCustomer.PhoneNumber);
        }
Beispiel #19
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         Customers cus = new Customers();
         cus.AppId    = Request.QueryString.Get("id");
         cus.FullName = Request.QueryString.Get("name");
         cus.Email    = Request.QueryString.Get("email");
         DataTable dt = CustomersService.Customers_GetByAppId(StringClass.SqlInjection(cus.AppId));
         if (dt.Rows.Count == 0)
         {
             int id = CustomersService.Customers_Insert(cus);
             cus.Id          = id.ToString();
             Session["Info"] = cus;
         }
         else
         {
             cus.Id          = dt.Rows[0]["Id"].ToString();
             cus.AppId       = dt.Rows[0]["AppId"].ToString();
             cus.UserName    = dt.Rows[0]["UserName"].ToString();
             cus.FullName    = dt.Rows[0]["FullName"].ToString();
             cus.Phone       = dt.Rows[0]["Phone"].ToString();
             cus.Email       = dt.Rows[0]["Email"].ToString();
             Session["Info"] = cus;
         }
     }
     catch (Exception ex)
     {
         MailSender.SendMail("", "", "Error System", ex.Message + "\n" + ex.StackTrace);
     }
 }
Beispiel #20
0
        public async Task GetAllCustomers_ShouldReturnListOfCustomerDto()
        {
            var customersList = new List <Customer>
            {
                new() { Id = 1, FirstName = "FirstName1", LastName = "LastName1" },
                new() { Id = 2, FirstName = "FirstName2", LastName = "LastName2" }
            };
            var customerDtoList = new List <CustomerDto>
            {
                new() { Id = 1, FirstName = "FirstName1", LastName = "LastName1" },
                new() { Id = 2, FirstName = "FirstName2", LastName = "LastName2" }
            };

            _mapper.Setup(x => x.Map <IList <CustomerDto> >(customersList)).Returns(customerDtoList);
            _allCustomersQuery.Setup(x => x.Get()).ReturnsAsync(customersList);

            var sut = new CustomersService(_logger.Object, _mapper.Object, null, _allCustomersQuery.Object, null, null);

            var result = await sut.GetAllCustomers();

            IsAssignableFrom <IList <CustomerDto> >(result);
            Equal(customerDtoList.First().Id, customersList.First().Id);
            Equal(customerDtoList.First().FirstName, customersList.First().FirstName);
            Equal(customerDtoList.First().LastName, customersList.First().LastName);
        }
        protected async Task DeleteCustomer()
        {
            await JSRuntime.InvokeAsync <bool>("customModal.hideDeleteDialog");

            await CustomersService.DeleteCustomer(DeleteId);

            await LoadCustomers(int.Parse(Page ?? "1"));
        }
Beispiel #22
0
        public async Task GetAllCustomers_AllCustomersQuery_Get_ResultShouldBeMappedFromCustomerListToCustomerDtoList()
        {
            var sut = new CustomersService(_logger.Object, _mapper.Object, null, _allCustomersQuery.Object, null, null);

            await sut.GetAllCustomers();

            _mapper.Verify(x => x.Map <IList <CustomerDto> >(new List <Customer>()), Times.Once());
        }
Beispiel #23
0
        public async Task GetAllCustomers_AllCustomersQuery_Get_ShouldBeInvoked()
        {
            var sut = new CustomersService(_logger.Object, _mapper.Object, null, _allCustomersQuery.Object, null, null);

            await sut.GetAllCustomers();

            _allCustomersQuery.Verify(x => x.Get(), Times.Once());
        }
Beispiel #24
0
        public async Task GetAllCustomers_LogInformation_WhenMethodWasCalledAsync()
        {
            var sut = new CustomersService(_logger.Object, _mapper.Object, null, _allCustomersQuery.Object, null, null);

            await sut.GetAllCustomers();

            _logger.Verify(x => x.LogInformation("Method GetAllCustomers Invoked."), Times.Once);
        }
Beispiel #25
0
        public async Task GetAllCustomers_NoCustomersShouldReturnEmptyListAsync()
        {
            var sut = new CustomersService(_logger.Object, _mapper.Object, null, _allCustomersQuery.Object, null, null);

            var result = await sut.GetAllCustomers();

            Empty(result);
        }
Beispiel #26
0
            public void ShouldCallCustomerService()
            {
                var actionResult = Controller.IndexAsync(new SearchCustomersViewModel {
                    SearchTerm = SearchTerm
                });

                CustomersService.Verify(_ => _.SearchCustomersAsync(It.Is <String>(s => s == SearchTerm)), Times.Once());
            }
Beispiel #27
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            CustomerInfo customerInfo = new CustomerInfo
            {
                Telephone        = this.txtTelephone.Text.Trim(),
                CustomerName     = this.txtName.Text.Trim(),
                DeliveryAddress1 = this.txtAddress1.Text.Trim(),
                DeliveryAddress2 = this.txtAddress2.Text.Trim(),
                DeliveryAddress3 = this.txtAddress3.Text.Trim()
            };

            if (!string.IsNullOrEmpty(customerInfo.DeliveryAddress3))
            {
                customerInfo.ActiveIndex = 3;
            }
            if (!string.IsNullOrEmpty(customerInfo.DeliveryAddress2))
            {
                customerInfo.ActiveIndex = 2;
            }
            if (!string.IsNullOrEmpty(customerInfo.DeliveryAddress1))
            {
                customerInfo.ActiveIndex = 1;
            }
            customerInfo.LastModifiedEmployeeID = ConstantValuePool.CurrentEmployee.EmployeeID;

            if (string.IsNullOrEmpty(customerInfo.Telephone))
            {
                MessageBox.Show("联系电话不能为空!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (string.IsNullOrEmpty(customerInfo.CustomerName))
            {
                MessageBox.Show("客户名称不能为空!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (customerInfo.ActiveIndex <= 0)
            {
                MessageBox.Show("客户的地址信息不能为空!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            int result = CustomersService.GetInstance().CreateCustomerInfo(customerInfo);

            if (result == 1)
            {
                MessageBox.Show("创建客户信息成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (result == 2)
            {
                MessageBox.Show("联系电话已存在,不能重复添加!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                MessageBox.Show("创建客户信息失败,请重新操作!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Beispiel #28
0
 public SalesController()
 {
     db = new DbContext();
     customersService = new CustomersService(db);
     filesService     = new FilesService(db);
     reportsService   = new ReportService(db);
     salesmansService = new SalesmansService(db);
     salesService     = new SalesService(db);
 }
Beispiel #29
0
        private void btnLoadCustomer_Click(object sender, EventArgs e)
        {
            IList <CustomerInfo> customerInfoList = CustomersService.GetInstance().GetAllCustomerInfo();

            if (customerInfoList != null && customerInfoList.Count > 0)
            {
                m_CustomerInfoList = customerInfoList;
                ReBindCustomerInfo(customerInfoList);
            }
        }
Beispiel #30
0
        public ActionResult LoadCustomersOutIds(string ids, string name, string tel, int page = 1, int rows = 10)
        {
            PageInfo pageInfo = new PageInfo()
            {
                Page = page, Rows = rows
            };
            var data = new CustomersService().SearchCustomersByWhere(ids, name, tel, pageInfo);

            return(Json(data));
        }
        public void GetAll_DTO_Success()
        {
            //Arrange
            using (var context = new ManagementContext())
            {
                var unitOfWork = new DatabaseUnitOfWork(context);
                var customerRepository = new CustomerRepository(unitOfWork);
                var sut = new CustomersService(customerRepository);

                Mapper.CreateMap<Customer, CustomerDTO>()
                    .ForMember(dst => dst.CustomerId, opt => opt.MapFrom(src => src.Id));

                Assert.Greater(sut.GetAll_DTO("C").Count(), 0);
            }
        }
Beispiel #32
0
        private long? Add(int docNum, string ccy, DateTime date, string accountIBAN, decimal amount, string purpose, string cashDeskSymbol, int userId)
        {
            #region OrdersService
            OrdersService o = new OrdersService();
            o.RequestHeadersValue = new OrdersAPI.RequestHeaders() { ApplicationKey = "BusinessCreditClient", RequestId = DateTime.Now.ToLongTimeString() };
            #endregion

            #region CustomersService
            CustomersService c = new CustomersService();
            c.RequestHeadersValue = new CustomersAPI.RequestHeaders() { ApplicationKey = "BusinessCreditClient", RequestId = DateTime.Now.ToLongTimeString() };
            #endregion

            #region CustomersService
            AccountsService a = new AccountsService();
            a.RequestHeadersValue = new AccountsAPI.RequestHeaders() { ApplicationKey = "BusinessCreditClient", RequestId = DateTime.Now.ToLongTimeString() };
            #endregion

            var acc = a.GetAccount(AccountControlFlags.Basic, true, new AccountsAPI.InternalAccountIdentification() { IBAN = accountIBAN }, ccy);
            var cus = c.GetCustomer(CustomerControlFlags.Basic, true, acc.CustomerId.Value, true);
            var cusEntity = cus.Entity as IndividualEntity;

            #region Variables
            long id;
            bool specified;
            #endregion

            #region Order Init
            var Order = new CashOrderData
            {
                Amount = new OrdersAPI.AmountAndCurrency { Amount = amount, Ccy = ccy },
                Date = date,
                Status = OrdersAPI.TransactionStatus.Green,
                StatusSpecified = true,
                TransactionCode = "qwe34242342", //09
                OpCode = "120",
                Purpose = purpose,
                //ExtraAccount = 0,
                //ExtraAccountSpecified = false,
                CustomerAccount = new OrdersAPI.InternalAccountIdentification { IBAN = accountIBAN },
                OrderDate = date,
                OrderDateSpecified = true,
                Type = CashOrderType.Deposit,
                Customer = new CustomerData { Name = (OrdersAPI.PersonName)cusEntity.Name },
                //DeptId = 5,
                //DeptIdSpecified = true,
                DocNum = 555847,
                DocNumSpecified = docNum == 0 ? false : true
            };

            cusEntity = (c.GetCustomer(CustomerControlFlags.IdentityDocuments, true, acc.CustomerId.Value, true).Entity as IndividualEntity);

            Order.Customer.IdentityDocument = (OrdersAPI.IdentityDocument)cusEntity.IdentityDocuments[0];
            #endregion

            #region Put Order
            o.PutOrder(new OrdersAPI.UserAndDeptId()
            {
                DeptId = 2,
                DeptIdSpecified = true,
                UserIdentification = new OrdersAPI.UserIdentification() { Id = 21, IdSpecified = true }
            }, 0, false,
                   new Guid().ToString(),
                   true, true, false, true, Order, out id, out specified);
            #endregion

            return id;
        }