Exemple #1
0
        protected override void RowConverter(ReportTypePackage item, DataRow row)
        {
            item.Description = row["DESCR"].ToString();
            item.Id          = int.Parse(row["REPORT_TYPE_ID"].ToString());
            item.ShortName   = row["SHORT_NAME"].ToString();
            item.Sql         = row["SQL"].ToString();
            if (row["ALLOW_DYNAMIC_MODS"] as char? == 'N')
            {
                item.AllowDynamicMod = false;
            }
            else
            {
                item.AllowDynamicMod = false;
            }


            //item.AllowDynamicMod = bool.Parse(row["ALLOW_DYNAMIC_MODS"].ToString());
            if (row["DATA_DUMP_ONLY"] as char? == 'N')
            {
                item.DataDumpOnly = false;
            }
            else
            {
                item.DataDumpOnly = true;
            }
            //item.DataDumpOnly = bool.Parse(row["DATA_DUMP_ONLY"].ToString());

            if (row["MUST_ENCRYPT"] as char? == 'Y')
            {
                item.MustEncrypt = true;
            }
        }
        public void RemoveType()
        {
            if (CreatingNew)
            {
                NoSave();
                return;
            }
            Modified = false;

            int id = Package.Id;

            int index = Table.IndexOf(package);

            // Can't remove last table. :(
            if (index == 0 && Table.Count == 1)
            {
                return;
            }

            if (index == 0)
            {
                Package = Table[index + 1];
            }
            else if (index == Table.Count - 1)
            {
                Package = Table[index - 1];
            }
            ReportTypePackage toRemove = Table.GetPackage(id);

            Table.Remove(toRemove);

            Target.Delete(toRemove);
            Modified = false;
        }
Exemple #3
0
        public override void Update(ReportTypePackage package)
        {
            if (package.Id == 0)
            {
                throw new ArgumentNullException("Item.InvoiceGrpId", "An item InvoiceGrpId was provided for the update.");
            }
            try
            {
                string sql = String.Format("update {0}.REPORT_TYPE set "
                                           + "  DESC = :DESC "
                                           + "  REPORT_TYPE_ID = :REPORT_TYPE_ID "
                                           + "  SHORT_NAME = :SHORT_NAME "
                                           + "  SQL = :SQL "
                                           + "  ,ALLOW_DYNAMIC_MODS = ALLOW_DYNAMIC_MODS "
                                           + "  ,DATA_DUMP_ONLY = DATA_DUMP_ONLY "
                                           + "  ,MUST_ENCRYPT = :MUST_ENCRYPT "
                                           + "where REPORT_TYPE_ID = :REPORT_TYPE_ID"
                                           , SchemaName);
                List <OracleParameter> parameters = new List <OracleParameter>();
                parameters.Add(OracleHelper.CreateParameter(":DESC", package.Description, OracleType.VarChar, ParameterDirection.Input));
                parameters.Add(OracleHelper.CreateParameter(":REPORT_TYPE_ID", null, OracleType.Int32, ParameterDirection.InputOutput));
                parameters.Add(OracleHelper.CreateParameter(":SHORT_NAME", package.ShortName, OracleType.VarChar, ParameterDirection.Input));
                parameters.Add(OracleHelper.CreateParameter(":SQL", package.Sql, OracleType.VarChar, ParameterDirection.Input));
                parameters.Add(OracleHelper.CreateParameter(":ALLOW_DYNAMIC_MODS", package.AllowDynamicMod, OracleType.Char, ParameterDirection.Input));
                parameters.Add(OracleHelper.CreateParameter(":DATA_DUMP_ONLY", package.DataDumpOnly, OracleType.Char, ParameterDirection.Input));
                parameters.Add(OracleHelper.CreateParameter(":MUST_ENCRYPT", package.MustEncrypt, OracleType.Char, ParameterDirection.Input));

                OracleParameterCollection outParams = OracleHelper.ExecuteNonQuery(base.ConnectionString.Value, sql, parameters.ToArray <OracleParameter>());
            }
            catch (OracleException ex)
            {
                throw ex;
            }
        }
Exemple #4
0
        public override ReportTypePackage RowConverter(IDataRecord record)
        {
            ReportTypePackage rtp = new ReportTypePackage();

            // TODO - Write the select statement
            //rtp.AllowDynamicMod = ...
            return(rtp);
        }
