示例#1
0
    protected void btnAddClient_Click(object sender, EventArgs e)
    {
        InvoicingDataContext db = new InvoicingDataContext();
        ClientDetail client = new ClientDetail
        {
            name = this.txtName.Text,
            email = this.txtEmail.Text,
            telephone = Convert.ToInt32(this.txtTelephone.Text),
            address_line1 = this.txtAddress1.Text,
            address_line2 = this.txtAddress2.Text,
            city = this.txtCity.Text,
            county = this.txtCounty.Text,
            post_code = this.txtPostCode.Text
        };

        db.ClientDetails.InsertOnSubmit(client);
        db.SubmitChanges();
    }
        /// <summary>
        /// add the 
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool AddCustomer(OrderDetails model)
        {
            try
            {
                var objCustomerDetails = new ClientDetail();

                objCustomerDetails.Name = model.CustomerName;
                objCustomerDetails.Email = model.Email;
                objCustomerDetails.BillingAddress = model.BillingAddress;
                objCustomerDetails.ShippingAddress = model.ShippingAddress;
                objCustomerDetails.Number = model.Number;
                ObjEntity.ClientDetails.Add(objCustomerDetails);
                ObjEntity.SaveChanges();

                var objContractDetail = new ContractDetail();
                objContractDetail.NetAmount = model.NetAmount;
                objContractDetail.Quantity = model.Quantity;
                objContractDetail.OrderAmount = model.OrderAmount;
                objContractDetail.Tax = model.Tax;
                objContractDetail.Discount = model.Discount;
                objContractDetail.IsActive = true;
                objContractDetail.TransactionDate = DateTime.Now;
                objContractDetail.Customer_ID = objCustomerDetails.ID; ;
                ObjEntity.ContractDetails.Add(objContractDetail);
               int OrderNo= ObjEntity.SaveChanges();
                var OrderItemDetails = new OrderItemDetail();
                OrderItemDetails.Rate = model.Rate;
                OrderItemDetails.Order_ID = objContractDetail.ID;
                OrderItemDetails.Product_ID = 4;
                OrderItemDetails.Quantity = model.Quantity.Value;

                OrderItemDetails.Amount = model.Amount;
                ObjEntity.OrderItemDetails.Add(OrderItemDetails);
                ObjEntity.SaveChanges();
                return true;
            }
            catch (Exception ex)
            {
                ExceptionHandling.SaveException(ex);
                return false;
            }
        }
 public ActionResult PrintDetails(int id)
 {
     ServicesDBContext serviceDB = new ServicesDBContext();
     ClientDetail cd = new ClientDetail(id, db, serviceDB);
     if (cd.client == null || cd.services == null)
     {
         return RedirectToAction("Index");
     }
     return View(cd);
 }
        public ActionResult Create(ClientAccountAddressVM clientAccountAddressVM)
        {
            int clientDetailId = clientAccountAddressVM.ClientDetail.ClientDetailId;

            ClientDetail clientDetail = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(clientDetailId);

            //Check Exists
            if (clientDetail == null)
            {
                ViewData["ActionMethod"] = "CreatePost";
                return(View("RecordDoesNotExistError"));
            }

            ClientDetailClientAccount clientDetailClientAccount = new ClientDetailClientAccount();

            clientDetailClientAccount = clientDetailClientAccountRepository.GetClientDetailClientAccount(clientDetailId);

            //Check Exists
            if (clientDetailClientAccount == null)
            {
                ViewData["ActionMethod"] = "CreatePost";
                return(View("RecordDoesNotExistError"));
            }

            string can = clientDetailClientAccount.ClientAccountNumber;
            string ssc = clientDetailClientAccount.SourceSystemCode;

            ClientAccount clientAccount = new ClientAccount();

            clientAccount = clientAccountRepository.GetClientAccount(can, ssc);

            //Check Exists
            if (clientAccount == null)
            {
                ViewData["ActionMethod"] = "CreatePost";
                return(View("RecordDoesNotExistError"));
            }

            //Access Rights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientAccount(can, ssc))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }


            //Update  Model from Form
            try
            {
                TryUpdateModel <Address>(clientAccountAddressVM.Address, "Address");
            }
            catch
            {
                string n = "";
                foreach (ModelState modelState in ViewData.ModelState.Values)
                {
                    foreach (ModelError error in modelState.Errors)
                    {
                        n += error.ErrorMessage;
                    }
                }
                ViewData["Message"] = "ValidationError : " + n;
                return(View("Error"));
            }



            try
            {
                clientDetailAddressRepository.Add(clientAccountAddressVM.ClientDetail, clientAccountAddressVM.Address);
            }
            catch (SqlException ex)
            {
                LogRepository logRepository = new LogRepository();
                logRepository.LogError(ex.Message);

                ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details";
                return(View("Error"));
            }


            return(RedirectToAction("List", new { id = clientDetailId }));
        }
示例#5
0
 //Update client details
 public string UpdateClientDetails(ClientDetail objClient)
 {
     Result = _ClientRepository.UpdateClientDetails(objClient);
     return(Result);
 }
