public void TestUpdateEntiyWithGet(AddressDto _AddressDto)
        {
            IAddressBO _AddressBO = new AddressBO(new FakeAddressConverter());
            var        dbResult   = _AddressBO.UpdateEntiyWithGet(_AddressDto);

            Assert.NotNull(dbResult);
        }
Ejemplo n.º 2
0
        public AddressBO GetAddress(Guid AddrKey)
        {
            AddressBO _address = new AddressBO();

            using (var cmd = new NpgsqlCommand("SELECT * from dbo.fn_get_address(@addrkey)", new NpgsqlConnection(connString)))
            {
                cmd.Parameters.Add(new NpgsqlParameter("@addrkey", DbType.Guid)
                {
                    Direction = ParameterDirection.Input
                });
                using (var reader = cmd.ExecuteReader())
                {
                    _address.Name     = reader["addrname"].ToString();
                    _address.Address1 = reader["address1"].ToString();
                    _address.Address2 = reader["address2"].ToString();
                    _address.City     = reader["city"].ToString();
                    _address.State    = reader["state"].ToString();
                    _address.Country  = reader["country"].ToString();
                    _address.Zip      = reader["zip"].ToString();
                    _address.Phone    = reader["phone"].ToString();
                    _address.Fax      = reader["fax"].ToString();
                    _address.WebSite  = reader["website"].ToString();
                    _address.Email    = reader["email"].ToString();
                }
            }
            return(_address);
        }
        public void TestUpdateWithAttachEntiy(AddressDto _AddressDto)
        {
            IAddressBO _AddressBO = new AddressBO(new FakeAddressConverter());
            bool       isUpdated  = _AddressBO.UpdateWithAttachEntiy(_AddressDto);

            Assert.True(isUpdated);
        }
Ejemplo n.º 4
0
        public HttpResponseMessage GetbyName(string name)
        {
            AddressRepository repo = new AddressRepository();
            var address            = repo.GetbyField(name);

            if (address != null)
            {
                AddressBO bo = new AddressBO()
                {
                    Address1 = address.address1,
                    Address2 = address.address2,
                    City     = address.city,
                    State    = address.state,
                    Zip      = address.zipcode,
                    Email    = address.email,
                    Email2   = address.email2,
                    Fax      = address.fax,
                    Phone    = address.phone,
                    Phone2   = address.phone2,
                    Name     = address.addrname
                };
                return(Request.CreateResponse(HttpStatusCode.OK, bo,
                                              Configuration.Formatters.JsonFormatter));
            }
            return(Request.CreateResponse(HttpStatusCode.NoContent, "Not found"));
        }
        public void TestAdd(AddressDto _AddressDto)
        {
            IAddressBO _AddressBO = new AddressBO(new FakeAddressConverter());
            bool       hasAdded   = _AddressBO.CreateEntiy(_AddressDto);

            Assert.True(hasAdded);
        }
Ejemplo n.º 6
0
        public ActionResult CreateWithdrawalRequest([FromBody] AddressBO addressBO)
        {
            try
            {
                // GET SESSIONS
                SessionController sessionController = new SessionController();
                TblUserAuth       userAuth          = sessionController.GetSession(HttpContext.Session);

                UserResponseBO _apiResponse = new UserResponseBO();

                _apiResponse.HttpStatusCode = "200";
                _apiResponse.Message        = "Transaction successful";
                _apiResponse.Status         = "Success";

                return(Ok(_apiResponse));
            }
            catch (Exception ex)
            {
                ApiResponseBO _apiResponse = new ApiResponseBO();
                _apiResponse.HttpStatusCode = "400";
                _apiResponse.Message        = ex.Message;
                _apiResponse.Status         = "Error";

                return(BadRequest(_apiResponse));
            }
        }
Ejemplo n.º 7
0
 public AdministrationController()
 {
     addressBO      = new AddressBO(SESSIONOBJ);
     companyBO      = new CompanyBO(SESSIONOBJ);
     branchBO       = new BranchBO(SESSIONOBJ);
     contributionBO = new ContributionBO(SESSIONOBJ);
 }
        public void TestDeleteEntiy(AddressDto _AddressDto)
        {
            IAddressBO _AddressBO = new AddressBO(new FakeAddressConverter());
            bool       isDeleted  = _AddressBO.DeleteEntiy(_AddressDto);

            Assert.True(isDeleted);
        }
Ejemplo n.º 9
0
 public IActionResult Post([FromBody] AddressBO address)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     return(Ok(facade.AddressService.Create(address)));
 }
Ejemplo n.º 10
0
 public AddressBO Create(AddressBO address)
 {
     using (var uow = facade.UnitOfWork)
     {
         var _address = uow.AddressRepository.Create(conv.Convert(address));
         uow.complete();
         return(conv.Convert(_address));
     }
 }
        public void TestFindEntiesWithSimplePaging(AddressDto _AddressDto)
        {
            IAddressBO _AddressBO = new AddressBO(new AddressConverter());
            bool       hasAdded   = _AddressBO.CreateEntiy(_AddressDto);
            var        dbResult   = _AddressBO.FindEnties(1, 10);

            Assert.NotNull(dbResult);
            Assert.True(dbResult.Count > 0);
        }
