private static void enviarA(string u, int b, string url) { Mail mail = new Mail(); List <USUARIO_BE> usuarioBeList = USUARIO_BLL.GET(2); string[] dest = new string[usuarioBeList.Count + 1]; string[] strArray = new string[usuarioBeList.Count + 1]; for (int index = 0; index < usuarioBeList.Count; ++index) { dest[index] = usuarioBeList[index].eMail; strArray[index] = usuarioBeList[index].NipLogin; } dest[usuarioBeList.Count] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(string.Concat((object)b))[0].FK_USUARIO)[0].eMail; strArray[usuarioBeList.Count] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(string.Concat((object)b))[0].FK_USUARIO)[0].NipLogin; string asunto = "Se ha creado una requisición"; string mensaje = u.ToUpper() + " creó la requisición: " + (object)b + "<br><br>"; string[] strArray2 = url.Split('/'); string url1 = ""; for (int index = 0; index < strArray2.Length - 1; ++index) { url1 = url1 + strArray2[index] + "/"; } mail.send(dest, asunto, mensaje, b, url1); }
private void enviarA(string u, int b, string url) { Mail email = new Mail(); int r = 2; List <USUARIO_BE> compras = USUARIO_BLL.GET(r); //Usuarios de Compras string[] dest3 = new string[compras.Count + 1]; string[] names3 = new string[compras.Count + 1]; for (int i = 0; i < compras.Count; i++) { dest3[i] = compras[i].eMail; names3[i] = compras[i].NipLogin; } dest3[compras.Count] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0].eMail; names3[compras.Count] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0].NipLogin; string asunto = "Se ha autorizado una requisición"; string mensaje = u.ToUpper() + " autorizó la requisición: " + b + "<br><br>"; //for (int i = 0; i < names3.Length; i++) //{ // mensaje += names3[i] + "<br>"; //} email.send(dest3, asunto, mensaje, b, url); }
private void enviarF(string u, int b, string url, string SAP_N) { Mail email = new Mail(); List <USUARIO_BE> gerencia = USUARIO_BLL.GET(USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0].AREA); //Usuarios gerencia de area string[] dest3 = new string[gerencia.Count + 1]; string[] names3 = new string[gerencia.Count + 1]; for (int i = 0; i < gerencia.Count; i++) { dest3[i] = gerencia[i].eMail; names3[i] = gerencia[i].NipLogin; } dest3[gerencia.Count] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].COMPRADOR)[0].eMail; names3[gerencia.Count] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].COMPRADOR)[0].NipLogin; string asunto = "Se ha aprobado una requisición"; string mensaje = u.ToUpper() + " aprobó la requisición: " + b + "<br><br>" + "Solicitud de compra en SAP: " + SAP_N + "<br><br>"; //for (int i = 0; i < names3.Length; i++) //{ // mensaje += names3[i] + "<br>"; //} email.send(dest3, asunto, mensaje, b, url); }
private void enviar(string u, int b, string url) { ////Mail email = new Mail(); ////int r = rol(USUARIO_BLL.GET(u)[0]) + 1; ////if (r < 6) ////{ //// string[] dest = getDestinatarios(r, u); //// USUARIO_BE usu = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0]; //// dest[dest.Length - 1] = usu.eMail; //// string asunto = "Se ha aprobado una requisición: " + b; //// string mensaje = u + " aprobó la requisición: " + b + "<br><br>"; //// email.send(dest, asunto, mensaje, b, url); ////} ////else ////{ //// string[] dest2 = new string[2]; //// string[] names2 = new string[2]; //// if (USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO).Count > 0) //// { //// USUARIO_BE usu = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0]; //// dest2[0] = usu.eMail; //// names2[0] = usu.NipLogin; //// } //// dest2[1] = USUARIO_BLL.GET(u)[0].eMail; //// names2[1] = USUARIO_BLL.GET(u)[0].NipLogin; //// string asuntos = "Se ha aprobado una requisición: " + b; //// string mensajes = u + " aprobó la requisición: " + b + "<br><br>"; //// for (int i = 0; i < names2.Length; i++) //// { //// mensajes += names2[i] + "<br><br>"; //// } //// email.send(dest2, asuntos, mensajes, b, url); ////} Mail email = new Mail(); //int r = 1; List <USUARIO_BE> gerencia = USUARIO_BLL.GET(USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0].AREA); //Usuarios gerencia de area string[] dest3 = new string[gerencia.Count + 1]; string[] names3 = new string[gerencia.Count + 1]; for (int i = 0; i < gerencia.Count; i++) { dest3[i] = gerencia[i].eMail; names3[i] = gerencia[i].NipLogin; } dest3[gerencia.Count] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].COMPRADOR)[0].eMail; names3[gerencia.Count] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].COMPRADOR)[0].NipLogin; string asunto = "Se ha aprobado una requisición"; string mensaje = u.ToUpper() + " aprobó la requisición: " + b + "<br><br>"; //for (int i = 0; i < names3.Length; i++) //{ // mensaje += names3[i] + "<br>"; //} email.send(dest3, asunto, mensaje, b, url); }
public string cancelar(string banfn, string user, string url, string comm) { string[] ur = url.Split('/'); string u = ""; for (int i = 0; i < ur.Length - 1; i++) { u += ur[i] + "/"; } List <ZEBAN_P_BE> requ = ZEBAN_P_BLL.GET(banfn); if (requ.Count > 0) { //int status = Int32.Parse(requ[0].STATUS); int status = 0; status = rol(USUARIO_BLL.GET(requ[0].FK_USUARIO)[0]); //if (status > 0) //{ // status--; //} //requ[0].STATUS = status + ""; requ[0].STATUS = "-2"; requ[0].APROBO = ""; int i = ZEBAN_P_BLL.UPDATE(requ[0]); if (i > 0) { ZEBAN_H_BE his = new ZEBAN_H_BE(); his.BANFN = banfn; his.FECHA = DateTime.Now; his.NIPLOGIN = user; ZEBAN_H_BLL.INSERT(his); ZEBAN_C_BE com = new ZEBAN_C_BE(); com.BANFN = Int32.Parse(banfn); com.FK_USUARIO = user; com.TEXTO = "CANCELADO POR: \n" + comm; ZEBAN_C_BLL.INSERT(com); //enviarR(user, Int32.Parse(banfn), u, comm); return("Se ha cancelado la requisición"); } } return("Hubo un error al cancelar la requisición"); }
private void enviarR(string u, int b, string url, string com) { Mail email = new Mail(); int r = rol(USUARIO_BLL.GET(u)[0]) + 1; List <ZEBAN_H_BE> hist = ZEBAN_H_BLL.GET(b); string[] dest3 = new string[1]; string[] names3 = new string[1]; ////for (int i = 0; i < hist.Count; i++) ////{ //// dest3[i] = USUARIO_BLL.GET(hist[i].NIPLOGIN)[0].eMail; //// names3[i] = USUARIO_BLL.GET(hist[i].NIPLOGIN)[0].NipLogin; ////} ////dest3[hist.Count] = USUARIO_BLL.GET(u)[0].eMail; ////names3[hist.Count] = USUARIO_BLL.GET(u)[0].NipLogin; dest3[0] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0].eMail; names3[0] = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0].NipLogin; string asunto = "Se ha rechazado una requisición"; string mensaje = u.ToUpper() + " rechazó la requisición: " + b + "<br><br>"; //for (int i = 0; i < names3.Length; i++) //{ // mensaje += names3[i] + "<br><br>"; //} mensaje += comentarios(com); email.send(dest3, asunto, mensaje, b, url); //} //else //{ // //string[] dest2 = new string[2]; // //USUARIO_BE usu = USUARIO_BLL.GET(ZEBAN_P_BLL.GET(b + "")[0].FK_USUARIO)[0]; // //dest2[0] = usu.eMail; // //dest2[1] = USUARIO_BLL.GET(u)[0].eMail; // //string asuntos = "Se ha aprobado una requisición"; // //string mensajes = u + " aprobó la requisición: " + b + "<br><br>"; // //email.send(dest2, asuntos, mensajes, b, url); //} }
public static string crear2(string url, string valores, string comentario, string r, string us)// Crea requisición { string tipo = ""; string id = ""; ZEBAN_P_BE header = new ZEBAN_P_BE(); header.FK_USUARIO = us; header.STATUS = "0";//getStatus(user) + ""; header.F_APROBACION = DateTime.Now; header.REFERENCIA = r; List <ZEBAN_BE> items = new List <ZEBAN_BE>(); List <ZEBAN_I_BE> imps = new List <ZEBAN_I_BE>(); List <ZEBAN_S_BE> serv = new List <ZEBAN_S_BE>(); string[] tabla = valores.Split('|'); string valores_temp = ""; int cont = 0; for (int i = 0; i < tabla.Length - 1; i += 9) { if (cont > 0) { cont = (i / 9) + 1;//27.01.2017 i/8 } else { cont = i + 1; } valores_temp = tabla[i + 2] + "|" + tabla[i + 3] + "|" + tabla[i + 4] + "|" + tabla[i + 5] + "|" + tabla[i + 6] + "|" + tabla[i + 7] + "|" + tabla[i + 8] + "|"; tipo = tabla[i]; id = tabla[i + 1]; if (tipo == "s") { //res = creaServicios(valores, id, comentario); List <Object> list = new List <object>(); list = creaServicios(valores_temp, id, cont); ZEBAN_BE item_s = new ZEBAN_BE(); ZEBAN_I_BE imp_s = new ZEBAN_I_BE(); ZEBAN_S_BE serv_s = new ZEBAN_S_BE(); item_s = (ZEBAN_BE)list[0]; items.Add(item_s); imp_s = (ZEBAN_I_BE)list[1]; imps.Add(imp_s); serv_s = (ZEBAN_S_BE)list[2]; serv.Add(serv_s); } else if (tipo == "a") { //res = creaActivos(valores, id, comentario); List <Object> list = new List <object>(); list = creaActivos(valores_temp, id, cont); ZEBAN_BE item_i = new ZEBAN_BE(); ZEBAN_I_BE imp_i = new ZEBAN_I_BE(); ZEBAN_S_BE serv_i = new ZEBAN_S_BE(); item_i = (ZEBAN_BE)list[0]; items.Add(item_i); imp_i = (ZEBAN_I_BE)list[1]; imps.Add(imp_i); serv_i = (ZEBAN_S_BE)list[2]; serv.Add(serv_i); } else if (tipo == "m") { ZEBAN_BE item = new ZEBAN_BE(); item = creaMateriales(valores_temp, id, cont); items.Add(item); } else { //res = creaServicios(valores, id, comentario); List <Object> list = new List <object>(); list = creaImputa(valores_temp, id, cont); ZEBAN_BE item_s = new ZEBAN_BE(); ZEBAN_I_BE imp_s = new ZEBAN_I_BE(); ZEBAN_S_BE serv_s = new ZEBAN_S_BE(); item_s = (ZEBAN_BE)list[0]; items.Add(item_s); imp_s = (ZEBAN_I_BE)list[1]; imps.Add(imp_s); } } int conf = ZEBAN_P_BLL.INSERT(header); //Insertar registro en SQL List <ZEBAN_P_BE> zeban_p = ZEBAN_P_BLL.GET(); int b = zeban_p[(zeban_p.Count - 1)].BANFN; int banfn = b; for (int i = 0; i < items.Count; i++) { items[i].BANFN = b; } for (int i = 0; i < imps.Count; i++) { imps[i].BANFN = b; } for (int i = 0; i < serv.Count; i++) { serv[i].BANFN = b; } conf += ZEBAN_BLL.INSERT(items); if (imps.Count > 0) { conf += ZEBAN_I_BLL.INSERT(imps); } if (serv.Count > 0) { conf += ZEBAN_S_BLL.INSERT(serv); } if (!comentario.Equals("")) { ZEBAN_C_BE com = new ZEBAN_C_BE(); com.BANFN = banfn; com.FK_USUARIO = us; com.TEXTO = comentario; conf += ZEBAN_C_BLL.INSERT(com); } //USUARIO_BE u = USUARIO_BLL.GET(us)[0]; //enviar(us, banfn, url); USUARIO_BE usuarioBe = USUARIO_BLL.GET(us)[0]; using (List <USUARIO_BE> .Enumerator enumerator = USUARIO_BLL.GET(USUARIO_BLL.GET(us)[0].AREA).GetEnumerator()) { while (enumerator.MoveNext()) { USUARIO_BE current = enumerator.Current; if (current.GEREN | current.DIREC) { header.BANFN = (b); header.STATUS = ("2"); conf += ZEBAN_P_BLL.UPDATE(header); enviarA(usuarioBe.NipLogin, b, url); } else { enviar(us, b, url); } } } return("B"); }
public string autorizar(string banfn, string user, string url) { string[] ur = url.Split('/'); string u = ""; for (int i = 0; i < ur.Length - 1; i++) { u += ur[i] + "/"; } List <ZEBAN_P_BE> requ = ZEBAN_P_BLL.GET(banfn); if (requ.Count > 0) { //int status = Int32.Parse(requ[0].STATUS); int status = 0; status = rol(USUARIO_BLL.GET(user)[0]); //if (status > 0) //{ // status--; //} //requ[0].STATUS = status + ""; requ[0].STATUS = (Int16.Parse(requ[0].STATUS) + 1) + ""; if (requ[0].STATUS.Equals("1")) { requ[0].STATUS = "2"; } if (status == 4) { if (!requ[0].COMPRADOR.Equals("-") & !requ[0].COMPRADOR.Equals("")) { requ[0].STATUS = "4"; } } requ[0].APROBO = ""; int i = ZEBAN_P_BLL.UPDATE(requ[0]); if (i > 0) { ZEBAN_H_BE his = new ZEBAN_H_BE(); his.BANFN = banfn; his.FECHA = DateTime.Now; his.NIPLOGIN = user; ZEBAN_H_BLL.INSERT(his); if (requ[0].STATUS.Equals("2")) { enviarA(user, Int32.Parse(banfn), u); } else if (requ[0].STATUS.Equals("4")) { enviarGerente(Int16.Parse(banfn), url, 4); } else if (requ[0].STATUS.Equals("5")) { enviarGerente(Int16.Parse(banfn), url, 5); } return("Se ha autorizado la requisición"); } } return("Hubo un error al autorizar la requisición"); }
public string rechazar(string banfn, string user, string url, string comm) { string[] ur = url.Split('/'); string u = ""; for (int i = 0; i < ur.Length - 1; i++) { u += ur[i] + "/"; } List <ZEBAN_P_BE> requ = ZEBAN_P_BLL.GET(banfn); if (requ.Count > 0) { int status = 0; status = rol(USUARIO_BLL.GET(user)[0]); if (status == 4 & !requ[0].STATUS.Trim().Equals("0") & !requ[0].STATUS.Trim().Equals("1")) { requ[0].STATUS = "2"; int i = ZEBAN_P_BLL.UPDATE(requ[0]); List <ZEBAN_BE> pos = ZEBAN_BLL.GET(Int16.Parse(banfn)); foreach (ZEBAN_BE p in pos) { List <ZEBAN_I_BE> imp = ZEBAN_I_BLL.GET(p.BANFN, p.BNFPO); foreach (ZEBAN_I_BE im in imp) { im.COSTCENTER = ""; im.GL_ACCOUNT = ""; } ZEBAN_I_BLL.UPDATE(imp); } ZEBAN_H_BE his = new ZEBAN_H_BE(); his.BANFN = banfn; his.FECHA = DateTime.Now; his.NIPLOGIN = user; ZEBAN_H_BLL.INSERT(his); ZEBAN_C_BE com = new ZEBAN_C_BE(); com.BANFN = Int32.Parse(banfn); com.FK_USUARIO = user; com.TEXTO = comm; ZEBAN_C_BLL.INSERT(com); //ENVIAR CORREO A CONTABILIDAD. enviarConta(Int32.Parse(banfn), u, comm); return("Se ha rechazado la requisición"); } else { requ[0].STATUS = "-1"; requ[0].COMPRADOR = ""; int i = ZEBAN_P_BLL.UPDATE(requ[0]); if (i > 0) { ZEBAN_H_BE his = new ZEBAN_H_BE(); his.BANFN = banfn; his.FECHA = DateTime.Now; his.NIPLOGIN = user; ZEBAN_H_BLL.INSERT(his); ZEBAN_C_BE com = new ZEBAN_C_BE(); com.BANFN = Int32.Parse(banfn); com.FK_USUARIO = user; com.TEXTO = comm; ZEBAN_C_BLL.INSERT(com); enviarR(user, Int32.Parse(banfn), u, comm); return("Se ha rechazado la requisición"); } } } return("Hubo un error al rechazar la requisición"); }
public string aprobar(string banfn, string user, string url) { string[] ur = url.Split('/'); string u = ""; for (int i = 0; i < ur.Length - 1; i++) { u += ur[i] + "/"; } List <ZEBAN_P_BE> requ = ZEBAN_P_BLL.GET(banfn); string referencia = "";//27.01.2017 if (requ.Count > 0) { referencia = requ[0].REFERENCIA;//27.01.2017 requ[0].STATUS = rol(USUARIO_BLL.GET(user)[0]) + ""; if (requ[0].STATUS.Equals("5") | requ[0].STATUS.Equals("6")) { Conexion con = new Conexion(); List <ZEBAN_BE> Items = ZEBAN_BLL.GET(Int32.Parse(banfn)); List <ZEBAN_I_BE> imps = new List <ZEBAN_I_BE>(); List <ZEBAN_S_BE> servs = new List <ZEBAN_S_BE>(); foreach (ZEBAN_BE z in Items) { List <ZEBAN_I_BE> ii = ZEBAN_I_BLL.GET(z.BANFN, z.BNFPO.Trim()); List <ZEBAN_S_BE> ss = ZEBAN_S_BLL.GET(z.BANFN, z.BNFPO.Trim()); foreach (ZEBAN_I_BE i in ii) { imps.Add(i); if (z.TIPO.Trim() != "F") { ZEBAN_S_BE t = new ZEBAN_S_BE(); t.ASSET_NUM = i.ASSET_NUM.Trim(); t.COSTCENTER = i.COSTCENTER.Trim(); t.BANFN = i.BANFN; t.BNFPO = i.BNFPO.Trim(); t.GL_ACCOUNT = i.GL_ACCOUNT.Trim(); t.SERIAL = i.SERIAL; //t. servs.Add(t); } } if (z.TIPO.Trim() == "F") { foreach (ZEBAN_S_BE s in ss) { s.SERVICIO = completa(s.SERVICIO.Trim(), 18); servs.Add(s); } } } string[] ret = con.bapi_pr_create2(Items, imps, servs, user, u, referencia); //Crea requisición//27.01.2017 string status; // = "E"; if (!ret[0].Equals("")) { status = "B"; requ[0].APROBO = user; requ[0].SAP_BANFN = ret[0]; requ[0].STATUS = "6"; int i = ZEBAN_P_BLL.UPDATE(requ[0]); if (i > 0) { ZEBAN_H_BE his = new ZEBAN_H_BE(); his.BANFN = banfn; his.FECHA = DateTime.Now; his.NIPLOGIN = user; ZEBAN_H_BLL.INSERT(his); List <ZEBAN_D_BE> docs = ZEBAN_D_BLL.GET(Int32.Parse(banfn)); for (int y = 0; y < docs.Count; y++) { byte[] bytes = docs[y].INFO; string name = docs[y].NOMBRE + "." + docs[y].EXT; ret[i] = con.rfcFuncionAdjuntar(ret[0], "BUS2105", name, bytes); } enviarF(user, Int32.Parse(banfn), u, ret[0]); //return "Se ha aprobado la requisición"; } ret[1] = "Se ha creado la requisición " + ret[0] + " en SAP"; } else { status = "Hubieron errores al crear la requisición:"; } return("\n" + ret[1]); } else { requ[0].APROBO = user; int i = ZEBAN_P_BLL.UPDATE(requ[0]); if (i > 0) { ZEBAN_H_BE his = new ZEBAN_H_BE(); his.BANFN = banfn; his.FECHA = DateTime.Now; his.NIPLOGIN = user; ZEBAN_H_BLL.INSERT(his); enviar(user, Int32.Parse(banfn), u); return("Se ha aprobado la requisición"); } } } return("Hubo un error al aprobar la requisición"); }