示例#6
0
        //Post client details
        public int AddClientDetails(ClientDetail Objclient)
        {
            int Result;

            return(Result = _ClientRepository.AddClientDetails(Objclient));
        }
        public ActionResult UnDelete(TravelerTypeClientDetailVM travelerTypeClientDetailVM, FormCollection collection)
        {
            int id = travelerTypeClientDetailVM.ClientDetail.ClientDetailId;
            ClientDetailTravelerType clientDetailTravelerType = new ClientDetailTravelerType();

            clientDetailTravelerType = clientDetailTravelerTypeRepository.GetClientDetailTravelerType(id);

            //Check Exists
            if (clientDetailTravelerType == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }

            string csu = travelerTypeClientDetailVM.ClientSubUnit.ClientSubUnitGuid;
            string tt  = travelerTypeClientDetailVM.TravelerType.TravelerTypeGuid;
            ClientSubUnitTravelerType clientSubUnitTravelerType = new ClientSubUnitTravelerType();

            clientSubUnitTravelerType = clientSubUnitTravelerTypeRepository.GetClientSubUnitTravelerType(csu, tt);

            //Check Exists
            if (clientSubUnitTravelerType == null)
            {
                ViewData["ActionMethod"] = "EditGet";
                return(View("RecordDoesNotExistError"));
            }

            //Access Rights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientSubUnit(csu))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            //Get Item
            ClientDetail clientDetail = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(id);

            //Delete Item
            try
            {
                clientDetail.VersionNumber = Int32.Parse(collection["ClientDetail.VersionNumber"]);
                clientDetail.DeletedFlag   = false;
                clientDetailRepository.UpdateGroupDeletedStatus(clientDetail);
            }
            catch (SqlException ex)
            {
                //Versioning Error - go to standard versionError page
                if (ex.Message == "SQLVersioningError")
                {
                    ViewData["ReturnURL"] = "/ClientDetailTravelerType.mvc/UnDelete?id=" + id + "&tt=" + tt + "&csu=" + csu;
                    return(View("VersionError"));
                }
                LogRepository logRepository = new LogRepository();
                logRepository.LogError(ex.Message);

                ViewData["Message"] = "There was a problem with your request, please see the log file or contact an administrator for details";
                return(View("Error"));
            }

            return(RedirectToAction("ListDeleted", new { csu = csu, tt = tt }));
        }
        // GET: /UnDelete
        public ActionResult UnDelete(string csu, string tt, int id)
        {
            ClientDetailTravelerType clientDetailTravelerType = new ClientDetailTravelerType();

            clientDetailTravelerType = clientDetailTravelerTypeRepository.GetClientDetailTravelerType(id);

            //Check Exists
            if (clientDetailTravelerType == null)
            {
                ViewData["ActionMethod"] = "UnDeleteGet";
                return(View("RecordDoesNotExistError"));
            }

            ClientSubUnitTravelerType clientSubUnitTravelerType = new ClientSubUnitTravelerType();

            clientSubUnitTravelerType = clientSubUnitTravelerTypeRepository.GetClientSubUnitTravelerType(csu, tt);

            //Check Exists
            if (clientSubUnitTravelerType == null)
            {
                ViewData["ActionMethod"] = "UnDeleteGet";
                return(View("RecordDoesNotExistError"));
            }

            //Get Item
            ClientDetail clientDetail = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(id);

            //Check Exists
            if (clientDetail == null || clientDetail.DeletedFlag == false)
            {
                ViewData["ActionMethod"] = "UnDeleteGet";
                return(View("RecordDoesNotExistError"));
            }

            //Check Access
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientSubUnit(csu))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            TravelerTypeClientDetailVM travelerTypeClientDetailVM = new TravelerTypeClientDetailVM();

            clientDetailRepository.EditGroupForDisplay(clientDetail);
            travelerTypeClientDetailVM.ClientDetail = clientDetail;

            ClientSubUnit clientSubUnit = new ClientSubUnit();

            clientSubUnit = clientSubUnitRepository.GetClientSubUnit(csu);
            travelerTypeClientDetailVM.ClientSubUnit = clientSubUnit;

            TravelerType travelerType = new TravelerType();

            travelerType = travelerTypeRepository.GetTravelerType(tt);
            travelerTypeClientDetailVM.TravelerType = travelerType;

            return(View(travelerTypeClientDetailVM));
        }
 /// <summary>
 /// There are no comments for ClientDetailSet in the schema.
 /// </summary>
 public void AddToClientDetailSet(ClientDetail clientDetail)
 {
     base.AddObject("ClientDetailSet", clientDetail);
 }
 /// <summary>
 /// Create a new ClientDetail object.
 /// </summary>
 /// <param name="detailId">Initial value of DetailId.</param>
 /// <param name="lastUpdatedDate">Initial value of LastUpdatedDate.</param>
 public static ClientDetail CreateClientDetail(int detailId, global::System.DateTime lastUpdatedDate)
 {
     ClientDetail clientDetail = new ClientDetail();
     clientDetail.DetailId = detailId;
     clientDetail.LastUpdatedDate = lastUpdatedDate;
     return clientDetail;
 }