Ejemplo n.º 12
0
 public AddressBO Create(AddressBO address)
 {
     using (var uow = _facade.UnitOfWork)
     {
         var newaddress = uow.AddressRepository.Create(_conv.Convert(address));
         uow.Complete();
         return(_conv.Convert(newaddress));
     }
 }
Ejemplo n.º 13
0
 public FedexShipServiceClient(CourierConfigBO credentials, decimal weight, string packagingType, AddressBO senderBO, AddressBO receiverBO, string path)
 {
     _credentials   = credentials;
     _weight        = weight;
     _packagingType = packagingType;
     _senderBO      = senderBO;
     _receiverBO    = receiverBO;
     _path          = path;
 }
Ejemplo n.º 14
0
 public AddressBO Create(AddressBO address)
 {
     using (var uow = _facade.UnitOfWork)                                         //enter the access to database
     {
         var addressEntity = uow.AddressRepository.Create(conv.Convert(address)); //create a order
         uow.Complete();                                                          //save changes
         return(conv.Convert(addressEntity));
     }
 }
        public void TestGetEntiyByPK(Int32 pkid)
        {
            IAddressBO _AddressBO = new AddressBO(new FakeAddressConverter());
            var        dtoEntity  = new AddressDto()
            {
                AddressID = pkid
            };
            var dbResult = _AddressBO.GetEntiyByPK(dtoEntity);

            Assert.NotNull(dbResult);
        }
Ejemplo n.º 16
0
        public AddressBO Delete(int id)
        {
            AddressBO addressBO = Get(id);

            using (var uow = facade.UnitOfWork)
            {
                uow.AddressRepository.Delete(id);
                uow.complete();
            }
            return(addressBO);
        }
 private void AddressForm_Load(object sender, EventArgs e)
 {
     dgvAddressBook.SelectionMode           = DataGridViewSelectionMode.FullRowSelect;
     dgvAddressBook.AutoGenerateColumns     = false;
     dgvAddressBook.ReadOnly                = true;
     dgvAddressBook.AllowUserToAddRows      = false;
     dgvAddressBook.AllowUserToDeleteRows   = false;
     dgvAddressBook.AllowUserToOrderColumns = false;
     dgvAddressBook.MultiSelect             = false;
     dgvAddressBook.DataSource              = AddressBO.GetAddress();
 }
        public void TestFindEnties(AddressDto _AddressDto)
        {
            IAddressBO _AddressBO = new AddressBO(new AddressConverter());
            bool       hasAdded   = _AddressBO.CreateEntiy(_AddressDto);
            var        dbResult   = _AddressBO.FindEnties(new PagedList <AddressDto> {
                _AddressDto
            });

            Assert.NotNull(dbResult);
            Assert.True(dbResult.Total > 0);
        }