Exemple #5
0
 public override void Delete(ReportTypePackage package)
 {
     try
     {
         string sql = String.Format("DELETE FROM {0}.REPORT_TYPE WHERE REPORT_TYPE_ID = :REPORT_TYPE_ID", SchemaName);
         List <OracleParameter> parameters = new List <OracleParameter>();
         parameters.Add(OracleHelper.CreateParameter(":REPORT_TYPE_ID", package.Id, OracleType.Int32, ParameterDirection.Input));
         OracleParameterCollection outParams = OracleHelper.ExecuteNonQuery(base.ConnectionString.Value, sql, parameters.ToArray <OracleParameter>());
     }
     catch (OracleException ex)
     {
         throw ex;
     }
 }
Exemple #6
0
        public override void Add(ReportTypePackage package)
        {
            //  DESCR       VARCHAR2
            //  REPORT_TYPE_ID	INTEGER
            //  SHORT_NAME	VARCHAR2
            //  SQL		VARCHAR2
            //  ALLOW_DYNAMIC_MODS  CHAR1
            //  DATA_DUMP_ONLY	CHAR1
            //  MUST_ENCRYPT	CHAR1
            string sql = String.Format("insert into {0}.REPORT_TYPE "
                                       + "  (DESCR"
                                       + "  ,REPORT_TYPE_ID"
                                       + "  ,SHORT_NAME"
                                       + "  ,SQL"
                                       + "  ,ALLOW_DYNAMIC_MODS"
                                       + "  ,DATA_DUMP_ONLY"
                                       + "  ,MUST_ENCRYPT) "
                                       + "values "
                                       + "  (:DESCR"
                                       + "  ,{0}.REPORT_TYPE_ID.nextval"
                                       + "  ,:SHORT_NAME"
                                       + "  ,:SQL"
                                       + "  ,:ALLOW_DYNAMIC_MODS"
                                       + "  ,:DATA_DUMP_ONLY"
                                       + "  ,:MUST_ENCRYPT)"
                                       + "  returning REPORT_TYPE_ID into :NEWID"
                                       , SchemaName);

            try
            {
                List <OracleParameter> parameters = new List <OracleParameter>();
                parameters.Add(OracleHelper.CreateParameter(":DESCR", package.Description, OracleType.VarChar, ParameterDirection.Input));
                parameters.Add(OracleHelper.CreateParameter(":SHORT_NAME", package.ShortName, OracleType.VarChar, ParameterDirection.Input));
                parameters.Add(OracleHelper.CreateParameter(":SQL", package.Sql, OracleType.VarChar, ParameterDirection.Input));
                parameters.Add(OracleHelper.CreateParameter(":ALLOW_DYNAMIC_MODS", (package.AllowDynamicMod) ? 'Y' : 'N', OracleType.Char, ParameterDirection.Input));
                parameters.Add(OracleHelper.CreateParameter(":DATA_DUMP_ONLY", (package.DataDumpOnly) ? 'Y' : 'N', OracleType.Char, ParameterDirection.Input));
                parameters.Add(OracleHelper.CreateParameter(":MUST_ENCRYPT", (package.MustEncrypt) ? 'Y' : 'N', OracleType.Char, ParameterDirection.Input));
                parameters.Add(OracleHelper.CreateParameter(":NEWID", OracleType.Int32, ParameterDirection.InputOutput));

                OracleParameterCollection outParams = OracleHelper.ExecuteNonQuery(base.ConnectionString.Value, sql, parameters.ToArray <OracleParameter>());
                package.Id = int.Parse(parameters[parameters.Count - 1].Value.ToString());
            }
            catch (OracleException ex)
            {
                throw ex;
            }
        }
        public void CreateEmptyPackage()
        {
            comparePackage      = new ReportTypePackage(Package);// Keep it dirty
            package             = new ReportTypePackage(Package);
            package.Description = newDescription;

            if (Table.IsDuplicate(package))
            {
                System.Windows.MessageBox.Show("This type already exists");
                return;
            }

            Table.Add(package);
            package.Id  = 0;
            package.Sql = "Select INVOICE_ID AS \"Invoice\" from SPHRSBILLING.CSV_DETAILS WHERE INVOICE_ID = :I_INVOICE_ID";
            package.ReConstructPackageListFromSql(null);
            OnPropertyChanged("Package");
            Modified = true;
        }
Exemple #8
0
 public override ReportTypePackage Get(ReportTypePackage entity)
 {
     throw new NotImplementedException();
 }
Exemple #9
0
 public override void Remove(ReportTypePackage item)
 {
     throw new NotImplementedException();
 }