/// <summary>
        /// Tworzenie, modyfikacja, usunięcie harmonogramu transferów FTP
        /// </summary>
        /// <param name="schedule">Definicja harmonogramu</param>
        /// <param name="mode">Rodzaj operacji</param>
        /// <returns>Komunikat o ewentualnym błędzie</returns>
        public static string ModifySchedule(FtpScheduleModel schedule, eDbOperation mode)
        {
            SqlCommand cmd = guiConn.CreateCommand();

            cmd.CommandText = "exec [ftp].[sp_modify_schedule] @mode,@xx,@end_xx,@nazwa,@start,@stop,@stride,@disabled";
            var par = cmd.Parameters;

            par.Add("mode", SqlDbType.Int).Value           = (int)mode;
            par.Add("xx", SqlDbType.Int).Value             = schedule.xx;
            par.Add("end_xx", SqlDbType.Int).Value         = schedule.endXX;
            par.Add("nazwa", SqlDbType.VarChar, 128).Value = schedule.name;
            par.Add("start", SqlDbType.SmallInt).Value     = (short)schedule.startSpan.TotalMinutes;
            par.Add("stop", SqlDbType.SmallInt).Value      = (short)schedule.stopSpan.TotalMinutes;
            par.Add("stride", SqlDbType.SmallInt).Value    = schedule.stride;
            par.Add("disabled", SqlDbType.TinyInt).Value   = !schedule.enabled;

            if (mode == eDbOperation.Insert)
            {
                return(ExecuteNonQueryStoreKey(cmd));
            }
            else
            {
                return(ExecuteNonQuery(cmd));
            }
        }
Example #2
0
        /// <summary>
        /// Tworzenie, modyfikacja, usunięcie harmonogramu transferów FTP
        /// </summary>
        /// <param name="schedule">Definicja harmonogramu</param>
        /// <param name="mode">Rodzaj operacji</param>
        /// <returns>Komunikat o ewentualnym błędzie</returns>
        public static string ModifySchedule(FtpScheduleModel schedule, eDbOperation mode)
        {
            OracleCommand cmd = guiConn.CreateCommand();

            cmd.CommandText = "begin modify_schedule2(:mode,:xx,:end_xx,:nazwa,:start,:stop,:stride,:disabled); end;";
            var par = cmd.Parameters;

            par.Add("mode", OracleDbType.Int32).Value          = (int)mode;
            par.Add("xx", OracleDbType.Int32).Value            = schedule.xx;
            par.Add("end_xx", OracleDbType.Int32).Value        = schedule.endXX;
            par.Add("nazwa", OracleDbType.Varchar2, 128).Value = schedule.name;
            par.Add("start", OracleDbType.Int16).Value         = (short)schedule.startSpan.TotalMinutes;
            par.Add("stop", OracleDbType.Int16).Value          = (short)schedule.stopSpan.TotalMinutes;
            par.Add("stride", OracleDbType.Int16).Value        = schedule.stride;
            par.Add("disabled", OracleDbType.Byte).Value       = !schedule.enabled;

            if (mode == eDbOperation.Insert)
            {
                return(ExecuteNonQueryStoreKeyAsync(cmd, 1).Result);
            }
            else
            {
                return(ExecuteNonQueryAsync(cmd).Result);
            }
        }
        /// <summary>
        /// Tworzenie, modyfikacja, usunięcie endpointu FTP
        /// </summary>
        /// <param name="endpoint">Definicja endpointu</param>
        /// <param name="mode">Rodzaj operacji</param>
        /// <returns>Komunikat o ewentualnym błędzie</returns>
        public static string ModifyEndpoint(FtpEndpointModel endpoint, eDbOperation mode)
        {
            SqlCommand cmd = guiConn.CreateCommand();

            cmd.CommandText = "exec [ftp].[sp_modify_endpoint] @mode,@xx,@ins_xx,@host,@userid,@passwd,@remdir,@locdir,@transprot,@transdir,@transmode";
            var par = cmd.Parameters;

            par.Add("mode", SqlDbType.Int).Value            = (int)mode;
            par.Add("xx", SqlDbType.Int).Value              = endpoint.xx;
            par.Add("ins_xx", SqlDbType.Int).Value          = endpoint.insXX;
            par.Add("host", SqlDbType.VarChar, 64).Value    = endpoint.host;
            par.Add("userid", SqlDbType.VarChar, 32).Value  = endpoint.uid;
            par.Add("passwd", SqlDbType.VarChar, 32).Value  = endpoint.pwd;
            par.Add("remdir", SqlDbType.VarChar, 256).Value = endpoint.remDir;
            par.Add("locdir", SqlDbType.VarChar, 256).Value = endpoint.locDir;
            par.Add("transprot", SqlDbType.TinyInt).Value   = endpoint.protocol;
            par.Add("transdir", SqlDbType.TinyInt).Value    = endpoint.direction;
            par.Add("transmode", SqlDbType.TinyInt).Value   = endpoint.mode;

            if (mode == eDbOperation.Insert)
            {
                return(ExecuteNonQueryStoreKey(cmd));
            }
            else
            {
                return(ExecuteNonQuery(cmd));
            }
        }
Example #4
0
        /// <summary>
        /// Tworzenie, modyfikacja, usunięcie endpointu FTP
        /// </summary>
        /// <param name="endpoint">Definicja endpointu</param>
        /// <param name="mode">Rodzaj operacji</param>
        /// <returns>Komunikat o ewentualnym błędzie</returns>
        public static string ModifyEndpoint(FtpEndpointModel endpoint, eDbOperation mode)
        {
            OracleCommand cmd = guiConn.CreateCommand();

            cmd.CommandText = "begin modify_endpoint(:mode,:xx,:ins_xx,:host,:userid,:passwd,:remdir,:locdir,:transprot,:transdir,:transmode); end;";
            var par = cmd.Parameters;

            par.Add("mode", OracleDbType.Int32).Value           = (int)mode;
            par.Add("xx", OracleDbType.Int32).Value             = endpoint.xx;
            par.Add("ins_xx", OracleDbType.Int32).Value         = endpoint.insXX;
            par.Add("host", OracleDbType.Varchar2, 64).Value    = endpoint.host;
            par.Add("userid", OracleDbType.Varchar2, 32).Value  = endpoint.uid;
            par.Add("passwd", OracleDbType.Varchar2, 32).Value  = endpoint.pwd;
            par.Add("remdir", OracleDbType.Varchar2, 256).Value = endpoint.remDir;
            par.Add("locdir", OracleDbType.Varchar2, 256).Value = endpoint.locDir;
            par.Add("transprot", OracleDbType.Byte).Value       = endpoint.protocol;
            par.Add("transdir", OracleDbType.Byte).Value        = endpoint.direction;
            par.Add("transmode", OracleDbType.Byte).Value       = endpoint.mode;

            if (mode == eDbOperation.Insert)
            {
                return(ExecuteNonQueryStoreKeyAsync(cmd, 1).Result);
            }
            else
            {
                return(ExecuteNonQueryAsync(cmd).Result);
            }
        }