Ejemplo n.º 19
0
 public IHttpActionResult SaveAddress(Address address)
 {
     try
     {
         var result = new AddressBO().SaveAddress(address);
         return(Ok(result ? UTILITY.SUCCESSMSG : UTILITY.FAILEDMSG));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
Ejemplo n.º 20
0
 public AddressBO Update(AddressBO address)
 {
     using (var uow = facade.UnitOfWork)
     {
         var ad = uow.AddressRepository.Get(address.Id);
         address.City   = ad.City;
         address.Number = ad.Number;
         address.Street = ad.Street;
         uow.complete();
         return(conv.Convert(ad));
     }
 }
Ejemplo n.º 21
0
 public IHttpActionResult List(string addressLinkID)
 {
     try
     {
         var addressList = new AddressBO().GetList(addressLinkID);
         return(Ok(addressList));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
        private void btnFilter_Click(object sender, EventArgs e)
        {
            int id = (int)(cmbStateId.SelectedValue);

            if (cmbIsActive.SelectedIndex == 0)
            {
                dgvAddressBook.DataSource = AddressBO.FilteredAddressbook(id, true);
            }
            if (cmbIsActive.SelectedIndex == 1)
            {
                dgvAddressBook.DataSource = AddressBO.FilteredAddressbook(id, false);
            }
        }
Ejemplo n.º 23
0
 public IHttpActionResult DeleteAddress(int addressID)
 {
     try
     {
         var result = new AddressBO().DeleteAddress(new Address {
             AddressId = addressID
         });
         return(Ok(result ? UTILITY.DELETEMSG : UTILITY.FAILEDMSG));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
Ejemplo n.º 24
0
 private BusinessManager()
 {
     this.montlyClientBO = new ClientBO();
     this.collaboratorBO = new CollaboratorBO();
     this.localManagerBO = new LocalManagerBO();
     this.globalManagerBO = new GlobalManagerBO();
     this.parkingBO = new ParkingBO();
     this.parkingSpaceBO = new ParkingSpaceBO();
     this.priceBO = new PriceBO();
     this.addressBO = new AddressBO();
     this.tagBO = new TagBO();
     this.plateBO = new PlateBO();
     this.usageRecordsBO = new UsageRecordBO();
 }
Ejemplo n.º 25
0
 public IHttpActionResult GetAddress(int addressID)
 {
     try
     {
         var address = new AddressBO().GetAddress(new Address {
             AddressId = addressID
         });
         return(Ok(address));
     }
     catch (Exception ex)
     {
         return(InternalServerError(ex));
     }
 }
Ejemplo n.º 26
0
 internal Address Convert(AddressBO address)
 {
     if (address == null)
     {
         return(null);
     }
     return(new Address()
     {
         Id = address.Id,
         City = address.City,
         Number = address.Number,
         Street = address.Street
     });
 }
Ejemplo n.º 27
0
 internal Address Convert(AddressBO addressBO)
 {
     if (addressBO == null)
     {
         return(null);
     }
     ;
     return(new Address()
     {
         City = addressBO.City,
         Id = addressBO.Id,
         Number = addressBO.Number,
         Street = addressBO.Street
     });
 }
Ejemplo n.º 28
0
 public EmployeeController()
 {
     empHeaderBO         = new EmployeeHeaderBO(SESSIONOBJ);
     empPersonalDetailBO = new EmployeePersonalDetailBO(SESSIONOBJ);
     empDocDetailBO      = new EmployeeDocumentDetailBO(SESSIONOBJ);
     empWorkDetailBO     = new EmployeeWorkDetailBO(SESSIONOBJ);
     addressBO           = new AddressBO(SESSIONOBJ);
     userBo                  = new UserBO(SESSIONOBJ);
     leaveTransactionBO      = new LeaveTrasactionBO(SESSIONOBJ);
     lookUpBO                = new LookUpBO(SESSIONOBJ);
     leaveTransBO            = new LeaveTransBO(SESSIONOBJ);
     salaryStructureHeaderBO = new SalaryStructureHeaderBO(SESSIONOBJ);
     empbankdetailBO         = new EmployeeBankDetailBO(SESSIONOBJ);
     otherleaveBo            = new OtherLeaveBO(SESSIONOBJ);
     employeeLeavePolicyBo   = new EmployeeLeavePolicyBO(SESSIONOBJ);
 }
 public AddressBO Update(AddressBO address)
 {
     using (var uow = facade.UnitOfWork)
     {
         Address addressFromDb = uow.AddressRepository.Get(address.Id);
         if (addressFromDb == null)
         {
             throw new InvalidOperationException("Address not found");
         }
         addressFromDb.City   = address.City;
         addressFromDb.Number = address.Number;
         addressFromDb.Street = address.Street;
         uow.Complete();
         return(conv.Convert(addressFromDb));
     }
 }
Ejemplo n.º 30
0
        public AddressBO GetAddressByKey(Guid addrKey)
        {
            try
            {
                string    sql  = "dbo.fn_get_address";
                AddressBO addr = new AddressBO();
                conn = new NpgsqlConnection(connString);
                conn.Open();

                using (var cmd = new NpgsqlCommand(sql, conn))
                {
                    cmd.CommandType = System.Data.CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("_addrkey", NpgsqlTypes.NpgsqlDbType.Uuid, addrKey);
                    var reader = cmd.ExecuteReader();
                    do
                    {
                        while (reader.Read())
                        {
                            addr.AddrKey  = Utils.CustomParse <Guid>(reader["addrkey"]);
                            addr.Name     = Utils.CustomParse <string>(reader["addrname"]);
                            addr.Address1 = Utils.CustomParse <string>(reader["address1"]);
                            addr.Address2 = Utils.CustomParse <string>(reader["address2"]);
                            addr.City     = Utils.CustomParse <string>(reader["city"]);
                            addr.State    = Utils.CustomParse <string>(reader["state"]);
                            addr.Zip      = Utils.CustomParse <string>(reader["zipcode"]);
                            addr.Country  = Utils.CustomParse <string>(reader["country"]);
                            addr.Website  = Utils.CustomParse <string>(reader["website"]);
                            addr.Phone    = Utils.CustomParse <string>(reader["phone"]);
                            addr.Phone2   = Utils.CustomParse <string>(reader["phone2"]);
                            addr.Email    = Utils.CustomParse <string>(reader["email"]);
                            addr.Email2   = Utils.CustomParse <string>(reader["email2"]);
                            addr.Fax      = Utils.CustomParse <string>(reader["fax"]);
                        }
                    }while (reader.NextResult());
                    reader.Close();
                }
                return(addr);
            }
            catch (Exception msg)
            {
                throw msg;
            }
            finally
            {
                conn.Close();
            }
        }
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (dgvAddressBook.RowCount != 0)
     {
         DialogResult dr = MessageBox.Show("Are you sure", "Delete", MessageBoxButtons.YesNo);
         if (dr == DialogResult.No)
         {
             return;
         }
         if (dr == DialogResult.Yes)
         {
             int AddressId = (int)(dgvAddressBook.SelectedRows[0].Cells[0].Value);
             AddressBO.DeleteInAddress(AddressId);
         }
     }
     dgvAddressBook.DataSource = AddressBO.GetAddress();
 }