public IActionResult CreateCustomer(CreateCustomerDto customerModel) { var customerNameOrError = CustomerName.Create(customerModel.Name); var customerEmailOrError = CustomerEmail.Create(customerModel.Email); var result = Result.Combine(customerNameOrError, customerEmailOrError); if (result.IsFailure) { return(Error(result.Error)); } if (_customerRepository.GetCustomerByEmail(customerEmailOrError.Value) != null) { return(Error($"[{customerModel.Email}] is already in use.")); } var customer = new Customer(customerNameOrError.Value, customerEmailOrError.Value); _customerRepository.Add(customer); return(Ok()); // return CreatedAtAction(nameof(GetCustomerById), new {id = customerModel.Id}, customerModel); }
public IActionResult Create([FromBody] CreateCustomerDto item) { try { Result <CustomerName> customerNameOrError = CustomerName.Create(item.Name); Result <Email> emailOrError = Email.Create(item.Email); Result result = Result.Combine(customerNameOrError, emailOrError); if (result.IsFailure) { return(BadRequest(result.Error)); } if (_customerRepository.GetByEmail(emailOrError.Value) != null) { return(BadRequest("Email is already by another user " + item.Email)); } var customer = new Customer(customerNameOrError.Value, emailOrError.Value); _customerRepository.Add(customer); return(Ok(item)); } catch (Exception e) { return(StatusCode(500, new { error = e.Message })); } }
public IActionResult Create([FromBody] CreateCustomerDto item) { Result <CustomerName> customerNameOrError = CustomerName.Create(item.FullName); Result <Email> emailOrError = Email.Create(item.Email); Result result = Result.Combine(customerNameOrError, emailOrError); if (result.IsFailure) { return(BadRequest(result.Error)); } if (_customerRepository.GetByEmail(emailOrError.Value) != null) { return(BadRequest("Email is already in use: " + item.Email)); } var customer = new Customer(customerNameOrError.Value, emailOrError.Value); bool uowStatus = false; try { uowStatus = _unitOfWork.BeginTransaction(); _customerRepository.Create(customer); _unitOfWork.Commit(uowStatus); return(StatusCode(StatusCodes.Status200OK)); } catch (Exception ex) { _unitOfWork.Rollback(uowStatus); Console.WriteLine(ex.StackTrace); return(StatusCode(StatusCodes.Status500InternalServerError, new ApiStringResponseDto("Internal Server Error"))); } }
public ActionResult CreateCustomer(CustomerModel customerModel) { Result <CustomerName> customerNameResult = CustomerName.Create(customerModel.Name); Result <Email> emailResult = Email.Create(customerModel.Email); if (customerNameResult.IsFailure) { ModelState.AddModelError("Name", customerNameResult.Error); } if (emailResult.IsFailure) { ModelState.AddModelError("Email", emailResult.Error); } if (!ModelState.IsValid) { return(View(customerModel)); } var customer = new Customer(customerNameResult.Value, emailResult.Value); // _database.Save(customer); return(RedirectToAction("Index")); }
partial void OnCustomerNameChanged() { if (!string.IsNullOrEmpty(_CustomerName)) { _CustomerName = CustomerName.TextEncode(); } }
public Dictionary <string, string> GetPaymentDictionary() { var dictionary = new Dictionary <string, string> { { "transaction_type", "sale" }, { "reference_number", Id.ToString() }, // use the actual id so we can find it easily { "amount", CalculatedTotal.ToString("F2") }, { "currency", "USD" }, { "transaction_uuid", Guid.NewGuid().ToString() }, { "signed_date_time", DateTime.UtcNow.ToString("yyyy-MM-dd'T'HH:mm:ss'Z'") }, { "unsigned_field_names", string.Empty }, { "locale", "en" }, { "bill_to_email", CustomerEmail }, { "bill_to_forename", CustomerName.SafeTruncate(60) }, { "bill_to_company_name", CustomerCompany.SafeRegexRemove().SafeTruncate(40) }, { "bill_to_address_country", "US" }, { "bill_to_address_state", "CA" } }; dictionary.Add("line_item_count", Items.Count.ToString("D")); for (var i = 0; i < Items.Count; i++) { dictionary.Add($"item_{i}_name", Items[i].Description); //dictionary.Add($"item_{i}_quantity", Items[i].Quantity.ToString()); dictionary.Add($"item_{i}_unit_price", Items[i].Total.ToString("F2")); } return(dictionary); }
public IActionResult Create([FromBody] CreateCustomerDto item) { Result <CustomerName> customerNameOrError = CustomerName.Create(item.Name); Result <Email> emailOrError = Email.Create(item.Email); Result result = Result.Combine(customerNameOrError, emailOrError); if (result.IsFailure) { return(Error(result.Error)); } if (_customerRepository.GetByEmail(emailOrError.Value) != null) { return(Error("Email is already in use: " + item.Email)); } var customer = new Customer(customerNameOrError.Value, emailOrError.Value); _customerRepository.Add(customer); // _customerRepository.SaveChanges(); return(Ok()); }
public static List <CustomerName> GetAllCustomerNames() { string query = "select DISTINCT client_name from FC_LocalContract;"; //Create Command MySqlCommand cmd = new MySqlCommand(query, connection); //Create a data reader and Execute the command MySqlDataReader dataReader = cmd.ExecuteReader(); List <CustomerName> inData = new List <CustomerName>(); while (dataReader.Read()) { CustomerName temp = new CustomerName(); temp.CustName = dataReader["client_name"] + ""; inData.Add(temp); } dataReader.Close(); TMSLogger.LogIt(" | " + "SQL.cs" + " | " + "SQL" + " | " + "GetAllCustomerNames" + " | " + "Confirmation" + " | " + "Customer names loaded" + " | "); return(inData); }
private static Result <Customer> CreateCustomer1(string email, string customerName) { // Email Result <Email> emailResult = Email.Create(email); if (emailResult.IsFailure) { return(Result.Failure <Customer>(emailResult.Error)); } Email emailObj = emailResult.Value; // CustomerName Result <CustomerName> customerNameResult = CustomerName.Create(customerName); if (customerNameResult.IsFailure) { return(Result.Failure <Customer>(customerNameResult.Error)); } CustomerName customerNameObj = customerNameResult.Value; // Customer return(new Customer(emailObj, customerNameObj)); }
/// <summary>Snippet for CreateEntitlement</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void CreateEntitlementRequestObject() { // Create client CloudChannelServiceClient cloudChannelServiceClient = CloudChannelServiceClient.Create(); // Initialize request argument(s) CreateEntitlementRequest request = new CreateEntitlementRequest { ParentAsCustomerName = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"), Entitlement = new Entitlement(), RequestId = "", }; // Make the request Operation <Entitlement, OperationMetadata> response = cloudChannelServiceClient.CreateEntitlement(request); // Poll until the returned long-running operation is complete Operation <Entitlement, OperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result Entitlement result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <Entitlement, OperationMetadata> retrievedResponse = cloudChannelServiceClient.PollOnceCreateEntitlement(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Entitlement retrievedResult = retrievedResponse.Result; } }
private void CustomerInsert_Click(object sender, EventArgs e) // Customer Insert Button(When I click on insert button the data will insert in Table) { con.Open(); // Connection Open comm = new SqlCommand("insert into Customer values('" + CustomerID.Text + "','" + CustomerName.Text + "','" + CustomerLastName.Text + "','" + CustomerAddress.Text + "','" + CustomerPhone.Text + "')", con); try { comm.ExecuteNonQuery(); MessageBox.Show("Customer Saved"); // Message Box (Its show the saved customers) con.Close(); // Connection Close ShowcustRecord(); CustomerID.Clear(); CustomerName.Clear(); CustomerLastName.Clear(); CustomerAddress.Clear(); CustomerPhone.Clear(); } catch (Exception) { MessageBox.Show("Customer Not Saved"); // Message Box } finally { con.Close(); // Connection Close } }
// Update Customer Button(This button used for update customer details private void UpdateCustomer_Click(object sender, EventArgs e) { con.Open();// Connection Open comm = new SqlCommand("update Customer set CId= '" + CustomerID.Text + "', FName= '" + CustomerName.Text + "', LName='" + CustomerLastName.Text + "', CAddress='" + CustomerAddress.Text + "', CPhoneNo='" + CustomerPhone.Text + "' where CId = '" + CustomerID.Text + "'", con); try { comm.ExecuteNonQuery(); MessageBox.Show("Customer Updated"); con.Close();// Connection Close ShowcustRecord(); CustomerID.Clear(); CustomerName.Clear(); CustomerLastName.Clear(); CustomerAddress.Clear(); CustomerPhone.Clear(); } catch (Exception) { MessageBox.Show("Customer Not Updated"); } finally { con.Close();// Connection Close } }
// Delete Customer Button(This button used for delete the customer) private void DeleteCustomer_Click(object sender, EventArgs e) { con.Open();// Connection Open comm = new SqlCommand("delete from Customer where CId = " + CustomerID.Text + " ", con); try { comm.ExecuteNonQuery(); MessageBox.Show("Customer Deleted"); con.Close();// Connection Close ShowcustRecord(); CustomerID.Clear(); CustomerName.Clear(); CustomerLastName.Clear(); CustomerAddress.Clear(); CustomerPhone.Clear(); CustomerID.Focus(); } catch (Exception x) { MessageBox.Show("Customer Not Deleted" + x.Message); } finally { con.Close();// Connection Close } }
public IActionResult Update(long id, [FromBody] UpdateCustomerDto item) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var customerNameOrError = CustomerName.Create(item.Name); if (customerNameOrError.IsFailure) { return(BadRequest(customerNameOrError.Error)); } Customer customer = _customerRepository.GetById(id); if (customer == null) { return(BadRequest("Invalid customer id: " + id)); } customer.Name = customerNameOrError.Value; _customerRepository.SaveChanges(); return(Ok()); } catch (Exception e) { return(StatusCode(500, new { error = e.Message })); } }
public async Task <Customer4A4> Get(Guid customerId) { using (var conn = new SqlConnection()) { var customerData = await conn.QuerySingleOrDefaultAsync <CustomerData4A>( "SELECT * FROM Customers WHERE CustomerId = @customerId", new { customerId }); var addressesData = await conn.QueryAsync <AddressData4A>( "SELECT * FROM Addresses WHERE Customer", new { customerId }); var nameResult = CustomerName.Create(customerData.Title, customerData.FirstName, customerData.LastName); var dobResult = Dob.Create(customerData.DateOfBirth); var idDocumentResult = IdDocument.Create(customerData.IdDocumentType, customerData.IdDocumentNumber); var addresses = addressesData.Select(a => Address4A.Create(a.AddressId, a.HouseNoOrName, a.Street, a.City, a.County, a.PostCode, a.CurrentAddress).Value); return(new Customer4A4(customerData.CustomerId, nameResult.Value, dobResult.Value, idDocumentResult.Value, addresses)); } }
public async stt::Task GetCustomerRequestObjectAsync() { moq::Mock <CloudChannelService.CloudChannelServiceClient> mockGrpcClient = new moq::Mock <CloudChannelService.CloudChannelServiceClient>(moq::MockBehavior.Strict); mockGrpcClient.Setup(x => x.CreateOperationsClient()).Returns(new moq::Mock <lro::Operations.OperationsClient>().Object); GetCustomerRequest request = new GetCustomerRequest { CustomerName = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"), }; Customer expectedResponse = new Customer { CustomerName = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"), OrgDisplayName = "org_display_nameb29ddfcb", OrgPostalAddress = new gt::PostalAddress(), PrimaryContactInfo = new ContactInfo(), AlternateEmail = "alternate_email3cdfc6ce", Domain = "domaine8825fad", CreateTime = new wkt::Timestamp(), UpdateTime = new wkt::Timestamp(), CloudIdentityId = "cloud_identity_idcb2e1526", LanguageCode = "language_code2f6c7160", CloudIdentityInfo = new CloudIdentityInfo(), ChannelPartnerId = "channel_partner_ida548fd43", }; mockGrpcClient.Setup(x => x.GetCustomerAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Customer>(stt::Task.FromResult(expectedResponse), null, null, null, null)); CloudChannelServiceClient client = new CloudChannelServiceClientImpl(mockGrpcClient.Object, null); Customer responseCallSettings = await client.GetCustomerAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Customer responseCancellationToken = await client.GetCustomerAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public static void PopulateTestData(IECommerceDbContext dbContext) { dbContext.Customers.Add(new Customer(CustomerName.Create("John"), Email.Create("*****@*****.**"))); dbContext.Customers.Add(new Customer(CustomerName.Create("Ana"), Email.Create("*****@*****.**"))); dbContext.SaveChanges(); }
public ProfileResponse(bool succeeded, string userId = null, CustomerName customerName = null, string customerCard = null, string bonuses = null) : base(succeeded) { UserId = userId; CustomerName = customerName; CustomerCard = customerCard; Bonuses = bonuses; }
public IActionResult Create([FromBody] CreateCustomerDto item) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var customerNameOrError = CustomerName.Create(item.Name); var emailOrError = Email.Create(item.Email); var result = Result.Combine(customerNameOrError, emailOrError); if (result.IsFailure) { return(BadRequest(result.Error)); } if (_customerRepository.GetByEmail(emailOrError.Value) != null) { return(BadRequest("Email is already in use: " + item.Email)); } var customer = new Customer(customerNameOrError.Value, emailOrError.Value); _customerRepository.Add(customer); _customerRepository.SaveChanges(); return(Ok()); } catch (Exception e) { return(StatusCode(500, new { error = e.Message })); } }
public override int GetHashCode() { unchecked { var hashCode = CustomerID; hashCode = (hashCode * 397) ^ (CustomerName != null ? CustomerName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (BusinessNumber != null ? BusinessNumber.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Domain != null ? Domain.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Address != null ? Address.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (City != null ? City.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (State != null ? State.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Country != null ? Country.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ZipCode != null ? ZipCode.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Phone != null ? Phone.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Fax != null ? Fax.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Notes != null ? Notes.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Logo != null ? Logo.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Website != null ? Website.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Longitude.GetHashCode(); hashCode = (hashCode * 397) ^ Latitude.GetHashCode(); hashCode = (hashCode * 397) ^ CreatedOn.GetHashCode(); hashCode = (hashCode * 397) ^ LastModified.GetHashCode(); return(hashCode); } }
private void ResetButton() { CustomerName.Clear(); CustomerAddress.Clear(); CustomerMobile.Clear(); CustomerName.Focus(); }
public override int GetHashCode() { int hash = 1; if (CustomerId.Length != 0) { hash ^= CustomerId.GetHashCode(); } if (CustomerName.Length != 0) { hash ^= CustomerName.GetHashCode(); } if (Message.Length != 0) { hash ^= Message.GetHashCode(); } if (Color.Length != 0) { hash ^= Color.GetHashCode(); } if (RoomId != 0) { hash ^= RoomId.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override int GetHashCode() { unchecked { var hashCode = ContractID; hashCode = (hashCode * 397) ^ (ContractName != null ? ContractName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ CustomerID; hashCode = (hashCode * 397) ^ (CustomerName != null ? CustomerName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ContractType != null ? ContractType.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Active.GetHashCode(); hashCode = (hashCode * 397) ^ Default.GetHashCode(); hashCode = (hashCode * 397) ^ Taxable.GetHashCode(); hashCode = (hashCode * 397) ^ StartDate.GetHashCode(); hashCode = (hashCode * 397) ^ EndDate.GetHashCode(); hashCode = (hashCode * 397) ^ (RetainerFlatFeeContract != null ? RetainerFlatFeeContract.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (HourlyContract != null ? HourlyContract.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (BlockHoursContract != null ? BlockHoursContract.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (BlockMoneyContract != null ? BlockMoneyContract.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (RemoteMonitoringContract != null ? RemoteMonitoringContract.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (OnlineBackupContract != null ? OnlineBackupContract.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ProjectOneTimeFeeContract != null ? ProjectOneTimeFeeContract.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ProjectHourlyRateContract != null ? ProjectHourlyRateContract.GetHashCode() : 0); return(hashCode); } }
public override int GetHashCode() { unchecked { var hashCode = AlertID; hashCode = (hashCode * 397) ^ Code; hashCode = (hashCode * 397) ^ (Source != null ? Source.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Title != null ? Title.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Severity != null ? Severity.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Created.GetHashCode(); hashCode = (hashCode * 397) ^ SnoozedEndDate.GetHashCode(); hashCode = (hashCode * 397) ^ (ThresholdValue1 != null ? ThresholdValue1.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ThresholdValue2 != null ? ThresholdValue2.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ThresholdValue3 != null ? ThresholdValue3.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ThresholdValue4 != null ? ThresholdValue4.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ThresholdValue5 != null ? ThresholdValue5.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DeviceGuid != null ? DeviceGuid.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AdditionalInfo != null ? AdditionalInfo.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (AlertCategoryID != null ? AlertCategoryID.GetHashCode() : 0); hashCode = (hashCode * 397) ^ Archived.GetHashCode(); hashCode = (hashCode * 397) ^ ArchivedDate.GetHashCode(); hashCode = (hashCode * 397) ^ TicketID.GetHashCode(); hashCode = (hashCode * 397) ^ (AlertMessage != null ? AlertMessage.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (DeviceName != null ? DeviceName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ CustomerID; hashCode = (hashCode * 397) ^ (CustomerName != null ? CustomerName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (MessageTemplate != null ? MessageTemplate.GetHashCode() : 0); hashCode = (hashCode * 397) ^ FolderID.GetHashCode(); hashCode = (hashCode * 397) ^ PollingCyclesCount.GetHashCode(); return(hashCode); } }
public override int GetHashCode() { int hashCode = IdVer.GetHashCode() + IdSubVer.GetHashCode() + Timestamp.GetHashCode() + (IdCustomer == null ? 0 : IdCustomer.GetHashCode()) + (CustomerName == null ? 0 : CustomerName.GetHashCode()) + Active.GetHashCode() + (VATNum == null ? 0 : VATNum.GetHashCode()) + (ShippingAddress == null ? 0 : ShippingAddress.GetHashCode()) + (ShippingAddressZh == null ? 0 : ShippingAddressZh.GetHashCode()) + (BillingAddress == null ? 0 : BillingAddress.GetHashCode()) + (BillingAddressZh == null ? 0 : BillingAddressZh.GetHashCode()) + (ContactName == null ? 0 : ContactName.GetHashCode()) + (ContactNameZh == null ? 0 : ContactNameZh.GetHashCode()) + (ContactPhone == null ? 0 : ContactPhone.GetHashCode()) + (Comments == null ? 0 : Comments.GetHashCode()) + (IdIncoterm == null ? 0 : IdIncoterm.GetHashCode()) + (IdPaymentTerms == null ? 0 : IdPaymentTerms.GetHashCode()) + (IdDefaultCurrency == null ? 0 : IdDefaultCurrency.GetHashCode()) + (User == null ? 0 : User.GetHashCode()); return(hashCode); }
public void Registering_invalid_customer_rop_should_have_correct_error() { // Arrange var customer = new Customer(CustomerName.TryCreate("test").Value); var customerRepository = Substitute.For <ICustomerRepository>(); customerRepository .Save(Arg.Any <Customer>()) .Returns(Result.Ok(customer)); var mailService = Substitute.For <IMailService>(); mailService .SendGreeting(Arg.Any <Customer>()) .Returns(Result.Ok(customer)); var sut = new RegistrationService(customerRepository, mailService); // Act var result = sut.RegisterNewCustomer_Error_Handling2(""); // Assert result.Should() .BeEquivalentTo(RegistrationResponse.Fail("invalid name")); }
/// <summary> /// The ConfigureValidationRules /// </summary> private void ConfigureValidationRules() { // Validator.AddAsyncRule(nameof(LRN), // async () => // { // var _context = new MorenoContext(); // var result = await _context.Students.FirstOrDefaultAsync(e => e.LRN == LRN); // bool isAvailable = result == null; // return RuleResult.Assert(isAvailable, // string.Format("LRN {0} is taken. Please choose a different one.", LRN)); // }); Validator.AddRule(nameof(CustomerName), () => { var count = _context.Customers.Count(c => c.Name.ToLower().Equals(CustomerName.Trim().ToLower())); var result = count == 0; return(RuleResult.Assert(result, $"Customer already exists")); }); Validator.AddRequiredRule(() => CustomerName, "Name is Required"); Validator.AddRequiredRule(() => CustomerMobile, "Mobile Number is Required"); Validator.AddRequiredRule(() => CustomerAddress, "Address is Required"); }
public void Registering_valid_customer_happy_path_works() { // Arrange var customer = new Customer(CustomerName.TryCreate("test").Value); var customerRepository = Substitute.For <ICustomerRepository>(); customerRepository .Save(Arg.Any <Customer>()) .Returns(Result.Ok(customer)); var mailService = Substitute.For <IMailService>(); mailService .SendGreeting(Arg.Any <Customer>()) .Returns(Result.Ok(customer)); var sut = new RegistrationService(customerRepository, mailService); // Act var result = sut.RegisterNewCustomer_NoError_Handling("test"); // Assert result.Should() .BeEquivalentTo(RegistrationResponse.Success(customer)); }
protected void Page_Load(object sender, EventArgs e) { if (Session["person"] != null) { int pK = (int)Session["person"]; int vhId = 0; CustomerName cn = new CustomerName(pK); lblName.Text = cn.CustomerNameFetch(); CustomerHistory ch = new CustomerHistory(pK); lblYear.Text = ch.VehicleYearFetch(); lblMake.Text = ch.VehicleMakeFetch(); vhId = ch.VehicleIdFetch(); AutomartEntities ae = new AutomartEntities(); var servdate = from s in ae.VehicleServiceDetails where s.VehicleService.VehicleID == vhId orderby s.VehicleService.ServiceDate select new {s.VehicleService.ServiceDate, s.AutoService.ServiceName, s.AutoService.ServicePrice }; dlHistory.DataSource = servdate.ToList(); dlHistory.DataBind(); } else { Response.Redirect("Login.aspx"); } }
public void Test1() { CustomerName C1 = new CustomerName("elam", "sk", "hyderabad"); CustomerName C2 = new CustomerName("elam", "sk", "hyderabad"); Assert.Equal(C1, C2); }
/// <summary>Snippet for ProvisionCloudIdentityAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task ProvisionCloudIdentityRequestObjectAsync() { // Create client CloudChannelServiceClient cloudChannelServiceClient = await CloudChannelServiceClient.CreateAsync(); // Initialize request argument(s) ProvisionCloudIdentityRequest request = new ProvisionCloudIdentityRequest { CustomerAsCustomerName = CustomerName.FromAccountCustomer("[ACCOUNT]", "[CUSTOMER]"), CloudIdentityInfo = new CloudIdentityInfo(), User = new AdminUser(), ValidateOnly = false, }; // Make the request Operation <Customer, OperationMetadata> response = await cloudChannelServiceClient.ProvisionCloudIdentityAsync(request); // Poll until the returned long-running operation is complete Operation <Customer, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Customer result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <Customer, OperationMetadata> retrievedResponse = await cloudChannelServiceClient.PollOnceProvisionCloudIdentityAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Customer retrievedResult = retrievedResponse.Result; } }
protected void Page_Load(object sender, EventArgs e) { if (Session["person"] != null) { int pK = (int)Session["person"]; CustomerName cn = new CustomerName(pK); lblName.Text = cn.CustomerNameFetch(); lblAuto.Text = cn.CustomerVehicleFetch(); } else { Response.Redirect("Default.aspx"); } }
protected void btnRegister_Click(object sender, EventArgs e) { int CustomerId = 0; string constr = ConfigurationManager.ConnectionStrings["ProductDb"].ConnectionString; using (SqlConnection con = new SqlConnection(constr)) { using (SqlCommand InsertCustomer = new SqlCommand("spInsertCustomer")) { using (SqlDataAdapter sda = new SqlDataAdapter()) { InsertCustomer.CommandType = CommandType.StoredProcedure; InsertCustomer.Parameters.AddWithValue("@Email", txtEmail.Text); InsertCustomer.Parameters.AddWithValue("@FName", txtFirstName.Text); InsertCustomer.Parameters.AddWithValue("@LName", txtLastName.Text); InsertCustomer.Parameters.AddWithValue("@Address1", txtAddress1.Text); InsertCustomer.Parameters.AddWithValue("@Address2", txtAddress2.Text); InsertCustomer.Parameters.AddWithValue("@City", txtCity.Text); InsertCustomer.Parameters.AddWithValue("@County", txtCounty.Text); InsertCustomer.Connection = con; con.Open(); //Put customerid into variable CustomerId = Convert.ToInt32(InsertCustomer.ExecuteScalar()); con.Close(); } } using (SqlCommand InsertCustomerLogin = new SqlCommand("spInsertCustomerLogin")) { using (SqlDataAdapter sda = new SqlDataAdapter()) { InsertCustomerLogin.Parameters.AddWithValue("@UserName", txtEmail.Text); InsertCustomerLogin.Parameters.AddWithValue("@Password", GetM5Hash(txtPassword.Text)); //FormsAuthentication.HashPasswordForStoringInConfigFile(txtPassword.Text, "MD5");; InsertCustomerLogin.Parameters.AddWithValue("@CustomerId", CustomerId); InsertCustomerLogin.Connection = con; con.Open(); con.Close(); } } //Bind to modal with delegate CustomerName custn = new CustomerName(displayName); custn(Label1.Text); Label1.Text = txtFirstName.Text; //string message = "Supplied email address has already been used"; Label4.Text = String.Format("Supplied email address has already been used"); switch (CustomerId) { case -1: //message = "Supplied email address has already been used."; ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "script", "<script type='text/javascript'>$( document ).ready(function() { $('#MyModal1').modal('show')});</script>", false); break; default: //CustomerName custn = new CustomerName(displayName); //cn += custn; //Open Modal ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "script", "<script type='text/javascript'>$( document ).ready(function() { $('#MyModal').modal('show')});</script>", false); break; } } }//End Register Click