protected void CustomerDetailsView_ModeChanging(object sender, DetailsViewModeEventArgs e) { CustomerDetailsView.ChangeMode(e.NewMode); if (e.NewMode != DetailsViewMode.Insert) { BindCustomer(); } }
private void BindCustomer() { var cust = mgr.GetCustomer(currentID); //returns customer and addresses and reservations CustomerDetailsView.DataSource = new List <ProjectedCustomer> { cust }; CustomerDetailsView.DataBind(); IsDataBound = true; }
private void Bindgrid() { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["RegistrationConnectionString"].ConnectionString); con.Open(); string query = "select * from Customer";//not recommended this i have wrtten just for example,write stored procedure for security SqlDataAdapter com = new SqlDataAdapter(query, con); DataSet dr = new DataSet(); com.Fill(dr); //CustomerDetailsView.DataSource = dr.Tables[0]; CustomerDetailsView.DataBind(); con.Close(); }
public async Task <ActionResult> EditCustomer(CustomerDetailsView EditedCustomer) { PaskolUser user = await UserManager.FindByIdAsync(EditedCustomer.UserID); if (user != null) { // Save artist details EditedCustomer.UpdatePaskolUserFrom(user); IdentityResult validPass = null; if (EditedCustomer.Password != null) { validPass = await UserManager.PasswordValidator.ValidateAsync(EditedCustomer.Password); if (validPass.Succeeded) { user.PasswordHash = UserManager.PasswordHasher.HashPassword(EditedCustomer.Password); IdentityResult result = await UserManager.UpdateAsync(user); if (result.Succeeded) { return(RedirectToAction("Index")); } else { AddErrorsFromResult(result); } } else { AddErrorsFromResult(validPass); } } } else { ModelState.AddModelError("", "User Not Found"); } return(View("UserDetails", user)); }
protected void CustomerDetailsView_PreRender(object sender, EventArgs e) { //needs to be in prerender and only when edit mode if (CustomerDetailsView.CurrentMode == DetailsViewMode.Edit) { var actList = mgr.GetActivityList(); var destList = mgr.GetDestinationList(); var cust = CustomerDetailsView.DataItem as ProjectedCustomer; var ddlA1 = (DropDownList)(CustomerDetailsView.FindControl("act1DDL")); var ddlA2 = (DropDownList)(CustomerDetailsView.FindControl("act2DDL")); var ddlL1 = (DropDownList)(CustomerDetailsView.FindControl("loc1DDL")); var ddlL2 = (DropDownList)(CustomerDetailsView.FindControl("loc2DDL")); BindPickList(ddlA1, actList, cust.PrimaryActivityID.Value, "ActivityID", "Name"); BindPickList(ddlA2, actList, cust.SecondaryActivityID.Value, "ActivityID", "Name"); BindPickList(ddlL1, destList, cust.PrimaryDestinationID.Value, "DestinationID", "Name"); BindPickList(ddlL2, destList, cust.SecondaryDestinationID.Value, "DestinationID", "Name"); } }
private void ExportGridToExcel() { Response.Clear(); Response.Buffer = true; Response.ClearContent(); Response.ClearHeaders(); Response.Charset = ""; string FileName = "Customer Details" + DateTime.Now + ".xls"; StringWriter strwritter = new StringWriter(); HtmlTextWriter htmltextwrtter = new HtmlTextWriter(strwritter); Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.ms-excel"; Response.AddHeader("Content-Disposition", "attachment;filename=" + FileName); CustomerDetailsView.GridLines = GridLines.Both; CustomerDetailsView.HeaderStyle.Font.Bold = true; CustomerDetailsView.RenderControl(htmltextwrtter); Response.Write(strwritter.ToString()); Response.End(); }
protected void CustomerDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { //only send changed var title = e.NewValues["Title"] as string; var lastName = e.NewValues["LastName"] as string; var firstName = e.NewValues["FirstName"] as string; var birthday = Convert.ToDateTime(e.NewValues["BirthDate"]); var height = Convert.ToInt32(e.NewValues["HeightInches"]); var weight = Convert.ToInt32(e.NewValues["WeightPounds"]); var restrictions = e.NewValues["DietaryRestrictions"] as string; var activityId = Convert.ToInt32(((DropDownList)CustomerDetailsView.FindControl("act1DDL")).SelectedValue); var destinationId = Convert.ToInt32(((DropDownList)(CustomerDetailsView.FindControl("loc1DDL"))).SelectedValue); var activity2Id = Convert.ToInt32(((DropDownList)CustomerDetailsView.FindControl("act2DDL")).SelectedValue); var destination2Id = Convert.ToInt32(((DropDownList)(CustomerDetailsView.FindControl("loc2DDL"))).SelectedValue); mgr.UpdateCustomerProfile((int)e.Keys["ContactID"], title, lastName, firstName, birthday, height, weight, restrictions, destinationId, activityId, destination2Id, activity2Id); CustomerDetailsView.ChangeMode(DetailsViewMode.ReadOnly); BindCustomer(); }
private void CustomerSelected(string id) { if (string.IsNullOrEmpty(id)) { return; } Customer selectedCustomer = this.dataService.GetCustomers().FirstOrDefault(item => item.Id == id); IRegion mainRegion = this.regionManager.Regions[RegionNames.MainRegion]; if (mainRegion == null) { return; } CustomerDetailsView view = mainRegion.GetView("CustomerDetailsView") as CustomerDetailsView; if (view == null) { view = this.container.Resolve <CustomerDetailsView>(); mainRegion.Add(view, "CustomerDetailsView"); } else { mainRegion.Activate(view); } // Set the current employee property on the view model. CustomerDetailsViewModel viewModel = view.DataContext as CustomerDetailsViewModel; if (viewModel != null) { viewModel.CurrentCustomer = selectedCustomer; } }
protected void Page_Init(object sender, EventArgs e) { CustomerDetailsView.EnableDynamicData(typeof(Customer)); insertPhoneDetailsView.EnableDynamicData(typeof(PhoneNumber)); }
public ActionResult CustomerDetails(ParametersView parameters) { ParametersBll parametersBll = new ParametersBll { PageSize = PagerParameters.PageSize, Page = parameters.Page }; CustomerBll customerBll = _sharingService.GetCustomerById(parameters.CustomerId); CustomerDetailsView customerDetails = new CustomerDetailsView { Id = customerBll.Id, FirstName = customerBll.FirstName, Surname = customerBll.Surname, Email = customerBll.Email }; foreach (RentBll rent in _sharingService.GetRentsByEmail(customerBll.Email)) { customerDetails.Rents.Add(new RentView { OfferId = rent.OfferBll.Id, Cost = rent.Cost, Customer = customerBll, StartDate = rent.StartDate, EndDate = rent.EndDate, InsuranceCase = rent.InsuranceCase }); } foreach (var rent in customerDetails.Rents) { OfferBll offerBll = _sharingService.GetOfferById(rent.OfferId); OfferView offerView = new OfferView { Id = offerBll.Id, Model = offerBll.Model, Description = offerBll.Description, Year = offerBll.Year, Image = offerBll.Image, Type = offerBll.Type, DailyCost = offerBll.DailyCost, IsTaken = _sharingService.IsOfferTaken(offerBll.Id) }; customerDetails.Offers.Add(offerView); } int totalItems = customerDetails.Offers.Count; PagingInfoView pagingInfo = new PagingInfoView { CurrentPage = parameters.Page, ItemsPerPage = PagerParameters.PageSize, TotalItems = totalItems }; if (customerDetails.Offers.Skip((parameters.Page - 1) * PagerParameters.PageSize).Count() > PagerParameters.PageSize) { customerDetails.Offers = customerDetails.Offers.GetRange((parameters.Page - 1) * PagerParameters.PageSize, PagerParameters.PageSize); customerDetails.Rents = customerDetails.Rents.GetRange((parameters.Page - 1) * PagerParameters.PageSize, PagerParameters.PageSize); } else { customerDetails.Offers = customerDetails.Offers.Skip((parameters.Page - 1) * PagerParameters.PageSize).ToList(); customerDetails.Rents = customerDetails.Rents.Skip((parameters.Page - 1) * PagerParameters.PageSize).ToList(); } customerDetails.PagingInfo = pagingInfo; return(View(customerDetails)); }
private void GetAccountDetails(string customerNo, List <tbl_CustomerAccounts> accounts, bool telleringOperations) { if (accounts.Count != 0 && accounts != null) { if (customerAccounts == null) { customerAccounts = new List <CustomerAccountsView>(); } var customerDetails = customerManager.GetCustomerDetails(customerNo).FirstOrDefault(); if (customerDetails == null) { customerDetails = new CustomerDetailsView(); } foreach (var account in accounts) { var accountTypeDetails = accounttypes.FirstOrDefault(x => x.code == account.AccountType);//.ToList(); if (accountTypeDetails == null) { accountTypeDetails = new tbl_accounttypes(); } if (telleringOperations && ValueConverters.ConvertNullToBool(accountTypeDetails.Disallow_Teller_Transactions)) { continue; } customerAccounts.Add(new CustomerAccountsView { tbl_CustomerAccountsID = account.tbl_CustomerAccountsID, CustomerNo = customerNo, AccountNo = account.AccountNo, AccountComments = account.AccountComments, AccountRemarks = account.AccountRemarks, AccountType = account.AccountType, AccountTypeName = accountTypeDetails.category, GlMemSav = accountTypeDetails.glmemsav, MinimumBalance = accountTypeDetails.minimum_bal, OpenedBy = account.OpenedBy, OpenedDate = account.OpenedDate, AuthorisedBy = account.AuthorisedBy, AuthorisedDate = account.AuthorisedDate, DateClosed = account.DateClosed, Locked = account.Locked, CustomerBranch = customerDetails.Branch, customerDetails = { new CustomerDetailsView { CustomerName = customerDetails.CustomerName, AccountComments = customerDetails.AccountComments, AccountRemarks = customerDetails.AccountRemarks, Branch = customerDetails.Branch, Locked = customerDetails.Locked, CustomerIdNo = customerDetails.CustomerIdNo, DateClosed = customerDetails.DateClosed, MemberType = customerDetails.MemberType, MobileNo = customerDetails.MobileNo, CustomerNo = customerNo } }, AccountTypeSettings = accountTypeDetails }); } } }