private void change3_Click(object sender, EventArgs e) { try { string token = File.ReadAllText("token.txt"); Bitmap threeB = new Bitmap(pictureBox3.ImageLocation); ImageConverter converter3 = new ImageConverter(); byte[] three = (byte[])converter3.ConvertTo(threeB, typeof(byte[])); HousesEndpointClient hu = new HousesEndpointClient(); responseDto re = hu.changeHousePhotoThree(houseCurrentNow.id, three, token); if (re.status == true) { DialogResult result = MessageBox.Show( re.message, "Success", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); this.Hide(); Dashboard dh = new Dashboard(); dh.Show(); } else { DialogResult result = MessageBox.Show( re.message, "Success", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } } catch { DialogResult result = MessageBox.Show( "Unknown error", "Exception", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } }
private void changepassword_Click(object sender, EventArgs e) { Boolean vpassword = false; if (string.IsNullOrWhiteSpace(password.Text) | password.Text.Length < 4) { vpassword = false; password.Focus(); errorProvider1.SetError(password, "New Password should contain at least four character."); } else { vpassword = true; errorProvider1.SetError(password, ""); } Boolean vconfirmpassword = false; if (string.IsNullOrWhiteSpace(confirmpassword.Text) | confirmpassword.Text.Length < 4 | !(confirmpassword.Text == password.Text)) { vconfirmpassword = false; confirmpassword.Focus(); errorProvider1.SetError(confirmpassword, "Confirm password should be same with password and not empty."); } else { vconfirmpassword = true; errorProvider1.SetError(confirmpassword, ""); } Boolean voldpassword = false; if (string.IsNullOrWhiteSpace(oldpassword.Text) | oldpassword.Text.Length < 4) { voldpassword = false; oldpassword.Focus(); errorProvider1.SetError(oldpassword, "Old password should contain at least four character."); } else { voldpassword = true; errorProvider1.SetError(oldpassword, ""); } if (vpassword == true & vconfirmpassword == true & voldpassword == true) { string token = File.ReadAllText("token.txt"); UserEndPointClient userClient = new UserEndPointClient(); responseDto res = userClient.changePasswordUser(password.Text, token); if (res.status == true) { MessageBox.Show(res.message + "\n" + "Password changed, Login again", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); File.Delete("token.txt"); this.Close(); Signin s = new Signin(); s.Show(); } else { MessageBox.Show(res.message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void update_Click(object sender, EventArgs e) { string token = File.ReadAllText("token.txt"); UserEndPointClient userend = new UserEndPointClient(); responseDto response = userend.deactivateUser(currentUserNow.id, token); if (response.status == true) { DialogResult rese = MessageBox.Show(response.message, "Success", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); this.Close(); Admin admin = new Admin(); admin.Show(); } else { DialogResult rese = MessageBox.Show(response.message, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } }
private void changestatus_Click(object sender, EventArgs e) { string token = File.ReadAllText("token.txt"); HousesEndpointClient h = new HousesEndpointClient(); responseDto re = h.changeHouseStatus(houseCurrentNow.id, token); if (re.status == true) { DialogResult result = MessageBox.Show( re.message, "Success", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); this.Hide(); Dashboard dh = new Dashboard(); dh.Show(); } else { DialogResult result = MessageBox.Show( re.message, "Success", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } }
public async Task <responseDto> PuedoOperarCVME(string identificacion) { List <Operacion> operaciones = new List <Operacion>(); List <Regla> reglas = await _reglas.Execute(); //si tiene operacion ejecutada que cumpla con una 1regla ?puede Operar? o se tienen que cumplir todas? foreach (var item in reglas) { operaciones.AddRange(await _buscarOperacionesCliente.Execute(identificacion)); } var resultado = await Task.Run(() => { if (operaciones.Count > 1) { var dtoNotOk = new responseDto() { puedeOperar = false, resultadoDeOperacion = "Posee prestamos tasa 0" }; return(dtoNotOk); } else { var dtoOK = new responseDto() { puedeOperar = true, resultadoDeOperacion = "Puede Operar" }; return(dtoOK); } }); return(resultado); }
private void update_Click(object sender, EventArgs e) { Boolean vname = false; if (string.IsNullOrWhiteSpace(name.Text) | name.Text.Length < 4) { vname = false; name.Focus(); errorProvider1.SetError(name, "Name should contain at least four character."); } else { vname = true; errorProvider1.SetError(name, ""); } Boolean vtype = false; if (string.IsNullOrWhiteSpace(type.Text) | type.Text.Length < 3) { vtype = false; type.Focus(); errorProvider1.SetError(type, "Type should be selected."); } else { vtype = true; errorProvider1.SetError(type, ""); } Boolean vfor = false; if (string.IsNullOrWhiteSpace(for_.Text) | for_.Text.Length < 3) { vfor = false; type.Focus(); errorProvider1.SetError(for_, "Type should be selected."); } else { vfor = true; errorProvider1.SetError(for_, ""); } Boolean vlocation = false; if (string.IsNullOrWhiteSpace(location.Text) | location.Text.Length < 4) { vlocation = false; location.Focus(); errorProvider1.SetError(location, "Loation should contain at least four character."); } else { vlocation = true; errorProvider1.SetError(location, ""); } Boolean varea = false; if (string.IsNullOrWhiteSpace(area.Text) | !Regex.IsMatch(totalprice.Text, @"[0-9]{1,20}")) { varea = false; location.Focus(); errorProvider1.SetError(area, "Area should be number."); } else { varea = true; errorProvider1.SetError(area, ""); } Boolean vpriceperhectar = false; if (string.IsNullOrWhiteSpace(priceheactar.Text) | !Regex.IsMatch(totalprice.Text, @"[0-9]{1,20}")) { vpriceperhectar = false; location.Focus(); errorProvider1.SetError(priceheactar, "Price per hectar should be number."); } else { vpriceperhectar = true; errorProvider1.SetError(priceheactar, ""); } Boolean vtotalprice = false; if (string.IsNullOrWhiteSpace(totalprice.Text) | !Regex.IsMatch(totalprice.Text, @"[0-9]{1,20}")) { vtotalprice = false; totalprice.Focus(); errorProvider1.SetError(totalprice, "Total price should be number."); } else { vtotalprice = true; errorProvider1.SetError(totalprice, ""); } Boolean vfinishing = false; if (string.IsNullOrWhiteSpace(finishing.Text) | finishing.Text.Length < 2) { vfinishing = false; type.Focus(); errorProvider1.SetError(finishing, "Finishing should be selected."); } else { vfinishing = true; errorProvider1.SetError(finishing, ""); } Boolean vcompany = false; if (string.IsNullOrWhiteSpace(company.Text) | company.Text.Length < 3) { vcompany = false; company.Focus(); errorProvider1.SetError(company, "Company name should contain atleast two character."); } else { vcompany = true; errorProvider1.SetError(company, ""); } if (vname == true & vtype == true & vfor == true & vlocation == true & varea == true & vpriceperhectar == true & vtotalprice == true & vfinishing == true & vcompany == true) { string token = File.ReadAllText("token.txt"); HousesEndpointClient houseClient = new HousesEndpointClient(); housesUpdateRequestDto house = new housesUpdateRequestDto(); house.name = name.Text; house.type = type.Text; house.for_ = for_.Text; house.location = location.Text; house.area = area.Text; house.priceperhectar = priceheactar.Text; house.totalprice = totalprice.Text; house.finishing = finishing.Text; house.id = houseCurrentNow.id; house.company = company.Text; Console.WriteLine(" house id == " + houseCurrentNow.id + " " + house.id); responseDto response = houseClient.updateHouse(house, houseCurrentNow.id, token); if (response.status == true) { DialogResult result = MessageBox.Show( response.message, "Success", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); //if (result == DialogResult.OK) //{ this.Hide(); Dashboard userDb = new Dashboard(); userDb.Show(); //} //else //{ // DialogResult res = MessageBox.Show(response.message, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop); //} } else { DialogResult result = MessageBox.Show( response.message, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Error); } } }
private void save_Click(object sender, EventArgs e) { Boolean vname = false; if (string.IsNullOrWhiteSpace(name.Text) | name.Text.Length < 4) { vname = false; name.Focus(); errorProvider1.SetError(name, "Name should contain at least four character."); } else { vname = true; errorProvider1.SetError(name, ""); } Boolean vtype = false; if (string.IsNullOrWhiteSpace(type.Text) | type.Text.Length < 3) { vtype = false; type.Focus(); errorProvider1.SetError(type, "Type should be selected."); } else { vtype = true; errorProvider1.SetError(type, ""); } Boolean vfor = false; if (string.IsNullOrWhiteSpace(for_.Text) | for_.Text.Length < 3) { vfor = false; type.Focus(); errorProvider1.SetError(for_, "Type should be selected."); } else { vfor = true; errorProvider1.SetError(for_, ""); } Boolean vlocation = false; if (string.IsNullOrWhiteSpace(location.Text) | location.Text.Length < 4) { vlocation = false; location.Focus(); errorProvider1.SetError(location, "Loation should contain at least four character."); } else { vlocation = true; errorProvider1.SetError(location, ""); } Boolean varea = false; if (string.IsNullOrWhiteSpace(area.Text) | !Regex.IsMatch(totalprice.Text, @"[0-9]{1,20}")) { varea = false; location.Focus(); errorProvider1.SetError(area, "Area should be number."); } else { varea = true; errorProvider1.SetError(area, ""); } Boolean vpriceperhectar = false; if (string.IsNullOrWhiteSpace(priceheactar.Text) | !Regex.IsMatch(totalprice.Text, @"[0-9]{1,20}")) { vpriceperhectar = false; location.Focus(); errorProvider1.SetError(priceheactar, "Price per hectar should be number."); } else { vpriceperhectar = true; errorProvider1.SetError(priceheactar, ""); } Boolean vtotalprice = false; if (string.IsNullOrWhiteSpace(totalprice.Text) | !Regex.IsMatch(totalprice.Text, @"[0-9]{1,20}")) { vtotalprice = false; totalprice.Focus(); errorProvider1.SetError(totalprice, "Total price should be number."); } else { vtotalprice = true; errorProvider1.SetError(totalprice, ""); } Boolean vfinishing = false; if (string.IsNullOrWhiteSpace(finishing.Text) | finishing.Text.Length < 2) { vfinishing = false; type.Focus(); errorProvider1.SetError(finishing, "Finishing should be selected."); } else { vfinishing = true; errorProvider1.SetError(finishing, ""); } Boolean vcompany = false; if (string.IsNullOrWhiteSpace(company.Text) | company.Text.Length < 3) { vcompany = false; company.Focus(); errorProvider1.SetError(company, "Company name should contain atleast two character."); } else { vcompany = true; errorProvider1.SetError(company, ""); } Boolean vpictureBox1 = false; if (string.IsNullOrWhiteSpace(pictureBox1.ImageLocation)) { vpictureBox1 = false; pictureBox1.Focus(); errorProvider1.SetError(pictureBox1, "Photo one should not be empty"); } else { vpictureBox1 = true; errorProvider1.SetError(pictureBox1, ""); } Boolean vpictureBox2 = false; if (string.IsNullOrWhiteSpace(pictureBox2.ImageLocation)) { vpictureBox2 = false; pictureBox2.Focus(); errorProvider1.SetError(pictureBox2, "Photo two should not be empty"); } else { vpictureBox2 = true; errorProvider1.SetError(pictureBox2, ""); } Boolean vpictureBox3 = false; if (string.IsNullOrWhiteSpace(pictureBox3.ImageLocation)) { vpictureBox3 = false; pictureBox3.Focus(); errorProvider1.SetError(pictureBox3, "Photo three should not be empty"); } else { vpictureBox3 = true; errorProvider1.SetError(pictureBox3, ""); } if (vname == true & vtype == true & vfor == true & vlocation == true & varea == true & vpriceperhectar == true & vtotalprice == true & vfinishing == true & vcompany == true & vpictureBox3 == true & vpictureBox2 == true & vpictureBox1 == true) { string token = File.ReadAllText("token.txt"); HousesEndpointClient houseClient = new HousesEndpointClient(); housesRequestDto house = new housesRequestDto(); house.name = name.Text; house.type = type.Text; house.for_ = for_.Text; house.location = location.Text; house.area = area.Text; house.priceperhectar = priceheactar.Text; house.totalprice = totalprice.Text; house.finishing = finishing.Text; house.status = true; house.id = 0; house.company = company.Text; Bitmap oneB = new Bitmap(pictureBox1.ImageLocation); ImageConverter converter = new ImageConverter(); byte[] one = (byte[])converter.ConvertTo(oneB, typeof(byte[])); house.photoone = one; Bitmap twoB = new Bitmap(pictureBox2.ImageLocation); ImageConverter converter2 = new ImageConverter(); byte[] two = (byte[])converter2.ConvertTo(twoB, typeof(byte[])); house.phototwo = two; Bitmap threeB = new Bitmap(pictureBox3.ImageLocation); ImageConverter converter3 = new ImageConverter(); byte[] three = (byte[])converter3.ConvertTo(threeB, typeof(byte[])); house.photothree = three; responseDto response = houseClient.createHouse(house, token); if (response.status == true) { DialogResult result = MessageBox.Show( response.message, "Success", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (result == DialogResult.OK) { this.Hide(); Dashboard userDb = new Dashboard(); userDb.Show(); } else { DialogResult res = MessageBox.Show(response.message, "Error", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop); //if (result == DialogResult.Cancel) //{ // this.Close(); //} } } } }
private void save_Click(object sender, EventArgs e) { Boolean vusername = false; if (string.IsNullOrWhiteSpace(username.Text) | username.Text.Length < 4) { vusername = false; username.Focus(); errorProvider1.SetError(username, "User name should contain at least four character."); } else { vusername = true; errorProvider1.SetError(username, ""); } Boolean vpassword = false; if (string.IsNullOrWhiteSpace(username.Text) | username.Text.Length < 4) { vpassword = false; password.Focus(); errorProvider1.SetError(password, "Password should contain at least four character."); } else { vpassword = true; errorProvider1.SetError(password, ""); } Boolean vconfirmpassword = false; if (string.IsNullOrWhiteSpace(confirmpassword.Text) | confirmpassword.Text.Length < 4 | !(confirmpassword.Text == password.Text)) { vconfirmpassword = false; confirmpassword.Focus(); errorProvider1.SetError(confirmpassword, "Confirm password should be same with password and empty."); } else { vconfirmpassword = true; errorProvider1.SetError(confirmpassword, ""); } Boolean vfirstname = false; if (string.IsNullOrWhiteSpace(firstname.Text) | firstname.Text.Length < 3) { vfirstname = false; firstname.Focus(); errorProvider1.SetError(firstname, "First name should contain at least three character."); } else { vfirstname = true; errorProvider1.SetError(firstname, ""); } Boolean vlastname = false; if (string.IsNullOrWhiteSpace(lastname.Text) | lastname.Text.Length < 3) { vlastname = false; lastname.Focus(); errorProvider1.SetError(lastname, "Last name should contain at least three character."); } else { vlastname = true; errorProvider1.SetError(lastname, ""); } Boolean vphone = false; if (string.IsNullOrWhiteSpace(lastname.Text) | lastname.Text.Length < 3) { vphone = false; phone.Focus(); errorProvider1.SetError(phone, "Phone should contain ten number."); } else { vphone = true; errorProvider1.SetError(phone, ""); } Boolean vemail = false; if (string.IsNullOrWhiteSpace(email.Text) | email.Text.Length < 3) { vemail = false; email.Focus(); errorProvider1.SetError(email, "Email should follow email format."); } else { vemail = true; errorProvider1.SetError(email, ""); } Boolean vcompany = false; if (string.IsNullOrWhiteSpace(company.Text) | company.Text.Length < 3) { vcompany = false; company.Focus(); errorProvider1.SetError(company, "Company name should contain atleast two character."); } else { vcompany = true; errorProvider1.SetError(company, ""); } if (vusername == true & vpassword == true & vfirstname == true & vlastname == true & vphone == true & vemail == true & vcompany == true & vconfirmpassword == true) { UserEndPointClient userClient = new UserEndPointClient(); userDto user = new userDto(); user.id = 0; user.username = username.Text; user.password = password.Text; Console.WriteLine("Password <===> " + password.Text); user.fname = firstname.Text; user.lname = lastname.Text; user.phone = phone.Text; user.email = email.Text; user.company = company.Text; user.status = true; user.createdat = new DateTime(); responseDto res = userClient.createUser(user); if (res.status == true) { MessageBox.Show(res.message + "\n" + "You can login now", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); Signin signin = new Signin(); signin.Show(); } else { MessageBox.Show(res.message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public async Task <IEnumerable <string> > Get() { responseDto resultado = await _orquestaStock.PuedoOperarCVME("1"); return(new string[] { resultado.puedeOperar.ToString(), resultado.resultadoDeOperacion }); }
private void update_Click(object sender, EventArgs e) { Boolean vusername = false; if (string.IsNullOrWhiteSpace(username.Text) | username.Text.Length < 4) { vusername = false; username.Focus(); errorProvider1.SetError(username, "User name should contain at least four character."); } else { vusername = true; errorProvider1.SetError(username, ""); } Boolean vfirstname = false; if (string.IsNullOrWhiteSpace(firstname.Text) | firstname.Text.Length < 3) { vfirstname = false; firstname.Focus(); errorProvider1.SetError(firstname, "First name should contain at least three character."); } else { vfirstname = true; errorProvider1.SetError(firstname, ""); } Boolean vlastname = false; if (string.IsNullOrWhiteSpace(lastname.Text) | lastname.Text.Length < 3) { vlastname = false; lastname.Focus(); errorProvider1.SetError(lastname, "Last name should contain at least three character."); } else { vlastname = true; errorProvider1.SetError(lastname, ""); } Boolean vphone = false; if (string.IsNullOrWhiteSpace(lastname.Text) | lastname.Text.Length < 3) { vphone = false; phone.Focus(); errorProvider1.SetError(phone, "Phone should contain ten number."); } else { vphone = true; errorProvider1.SetError(phone, ""); } Boolean vemail = false; if (string.IsNullOrWhiteSpace(email.Text) | email.Text.Length < 3) { vemail = false; email.Focus(); errorProvider1.SetError(email, "Email should follow email format."); } else { vemail = true; errorProvider1.SetError(email, ""); } Boolean vcompany = false; if (string.IsNullOrWhiteSpace(company.Text) | company.Text.Length < 3) { vcompany = false; company.Focus(); errorProvider1.SetError(company, "Company name should contain atleast two character."); } else { vcompany = true; errorProvider1.SetError(company, ""); } if (vusername == true & vfirstname == true & vlastname == true & vphone == true & vemail == true & vcompany == true) { UserEndPointClient userClient = new UserEndPointClient(); userDto user = new userDto(); user.id = currentUserNow.id; //user.username = username.Text; //user.password = password.Text; user.fname = firstname.Text; user.lname = lastname.Text; user.phone = phone.Text; user.email = email.Text; user.company = company.Text; //user.status = null; user.createdat = currentUserNow.createdat; string token = File.ReadAllText("token.txt"); responseDto res = userClient.updateUser(user, token); if (res.status == true) { MessageBox.Show(res.message, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); Signin signin = new Signin(); signin.Show(); } else { MessageBox.Show(res.message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }