// FUNCION QUE ALMACENA UN DOCUMENTO INFORMATIVO [ ARCHIVERO ] public string AltaDocCConsejeria(DocCConsejeria docinformativo) { try { SQL.comandoSQLTrans("DocInformativoCC"); SQL.commandoSQL = new SqlCommand("INSERT INTO dbo.consejeriadocumentos (idcentro, nombre, extension, archivo, fechahora, admusuario) VALUES ((SELECT id FROM dbo.centros WHERE tokencentro = @TokenCentroParam), @NombreParam, @ExtensionParam, @ArchivoParam, @FechaParam, (SELECT usuario FROM dbo.usuarios WHERE tokenusuario = @TokenUsuarioParam))", SQL.conSQL, SQL.transaccionSQL); SqlParameter[] altaDocMedico = { new SqlParameter("@TokenCentroParam", SqlDbType.VarChar) { Value = docinformativo.TokenCentro }, new SqlParameter("@NombreParam", SqlDbType.VarChar) { Value = docinformativo.Nombre }, new SqlParameter("@ExtensionParam", SqlDbType.VarChar) { Value = docinformativo.Extension }, new SqlParameter("@ArchivoParam", SqlDbType.VarChar) { Value = docinformativo.Archivo }, new SqlParameter("@FechaParam", SqlDbType.DateTime) { Value = MISC.FechaHoy() }, new SqlParameter("@TokenUsuarioParam", SqlDbType.VarChar) { Value = docinformativo.TokenUsuario } }; SQL.commandoSQL.Parameters.AddRange(altaDocMedico); SQL.commandoSQL.ExecuteNonQuery(); SQL.transaccionSQL.Commit(); return "true"; } catch (Exception e) { SQL.transaccionSQL.Rollback(); return e.ToString(); } finally { SQL.conSQL.Close(); } }
static void Main(string[] args) { Console.Title = "BnS Model Info Generator, ver 1.0.6, build date 2016-05-22"; Program_Parameter para; if (Program_Parameter.Parse(args, out para)) { PrepareData(para); //now write! if (para.IfWrite_ModelInfo) { File.WriteAllText($"{para.FolderPath_Out}BnS_ModelInfo.{MISC.GetPathable_YMD(DateTime.Now)}.txt", UPackageInfo_Analyzer.Generate_ModelInfo(false)); } if (para.IfWrite_ModelInfo_withName) { File.WriteAllText($"{para.FolderPath_Out}BnS_ModelInfo_withName.{MISC.GetPathable_YMD(DateTime.Now)}.txt", UPackageInfo_Analyzer.Generate_ModelInfo(true)); } if (para.IfWrite_NameModelRelation) { File.WriteAllText($"{para.FolderPath_Out}BnS_NameModel_Relation.{MISC.GetPathable_YMD(DateTime.Now)}.txt", DatInfo_Generator.Generate_ObjHumanInfo()); } Console.WriteLine(); Console.WriteLine(" Programming by Elan(or iVAiU, I no longer use that name)."); Console.WriteLine(" Many thanks to: Eliot van Uytfanghe (UELib), ronny1982 (bnsdat)."); } Console.WriteLine("End of Program."); }
// FUNCION QUE INICIA LA SESIÓN public string IniciarSesion(MLogin.LoginInfo LoginData) { string respuesta = MiLogin.LoginFuncion(LoginData); MLogin.LoginRespuesta RespuestaJSON = JsonConvert.DeserializeObject <MLogin.LoginRespuesta>(respuesta); if (RespuestaJSON.Respuesta) { Session["IdSession"] = MISC.CrearIdSession(); Session["IdUsuario"] = LoginData.Usuario; Session["Token"] = RespuestaJSON.Token; Session["TokenCentro"] = RespuestaJSON.TokenCentro; Session["ClaveCentro"] = LoginData.ClaveCentro; Session["Id"] = RespuestaJSON.IdUsuario; Session["Administrador"] = RespuestaJSON.Administrador; Session["AlAnon"] = RespuestaJSON.AlAnon; Session["CoordDeportiva"] = RespuestaJSON.CoordDeportiva; Session["CoordMedica"] = RespuestaJSON.CoordMedica; Session["CoordPsicologica"] = RespuestaJSON.CoordPsicologica; Session["CoordEspiritual"] = RespuestaJSON.CoordEspiritual; Session["Cord12Pasos"] = RespuestaJSON.Cord12Pasos; Session["Documentacion"] = RespuestaJSON.Documentacion; Session["NotifCentroID"] = RespuestaJSON.NotifCentroID; Session["NotifUsuarioID"] = RespuestaJSON.NotifUsuarioID; } return(respuesta); }
// FUNCION QUE ENVIA CORREO ELECTRONICO CON LOS [ USUARIOS ] public string EnviarCorreoUsuarioPass(string Correo, string Pass, string Usuario, string NombreUsuario) { try { string UrlUsuarioDocs = System.Web.HttpContext.Current.Request.Url.AbsoluteUri.Replace(System.Web.HttpContext.Current.Request.Url.AbsolutePath, "") + "/Docs/" + (string)Session["TokenCentro"] + "/"; string correoHTML = "<p>Estimado <b>" + NombreUsuario + "</b></p><br /><p>Le damos la bienvenida al sistema <b>SIUR-A</b> anunciándole que su registro, realizado por el administrador, se ha realizado correctamente. A continuación le damos a conocer los valores de acceso para que inicie sesión en el sistema:</p><br><p><b>Usuario: </b>" + Usuario + "</p><p><b>Contraseña: </b>" + Pass + "</p><p><b>Clave Centro: </b>" + (string)Session["ClaveCentro"] + "</p>"; var smtpUsuario = new SmtpClient("smtp.gmail.com", 587) { Credentials = new NetworkCredential("*****@*****.**", "siura2020"), EnableSsl = true }; MailMessage msg = new MailMessage(); MailAddress mailKiosko = new MailAddress("*****@*****.**"); MailAddress mailCategorie = new MailAddress(Correo); msg.From = mailKiosko; msg.To.Add(mailCategorie); msg.Subject = "Info. Inicio de Sesión"; msg.Body = MISC.MailHTML().Replace("×ØCUERPOMAILØ×", correoHTML); msg.IsBodyHtml = true; smtpUsuario.Send(msg); return("true"); } catch (Exception e) { return(e.ToString()); } }
// FUNCION QUE ENVIA CORREO ELECTRONICO CON NUEVA CONTRASEÑA DE USUARIO [ USUARIOS ] public string EnviarCorreoUsuarioNuevaPass(string Correo, string Pass, string NombreUsuario) { try { string UrlUsuarioDocs = System.Web.HttpContext.Current.Request.Url.AbsoluteUri.Replace(System.Web.HttpContext.Current.Request.Url.AbsolutePath, "") + "/Docs/" + (string)Session["TokenCentro"] + "/"; string correoHTML = "<p>Estimado <b>" + NombreUsuario + "</b></p><br /><p>Hemos recibido una solicitud de reestablecimiento de su contraseña de acceso al sistema SIURA por parte de su usuario <b>administrador</b>. Su nueva clave de acceso es:</p><p><b>Nueva Contraseña: </b>" + Pass + "</p><br /><p>Una vez iniciado sesión le recomendamos ampliamente personalizarla desde el menú <b>Configuración.</b></p>"; var smtpUsuario = new SmtpClient("smtp.gmail.com", 587) { Credentials = new NetworkCredential("*****@*****.**", "siura2020"), EnableSsl = true }; MailMessage msg = new MailMessage(); MailAddress mailKiosko = new MailAddress("*****@*****.**"); MailAddress mailCategorie = new MailAddress(Correo); msg.From = mailKiosko; msg.To.Add(mailCategorie); msg.Subject = "Nueva Contraseña"; msg.Body = MISC.MailHTML().Replace("×ØCUERPOMAILØ×", correoHTML); msg.IsBodyHtml = true; smtpUsuario.Send(msg); return("true"); } catch (Exception e) { return(e.ToString()); } }
// FUNCION QUE DEVUELVE LOS PARAMETROS DEL USUARIO LOGGEADO public string ParametrosUsuario(string token) { try { SQL.comandoSQLTrans("Parametros"); string TokenCentro = ""; SQL.commandoSQL = new SqlCommand("SELECT * FROM dbo.usuarios WHERE tokenusuario = @TokenUsuarioDATA", SQL.conSQL, SQL.transaccionSQL); SQL.commandoSQL.Parameters.Add(new SqlParameter("@TokenUsuarioDATA", SqlDbType.VarChar) { Value = token }); using (var lector = SQL.commandoSQL.ExecuteReader()) { while (lector.Read()) { TokenCentro = lector["tokencentro"].ToString(); } } List <object> Parametros = new List <object>(); Random aleatorio = new Random(); string cadHTML = MISC.GenerarCadAleatoria(10, aleatorio); SQL.commandoSQL = new SqlCommand("SELECT * FROM dbo.usuariomenuprincipal WHERE idcentro = (SELECT id FROM dbo.centros WHERE tokencentro = @TokenCentroDATA)", SQL.conSQL, SQL.transaccionSQL); SQL.commandoSQL.Parameters.Add(new SqlParameter("@TokenCentroDATA", SqlDbType.VarChar) { Value = TokenCentro }); using (var lector = SQL.commandoSQL.ExecuteReader()) { while (lector.Read()) { Dictionary <string, object> Parametro = new Dictionary <string, object>() { { "Nombre", lector["nombre"].ToString() }, { "Visible", bool.Parse(lector["visible"].ToString()) }, { "IdHTML", cadHTML.ToLower() } }; Parametros.Add(Parametro); cadHTML = MISC.GenerarCadAleatoria(10, aleatorio); } } SQL.transaccionSQL.Commit(); return(JsonConvert.SerializeObject(Parametros)); } catch (Exception e) { SQL.transaccionSQL.Rollback(); return(e.ToString()); } finally { SQL.conSQL.Close(); } }
// FUNCION QUE GENERA UNA NUEVA PASS Y ENVIA CORREO AL USUARIO [ USUARIOS ] public string NuevaPassUsuario(MConfiguracion.Usuarios UsuarioInfo) { UsuarioInfo.Pass = MISC.CrearCadAleatoria(3, 4); string UsuarioAccion = MiConfiguracion.NuevaPassUsuario(UsuarioInfo, (string)Session["Token"], (string)Session["TokenCentro"]); if (UsuarioAccion == "true") { EnviarCorreoUsuarioNuevaPass(UsuarioInfo.Correo, UsuarioInfo.Pass, UsuarioInfo.Nombre + " " + UsuarioInfo.Apellido); } return(UsuarioAccion); }
//================================================================================================= public void RefreshForms() { FormList.ClearOptions(); List <Form> forms = MISC.LoadForms(); List <string> options = new List <string>(); for (int x = 0; x < forms.Count; x++) { options.Add(forms[x].Name); } FormList.AddOptions(options); }
public static List <UPackage_Info> Load_Folder(string log_path = "") { if (!is_UFolder_set) { throw new Exception("Coder's fault."); } var files = Directory.EnumerateFiles(u_folder, "*", SearchOption.AllDirectories) .Where(x => If_LoadFile(x)).ToArray(); var _R = new List <UPackage_Info>(); // string vac255 = MISC.GetSpaceString_ofLength(255); Console.BufferWidth = 300; Console.WriteLine(); var log_sb = new StringBuilder(); foreach (var v in files) { Console.CursorTop -= 1; Console.WriteLine(vac255); Console.CursorTop -= 1; Console.Write($"[Reading from] {v}"); TextWriter tmp = Console.Out; StringWriter tsw = new StringWriter(); Console.SetOut(tsw); try { _R.Add(LoadInfo_fromFile(v)); tsw.Close(); Console.SetOut(tmp); Console.WriteLine(" > Success"); } catch { tsw.Close(); Console.SetOut(tmp); Console.WriteLine($" < Failure, file size: {MISC.GetString_ofFileLength(v)}\n"); log_sb.AppendLine($"[Reading Failure] {v} [File Size: {MISC.GetString_ofFileLength(v)}]"); } } var log = log_sb.ToString(); if (log?.Length > 0) { Console.Write("Writing log to ouput folder..."); File.WriteAllText($"{log_path}{log_file}", log); Console.WriteLine("Done."); } Console.WriteLine("The loading process is done."); return(_R); }
public void ChangeColor(int Color) { FormBuild.Color = Color; GameObject Cache = this.transform.Find("Images").gameObject; for (int x = 0; x < Cache.transform.childCount; x++) { Image iTile = Cache.transform.GetChild(x).GetComponent <Image>(); if (iTile) { iTile.color = MISC.GetColorCode(Color); } } }
// FUNCION QUE GENERA EL TOKEN DE ACCESO AL WIZARD SIURA public WizardAcceso CrearWizardAcceso(string tokencentro) { WizardAcceso WizardData = new WizardAcceso() { Exito = true, }; try { SQL.comandoSQLTrans("CrearWizardAcceso"); string TokenAcceso = MISC.CrearIdSession(); SQL.commandoSQL = new SqlCommand("INSERT INTO dbo.wizardaccesos (idcentro, token) VALUES ((SELECT id FROM dbo.centros WHERE tokencentro = @TokenCentroParam), @TokenAccesoParam)", SQL.conSQL, SQL.transaccionSQL); SqlParameter[] altaWizardTokenAcceso = { new SqlParameter("@TokenCentroParam", SqlDbType.VarChar) { Value = tokencentro }, new SqlParameter("@TokenAccesoParam", SqlDbType.VarChar) { Value = TokenAcceso }, }; SQL.commandoSQL.Parameters.AddRange(altaWizardTokenAcceso); SQL.commandoSQL.ExecuteNonQuery(); WizardData.Token = TokenAcceso; SQL.transaccionSQL.Commit(); return(WizardData); } catch (Exception e) { SQL.transaccionSQL.Rollback(); WizardData.Exito = false; WizardData.Error = e.ToString(); return(WizardData); } finally { SQL.conSQL.Close(); } }
public FormController SpawnForm(string Name = "") { FormController c = null; List <Form> forms = MISC.LoadForms(); for (int x = 0; x < forms.Count; x++) { if (forms[x].Name == Name) { GameObject Cache = Instantiate(FormFrame); Cache.transform.SetParent(LevelFormContainer.transform); //Cache.name = "Form"; Cache.name = forms[x].Name; FormController LEMFC = Cache.GetComponent <FormController>(); if (LEMFC != null) { LEMFC.FormPlan = forms[x]; RectTransform LEMFCRT = Cache.GetComponent <RectTransform>(); LEMFCRT.localScale = new Vector3(0.5f, 0.5f, 0.5f); LEMFCRT.anchoredPosition = Vector2.zero; LEMFCRT.anchorMin = new Vector2(0, 1); LEMFCRT.anchorMax = new Vector2(0, 1); LEMFCRT.pivot = new Vector2(0, 1); FormsInLevel.Add(LEMFC); return(LEMFC); } else { Debug.LogError("[LVM] No Form Controller found!"); } return(c); } } Debug.LogWarning("[LVM] Could not find form!"); return(c); }
// -------------------------------------------------------------------------------------------- // :::::::::::::::::::::::: [ GENERACION DE DOCUMENTOS FORMATO EXCEL ] :::::::::::::::::::::::: public string InventarioImpresionExcel(MDinamicos.InventarioImpresionInfo InventarioImpresionInfo, string Gestion) { try { ExcelPackage ExcelInventario = new ExcelPackage(); List <MDinamicos.InventarioImpresionAux> InventarioData = InventarioImpresionInfo.InventarioData; string celda = "A1:G1", NombreDocumento = MISC.InventarioNombreGestion(Gestion)[0] + "_Doc_" + InventarioImpresionInfo.Usuario + ".xlsx"; string[] tablaCeldas = MISC.CeldasReporteInventario(Gestion); foreach (MDinamicos.InventarioImpresionAux Inventario in InventarioData) { ExcelInventario.Workbook.Worksheets.Add(Inventario.Area); ExcelWorksheet Hoja = ExcelInventario.Workbook.Worksheets[Inventario.Area]; Hoja.Cells[celda].Merge = true; Hoja.Cells[celda].Value = InventarioImpresionInfo.NombreCentro; Hoja.Cells[celda].Style.Font.Size = 16; Hoja.Cells[celda].Style.Font.Bold = true; Hoja.Cells[celda].Style.VerticalAlignment = ExcelVerticalAlignment.Center; Hoja.Cells[celda].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; celda = "A2:G2"; Hoja.Cells[celda].Merge = true; Hoja.Cells[celda].Value = InventarioImpresionInfo.Direccion + " " + InventarioImpresionInfo.Colonia + " C.P. " + InventarioImpresionInfo.CodigoPostal + " Tel: (" + InventarioImpresionInfo.Telefono + ")"; Hoja.Cells[celda].Style.Font.Size = 14; Hoja.Cells[celda].Style.Font.Bold = true; Hoja.Cells[celda].Style.VerticalAlignment = ExcelVerticalAlignment.Center; Hoja.Cells[celda].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; celda = "A3:G3"; Hoja.Cells[celda].Merge = true; Hoja.Cells[celda].Value = InventarioImpresionInfo.Estado + ", " + InventarioImpresionInfo.Municipio; Hoja.Cells[celda].Style.Font.Size = 14; Hoja.Cells[celda].Style.Font.Bold = true; Hoja.Cells[celda].Style.VerticalAlignment = ExcelVerticalAlignment.Center; Hoja.Cells[celda].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; celda = "A4:G4"; Hoja.Cells[celda].Merge = true; Hoja.Cells[celda].Value = MISC.InventarioNombreGestion(Gestion)[1]; Hoja.Cells[celda].Style.Font.Size = 14; Hoja.Cells[celda].Style.Font.Bold = true; Hoja.Cells[celda].Style.Fill.PatternType = ExcelFillStyle.Solid; Hoja.Cells[celda].Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml("#AED6F1")); Hoja.Cells[celda].Style.Font.Color.SetColor(Color.Black); Hoja.Cells[celda].Style.Border.Top.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Left.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Right.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Bottom.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.VerticalAlignment = ExcelVerticalAlignment.Center; Hoja.Cells[celda].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; foreach (string tablaCelda in tablaCeldas) { celda = tablaCelda.Split('ø')[1] + "5"; Hoja.Cells[celda].Value = tablaCelda.Split('ø')[0]; Hoja.Cells[celda].Style.Font.Size = 12; Hoja.Cells[celda].Style.Font.Bold = true; Hoja.Cells[celda].Style.Fill.PatternType = ExcelFillStyle.Solid; Hoja.Cells[celda].Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml("#D5D8DC")); Hoja.Cells[celda].Style.Font.Color.SetColor(Color.Black); Hoja.Cells[celda].Style.Border.Top.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Left.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Right.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Bottom.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.VerticalAlignment = ExcelVerticalAlignment.Center; Hoja.Cells[celda].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; } Hoja.View.FreezePanes(6, 1); int numCelda = 6, CantElemsG = 0; foreach (MDinamicos.InventarioArticulo Data in Inventario.InventarioData) { celda = "A" + numCelda.ToString(); if (Gestion == "G1" || Gestion == "G2" || Gestion == "E1" || Gestion == "E2" || Gestion == "E3") { Hoja.Cells[celda].Value = Data.Codigo; } Hoja.Cells[celda].Style.Font.Size = 11; Hoja.Cells[celda].Style.Border.Top.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Left.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Right.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Bottom.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.VerticalAlignment = ExcelVerticalAlignment.Center; Hoja.Cells[celda].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; celda = "B" + numCelda.ToString(); if (Gestion == "G1" || Gestion == "G2" || Gestion == "E1" || Gestion == "E2" || Gestion == "E3") { Hoja.Cells[celda].Value = Data.Nombre; } Hoja.Cells[celda].Style.Font.Size = 11; Hoja.Cells[celda].Style.Border.Top.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Left.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Right.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Bottom.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.VerticalAlignment = ExcelVerticalAlignment.Center; Hoja.Cells[celda].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; celda = "C" + numCelda.ToString(); if (Gestion == "G1" || Gestion == "G2" || Gestion == "E1" || Gestion == "E2" || Gestion == "E3") { Hoja.Cells[celda].Value = Data.Presentacion; } Hoja.Cells[celda].Style.Font.Size = 11; Hoja.Cells[celda].Style.Border.Top.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Left.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Right.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Bottom.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.VerticalAlignment = ExcelVerticalAlignment.Center; Hoja.Cells[celda].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; celda = "D" + numCelda.ToString(); if (Gestion == "G1" || Gestion == "G2") { Hoja.Cells[celda].Value = "$ " + Data.PrecioCompra.ToString("N2"); } else if (Gestion == "E1" || Gestion == "E2" || Gestion == "E3") { Hoja.Cells[celda].Value = Data.Area; Hoja.Cells[celda].Style.Fill.PatternType = ExcelFillStyle.Solid; Hoja.Cells[celda].Style.Font.Color.SetColor(Color.Black); if (Data.Area == "Salida") { Hoja.Cells[celda].Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml("#F5B7B1")); } else { Hoja.Cells[celda].Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml("#ABEBC6")); } } Hoja.Cells[celda].Style.Font.Size = 11; Hoja.Cells[celda].Style.Border.Top.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Left.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Right.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Bottom.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.VerticalAlignment = ExcelVerticalAlignment.Center; Hoja.Cells[celda].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; celda = "E" + numCelda.ToString(); if (Gestion == "G1" || Gestion == "G2") { Hoja.Cells[celda].Value = "$ " + Data.PrecioVenta.ToString("N2"); } else if (Gestion == "E1" || Gestion == "E2" || Gestion == "E3") { Hoja.Cells[celda].Value = Data.Existencias.ToString("N4"); } Hoja.Cells[celda].Style.Font.Size = 11; Hoja.Cells[celda].Style.Border.Top.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Left.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Right.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Bottom.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.VerticalAlignment = ExcelVerticalAlignment.Center; Hoja.Cells[celda].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; celda = "F" + numCelda.ToString(); if (Gestion == "G1" || Gestion == "G2") { Hoja.Cells[celda].Value = "$ " + Data.Existencias.ToString("N4"); if (Data.Existencias < Data.Stock) { Hoja.Cells[celda].Style.Fill.PatternType = ExcelFillStyle.Solid; Hoja.Cells[celda].Style.Font.Color.SetColor(Color.Black); Hoja.Cells[celda].Style.Fill.BackgroundColor.SetColor(ColorTranslator.FromHtml("#F5B7B1")); } } else if (Gestion == "E1" || Gestion == "E2" || Gestion == "E3") { Hoja.Cells[celda].Value = Data.Usuario; } Hoja.Cells[celda].Style.Font.Size = 11; Hoja.Cells[celda].Style.Border.Top.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Left.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Right.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Bottom.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.VerticalAlignment = ExcelVerticalAlignment.Center; Hoja.Cells[celda].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; celda = "G" + numCelda.ToString(); if (Gestion == "G1" || Gestion == "G2") { Hoja.Cells[celda].Value = "$ " + Data.Stock.ToString("N4"); } else if (Gestion == "E1" || Gestion == "E2" || Gestion == "E3") { Hoja.Cells[celda].Value = Data.FechaTxt; } Hoja.Cells[celda].Style.Font.Size = 11; Hoja.Cells[celda].Style.Border.Top.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Left.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Right.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.Border.Bottom.Style = ExcelBorderStyle.Thin; Hoja.Cells[celda].Style.VerticalAlignment = ExcelVerticalAlignment.Center; Hoja.Cells[celda].Style.HorizontalAlignment = ExcelHorizontalAlignment.Center; numCelda++; CantElemsG++; } Hoja.Cells[Hoja.Dimension.Address].AutoFitColumns(); } Directory.CreateDirectory(Server.MapPath("~/Docs/" + (string)Session["TokenCentro"] + "/")); ExcelInventario.SaveAs(new FileInfo(Server.MapPath("~/Docs/" + (string)Session["TokenCentro"] + "/") + NombreDocumento)); Dictionary <string, object> Respuesta = new Dictionary <string, object>() { { "Correcto", true }, { "UrlDoc", System.Web.HttpContext.Current.Request.Url.AbsoluteUri.Replace(System.Web.HttpContext.Current.Request.Url.AbsolutePath, "") + "/Docs/" + (string)Session["TokenCentro"] + "/" + NombreDocumento }, }; return(JsonConvert.SerializeObject(Respuesta)); } catch (Exception e) { Dictionary <string, object> Err = new Dictionary <string, object>() { { "Correcto", false }, { "Error", e.ToString() } }; return(JsonConvert.SerializeObject(Err)); } }
static void Main(string[] args) { /* * TwoKeyDictionary<string, string, string> readconf = new TwoKeyDictionary<string, string, string>(); * MISC.readconfig_2kdict("conf\\GCF_BI_IRAT_TC.conf",readconf); * Debug.Print(readconf.ToString()); * Dictionary< * string,string> ab = readconf["36.523-1"]; * _Dictionary<string,string> abc = new _Dictionary<string, string>(ab); * Debug.Print(abc.ToString()); * Dictionary<string, List<string>> t1 = MISC.readconfiglist("conf\\PTCRB_IRAT_band.conf",'\t'); * foreach (KeyValuePair<string , List<string>> kvp in t1) * { * Debug.Print(kvp.Key); * Debug.Print("\t\t"+string.Join(",",kvp.Value)); * } */ Logging lg = new Logging("log.log", 0); MISC.lgstr = lg; _Dictionary <string, string> configdic = MISC.readconfig(@"conf\\config.conf"); string[] excelfilearr_env = configdic["ecfile"].Split(','); string[] sheetnamearr_env = configdic["ecsheet"].Split(','); string printlevelforenvcondition = configdic["envdebprint"]; string bandsupportfile = configdic["bandsupportfile"]; string bandsupportproject = configdic["bandsupportproject"]; bool sheetspecwise = Convert.ToBoolean(configdic["sheetspecwise"]); string[] gcfsheetarr = configdic["gcfsheetarr"].Split(','); string[] gcfarrBI = configdic["gcfbandlistforBI"].Split(','); string[] gcfarrBIM = configdic["gcfbandlistforBIM"].Split(','); string[] gcfarrBIW = configdic["gcfbandlistforBIW"].Split(','); string[] ptcrbspecarr = configdic["ptcrbspecarr"].Trim().Split(','); string[] ptcrbarrBI = configdic["ptcrbbandlistforBI"].Trim().Split(','); string[] ptcrbarrBIW = configdic["ptcrbbandlistforBIW"].Trim().Split(','); _Dictionary <string, string> bandlistdic = MISC.readconfig(bandsupportfile); Debug.Print(bandlistdic.ToString()); Dictionary <string, string[]> prjsupbandlist = MISC.prjsupbl(bandlistdic, bandsupportproject); _List <string> allband = new _List <string>(); _List <string> ulcaband = new _List <string>(); foreach (KeyValuePair <string, string[]> kvp in prjsupbandlist) { if (kvp.Key.ToUpper() == "ULCA") { ulcaband.AddRange(kvp.Value); } else { allband.AddRange(kvp.Value); } lg.deb("key: " + kvp.Key + " val: " + String.Join(" ", kvp.Value)); } lg.inf("All together" + allband.ToString()); MISC.PICSBandSupportList = allband; Dictionary <string, List <string> > spec_tc_env = new Dictionary <string, List <string> >(); for (int xl = 0; xl < excelfilearr_env.Count(); xl++) { string excelfile_env = excelfilearr_env[xl]; string sheetname_env = sheetnamearr_env[xl]; string[] filenamepart = excelfile_env.Split('_'); string spec = filenamepart[0];// +"."+ filenamepart[1]; Debug.Print("spec:" + spec + ":"); spec_tc_env.Add(spec, new List <string>()); ParseExcel envpe = new ParseExcel(excelfile_env); envpe.lgx = lg; DataTable dt_env = envpe.GetExcelData(sheetname_env + "$"); envpe.processenv(dt_env, spec_tc_env, printlevelforenvcondition); } foreach (KeyValuePair <string, List <string> > kvp in spec_tc_env) { lg.war("spec: " + kvp.Key); lg.war("bandlist extreme" + String.Join("#", kvp.Value.ToArray())); } //ParseExcel envcond = new ParseExcel(excelfile_env); Console.WriteLine("This program will parse and process GCF/PTCRB file."); Console.WriteLine("First argument is g/p g=> GCF, p=> PTCRB."); Console.WriteLine("Second argument is file name"); Console.WriteLine("========================================================\n\n"); if (args.Length != 2) { Console.WriteLine("Please add exactly two argument "); } else { string file = args[1]; if (File.Exists(file)) { if (args[0].ToLower() == "g") { //code for gcf here. Console.WriteLine("Now GCF file processing ..."); ParseExcel.BIlist = gcfarrBI; ParseExcel.BIlistW = gcfarrBIW; ParseExcel.BIlistM = gcfarrBIM; ParseExcel pex = new ParseExcel(file, "g"); pex.lgx = lg; pex.cleanupfolder(); //List<string> sheetlist = pex.GetExcelsheetslist(); foreach (string sh in gcfsheetarr) { lg.inf("processing Sheet: " + sh); DataTable dt = pex.GetExcelData(sh + "$"); pex.processgcffile(dt, spec_tc_env); } pex.writeoutput(); Console.WriteLine("Processing done"); } else if (args[0].ToLower() == "p") { //code for ptcrb here. Console.WriteLine("Now PTCRB file processing ..."); ParseExcel.BIlist = ptcrbarrBI; ParseExcel.BIlistW = ptcrbarrBIW; ParseExcel pex = new ParseExcel(file, "p"); pex.lgx = lg; pex.cleanupfolder(); DataTable dt = pex.GetExcelData("Sheet$"); pex.processptcrbfile(dt, spec_tc_env, ptcrbspecarr); pex.writeoutput(); Console.WriteLine("Processing done"); } else { Console.WriteLine("Please use letter g/p as the first argument "); } } else { Console.WriteLine("The file path is invalid"); Debug.Print("file not found"); lg.cri("file not found"); } } }
// ------------------- [ FUNCIONES GENERALES ] ------------------- // FUNCION QUE PERMITE LOGIN A LA APP public string IniciarSesionApp(LoginApp Login) { LoginAppRespuesta respuesta = new LoginAppRespuesta() { IdUsuario = 0, Respuesta = false, RespuestaText = "errLogin", }; try { SQL.comandoSQLTrans("Login"); SQL.commandoSQL = new SqlCommand("SELECT U.*, C.tokencentro, C.idnotificacion AS CentroNotifId FROM dbo.usuarios U JOIN dbo.centros C ON C.clave = @ClaveCentroDATA AND C.tokencentro = U.tokencentro WHERE U.usuario = @UsuarioDATA AND U.pass = @PassDATA AND U.activo > 0", SQL.conSQL, SQL.transaccionSQL); SqlParameter[] AppUsuarioLoginPars = { new SqlParameter("@UsuarioDATA", SqlDbType.VarChar) { Value = Login.Usuario }, new SqlParameter("@PassDATA", SqlDbType.VarChar) { Value = MISC.CrearMD5(Login.Password) }, new SqlParameter("@ClaveCentroDATA", SqlDbType.VarChar) { Value = Login.CentroClave }, }; SQL.commandoSQL.Parameters.AddRange(AppUsuarioLoginPars); using (var lector = SQL.commandoSQL.ExecuteReader()) { while (lector.Read()) { respuesta.IdUsuario = int.Parse(lector["id"].ToString()); respuesta.Respuesta = true; respuesta.TokenUsuario = lector["tokenusuario"].ToString(); respuesta.TokenCentro = lector["tokencentro"].ToString(); respuesta.UsuarioNombre = lector["nombre"].ToString() + " " + lector["apellido"].ToString(); respuesta.Administrador = bool.Parse(lector["administrador"].ToString()); respuesta.RespuestaText = "LoginCorrecto"; } } if (respuesta.IdUsuario > 0) { if (respuesta.Administrador) { respuesta.AlAnon = true; respuesta.CoordDeportiva = true; respuesta.CoordMedica = true; respuesta.CoordPsicologica = true; respuesta.CoordEspiritual = true; respuesta.Cord12Pasos = true; respuesta.Documentacion = true; } else { SQL.commandoSQL = new SqlCommand("SELECT * FROM dbo.usuariosperfiles WHERE idusuario = @IDUsuarioParam AND idcentro = (SELECT id FROM dbo.centros WHERE tokencentro = @TokenCentroDATA)", SQL.conSQL, SQL.transaccionSQL); SqlParameter[] UsuarioLoginPerfilPars = { new SqlParameter("@IDUsuarioParam", SqlDbType.Int) { Value = respuesta.IdUsuario }, new SqlParameter("@TokenCentroDATA", SqlDbType.VarChar) { Value = respuesta.TokenCentro }, }; SQL.commandoSQL.Parameters.AddRange(UsuarioLoginPerfilPars); using (var lector = SQL.commandoSQL.ExecuteReader()) { while (lector.Read()) { respuesta.AlAnon = bool.Parse(lector["alanon"].ToString()); respuesta.CoordDeportiva = bool.Parse(lector["coorddeportiva"].ToString()); respuesta.CoordMedica = bool.Parse(lector["coordmedica"].ToString()); respuesta.CoordPsicologica = bool.Parse(lector["coordpsicologica"].ToString()); respuesta.CoordEspiritual = bool.Parse(lector["coordespiritual"].ToString()); respuesta.Cord12Pasos = bool.Parse(lector["coorddocepasos"].ToString()); respuesta.Documentacion = bool.Parse(lector["documentacion"].ToString()); } } } } SQL.transaccionSQL.Commit(); return(JsonConvert.SerializeObject(respuesta)); } catch (Exception e) { SQL.transaccionSQL.Rollback(); respuesta.RespuestaText = e.ToString(); return(JsonConvert.SerializeObject(respuesta)); } finally { SQL.conSQL.Close(); } }
public void UpdateImage() { Image FormSprite = this.GetComponent <Image>(); FormSprite.sprite = LevelSprite; //FormSprite.overrideSprite = LevelSprite; FormSprite.color = MISC.GetColorCode(FormBuild.Color); //FormSprite.transform.Find("Texture").GetComponent<Image>().color= MISC.GetColorCode(FormBuild.Color); //FormSprite.GetComponentInChildren<GameObject>()//.Find("Gun").gameObject; FormSprite.rectTransform.sizeDelta = new Vector2(LevelSprite.texture.width, LevelSprite.texture.height); rectTransform.anchoredPosition = new Vector2(xpos, ypos); this.GetComponent <Image>().enabled = false; for (int i = 0; i < texturesAndShadows.Length; i++) { if (this.name + "texture" == texturesAndShadows[i].name) { this.transform.Find("texture").GetComponent <Image>().sprite = texturesAndShadows[i]; } if (this.name + "shadow" == texturesAndShadows[i].name) { this.transform.Find("shadow").GetComponent <Image>().sprite = texturesAndShadows[i]; } } this.transform.Find("texture").transform.Rotate(0.0f, 0.0f, this.GetComponent <FormController>().FormBuild.Rotated * 90f, Space.Self); this.transform.Find("texture").GetComponent <Image>().color = ColorPalette[Random.Range(0, ColorPalette.Count)]; this.transform.Find("texture").GetComponent <Image>().preserveAspect = true; //this.transform.Find("texture").GetComponent<RectTransform>().sizeDelta = this.GetComponent<RectTransform>().sizeDelta; float max = Compare(this.GetComponent <RectTransform>().sizeDelta.x, this.GetComponent <RectTransform>().sizeDelta.y); this.transform.Find("shadow").transform.Rotate(0.0f, 0.0f, this.GetComponent <FormController>().FormBuild.Rotated * 90f, Space.Self); this.transform.Find("shadow").GetComponent <Image>().preserveAspect = true; this.transform.Find("shadow").GetComponent <RectTransform>().sizeDelta = this.GetComponent <RectTransform>().sizeDelta; this.transform.Find("texture").GetComponent <RectTransform>().sizeDelta = new Vector2(max, max); this.transform.Find("shadow").GetComponent <RectTransform>().sizeDelta = new Vector2(max, max); // this.transform.Find("shadow").GetComponent<RectTransform>().transform.position = new Vector2(7,-7); //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // README //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // Because rotating shifts the position // Just rotate the images in Photoshop etc // and put the rotated versions also in the list // Then load it. // // Check it with rotationstate again (from FormBuild) //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! /* || this.name + "texture" == "Tri5texture" * { * this.transform.Find("texture").GetComponent<RectTransform>().sizeDelta = new Vector2(this.GetComponent<RectTransform>().sizeDelta.y, this.GetComponent<RectTransform>().sizeDelta.x); * } * if (this.name == "Tri5" && this.FormBuild.Rotated == 3/* || this.name + "texture" == "Tri5texture"* * /* { * this.transform.Find("texture").GetComponent<RectTransform>().sizeDelta = new Vector2(this.GetComponent<RectTransform>().sizeDelta.y, this.GetComponent<RectTransform>().sizeDelta.x); * } * else*/ }
public static Sprite GenerateLevelSprite() { if (CurrentLevel == null) { return(null); } Form LevelForm = ScriptableObject.CreateInstance <Form>(); LevelForm.Width = 9; LevelForm.Height = 12; LevelForm.Resize(9, 9); minx = 5; miny = 5; maxx = 0; maxy = 0; LevelTilesShouldBe.Resize(9, 12); List <Form> forms = MISC.LoadForms(); foreach (LevelData ld in CurrentLevel.Data) { for (int x = 0; x < forms.Count; x++) { if (forms[x].Name == ld.FormName) { Form Cache = ScriptableObject.CreateInstance <Form>(); forms[x].CloneTo(Cache); while (Cache.Rotated != ld.RotationState) { Cache.RotateRight(); } for (int fy = 0; fy < Cache.Height; fy++) { for (int fx = 0; fx < Cache.Width; fx++) { SimpleTriforce CacheTri = new SimpleTriforce(); CacheTri = Cache.Get(fx, fy); int realX = ld.x / 64 + fx; int realY = ld.y / 64 * -1 + fy; if (CacheTri.Type != SimpleTriforce.TriforceType.EMPTY) { if (LevelForm.Get(realX, realY).Type != SimpleTriforce.TriforceType.EMPTY) { LevelForm.Set(realX, realY, new SimpleTriforce(SimpleTriforce.TriforceType.FILLED)); LevelTilesShouldBe.Set(realX, realY, new SimpleTriforce(SimpleTriforce.TriforceType.FILLED)); } else { LevelForm.Set(realX, realY, CacheTri); LevelTilesShouldBe.Set(realX, realY, CacheTri); } if (realX < minx) { minx = realX; } if (realY < miny) { miny = realY; } if (realX + 1 > maxx) { maxx = realX + 1; } if (realY + 1 > maxy) { maxy = realY + 1; } } } } } } } Sprite retSprite = GenerateFormSprite(LevelForm); return(retSprite); }
public LEM_FormController SpawnForm(string Name = "") { LEM_FormController c = null; if (Name == "") { Name = FormList.options[FormList.value].text; } List <Form> forms = MISC.LoadForms(); for (int x = 0; x < forms.Count; x++) { if (forms[x].Name == Name) { GameObject Cache = Instantiate(FormFrame); Cache.transform.SetParent(FormContainer.transform); Cache.name = "Form"; LEM_FormController LEMFC = Cache.GetComponent <LEM_FormController>(); if (LEMFC != null) { LEMFC.FormPlan = forms[x]; RectTransform LEMFCRT = Cache.GetComponent <RectTransform>(); LEMFCRT.anchoredPosition = Vector2.zero; LEMFCRT.anchorMin = new Vector2(0, 1); LEMFCRT.anchorMax = new Vector2(0, 1); LEMFCRT.pivot = new Vector2(0, 1); // return LEMFC; } else { Debug.LogError("[LEM] No Form Controller found!"); } Cache = Instantiate(FormButtonFrame); Cache.transform.SetParent(FormButtonContainer.transform); Cache.name = "BottomForm"; LEM_BottomController LEMBC = Cache.GetComponent <LEM_BottomController>(); if (LEMBC != null) { LEMBC.FormPlan = forms[x]; RectTransform LEMFCRT = Cache.GetComponent <RectTransform>(); LEMFCRT.anchoredPosition = Vector2.zero; LEMFCRT.anchorMin = new Vector2(0, 1); LEMFCRT.anchorMax = new Vector2(0, 1); LEMFCRT.pivot = new Vector2(0, 1); CurrentBottom = LEMBC; return(LEMFC); } else { Debug.LogError("[LEM] No Form Controller found!"); } return(c); } } Debug.LogWarning("[LEM] Could not find form!"); return(c); }