示例#11
0
        public ActionResult Delete(int id, int pid, string sc)
        {
            ClientDetailSupplierProduct clientDetailSupplierProduct = new ClientDetailSupplierProduct();

            clientDetailSupplierProduct = clientDetailSupplierProductRepository.GetClientDetailSupplierProduct(id, pid, sc);

            //Check Exists
            if (clientDetailSupplierProduct == null)
            {
                ViewData["ActionMethod"] = "DeleteGet";
                return(View("RecordDoesNotExistError"));
            }

            int clientDetailId = clientDetailSupplierProduct.ClientDetailId;
            ClientDetailClientAccount clientDetailClientAccount = new ClientDetailClientAccount();

            clientDetailClientAccount = clientDetailClientAccountRepository.GetClientDetailClientAccount(id);

            //Check Exists
            if (clientDetailClientAccount == null)
            {
                ViewData["ActionMethod"] = "DeleteGet";
                return(View("RecordDoesNotExistError"));
            }

            string can = clientDetailClientAccount.ClientAccountNumber;
            string ssc = clientDetailClientAccount.SourceSystemCode;

            ClientAccount clientAccount = new ClientAccount();

            clientAccount = clientAccountRepository.GetClientAccount(can, ssc);

            //Check Exists
            if (clientAccount == null)
            {
                ViewData["ActionMethod"] = "CreatePost";
                return(View("RecordDoesNotExistError"));
            }

            //Access Rights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToClientAccount(can, ssc))
            {
                ViewData["Message"] = "You do not have access to this item";
                return(View("Error"));
            }

            ClientAccountSupplierProductVM clientAccountSupplierProductVM = new ClientAccountSupplierProductVM();

            clientAccountSupplierProductVM.ClientAccount = clientAccount;

            ClientDetail clientDetail = new ClientDetail();

            clientDetail = clientDetailRepository.GetGroup(clientDetailId);
            clientAccountSupplierProductVM.ClientDetail = clientDetail;

            clientDetailSupplierProductRepository.EditForDisplay(clientDetailSupplierProduct);
            clientAccountSupplierProductVM.SupplierProduct = clientDetailSupplierProduct;

            return(View(clientAccountSupplierProductVM));
        }
 public ClientTopUnitSubProductFormOfPaymentTypesVM(ClientTopUnit clientTopUnit, ClientDetail clientDetail, CWTPaginatedList <spDesktopDataAdmin_SelectClientDetailSubProductFormOfPaymentTypes_v1Result> subProductFormOfPaymentTypes)
 {
     ClientTopUnit = clientTopUnit;
     ClientDetail  = clientDetail;
     SubProductFormOfPaymentTypes = subProductFormOfPaymentTypes;
 }
示例#13
0
 public ClientSubUnitClientDetailVM(ClientSubUnit clientSubUnit, ClientDetail clientDetail, IEnumerable <SelectListItem> tripTypes)
 {
     ClientSubUnit = clientSubUnit;
     ClientDetail  = clientDetail;
     TripTypes     = tripTypes;
 }
        private void initialize()
        {
            svc = new ShipService();
            svc.Url = Settings.Endpoint;

            shipper = new Party();
            shipper.Contact = new Contact();
            shipper.Contact.CompanyName = Settings.CompanyName;
            shipper.Contact.PhoneNumber = Settings.Telephone;
            shipper.Contact.EMailAddress = Settings.Email;
            shipper.Address = new Address();
            var l1 = Settings.AddressLine1;
            var l2 = Settings.AddressLine2;
            if (string.IsNullOrEmpty(l2)) {
                shipper.Address.StreetLines = new string[1] { l1 };
            } else {
                shipper.Address.StreetLines = new string[2] { l1, l2 };
            }
            shipper.Address.City = Settings.City;
            shipper.Address.StateOrProvinceCode = Settings.State;
            shipper.Address.PostalCode = Settings.PostalCode;
            shipper.Address.CountryCode = Settings.CountryCode;
            shipper.AccountNumber = Settings.AccountNumber;

            auth = new WebAuthenticationDetail();
            auth.UserCredential = new WebAuthenticationCredential();
            auth.UserCredential.Key = Settings.APIKey;
            auth.UserCredential.Password = Settings.Password;

            clientDetail = new ClientDetail();
            clientDetail.AccountNumber = Settings.AccountNumber;
            clientDetail.MeterNumber = Settings.MeterNumber;
        }
        public async Task <ClientDetail> FetchbyClientId(int clientid)
        {
            ClientDetail clientdetail = await db.ClientDetails.FindAsync(clientid);

            return(clientdetail);
        }
示例#16
0
 internal void SetupGetClientAsync(ClientDetail clientResult)
 {
     Setup(x => x.GetClientAsync(It.IsAny <string>()))
     .Returns(Task.FromResult(new IdentityAdminResult <ClientDetail>(clientResult)));
 }