private void CarregaTabelaVendedores() { var tabelaHtml = new StringBuilder(); tabelaHtml.Append("<table id=\"tabelaVendedores\" class=\"table table-striped table-bordered table-hover dataTables-example\">"); tabelaHtml.Append("<thea><tr>"); tabelaHtml.Append("<th style=\"text-align: center; vertical-align: middle;\"><h3>ID</h3></th>"); tabelaHtml.Append("<th style=\"text-align: center; vertical-align: middle;\"><h3>Vendedor</h3></th>"); tabelaHtml.Append("<th style=\"text-align: center; vertical-align: middle;\"><h3>Situação</h3></th>"); tabelaHtml.Append("<th style=\"text-align: center; vertical-align: middle;\"><h3></h3></th>"); tabelaHtml.Append("</tr></thead><tbody>"); var listaVendedor = AcaoEntreAmigosVendedor.Lista(-1); foreach (var vdr in listaVendedor) { tabelaHtml.Append("<tr>"); //ID tabelaHtml.Append(string.Format("<td style=\"vertical-align: middle; text-align: center;\" >{0}</td>", vdr.IdVendedor)); //Vendedor tabelaHtml.Append(string.Format("<td style=\"vertical-align: middle; text-align: center;\" >{0}</td>", vdr.NomeVendedor)); //Situação var sit = string.Format("<small class=\"label label-{1}\">{0}</small>" , vdr.IdStatus == 0 ? "INATIVO" : "ATIVO" , vdr.IdStatus == 0 ? "danger" : "primary" ); tabelaHtml.Append(string.Format("<td style=\"vertical-align: middle; text-align: center;\" >{0}</td>", sit)); //=== AÇÕES ====== //eDITAR var idCrypto = Criptografia.Encrypt(vdr.IdVendedor.ToString()); idCrypto = idCrypto.Replace('/', '_').Replace('+', '.').Replace('=', '-'); var htmlBtnEditar = string.Format("<a href=\"javascript:;\" onclick=\"carregaIdVendedorEdit('{0}', '{1}', {2})\" " + //class=\"btn btn-outline btn-success btn-sm\" " title=\"Editar\" data-toggle=\"modal\" data-target=\"#myModalEditInvest\"><i class=\"fa fa-pencil fa-lg\"></i></a>", idCrypto, vdr.NomeVendedor, vdr.IdStatus); tabelaHtml.Append(string.Format("<td style=\"vertical-align: middle; text-align: center;\" >{0}</td>", htmlBtnEditar)); //tabelaHtml.Append(string.Format("<td style=\"color: {1}; font-weight: bold; vertical-align: middle; text-align: center;\" >{0}</td>", numero, num.IdStatus == 0 ? "green" : "red")); //style="background-color: red;" tabelaHtml.Append("</tr>"); } tabelaHtml.Append("</tbody></table>"); ltlTabelaVendedores.Text = tabelaHtml.ToString(); }
public static string CarregaNumeroEdit(string numero) { try { var htmlCamposModal = new StringBuilder(); numero = numero.Replace('_', '/').Replace('.', '+').Replace('-', '='); numero = Criptografia.Decrypt(numero); var aea = AcaoEntreAmigos.PesquisaNumero(int.Parse(numero)); if (aea != null) { //campo Numero htmlCamposModal.Append("<div class=\"form-group\"><label>Número</label>"); htmlCamposModal.Append(string.Format("<input id=\"txtNumeroEdit\" type=\"text\" class=\"form-control\" value=\"{0}\" disabled=\"\"/></div>", aea.NumeroStr)); //campo Comprador htmlCamposModal.Append("<div class=\"form-group\"><label>Comprador</label>"); htmlCamposModal.Append(string.Format("<input id=\"txtCompradorEdit\" type=\"text\" class=\"form-control\" value=\"{0}\"/></div>", aea.NomeComprador)); //campo Telefone htmlCamposModal.Append("<div class=\"form-group\"><label>Telefone(s)</label>"); htmlCamposModal.Append(string.Format("<input id=\"txtTelefoneEdit\" type=\"text\" class=\"form-control\" value=\"{0}\"/></div>", aea.Telefone)); //campo Email htmlCamposModal.Append("<div class=\"form-group\"><label>Email</label>"); htmlCamposModal.Append(string.Format("<input id=\"txtEmailEdit\" type=\"text\" class=\"form-control\" value=\"{0}\"/></div>", aea.Email)); //campo data Venda htmlCamposModal.Append("<div class=\"form-group\"><label>Data Venda</label>"); htmlCamposModal.Append(string.Format("<input id=\"txtDataVendaEdit\" type=\"date\" class=\"form-control\" value=\"{0}\"/></div>" , aea.DataVenda.ToString().Equals("01/01/1900 00:00:00") ? string.Empty : aea.DataVenda.ToString("yyyy-MM-dd")) ); //campo Vendedor htmlCamposModal.Append("<div class=\"form-group\"><label>Vendedor</label>"); //htmlCamposModal.Append(string.Format("<input id=\"txtVe Edit\" type=\"text\" class=\"form-control\" value=\"{0}\"/></div>", aea.NomeVendedor)); htmlCamposModal.Append("<select id=\"ddlVendedorEdit\" class=\"form-control\">"); var listaVendedor = AcaoEntreAmigosVendedor.Lista(-1); foreach (var item in listaVendedor) { var selected = item.IdVendedor == aea.IdVendedor ? " selected=\"selected\"" : ""; htmlCamposModal.Append(string.Format("<option value=\"{0}\" {2}>{1}</option>", item.IdVendedor, item.NomeVendedor, selected)); } htmlCamposModal.Append("</select></div>"); //campo Situação htmlCamposModal.Append("<div class=\"form-group\"><label>Situação</label>"); htmlCamposModal.Append("<select id=\"ddlStatusEdit\" class=\"form-control\">"); var selected_1 = aea.IdStatus == 0 ? " selected=\"selected\"" : ""; htmlCamposModal.Append(string.Format("<option value=\"0\" {0}>Disponível</option>", selected_1)); selected_1 = aea.IdStatus == 1 ? " selected=\"selected\"" : ""; htmlCamposModal.Append(string.Format("<option value=\"1\" {0}>Vendido</option>", selected_1)); htmlCamposModal.Append("</select></div>"); } return(htmlCamposModal.ToString()); } catch (Exception ex) { return("<div class=\"alert alert-block alert-danger fade in\"><button data-dismiss=\"alert\" class=\"close\" type=\"button\">" + "</button><p><i class=\"fa fa-times-circle fa-lg\"></i> btnPesquisar_Click-ERRO:" + ex.Message + "</p></div>"); } }