Exemple #1
0
 public Boolean File2Compress_Ext(String PathFile, String PathZipFile, String LicName)
 {
     //
     _st_srcFile  = PathFile;
     _st_destFile = PathZipFile;
     try
     {
         if (_st_Lic.Length == 0)
         {
             MessageBox.Show("Invalid Lic To work");
             return(false);
         }
         else
         {
             String stL_Archivo_Sin_Extension = PathZipFile.Substring(PathZipFile.LastIndexOf("\\") + 1);
             stL_Archivo_Sin_Extension = stL_Archivo_Sin_Extension.Substring(0, stL_Archivo_Sin_Extension.IndexOf("."));
             //
             CLNBTN_Es ObjL_Encrip    = new CLNBTN_Es(_st_User, _st_FileLog, false, true, false, LicName);
             String    stL_Encriptado = ObjL_Encrip.File2Es("SGA-" + stL_Archivo_Sin_Extension + "-APQ", "Frgtyhw", "FT/yQYmins06srbyMggYjcEY/ns2slWTURobdSariTY=+-6aUVQ2SZO7QHT6kUHtr2zRbupap5KPu4jeO9GE+UMnk=", "Oklijdiue", LicName);
             //
             using (ZipFile zip = new ZipFile())
             {
                 zip.Password = stL_Encriptado;
                 zip.AddDirectory(_st_srcFile);
                 zip.Save(_st_destFile);
             }
             return(true);
         }
     }
     catch (System.AccessViolationException ex_0)
     {
         _Obj_Log.WriteOutErrorMessage(_st_Relac, _st_RelacSon, "File2Compress_Ext", "", "System.AccessViolationException: " + ex_0.Message, "", "");
         return(false);
     }
     catch (Exception e)
     {
         _Obj_Log.WriteOutErrorMessage(_st_Relac, _st_RelacSon, "File2Compress_Ext", "", "Excepcion: " + e.Message, "", "");
         return(false);
     }
 }
