/// <summary> /// Gets the client. /// </summary> /// <param name="clientId">The client identifier.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns></returns> /// <exception cref="Exception">Http Status Code [{response.StatusCode}] Message [{responseBody}]</exception> private async Task <ClientDetails> GetClient(String clientId, CancellationToken cancellationToken) { ClientDetails clientDetails = await this.TestingContext.DockerHelper.SecurityServiceClient.GetClient(clientId, cancellationToken).ConfigureAwait(false); return(clientDetails); }
public async Task WhenIGetTheClientWithClientIdTheClientDetailsAreReturnedAsFollows(String clientId, Table table) { ClientDetails clientDetails = await this.GetClient(clientId, CancellationToken.None).ConfigureAwait(false); table.Rows.Count.ShouldBe(1); TableRow tableRow = table.Rows.First(); clientDetails.ShouldNotBeNull(); String scopes = SpecflowTableHelper.GetStringRowValue(tableRow, "Scopes"); String grantTypes = SpecflowTableHelper.GetStringRowValue(tableRow, "GrantTypes"); clientDetails.ClientDescription.ShouldBe(SpecflowTableHelper.GetStringRowValue(tableRow, "Description")); clientDetails.ClientId.ShouldBe(SpecflowTableHelper.GetStringRowValue(tableRow, "ClientId")); clientDetails.ClientName.ShouldBe(SpecflowTableHelper.GetStringRowValue(tableRow, "Name")); if (string.IsNullOrEmpty(scopes)) { clientDetails.AllowedScopes.ShouldBeEmpty(); } else { clientDetails.AllowedScopes.ShouldBe(scopes.Split(",").ToList()); } if (string.IsNullOrEmpty(grantTypes)) { clientDetails.AllowedGrantTypes.ShouldBeEmpty(); } else { clientDetails.AllowedGrantTypes.ShouldBe(grantTypes.Split(",").ToList()); } }
public IHttpActionResult AddNewClientDetails(ClientDetails Param) { JSON JSONReturn = new JSON(); ClientDetails clientDetails = new ClientDetails(); AccountDetails accountDetails = new AccountDetails(); accountDetails = DatabaseAccess.AddNewAccount(Param); Param.AccountDetails.AccountID = accountDetails.AccountID; DatabaseAccess.AddNewClientDetails(Param); JSON returnJSON = new JSON(); try { JSONReturn.Data = clientDetails; JSONReturn.Message = connectionString; } catch (Exception ex) { returnJSON.Message = ex.Message; return(Json(returnJSON)); } return(Json(JSONReturn)); }
private void btnUpdate_Click(object sender, EventArgs e) { ClientDetails clientModel = new ClientDetails(); //Client Details int i = ClientDGView.SelectedCells[0].RowIndex; clientModel.ClientId = (int)ClientDGView.CurrentRow.Cells[0].Value; clientModel.Name = ClientDGView.Rows[i].Cells[1].Value.ToString(); ContactDetails contactDetails = new ContactDetails(); //Client Contact contactDetails.CellNumber = ClientDGView.Rows[i].Cells[7].Value.ToString(); contactDetails.WorkTel = ClientDGView.Rows[i].Cells[8].Value.ToString(); //Client Address AddressDetails clientAddress = new AddressDetails(); clientAddress.WorkAddress = ClientDGView.Rows[i].Cells[5].Value.ToString(); clientAddress.ResAddress = ClientDGView.Rows[i].Cells[4].Value.ToString(); clientAddress.PosAddress = ClientDGView.Rows[i].Cells[6].Value.ToString(); clientServiceClient.UpdateClient(clientModel.ClientId, clientModel, clientAddress, contactDetails); MessageBox.Show("Client Updated Succesfully", "Update Status", MessageBoxButtons.OK); HomeForm home = new HomeForm(); Hide(); home.Show(); }
public void SubsriceClient(ClientDetails clientDetails, string connectionId) { var clients = GetAllClients(); var client = clients.FirstOrDefault(x => x.ClientDetails.Ip == clientDetails.Ip); if (client == null) { // add new client client = new Client { ClientDetails = clientDetails, Connections = new List <Connection>() }; clients.Add(client); } // add new connection if (client.Connections.Any(x => x.ConnectionID == connectionId)) { client.Connections.First(x => x.ConnectionID == connectionId).Connected = true; } else { client.Connections.Add(new Connection() { Connected = true, ConnectionID = connectionId }); } _dataStorageService.Save(STORAGE_KEY, clients); }
public IHttpActionResult PutClientDetails(int id, ClientDetails clientDetails) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != clientDetails.ClientId) { return(BadRequest()); } db.Entry(clientDetails).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ClientDetailsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void DeleteClientDetails() { ClientDetails cl = new ClientDetails(); int clientId = 237; cl.DeleteClientDetails(clientId); }
public int UpdateClient(ClientDetails clientDetails, AddressDetails addressDetails, ContactDetails contactDetails) { string message; dbConn.openConnection(); SqlCommand cmd = new SqlCommand("nsp_updateClient @clientId,@name,@gender" + ",@cellNumber,@workTel,@resAddress,@workAddress,@posAddress", dbConn.connection); cmd.Parameters.Add("@clientId", SqlDbType.Int, 100).Value = clientDetails.ClientId; //Insert Client Details cmd.Parameters.Add("@name", SqlDbType.VarChar, 100).Value = clientDetails.Name; cmd.Parameters.Add("@gender", SqlDbType.VarChar, 100).Value = clientDetails.Gender; //Insert Client Contact cmd.Parameters.Add("@cellNumber", SqlDbType.VarChar, 100).Value = contactDetails.CellNumber; cmd.Parameters.Add("@workTel", SqlDbType.VarChar, 100).Value = contactDetails.WorkTel; //Insert Client Address cmd.Parameters.Add("@resAddress", SqlDbType.VarChar, 100).Value = addressDetails.ResAddress; cmd.Parameters.Add("@workAddress", SqlDbType.VarChar, 100).Value = addressDetails.WorkAddress; cmd.Parameters.Add("@posAddress", SqlDbType.VarChar, 100).Value = addressDetails.PosAddress; int res = cmd.ExecuteNonQuery(); message = clientDetails.Name + " Updated Succesfully"; return(res); }
protected void Page_Load(object sender, EventArgs e) { ClientDetails client = new ClientDetails(); GridView1.DataSource = objServiceClient.GetClientData().ClientTable; GridView1.DataBind(); }
public Result SaveClientDetails(ClientDetails req) { Result result = new Result(); if (!req.IsValid()) { result.StatusCode = Globals.FAILURE_STATUS_CODE; result.StatusDesc = req.StatusDesc; return(result); } //req.CustomerPhoto = GetBase64String(req.CustomerPhoto); //req.IDPhoto = GetBase64String(req.IDPhoto); //req.BackIDPhoto = GetBase64String(req.BackIDPhoto); //req.CustomerSignPhoto = GetBase64String(req.CustomerSignPhoto); //req.RegFormPhoto = GetBase64String(req.RegFormPhoto); //req.KeyFactsPhoto = GetBase64String(req.KeyFactsPhoto); DataTable dt = dh.ExecuteDataSet("SaveClientsDetails", req.ClientNo, req.ClientName, req.ClientAddress, req.ClientPhoneNumber, req.Gender, req.IDType, req.IDNumber, req.DOB, req.ClientPhoto, req.IDPhoto, req.Referee, req.RefrereePhoneNo, req.ClientEmail, req.ModifiedBy, req.ClientPassword).Tables[0]; if (dt.Rows.Count <= 0) { result.StatusCode = Globals.FAILURE_STATUS_CODE; result.StatusDesc = "Client DETAILS NOT SAVED"; return(result); } result.StatusCode = Globals.SUCCESS_STATUS_CODE; result.StatusDesc = Globals.SUCCESS_STATUS_TEXT; result.LoanID = dt.Rows[0][0].ToString(); return(result); }
/// <summary> /// Gets the client. /// </summary> /// <param name="clientId">The client identifier.</param> /// <param name="cancellationToken">The cancellation token.</param> /// <returns></returns> public async Task <ClientDetails> GetClient(String clientId, CancellationToken cancellationToken) { ClientDetails response = null; String requestUri = this.BuildRequestUrl($"/api/clients/{clientId}"); try { // Add the access token to the client headers //this.HttpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken); // Make the Http Call here HttpResponseMessage httpResponse = await this.HttpClient.GetAsync(requestUri, cancellationToken); // Process the response String content = await this.HandleResponse(httpResponse, cancellationToken); // call was successful so now deserialise the body to the response object response = JsonConvert.DeserializeObject <ClientDetails>(content); } catch (Exception ex) { // An exception has occurred, add some additional information to the message Exception exception = new Exception($"Error getting client {clientId}.", ex); throw exception; } return(response); }
/// <summary> /// converts to Business UserLogin model from UserLoginViewModel /// </summary> /// <param name="clientUser"></param> /// <returns></returns> private UserLoginDTO ToUserLogin(UserLoginViewModel clientUser) { UserLoginDTO clientUserlogin = new UserLoginDTO(); clientUserlogin.UserId = string.IsNullOrEmpty(clientUser.UserId) ? _allUserRepository.GetClientUserSequenceValue() : clientUser.UserId; clientUserlogin.UserName = clientUser.UserName; clientUserlogin.FirstName = clientUser.FirstName; clientUserlogin.LastName = clientUser.LastName; clientUserlogin.MobileNumber = clientUser.MobileNumber; clientUserlogin.Email = clientUser.Email; clientUserlogin.IsMeridianUser = clientUser.IsMeridianUser; clientUserlogin.Password = clientUser.Password; clientUserlogin.RoleCode = clientUser.RoleCode; clientUserlogin.RoleName = clientUser.RoleName; clientUserlogin.RecordStatus = clientUser.IsActive ? Infra.DomainConstants.RecordStatusActive : Infra.DomainConstants.RecordStatusInactive; clientUserlogin.LoggedInUserID = clientUser.LoggedInUserID; clientUserlogin.Client = new List <ClientDetails>(); foreach (ClientViewModel client in clientUser.Clients) { ClientDetails clientDetails = new ClientDetails(); clientDetails.ClientCode = client.ClientCode; clientDetails.Name = client.Name; clientUserlogin.Client.Add(clientDetails); } return(clientUserlogin); }
public List <ClientInformationModel> GetDataClientData() { ClientDetails data = new ClientDetails(); var clientsData = data.GetClientsData(); return(clientsData); }
public Result SaveAdditionalClientDetails(ClientDetails req) { Result Res = new Result(); Res = bll.SaveAdditionalClientDetails(req); return(Res); }
public ClientInformationModel GetClientData(int clientId) { ClientDetails clientDetail = new ClientDetails(); var clientData = clientDetail.GetClientData(clientId); return(clientData); }
/// <summary> /// To map M3User login data /// </summary> /// <param name="m3User"></param> /// <returns></returns> public static UserLoginDTO MappingM3UserViewModelToBusinessModel(M3UserViewModel m3User) { UserLoginDTO clientUserlogin = new UserLoginDTO(); if (m3User != null) { clientUserlogin.UserId = m3User?.User.UserId; clientUserlogin.UserName = m3User?.User.UserName; clientUserlogin.FirstName = m3User?.User.FirstName; clientUserlogin.LastName = m3User?.User.LastName; clientUserlogin.MobileNumber = m3User?.User.MobileNumber; clientUserlogin.Email = m3User?.User.Email; clientUserlogin.IsMeridianUser = m3User?.User.IsMeridianUser; clientUserlogin.Password = m3User?.User.Password; clientUserlogin.RoleCode = m3User?.User.RoleCode; clientUserlogin.RoleName = m3User?.User.RoleName; clientUserlogin.RecordStatus = m3User.User.IsActive ? Infra.DomainConstants.RecordStatusActive : Infra.DomainConstants.RecordStatusInactive; clientUserlogin.LoggedInUserID = m3User.User.LoggedInUserID; clientUserlogin.Client = new List <ClientDetails>(); if (clientUserlogin.RoleCode != Infra.BusinessConstants.Admin) { foreach (string client in m3User.Clients) { ClientDetails clientDetails = new ClientDetails(); clientDetails.ClientCode = client; clientUserlogin.Client.Add(clientDetails); } } } return(clientUserlogin); }
public static int InsertClient(int id, string name, string details) { ClientDetails tb1 = new ClientDetails(id, name, details, MyDateTime.Now, 0); int x = myRealProvider.InsertClient(tb1); return(x); }
public static bool UpdateClient(int id, string name, string details, double blance) { ClientDetails tb1 = new ClientDetails(id, name, details, MyDateTime.Now, blance); bool x = myRealProvider.UpdateClient(tb1); return(x); }
private async void updateButton_Click(object sender, RoutedEventArgs e) { { try { // Get the selected client ClientDetails selectedclient = (ClientDetails)ClientDetailsView.SelectedItem; if (selectedclient == null) { MessageDialog dialog = new MessageDialog("Not selected the Item", "Oops..!"); await dialog.ShowAsync(); } else { // Update the fields of the selected person CDFirstName.Text = selectedclient.FirstName; CDLastName.Text = selectedclient.LastName; CDCompanyName.Text = selectedclient.CompanyName; phoneNumber.Text = selectedclient.phoneNumber.ToString(); } } catch (NullReferenceException) { MessageDialog dialog = new MessageDialog("Not selected the Item", "Oops..!"); await dialog.ShowAsync(); } } }
public int UpdateClient(int clientId, ClientDetails clientDetails, AddressDetails addressDetails, ContactDetails contactDetails) { dbConn.openConnection(); string sqlClientUpdate = "UPDATE ClientDetails " + "SET name = '" + clientDetails.Name + "'" + " WHERE clientId = " + clientId; SqlCommand cmdUpdateClient = new SqlCommand(sqlClientUpdate, dbConn.connection); cmdUpdateClient.ExecuteNonQuery(); string sqlAddressUpdate = "UPDATE ClientAddress " + "SET resAddress = '" + addressDetails.ResAddress + "'" + ", posAddress = '" + addressDetails.PosAddress + "'" + ", workAddress = '" + addressDetails.WorkAddress + "'" + "WHERE clientId = " + clientId; SqlCommand cmdUpdateAddress = new SqlCommand(sqlAddressUpdate, dbConn.connection); cmdUpdateAddress.ExecuteNonQuery(); string sqlContactUpdate = "UPDATE ClientContact " + "SET cellNumber = '" + contactDetails.CellNumber + "'" + ", workTel = '" + contactDetails.WorkTel + "'" + "WHERE clientId = " + clientId; SqlCommand cmdUpdateContact = new SqlCommand(sqlContactUpdate, dbConn.connection); int res = cmdUpdateContact.ExecuteNonQuery(); return(res); }
private static Role ToRole(ClientDetails details) { var role = new Role(); SetRoleValues(role, details); return(role); }
public static List <ClientDetails> ReadClients() { List <ClientDetails> clients = new List <ClientDetails>(); try { using (StreamReader reader = new StreamReader(ConfigPath + "Clients.json")) { string raw = reader.ReadToEnd(); var rawClients = JsonConvert.DeserializeObject <List <ClientDetails> >(raw); for (int i = 0; i < rawClients.Count; i++) { ClientDetails client = new ClientDetails(); client.IP_DNS = rawClients[i].IP_DNS; client.NickName = rawClients[i].NickName; clients.Add(client); } } } catch (Exception ex) { // File missing or corrupt json stream //TODO: Handle this or report it } return(clients); }
private void btnAdd_Click(object sender, EventArgs e) { ClientDetails clientModel = new ClientDetails(); //Client Details clientModel.Name = txtName.Text; clientModel.Gender = comboBox1.SelectedItem.ToString(); ContactDetails contactDetails = new ContactDetails(); //Client Contact contactDetails.CellNumber = txtCell.Text; contactDetails.WorkTel = txtWorkTel.Text; //Client Address AddressDetails clientAddress = new AddressDetails(); clientAddress.WorkAddress = txtWorkAddress.Text; clientAddress.ResAddress = txtResAddress.Text; clientAddress.PosAddress = txtPosAddress.Text; clientService.InsertClientDetails(clientModel, clientAddress, contactDetails); MessageBox.Show("Client Added Succesfully", "Create Status", MessageBoxButtons.OK); HomeForm home = new HomeForm(); Hide(); home.Show(); }
private ClientDetails SetClientDetailsForMikrotikUser(MikrotikUser user, List <Package> lstPackage) { ClientDetails cd = new ClientDetails(); cd.Name = user.LoginName; cd.LoginName = user.LoginName; cd.Password = user.Password; cd.Address = "Address"; cd.ContactNumber = "0101010101"; cd.ZoneID = 10; cd.SMSCommunication = cd.ContactNumber; cd.Occupation = "Ocupation"; cd.SocialCommunicationURL = "SocialCommunicationURL"; cd.Remarks = "Remarks"; cd.ConnectionTypeID = 1; cd.BoxNumber = "BoxNumber"; cd.PopDetails = "PopDetails"; cd.Reference = "Reference"; cd.NationalID = "NationalID"; cd.PackageID = lstPackage.Where(x => x.PackageName.ToLower().Trim() == user.PackageName.ToLower().Trim()).Select(x => x.PackageID).FirstOrDefault(); cd.SecurityQuestionID = 0; cd.SecurityQuestionAnswer = "SecurityQuestionAnswer"; cd.MacAddress = "MacAddress"; cd.ClientSurvey = "ClientSurvey"; cd.ConnectionDate = AppUtils.dateTimeNow; cd.MikrotikID = user.MikrotikID; cd.IP = "IP"; cd.Mac = "Mac"; cd.ApproxPaymentDate = 10; return(cd); }
protected void lnkSignIn_Click(object sender, EventArgs e) { using (CultureDataContext db = new CultureDataContext()) { var query = (from q in db.Users where q.User_Email.Equals(txtEmail.Text.Trim()) && q.User_Password.Equals(EncryptString.Encrypt(txtPassword.Text)) select q).FirstOrDefault(); if (query != null) { if (query.User_StatusID == (int)StatusEnum.Approved) { Session["User"] = ClientDetails.SerializeClientDetails(new ClientDetails(query.User_ID, query.User_FullName, query.User_Email, query.User_Mobile1, db.GroupUsers.FirstOrDefault(x => x.GroupUser_UserID.Equals(query.User_ID)).GroupUser_GroupID ?? 0, query.User_CommitteeID ?? 0)); var per = db.SP_SelectUserPermission(query.User_ID).ToList(); List <UserPermissions> tempList = UserPermissions; tempList.AddRange( per.Select( i => new UserPermissions(i.ModuleID, i.ModuleName, i.PageName, i.PageURL, bool.Parse(i.Show), bool.Parse(i.Add), bool.Parse(i.Edit), bool.Parse(i.Delete), bool.Parse(i.Index)))); UserPermissions = tempList; Response.Redirect("default.aspx"); } } else { ScriptManager.RegisterStartupScript(Page, Page.GetType(), "alertUser", "alert('عفوا، المستخدم غير موجود');", true); } } }
public void DifferentClientDetailsCanStillBeEqual() { ClientDetails details1 = new ClientDetails(Name, ClientStatus.Lapsed); ClientDetails details2 = new ClientDetails(Name, ClientStatus.Lapsed); details1.ShouldBe(details2); }
public static bool UpdateClient(int id, string name, string details) { ClientDetails tb1 = new ClientDetails(id, name, details, MyDateTime.Now); bool x = myRealProvider.UpdateClient(tb1); BllGlobal.UpdateAllClients(); return(x); }
public void ConstructorSetsValue() { ClientStatus status = ClientStatus.Lapsed; ClientDetails clientDetails = new ClientDetails(Name, status); clientDetails.Name.ShouldBe(Name); clientDetails.Status.ShouldBe(status); }
public ClientDetails ClientDetails() { var details = new ClientDetails(); details.ClientIPAddress = localAddress.ToString(); details.ClientListenPort = mListenPort; return(details); }
public ActionResult DeleteConfirmed(int id) { ClientDetails clientDetails = db.ClientDetails.Find(id); db.ClientDetails.Remove(clientDetails); db.SaveChanges(); return(RedirectToAction("Index")); }
public bool DeleteClientDetails(ClientDetails clientInfo) { SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=registration;User ID=sa;Password=123456"); con.Open(); SqlCommand cmd = new SqlCommand("delete from RegistrationTable where Id=@Id", con); cmd.Parameters.AddWithValue("@Id", clientInfo.Id); cmd.ExecuteNonQuery(); con.Close(); return true; }
// Botão para excluir o registro. protected void imgDel_Command(object sender, System.Web.UI.WebControls.CommandEventArgs e) { ClientDetails cliente = new ClientDetails(); cliente.Id = int.Parse(e.CommandArgument.ToString()); if (service.DeleteClientDetails(cliente) == true) lblMensagem.Text = "Registro Excluído com Sucesso."; else lblMensagem.Text = "Registro não pode ser excluído."; BindRegistrosGrid(); }
public void GetClientDetails(string s) { var id = Context.ConnectionId; Console.WriteLine("Excecution for " + id); Console.WriteLine("Executing"); var cd = new ClientDetails { Observations = Observation.ClientMacList(DateTime.Now.AddHours(-1), DateTime.Now, s, 20.0f), AccessPoints = AccessPoint.APList() }; Clients.Client(id).clientDetails(cd); }
public string InsertClientDetails(ClientDetails clientInfo) { string message; // Validação dos campos obrigatórios. if (!VerificarCamposObrigatorios(clientInfo)) return message = "Verificar campos obrigatórios."; // Validação de CPF ou CNPJ if (!VerificarCpfCnpj(clientInfo.CpfCnpj)) return message = "CPF/CNPJ Inválido."; // O certo seria buscar do Web.config, como é apenas um exemplo. Esta seria a forma correta. // SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["DBConnection"].ConnectionString); SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=registration;User ID=sa;Password=123456"); // Testa se a conexão com o BD está fechada. if (con.State == ConnectionState.Closed) con.Open(); SqlCommand cmd = new SqlCommand("insert into RegistrationTable(Nome, CpfCnpj, Telefone, Logradouro, Numero, Cep, Bairro, Cidade, Uf, Pais) values(@Nome, @CpfCnpj, @Telefone, @Logradouro, @Numero, @Cep, @Bairro, @Cidade, @Uf, @Pais)", con); cmd.Parameters.AddWithValue("@Nome", clientInfo.Nome); cmd.Parameters.AddWithValue("@CpfCnpj", clientInfo.CpfCnpj); cmd.Parameters.AddWithValue("@Telefone", clientInfo.Telefone); cmd.Parameters.AddWithValue("@Logradouro", clientInfo.Logradouro); cmd.Parameters.AddWithValue("@Numero", clientInfo.Numero); cmd.Parameters.AddWithValue("@Cep", clientInfo.Cep); cmd.Parameters.AddWithValue("@Bairro", clientInfo.Cep); cmd.Parameters.AddWithValue("@Cidade", clientInfo.Cidade); cmd.Parameters.AddWithValue("@Uf", clientInfo.Uf); cmd.Parameters.AddWithValue("@Pais", clientInfo.Pais); int result = cmd.ExecuteNonQuery(); // Se igual a 1 ocorreu tudo certo. if (result.Equals(1)) message = string.Concat(clientInfo.Nome, ", cliente registrado com sucesso."); else message = string.Concat(clientInfo.Nome, ", problema ao inserir. Cliente não pode ser registrado."); con.Close(); return message; }
// Edição dos registros da Grid. protected void imgEdit_Command(object sender, System.Web.UI.WebControls.CommandEventArgs e) { ClientDetails cliente = new ClientDetails(); cliente.Id = int.Parse(e.CommandArgument.ToString()); ViewState["Id"] = cliente.Id; DataSet ds = new DataSet(); ds = service.SelectClientDetails(); if (ds.Tables[0].Rows.Count > 0) { txtNome.Text = ds.Tables[0].Rows[0]["Nome"].ToString(); txtCpfCnpj.Text = ds.Tables[0].Rows[0]["CpfCnpj"].ToString(); txtTelefone.Text = ds.Tables[0].Rows[0]["Telefone"].ToString(); txtLogradouro.Text = ds.Tables[0].Rows[0]["Logradouro"].ToString(); txtNumero.Text = ds.Tables[0].Rows[0]["Numero"].ToString(); txtCep.Text = ds.Tables[0].Rows[0]["Cep"].ToString(); txtBairro.Text = ds.Tables[0].Rows[0]["Bairro"].ToString(); txtCidade.Text = ds.Tables[0].Rows[0]["Cidade"].ToString(); txtUf.Text = ds.Tables[0].Rows[0]["Uf"].ToString(); txtPais.Text = ds.Tables[0].Rows[0]["Pais"].ToString(); btnSubmit.Text = "Alterar"; } }
private bool VerificarCamposObrigatorios(ClientDetails cliente) { // Nome e CPF ou CNPJ são obrigatórios. if (String.IsNullOrEmpty(cliente.Nome) || String.IsNullOrEmpty(cliente.CpfCnpj)) return false; else return true; }
public ActionResult CreateAccount(CreateAccountRequest req) { logger.Info("new account creation request"); var _db = new ZestorkContainer(); String emailRetVal = String.Empty; //if user already exists if(_db.Users.Any(x=>x.Username==req.userName)) return Json(new { code="402",msg="User Already Exists" }); String ID = Guid.NewGuid().ToString(); var user = new Users { Username = req.userName, Password = req.password, Source = req.source, isActive = "false", Type = req.type, guid = Guid.NewGuid().ToString(), FirstName = req.firstName, LastName = req.lastName, gender = "NA", ImageUrl = "NA" }; _db.Users.Add(user); if (req.referral != null && req.referral != "") { var referral = new RecommendedBy { RecommendedFrom = req.referral, RecommendedTo = req.userName }; _db.RecommendedBies.Add(referral); } if (req.type == "client") { var clientDetails = new ClientDetails { Username = req.userName, CompanyName = req.CompanyName }; _db.ClientDetails.Add(clientDetails); } var ValidateUserKey = new ValidateUserKey { Username = req.userName, guid = ID }; _db.ValidateUserKeys.Add(ValidateUserKey); try { _db.SaveChanges(); sendAccountCreationValidationEmail sendAccountCreationValidationEmail = new sendAccountCreationValidationEmail(); emailRetVal = sendAccountCreationValidationEmail.sendAccountCreationValidationEmailMessage(req.userName, ID,Request); } catch (DbEntityValidationException e) { dbContextException.logDbContextException(e); throw; } //Users User = _db.Users.SingleOrDefault(x => x.Username == req.userName); //ValidateUserKey key = _db.ValidateUserKeys.SingleOrDefault(x => x.Username == req.userName); return Json(new { code="200",msg="successfully created account" }); }
public void UpdateRegistrationTable(ClientDetails clientInfo) { SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=registration;User ID=sa;Password=123456"); con.Open(); SqlCommand cmd = new SqlCommand("update RegistrationTable set Nome=@Nome, CpfCnpj=@CpfCnpj, Telefone=@Telefone, Logradouro=@Logradouro, Numero=@Numero, Cep=@Cep, Bairro=@Bairro, Cidade=@Cidade, Uf=@Uf, Pais=@Pais where Id=@Id", con); cmd.Parameters.AddWithValue("@Nome", clientInfo.Nome); cmd.Parameters.AddWithValue("@CpfCnpj", clientInfo.CpfCnpj); cmd.Parameters.AddWithValue("@Telefone", clientInfo.Telefone); cmd.Parameters.AddWithValue("@Logradouro", clientInfo.Logradouro); cmd.Parameters.AddWithValue("@Numero", clientInfo.Numero); cmd.Parameters.AddWithValue("@Cep", clientInfo.Cep); cmd.Parameters.AddWithValue("@Bairro", clientInfo.Cep); cmd.Parameters.AddWithValue("@Cidade", clientInfo.Cidade); cmd.Parameters.AddWithValue("@Uf", clientInfo.Uf); cmd.Parameters.AddWithValue("@Pais", clientInfo.Pais); cmd.ExecuteNonQuery(); con.Close(); }
private void GravarDetails() { ClientDetails cliente = new ClientDetails() { Nome = txtNome.Text.Trim(), CpfCnpj = txtCpfCnpj.Text.Trim(), Telefone = txtTelefone.Text.Trim(), Logradouro = txtLogradouro.Text.Trim(), Numero = txtNumero.Text.Trim(), Cep = txtCep.Text.Trim(), Bairro = txtBairro.Text.Trim(), Cidade = txtCidade.Text.Trim(), Uf = Convert.ToChar(txtUf), Pais = txtPais.Text.Trim() }; lblMensagem.Text = service.InsertClientDetails(cliente); LimparDetails(); BindRegistrosGrid(); }
private void UpdateClienteDetails() { ClientDetails cliente = new ClientDetails() { Id = Convert.ToInt32(ViewState["Id"].ToString()), Nome = txtNome.Text.Trim(), CpfCnpj = txtCpfCnpj.Text.Trim(), Telefone = txtTelefone.Text.Trim(), Logradouro = txtLogradouro.Text.Trim(), Numero = txtNumero.Text.Trim(), Cep = txtCep.Text.Trim(), Bairro = txtBairro.Text.Trim(), Cidade = txtCidade.Text.Trim(), Uf = Convert.ToChar(txtUf), Pais = txtPais.Text.Trim() }; service.UpdateClientDetails(cliente); lblMensagem.Text = "Registro Alterado com Sucesso."; LimparDetails(); BindRegistrosGrid(); }
public DataSet UpdateClientDetails(ClientDetails clientInfo) { SqlConnection con = new SqlConnection("Data Source=.;Initial Catalog=registration;User ID=sa;Password=123456"); con.Open(); SqlCommand cmd = new SqlCommand("select * from RegistrationTable where Id=@Id", con); cmd.Parameters.AddWithValue("@Id", clientInfo.Id); SqlDataAdapter sda = new SqlDataAdapter(cmd); DataSet ds = new DataSet(); sda.Fill(ds); cmd.ExecuteNonQuery(); con.Close(); return ds; }