Exemple #2
0
        private void CmdAceptar_Click(object sender, EventArgs e)
        {
            CLNBTN_Qy Query           = null;
            CLNBTN_Es Encrip          = new CLNBTN_Es(_st_User, _st_FileLog, _st_Lic);
            CLNBTN_Ul Utils           = new CLNBTN_Ul(_st_User, _st_FileLog, _st_Lic);
            Boolean   blL_ValidaClave = false;
            String    stL_Encrip      = "";
            int       inL_DiasClave   = 0;

            try
            {
                //
                LblMensaje.Text  = "";
                inPr_NumIntentos = inPr_NumIntentos + 1;
                if (inPr_NumIntentos > MAX_INTENTOS)
                {
                    LblMensaje.Text = MENSAJE_3;
                }
                else
                {
                    //
                    switch (ObjPr_InfoBD.get_DataBaseConn_Type())
                    {
                    case CLNBTN_IQy.inConnect_Type.TYPE_1_CONNECT_USER_SQL:
                        //
                        blL_ValidaClave = true;
                        break;

                    case CLNBTN_IQy.inConnect_Type.TYPE_4_CONNECT_USER_INFO_EXT:
                        //
                        blL_ValidaClave = true;
                        break;
                    }
                    if (blL_ValidaClave)
                    { // del if ( blL_ValidaClave )
                        // Asigna informacion
                        Query = new CLNBTN_Qy(_st_User, _st_FileLog, _st_Lic);
                        //
                        // Hace la conexion
                        Query.setDataBaseInfo(ObjPr_InfoBD);
                        Query.ConnectDataBase();
                        //
                        if (Query.getIs_Connected())
                        {
                            blL_ValidaClave = false;
                            if (ObjPr_InfoBD.getUserApp_PWD().Length == 0)
                            {
                                blL_ValidaClave = true;
                            }
                            else
                            {
                                if (ObjPr_InfoBD.getUserApp_PWD() == TxtClave.Text)
                                {
                                    blL_ValidaClave = true;
                                }
                                else
                                {
                                    LblMensaje.Text = MENSAJE_18;
                                }
                            }
                            if (blL_ValidaClave)
                            {
                                blL_ValidaClave = false;
                                if (TxtClave1.Text == TxtClave2.Text)
                                {
                                    if (TxtClave.Text == TxtClave1.Text)
                                    {
                                        LblMensaje.Text = MENSAJE_20;
                                    }
                                    else
                                    {
                                        blL_ValidaClave = true;
                                    }
                                }
                                else
                                {
                                    LblMensaje.Text = MENSAJE_19;
                                }
                            }
                            if (blL_ValidaClave)
                            {
                                // Define DataTable, para los Datos del Query
                                DataTable DatTable = null;
                                //
                                Query.ToDo_SELECT("*");
                                Query.ToDo_FROM("t00usuarios");
                                Query.ToDo_WHERE("A00USUARIOWIN", "'" + ObjPr_InfoBD.getUser() + "'");
                                Query.ToDo_EXECUTE_SQL(ref DatTable);
                                if (DatTable != null)
                                { // del if (Query.Rs.State != 0)
                                    for (int inL_Row = 0; inL_Row < DatTable.Rows.Count; inL_Row++)
                                    {
                                        // Toma la informacion de la fila
                                        DataRow Info_Fila = DatTable.Rows[inL_Row];
                                        inL_DiasClave = 0;
                                        //if (!DBNull.Value.Equals(Info_Fila["A00DIAS_CLAVE"].ToString()))
                                        //{
                                        if (Info_Fila["A00DIAS_CLAVE"].ToString().Length > 0)
                                        {
                                            inL_DiasClave = Convert.ToInt16(Info_Fila["A00DIAS_CLAVE"].ToString());
                                        }
                                        //}
                                    }
                                }
                                Query.ToDo_CLOSE();
                                //
                                stL_Encrip = Encrip.File2Es(TxtClave1.Text.Trim(), "", "FT/yQYmins06srbyMggYjcEY/ns2slWTURobdSariTY=+-6aUVQ2SZO7QHT6kUHtr2zRbupap5KPu4jeO9GE+UMnk=", "", _st_Lic);
                                Query.ToDo_UPDATE("t00usuarios");
                                Query.ToDo_SET("A00ESTADO", ESTADO_ACTIVO);
                                Query.ToDo_SET("A00CLAVE", stL_Encrip);
                                Query.ToDo_SET("A00FECHA_CLAVE", Utils.BringMeServerDate(ObjPr_InfoBD, true));
                                if (inL_DiasClave == 0)
                                {
                                    Query.ToDo_SET("A00DIAS_CLAVE", "30");
                                }
                                Query.ToDo_WHERE("A00USUARIOWIN", " '" + ObjPr_InfoBD.getUser() + "' ");
                                Query.ToDo_EXECUTE_SQL();
                                if (Query.getSuccessQueryExecution())
                                {
                                    ObjPr_InfoBD.setUserApp_PWD(TxtClave1.Text);
                                    ObjPr_InfoBD.setUserApp_PWD_Enc(stL_Encrip);
                                    MessageBox.Show(MENSAJE_21, MENSAJE_5);
                                }
                                Query.ToDo_CLOSE();
                                //
                                blPr_AceptoInformacion = true;
                                // Cierra la forma
                                this.Hide();
                            }
                        }
                    } // del if ( blL_ValidaClave )
                }
            }
            catch (System.AccessViolationException ex_0)
            {
                CLNBTN_Lg objL_Log = new CLNBTN_Lg(_st_User, _st_FileLog, _bl_OutLineConsole, _bl_OutFileLog, _bl_OutWindow);
                objL_Log.WriteOutErrorMessage(_st_Relac, _st_RelacSon, "FrmChgPwd(2). System.AccessViolationException", "", ex_0.Message.ToString());
            }
            catch (Exception ex)
            {
                CLNBTN_Lg objL_Log = new CLNBTN_Lg(_st_User, _st_FileLog, _bl_OutLineConsole, _bl_OutFileLog, _bl_OutWindow);
                objL_Log.WriteOutErrorMessage(_st_Relac, _st_RelacSon, "FrmChgPwd(2). Exception", "", ex.Message.ToString());
            }
        }