Esempio n. 1
0
        //C:\Users\Eminent\Documents\Projects\perception\CMS\CMS\CMS\Files\_originals\Koala.jpg
        //string strPath = HttpContext.Current.Server.MapPath("/Files/_originals/Koala.jpg");

        public Values.AddFile SaveFile(IConnectToDB _Connect, IFormFile File)
        {
            add addHelp = new add();

            string ContentType = File.ContentType;

            long?  ContentSize = File.Length;
            string FileName    = File.FileName;

            byte[] longRaw = new byte[File.Length];

            //TODO: Review .Net Core Port
            if (File.Length > 0)
            {
                using (var ms = new MemoryStream())
                {
                    File.CopyTo(ms);
                    longRaw = ms.ToArray();
                    //string s = Convert.ToBase64String(fileBytes);
                    // act on the Base64 data
                }
            }

            Values.AddFile thisFile = addHelp.ADD_ENTRY_FILE(_Connect, new Values.AddFile
            {
                I_FILE_NAME    = FileName,
                I_CONTENT_TYPE = ContentType,
                I_FILE_SIZE    = ContentSize,
                I_FILE_DATA    = longRaw
            });

            return(thisFile);
        }
Esempio n. 2
0
        public List <CommandResult> EXTEND_SCAFFOLD(IConnectToDB _Connect, string Name)
        {
            List <CommandResult> HoldResult = new List <CommandResult>();
            ER_Generate          gen        = new ER_Generate();

            HoldResult.Add(new CommandResult
            {
                _Successful = true,
                _Response   = "---Start Scaffold " + Name + "",
                _EndTime    = DateTime.Now
            });
            List <string> ColumnsList2 = new List <string>();

            ColumnsList2.Add(Name + "_ID");
            //Add(ADD_TABLE(Name));
            //HoldResult.AddRange(ADD_COLUMNS(_Connect, Name, ColumnsList));
            //HoldResult.Add(ADD_KEY_UNIQUE(_Connect, Name, ColumnsList2));
            //HoldResult.Add(er_ddl.ADD_ORACLE_SEQUENCE(_Connect, Name));
            //HoldResult.Add(er_ddl.ADD_SEQUENCE_TRIGGER(_Connect, Name, "Before", "INSERT", (Name + "_SQ"), (Name + "_ID")));
            HoldResult.AddRange(gen.ADD_PROCEDURE_INSERT(_Connect, Name, ""));
            HoldResult.AddRange(gen.ADD_PROCEDURE_UPDATE(_Connect, Name, ""));
            HoldResult.AddRange(gen.ADD_PROCEDURE_DELETE(_Connect, Name, ""));

            HoldResult.Add(new CommandResult
            {
                _Successful = true,
                _Response   = "---End Scaffold " + Name + "",
                _EndTime    = DateTime.Now
            });
            return(HoldResult);
        }
Esempio n. 3
0
        public ViewObjectPropFile GetFileByID(IConnectToDB _Connect, Guid?FileID)
        {
            byte[]             bytes = new byte[0];
            ViewObjectPropFile _File = new ViewObjectPropFile();

            _DynamicOutputProcedures DynamicOutput = new _DynamicOutputProcedures();

            List <DynamicModels.RootReportFilter> Filters = new List <DynamicModels.RootReportFilter>();

            Filters.Add(new DynamicModels.RootReportFilter {
                FilterName = "OBJ_PROP_SETS_DAT_FILE_ID_", DBType = SqlDbType.UniqueIdentifier, ParamValue = FileID
            });

            DataTable _DT = DynamicOutput.DynoProcSearch(_Connect, "Custom Query", "SP_S_VW__OBJ_PROP_SETS_DAT_FILE_SEARCH",
                                                         new DataTableDotNetModelMetaData {
                columns = "DT_CREATED, CONTENT_TYPE, FILE_NAME", length = -1, order = "1 asc", start = 0, verify = "T"
            },
                                                         Filters);

            DataColumnCollection DCC = _DT.Columns;

            if (DCC.Contains("FILE_NAME") && _DT.Rows.Count > 0)
            {
                string thisFileRow = new JObject(_DT.Columns.Cast <DataColumn>()
                                                 .Select(c => new JProperty(c.ColumnName, JToken.FromObject(_DT.Rows[0][c])))
                                                 ).ToString(Formatting.None);

                _File = Newtonsoft.Json.JsonConvert.DeserializeObject <ViewObjectPropFile>(thisFileRow);
            }
            return(_File);
        }
Esempio n. 4
0
        public long?GetProfileRendition(IConnectToDB _Connect, long?identity_id)
        {
            long?value = 0;

            ER_DML er_dml = new ER_DML();

            _DynamicOutputProcedures DynamicOutput = new _DynamicOutputProcedures();

            List <DynamicModels.RootReportFilter> Filters = new List <DynamicModels.RootReportFilter>();

            Filters.Add(new DynamicModels.RootReportFilter {
                FilterName = "IDENTITIES_ID_", DBType = SqlDbType.BigInt, ParamValue = identity_id
            });

            DataTable TempDataTable = DynamicOutput.DynoProcSearch(_Connect, "Custom Query", "SP_S_VW_PROFILES_DAT_CHAR_RENDITION_SEARCH",
                                                                   new DataTableDotNetModelMetaData {
                length = -1, order = "1 asc", start = 0, verify = "T"
            },
                                                                   Filters);

            foreach (DataRow row in TempDataTable.Rows)
            {
                if (row["rendition"].ToString() != "")
                {
                    value = ER_Tools.ConvertToInt64(row["rendition"].ToString());
                }
            }

            return(value);
        }
Esempio n. 5
0
        public static string GetSymbolbyID(IConnectToDB _Connect, string SymbolName)
        {
            string sqlstatement = "Select * from CSA.SYMBOLS where LOWER(SYMBOL_NAME) = @SYMBOL_NAME";

            ER_Query.Parameter_Run SQlin = new ER_Query.Parameter_Run
            {
                sqlIn         = sqlstatement,
                _dbParameters = new List <DBParameters> {
                    new DBParameters {
                        ParamName = "SYMBOL_NAME", MSSqlParamDataType = SqlDbType.BigInt, ParamValue = SymbolName.ToLower()
                    }
                }
            };

            DataTable            _DT = ER_Query._RUN_PARAMETER_QUERY(_Connect, SQlin);
            DataColumnCollection DCC = _DT.Columns;

            if (_DT.Rows.Count > 0 && DCC.Contains("SYMBOLS_ID"))
            {
                return(_DT.Rows[0]["SYMBOLS_ID"].ToString());
            }
            else
            {
                return("1000");
            }
        }
Esempio n. 6
0
        public long?AddProfileEntry(IConnectToDB _Connect, long?identitiesId)
        {
            SecurityHelper securityHelper = new SecurityHelper();
            add            addHelp        = new add();
            long?          profilesId     = null;
            long?          privilegesId   = ER_Tools.ConvertToInt64(securityHelper.GetPrivID(_Connect, "ADD PROFILE"));

            //Enter profile information
            Values.AddProfiles ProfilesModel = null;
            ProfilesModel = addHelp.ADD_ENTRY_Profiles(_Connect, new Values.AddProfiles
            {
                I_IDENTITIES_ID = identitiesId,
                I_ENABLED       = 'Y',
            });
            profilesId = ProfilesModel.O_PROFILES_ID;

            //Enter profile security information
            //Values.AddProfilesSecPriv ProfilesSecPrivModel = null;
            //ProfilesSecPrivModel = addHelp.ADD_ENTRY_Profiles_Sec_Priv(_Connect, new Values.AddProfilesSecPriv
            //{
            //    I_OBJECT_TYPE = "Permission",
            //    I_PROFILES_ID = profilesId,
            //    I_PRIVILEGES_ID = privilegesId,
            //    I_ENABLED = 'Y',
            //    I_IDENTITIES_ID = identitiesId
            //});
            //profilesSecPrivId = ProfilesSecPrivModel.O_PROFILES_SEC_PRIV_ID;

            return(profilesId);
        }
Esempio n. 7
0
        public string GetProfileData(IConnectToDB _Connect, long?identity_id, string property)
        {
            string value = "", rendition = "";

            rendition = GetProfileRendition(_Connect, identity_id).ToString();

            _DynamicOutputProcedures DynamicOutput        = new _DynamicOutputProcedures();

            List <DynamicModels.RootReportFilter> Filters = new List <DynamicModels.RootReportFilter>();

            Filters.Add(new DynamicModels.RootReportFilter {
                FilterName = "IDENTITIES_ID_", DBType = SqlDbType.BigInt, ParamValue = identity_id
            });
            Filters.Add(new DynamicModels.RootReportFilter {
                FilterName = "RENDITION_", DBType = SqlDbType.VarChar, ParamSize = -1, ParamValue = rendition
            });
            Filters.Add(new DynamicModels.RootReportFilter {
                FilterName = "PROPERTY_VALUE_", DBType = SqlDbType.VarChar, ParamSize = -1, ParamValue = property
            });

            DataTable TempDataTable = DynamicOutput.DynoProcSearch(_Connect, "Custom Query", "SP_S_VW__PROFILES_DAT_CHAR_SEARCH",
                                                                   new DataTableDotNetModelMetaData {
                columns = "VALUE", length = -1, order = "1 asc", start = 0, verify = "T"
            },
                                                                   Filters);

            if (TempDataTable.Rows.Count > 0)
            {
                value = TempDataTable.Rows[0][0].ToString();
            }

            return(value);
        }
Esempio n. 8
0
        public Dictionary.DropView DROP_Dictionary_View(IConnectToDB _Connect, string ViewName)
        {
            List <DBParameters> EntryProcedureParameters = new List <DBParameters>();

            ER_Query.Parameter_Run SQlin = new ER_Query.Parameter_Run
            {
                sqlIn         = "Select * from CSA.ER_VIEWS where UPPER(VIEW_NAME) = @VIEW_NAME",
                _dbParameters = new List <DBParameters> {
                    new DBParameters {
                        ParamName = "VIEW_NAME", MSSqlParamDataType = SqlDbType.VarChar, ParamValue = ViewName.ToUpper()
                    }
                }
            };

            DataTable            _DT = ER_Query._RUN_PARAMETER_QUERY(_Connect, SQlin);
            DataColumnCollection DCC = _DT.Columns;

            Dictionary.DropView thisModel = new Dictionary.DropView();

            if (_DT.Rows.Count > 0 && DCC.Contains("ER_VIEWS_ID"))
            {
                thisModel = new Dictionary.DropView {
                    I_ER_VIEWS_ID = _DT.Rows[0].Field <long?>("ER_VIEWS_ID")
                };
                Universal_Call <Dictionary.DropView> dv = new Universal_Call <Dictionary.DropView>();
                thisModel = dv.GenericInputProcedure(_Connect, thisModel);
            }

            return(thisModel);
        }
Esempio n. 9
0
        public string GetNotificationSettingValue(IConnectToDB _Connect, long?identity, string type)
        {
            ER_Query er_query = new ER_Query();

            ER_Query.Parameter_Run SQlin = new ER_Query.Parameter_Run();
            string settingValue          = "";

            SQlin.sqlIn = "Select property_type from CSA.IDENTITY_PROPERTIES a where a.DT_CREATED >= (select max(ip.DT_CREATED) FROM CSA.IDENTITY_PROPERTIES ip where ip.IDENTITIES_ID = @IDENTITIES_ID and ip.PROPERTY_NAME = @PROPERTY_NAME) and a.PROPERTY_NAME = @PROPERTY_NAME";

            SQlin._dbParameters = new List <DBParameters>
            {
                new DBParameters {
                    ParamName = "IDENTITIES_ID", MSSqlParamDataType = SqlDbType.BigInt, ParamValue = identity
                },
                new DBParameters {
                    ParamName = "PROPERTY_NAME", MSSqlParamDataType = SqlDbType.VarChar, ParamValue = type
                }
            };

            DataTable TempDataTable = er_query.RUN_PARAMETER_QUERY(_Connect, SQlin);

            if (TempDataTable.Rows.Count > 0)
            {
                settingValue = TempDataTable.Rows[0][0].ToString();
            }

            return(settingValue);
        }
Esempio n. 10
0
        public DataTable FindNotifications(IConnectToDB _Connect, string start)
        {
            ER_Query er_query = new ER_Query();

            ER_Query.Parameter_Run SQlin = new ER_Query.Parameter_Run();

            SQlin._dbParameters = new List <DBParameters>
            {
                new DBParameters {
                    ParamName = "ACTIVITY_ID", MSSqlParamDataType = SqlDbType.BigInt, ParamValue = start
                }
            };

            SQlin.sqlIn = " Select * " +
                          " from (Select ROW_NUMBER() OVER(ORDER BY ACTIVITY_ID ) AS rownumb, * from CSA.VW__ACTIVITY where Lower(object_type) in ('add object','delete object') and " +
                          "Lower(table_source) in ('identities', 'applications')) ok " +
                          " where  rownumb between CONVERT(int, (select rownumb1 from (Select ROW_NUMBER() OVER(ORDER BY ACTIVITY_ID ) AS rownumb1, * from CSA.VW__ACTIVITY where Lower(object_type) in ('add object','delete object') and " +
                          " Lower(table_source) in ('identities', 'applications')) ok1 where activity_id = @ACTIVITY_ID)) + 1 and CONVERT(int, (select rownumb1 from (Select ROW_NUMBER() OVER(ORDER BY ACTIVITY_ID ) AS rownumb1, * from CSA.VW__ACTIVITY where Lower(object_type) in ('add object','delete object') and " +
                          " Lower(table_source) in ('identities', 'applications')) ok1 where activity_id = @ACTIVITY_ID)) + 10 and Lower(object_type) in ('add object','delete object') and " +
                          " Lower(table_source) in ('identities', 'applications')  Order by DT_CREATED desc";

            DataTable TempDataTable = er_query.RUN_PARAMETER_QUERY(_Connect, SQlin);

            return(TempDataTable);
        }
Esempio n. 11
0
        public static flowObject GetWorkflowIfExists(IConnectToDB _Connect, Guid?applications_uuid, string Column)
        {
            flowObject theWorkflow = null;
            List <DynamicModels.RootReportFilter> thisTempFilters = new List <DynamicModels.RootReportFilter>();

            thisTempFilters.Add(new DynamicModels.RootReportFilter {
                FilterName = "GET_LATEST", ParamValue = "T"
            });
            thisTempFilters.Add(new DynamicModels.RootReportFilter {
                FilterName = Column + "_", ParamValue = applications_uuid
            });

            DataTable AppWorkflow = _DynamicOutputProcedures._DynoProcSearch(_Connect, "Custom Query", "SP_S_VW__WORKFLOWS_SEARCH",
                                                                             new DataTableDotNetModelMetaData {
                length = -1, order = "1 desc", start = 0, verify = "T"
            }, thisTempFilters);

            if (AppWorkflow.Rows.Count > 0)
            {
                byte[] thisWorkflowBytes = AppWorkflow.Rows[0].Field <Byte[]>("WORKFLOW");

                theWorkflow = Revamp.IO.Tools.Box.FromByteArray <flowObject>(thisWorkflowBytes);
                theWorkflow.workflows_uuid      = AppWorkflow.Rows[0].Field <Guid?>("workflows_uuid");
                theWorkflow.base_workflows_uuid = AppWorkflow.Rows[0].Field <Guid?>("base_workflows_uuid");
            }

            return(theWorkflow);
        }
Esempio n. 12
0
        public List <ObjectPropSetModels> GetPropSetsbySetNID(IConnectToDB _Connect, List <ObjectPropSetModels> PropSets, ObjectSetModels ObjSet, int identity_id)
        {
            ObjectPropSetsHelper PropSetHelper = new ObjectPropSetsHelper();

            DataTable PropSetDT = PropSetHelper.FindbyColumnID(_Connect, "Object_Sets_ID", ObjSet.SetView.object_sets_id.ToString());

            foreach (DataRow PropRows in PropSetDT.Rows)
            {
                ObjectPropSetModels PropSet = new ObjectPropSetModels();
                PropSet.PropSetView = new PropSetView();

                PropSet.PropSetView.obj_prop_sets_id        = PropRows.Field <long?>("obj_prop_sets_id");
                PropSet.PropSetView.object_prop_type        = PropRows.Field <string>("object_prop_type");
                PropSet.PropSetView.property_name           = PropRows.Field <string>("property_name");
                PropSet.PropSetView.property_value          = PropRows.Field <string>("property_value");
                PropSet.PropSetView.value_datatype          = PropRows.Field <string>("value_datatype");
                PropSet.PropSetView.has_parent              = PropRows.Field <string>("has_parent");
                PropSet.PropSetView.has_child               = PropRows.Field <string>("has_child");
                PropSet.PropSetView.parent_obj_prop_sets_id = PropRows.Field <long?>("parent_obj_prop_sets_id");

                PropSet.ObjectPropOptSets = GetPropOptSetsbyPropSetNID(_Connect, new List <ObjectPropOptSetModels>(), PropSet, identity_id);

                PropSets.Add(PropSet);
            }
            return(PropSets);
        }
Esempio n. 13
0
        public DataTable Find(IConnectToDB _Connect, string _id, string type)
        {
            _DynamicOutputProcedures DynamicOutput = new _DynamicOutputProcedures();

            List <DynamicModels.RootReportFilter> Filters = new List <DynamicModels.RootReportFilter>();

            switch (type.ToLower())
            {
            case "cores":
            case "core":
                Filters.Add(new DynamicModels.RootReportFilter {
                    FilterName = "CORES_ID_", DBType = SqlDbType.BigInt, ParamValue = _id
                });
                break;

            case "coreactivity":
                Filters.Add(new DynamicModels.RootReportFilter {
                    FilterName = "OBJECT_TYPE_", DBType = SqlDbType.VarChar, ParamSize = -1, ParamValue = "add object"
                });
                //Filters.Add(new DynamicModels.RootReportFilter { FilterName = "OBJECT_TYPE_", DBType = SqlDbType.VarChar, ParamSize = -1, ParamValue = type });
                Filters.Add(new DynamicModels.RootReportFilter {
                    FilterName = "TABLE_SOURCE_", DBType = SqlDbType.VarChar, ParamSize = -1, ParamValue = "applications"
                });
                break;
            }

            DataTable TempDataTable = DynamicOutput.DynoProcSearch(_Connect, "Custom Query", "SP_S_VW__ACTIVITY_SEARCH",
                                                                   new DataTableDotNetModelMetaData {
                length = -1, order = "1 asc", start = 0, verify = "T"
            },
                                                                   Filters);

            return(TempDataTable);
        }
Esempio n. 14
0
        public List <GripModels> GetgripsforStage(IConnectToDB _Connect, List <GripModels> Grips, StageModels Stage, int identity_id)
        {
            GripsHelper griphelper = new GripsHelper();

            DataTable StageGrips = griphelper.FindbyColumnID(_Connect, "Stages_ID", Stage.Stage.stages_id.ToString());

            foreach (DataRow GripRows in StageGrips.Rows)
            {
                GripModels grip = new GripModels();
                grip.gripinfo = new GripModel();

                grip.gripinfo.grips_id      = GripRows.Field <long?>("grips_id");
                grip.gripinfo.grip_name     = GripRows.Field <string>("grip_name");
                grip.gripinfo.grip_type     = GripRows.Field <string>("grip_type");
                grip.gripinfo.stages_id     = GripRows.Field <long?>("stages_id");
                grip.gripinfo.stage_name    = GripRows.Field <string>("stage_name");
                grip.gripinfo.stage_type    = GripRows.Field <string>("stage_type");
                grip.gripinfo.identities_id = GripRows.Field <long?>("identities_id");
                grip.gripinfo.enabled       = GripRows.Field <string>("enabled");
                grip.gripinfo.dt_created    = GripRows.Field <DateTime>("dt_created");
                grip.gripinfo.dt_available  = GripRows.Field <DateTime?>("dt_available");

                grip.ObjectSets = GetSetsbyGripNID(_Connect, new List <ObjectSetModels>(), grip, identity_id);

                Grips.Add(grip);
            }

            return(Grips);
        }
Esempio n. 15
0
        public List <StageModels> GetStagesForAppandUserID(IConnectToDB _Connect, List <StageModels> Stages, ApplicationModels application, int identity_id)
        {
            StagesHelper stageshelper = new StagesHelper();

            DataTable ApplicationStages = stageshelper.FindbyColumnID(_Connect, "Applications_ID", application.AppView.applications_id.ToString());

            foreach (DataRow StageRows in ApplicationStages.Rows)
            {
                StageModels tempStageModel = new StageModels();
                tempStageModel.Stage = new StageModel();
                tempStageModel.Grips = new List <GripModels>();

                tempStageModel.Stage.stages_id    = StageRows.Field <long?>("stages_id");
                tempStageModel.Stage.stage_name   = StageRows.Field <string>("stage_name");
                tempStageModel.Stage.stage_type   = StageRows.Field <string>("stage_type");
                tempStageModel.Stage.dt_created   = StageRows.Field <DateTime>("dt_created");
                tempStageModel.Stage.dt_available = StageRows.Field <DateTime?>("dt_available");
                tempStageModel.Stage.dt_end       = StageRows.Field <DateTime?>("dt_end");
                tempStageModel.Stage.enabled      = StageRows.Field <string>("enabled");

                tempStageModel.Grips = GetgripsforStage(_Connect, new List <GripModels>(), tempStageModel, identity_id);

                Stages.Add(tempStageModel);
            }

            return(Stages);
        }
Esempio n. 16
0
        public List <CoreModels> GetsCoreForUserID(IConnectToDB _Connect, List <CoreModels> Cores, int identity_id)
        {
            //Get Cores for user.

            CoreHelper CoreHelper = new CoreHelper();

            DataTable CoreTable = CoreHelper.FindAll(_Connect);


            foreach (DataRow CoreRow in CoreTable.Rows)
            {
                //Instantiate New Models
                CoreModels CoreModel = new CoreModels();
                CoreModel.Core      = new CoreStruct();
                CoreModel.Core.Core = new CoreTableModel();

                CoreModel.Core.Core.core_name    = CoreRow.Field <string>("core_name");
                CoreModel.Core.Core.dt_created   = CoreRow.Field <DateTime>("dt_created");
                CoreModel.Core.Core.cores_id     = CoreRow.Field <long?>("cores_id");
                CoreModel.Core.Core.object_type  = CoreRow.Field <string>("object_type");
                CoreModel.Core.Core.dt_available = CoreRow.Field <DateTime?>("dt_available");
                CoreModel.Core.Core.dt_end       = CoreRow.Field <DateTime?>("dt_end");
                CoreModel.Core.Core.enabled      = CoreRow.Field <string>("enabled");

                //Get Applications belonging to Each Core.

                CoreModel.applications = GetApplicationsForUserID(_Connect, CoreModel, new List <ApplicationModels>(), identity_id);

                Cores.Add(CoreModel);
            }

            return(Cores);
        }
Esempio n. 17
0
        public List <ViewObjectPropSetsModel> GetObjectPropSetsViaObjectSet(IConnectToDB _Connect, string object_sets_id)
        {
            //ObjectSets objectsets = new ObjectSets();
            ObjectPropSetsHelper objectpropsets = new ObjectPropSetsHelper();

            DataTable objectpropsetsdt;

            if (object_sets_id.ToLower() == "all")
            {
                objectpropsetsdt = objectpropsets.FindAll(_Connect);
            }
            else
            {
                objectpropsetsdt = objectpropsets.FindbyColumnID(_Connect, "object_sets_id", object_sets_id);
            }

            List <ViewObjectPropSetsModel> ObjectPropSetsList = new List <ViewObjectPropSetsModel>();

            ViewObjectPropSetsModel[] ObjectPropSets = new ViewObjectPropSetsModel[objectpropsetsdt.Rows.Count];

            for (int i = 0; i < objectpropsetsdt.Rows.Count; i++)
            {
                string thisPropSet = new JObject(objectpropsetsdt.Columns.Cast <DataColumn>()
                                                 .Select(c => new JProperty(c.ColumnName, JToken.FromObject(objectpropsetsdt.Rows[i][c])))
                                                 ).ToString(Formatting.None);

                ObjectPropSets[i] = JsonConvert.DeserializeObject <ViewObjectPropSetsModel>(thisPropSet);

                ObjectPropSets[i].ObjectPropOptSets = objectpropsets.GetPropOptSetsViaPropSets(_Connect, ObjectPropSets[i].obj_prop_sets_id.ToString());

                ObjectPropSetsList.Add(ObjectPropSets[i]);
            }

            return(ObjectPropSetsList);
        }
Esempio n. 18
0
        //Returns the count of the new notifications
        public string NewNotificationCount(IConnectToDB _Connect, string _identity)
        {
            ER_Query er_query = new ER_Query();

            ER_Query.Parameter_Run SQlin = new ER_Query.Parameter_Run();
            string count = "";

            SQlin._dbParameters = new List <DBParameters>
            {
                new DBParameters {
                    ParamName = "IDENTITIES_ID", MSSqlParamDataType = SqlDbType.BigInt, ParamValue = _identity
                },
            };

            SQlin.sqlIn = " Select COUNT(*) total from CSA.VW__ACTIVITY a where a.APPLICATION_NAME != 'Core Settings' and a.DT_CREATED >= (select max(ip.DT_CREATED) FROM CSA.IDENTITY_PROPERTIES ip where ip.IDENTITIES_ID = @IDENTITIES_ID) and a.OBJECT_TYPE not in ('Login','Access Log')";

            DataTable TempDataTable = er_query.RUN_PARAMETER_QUERY(_Connect, SQlin);

            if (TempDataTable.Rows.Count > 0)
            {
                count = TempDataTable.Rows[0][0].ToString();
            }

            return(count);
        }
Esempio n. 19
0
        public string GetSessionAndRequest(IConnectToDB _Connect, long?_identities_id, string uname)
        {
            SessionRequest SR = new SessionRequest();

            SR.identities_id = _identities_id > 0 ? _identities_id : 0;
            SR.username      = uname;
            //TODO: Refactor for .Net Core

            /* SR.anonymousid = System.Web.HttpContext.Current.Request.AnonymousID != null ? System.Web.HttpContext.Current.Request.AnonymousID : "0";
             * SR.sessionid = !Current.Session.Keys.Contains("SessionID") ? "" : Current.Session.GetString("SessionID");
             * SR.timeout = !Current.Session.Keys.Contains("Timeout") ? "" : Current.Session.GetString("Timeout");
             * SR.useragent = !Current.Request.Headers.Keys.Contains("User-Agent") ? "" : Current.Request.Headers["User-Agent"].ToString();
             * SR.userhostaddress = !Current.Request.Headers.Keys.Contains("UserHostAddress") ? "" : Current.Request.Headers["UserAgent"].ToString();
             * SR.userhostaddress = System.Web.HttpContext.Current.Request.UserHostAddress == null ? "" : System.Web.HttpContext.Current.Request.UserHostAddress;
             * SR.userhostname = System.Web.HttpContext.Current.Request.UserHostName == null ? "" : System.Web.HttpContext.Current.Request.UserHostName;
             * SR.isauthenticated = System.Web.HttpContext.Current.Request.IsAuthenticated.ToString() == null ? "" : System.Web.HttpContext.Current.Request.IsAuthenticated.ToString();
             * SR.logonuseridentity = System.Web.HttpContext.Current.Request.LogonUserIdentity.Name.ToString() == null ? "" : System.Web.HttpContext.Current.Request.LogonUserIdentity.Name.ToString();
             * SR.browser = System.Web.HttpContext.Current.Request.Browser.Browser.ToString() == null ? "" : System.Web.HttpContext.Current.Request.Browser.Browser.ToString();
             * SR.majorversion = System.Web.HttpContext.Current.Request.Browser.MajorVersion.ToString() == null ? "" : System.Web.HttpContext.Current.Request.Browser.MajorVersion.ToString();
             * SR.version = System.Web.HttpContext.Current.Request.Browser.Version.ToString() == null ? "" : System.Web.HttpContext.Current.Request.Browser.Version.ToString();
             * SR.crawler = System.Web.HttpContext.Current.Request.Browser.Crawler.ToString() == null ? "" : System.Web.HttpContext.Current.Request.Browser.Crawler.ToString();
             * SR.clrversion = System.Web.HttpContext.Current.Request.Browser.ClrVersion.ToString() == null ? "" : System.Web.HttpContext.Current.Request.Browser.ClrVersion.ToString();
             * SR.cookies = "";
             * SR.ismobiledevice = System.Web.HttpContext.Current.Request.Browser.IsMobileDevice.ToString() == null ? "" : System.Web.HttpContext.Current.Request.Browser.IsMobileDevice.ToString();
             * SR.platform = System.Web.HttpContext.Current.Request.Browser.Platform == null ? "" : System.Web.HttpContext.Current.Request.Browser.Platform;
             * SR.url = System.Web.HttpContext.Current.Request.Url.ToString() == null ? "" : System.Web.HttpContext.Current.Request.Url.ToString();
             * SR.urlreferrer = (System.Web.HttpContext.Current.Request.UrlReferrer == null) ? "" : System.Web.HttpContext.Current.Request.UrlReferrer.ToString();*/

            return(LogRequest(_Connect, SR));
        }
Esempio n. 20
0
        public DataTable FindAll(IConnectToDB _Connect, string _typeofActivity)
        {
            _DynamicOutputProcedures DynamicOutput = new _DynamicOutputProcedures();

            List <DynamicModels.RootReportFilter> Filters = new List <DynamicModels.RootReportFilter>();

            switch (_typeofActivity.ToLower())
            {
            case "all":
                break;

            default:
                Filters.Add(new DynamicModels.RootReportFilter {
                    FilterName = "OBJECT_TYPE_", DBType = SqlDbType.VarChar, ParamSize = -1, ParamValue = _typeofActivity
                });
                break;
            }

            DataTable TempDataTable = DynamicOutput.DynoProcSearch(_Connect, "Custom Query", "SP_S_VW__ACTIVITY_SEARCH",
                                                                   new DataTableDotNetModelMetaData {
                length = -1, order = "DT_CREATED desc", start = 0, verify = "T"
            },
                                                                   Filters);

            return(TempDataTable);
        }
Esempio n. 21
0
        public string PROCEDURE_ACTION(IConnectToDB _Connect, string ProcedureName, List <DBParameters> EntryProcedureParameters, string _ReturnParameter)
        {
            List <DBParameters> ParamListDynamic = new List <DBParameters>();

            switch (_Connect.Platform.ToLower())
            {
            case "microsoft":

                Paramatizer(EntryProcedureParameters, ParamListDynamic);

                BIG_CALL RUN = new BIG_CALL();

                RUN.COMMANDS = new List <SQL_PROCEDURE_CALL>();

                RUN.COMMANDS.Add(new SQL_PROCEDURE_CALL {
                    ProcedureType = "value", ProcedureName = ProcedureName, _dbParameters = ParamListDynamic
                });

                DataTable _result = ER_Procedure.SQL_PROCEDURE_PARAMS(_Connect, RUN).COMMANDS[0].result._DataTable;

                return(ER_Procedure.SQL_PROCEDURE_GET_VALUE("@" + _ReturnParameter, _result));


            default:

                return("Invalid DB Platform");
            }
        }
Esempio n. 22
0
        // START  DB SQL Executes, USER for DDL, and DML

        //Only for None Query SQL statements.

        public bool CanIdentityConnect(IConnectToDB _Connect)
        {
            switch (_Connect.Platform)
            {
            case "Microsoft":
            case "MICROSOFT":
                using (SqlConnection connection = new SqlConnection(_Connect.DBConnString))
                {
                    try
                    {
                        connection.Open();

                        return(true);
                    }
                    catch (SqlException ex)
                    {
                        string err = ex.ToString();

                        return(false);
                    }
                    finally
                    {
                        connection.Close();
                        connection.Dispose();
                    }
                }

            default:
                return(false);
            }
        }
Esempio n. 23
0
        public DataTable GET_COLUMNS_VIA_TABLENAME(IConnectToDB _Connect, string TableName)
        {
            StringBuilder SQLin = new StringBuilder();

            SQLin.Append("Select COLUMN_NAME, DATA_TYPE, ");

            switch (_Connect.Platform)
            {
            case "Microsoft":
            case "MICROSOFT":
                SQLin.Append("CHARACTER_OCTET_LENGTH DATA_LENGTH, NUMERIC_PRECISION, NUMERIC_SCALE ");
                SQLin.Append("from INFORMATION_SCHEMA.COLUMNS ");
                SQLin.Append("where upper(TABLE_NAME) = upper(@TABLE_NAME) ");
                SQLin.Append("order by ORDINAL_POSITION ASC ");

                ER_Query.Parameter_Run SQlin = new ER_Query.Parameter_Run
                {
                    sqlIn         = SQLin.ToString(),
                    _dbParameters = new List <DBParameters> {
                        new DBParameters {
                            ParamName = "TABLE_NAME", MSSqlParamDataType = SqlDbType.VarChar, ParamValue = TableName
                        }
                    }
                };

                return(ER_Query._RUN_PARAMETER_QUERY(_Connect, SQlin));

            default:
                return(new DataTable());
            }
        }
Esempio n. 24
0
        public List <string> GetAllStagesforApp(IConnectToDB _Connect, string applications_id)
        {
            _DynamicOutputProcedures DynamicOutput = new _DynamicOutputProcedures();

            List <DynamicModels.RootReportFilter> Filters = new List <DynamicModels.RootReportFilter>();

            Filters.Add(new DynamicModels.RootReportFilter {
                FilterName = "APPLICATIONS_ID_", DBType = SqlDbType.BigInt, ParamValue = applications_id
            });

            DataTable TempDataTable = DynamicOutput.DynoProcSearch(_Connect, "Custom Query", "SP_S_VW__STAGES_SEARCH",
                                                                   new DataTableDotNetModelMetaData {
                columns = "stages_id", length = -1, order = "1 asc", start = 0, verify = "T"
            },
                                                                   Filters);

            List <string> stagesList = new List <string>();

            foreach (DataRow datarowdc in TempDataTable.Rows)
            {
                stagesList.Add(datarowdc["stages_id"].ToString());
            }

            return(stagesList);
        }
Esempio n. 25
0
        public void ChangePassword(IConnectToDB _Connect, Guid?uuid, string password)
        {
            _DynamicOutputProcedures DynamicOutput        = new _DynamicOutputProcedures();
            List <DynamicModels.RootReportFilter> Filters = new List <DynamicModels.RootReportFilter>();
            ER_Sec er_sec  = new ER_Sec();
            add    addHelp = new add();

            Filters.Add(new DynamicModels.RootReportFilter {
                FilterName = "IDENTITIES_UUID_", DBType = SqlDbType.UniqueIdentifier, ParamValue = uuid
            });

            DataTable TempDataTable = DynamicOutput.DynoProcSearch(_Connect, "Custom Query", "SP_S_VW__ID_PASSWORD_SEARCH",
                                                                   new DataTableDotNetModelMetaData {
                columns = "ID_PASSWORD_ID,RENDITION,IDENTITIES_ID", length = -1, order = "1 asc", start = 0, verify = "T"
            },
                                                                   Filters);

            DataColumnCollection _dccColumnID = TempDataTable.Columns;

            if (_dccColumnID.Contains("ID_PASSWORD_ID") && TempDataTable.Rows.Count > 0)
            {
                //Update Password
                Values.UpdateIDPassword IDPasswordModel = null;
                string hash = ER_Sec.ComputeHash(password, "SHA512", null);
                IDPasswordModel = addHelp.UPDATE_ENTRY_Identities_Password(_Connect, new Values.UpdateIDPassword
                {
                    I_ID_PASSWORD_ID = TempDataTable.Rows[0].Field <long?>("ID_PASSWORD_ID"),
                    I_OBJECT_TYPE    = "Password",
                    I_RENDITION      = TempDataTable.Rows[0].Field <long?>("RENDITION"),
                    I_PASSWORD       = er_sec.EncryptStringToBytes_Aes(hash, er_sec.GetCryptPairforID(_Connect, TempDataTable.Rows[0].Field <long?>("IDENTITIES_ID"), new ER_CRYPT_PAIR()))
                });
            }
        }
Esempio n. 26
0
        public List <CommandResult> ADD_SCAFFOLD_FLOW(IConnectToDB _Connect, string Name, string ScaffoldType, List <ColumnStructure> ColumnsList)
        {
            Tools.Box er_tools = new Tools.Box();

            List <CommandResult> HoldResult = new List <CommandResult>();
            ER_Generate          gen        = new ER_Generate();
            string newTableName             = er_tools.MaxNameLength(Name, (128 - 16));

            string Actions_Table    = newTableName + "_Flo_Acts";
            string Identities_Table = newTableName + "_Flo_Iden";
            string Conditions_Table = newTableName + "_Flo_Cond";
            string if_table         = newTableName + "_Flo_If";
            string then_table       = newTableName + "_Flo_Then";

            HoldResult.Add(new CommandResult {
                _Response = "--Start FLOW Scaffold " + Name + "", _Successful = true
            });
            List <string> ColumnsList2 = new List <string>();

            ColumnsList2.Add(Name + "_ID");
            HoldResult.AddRange(ER_DDL._ADD_TABLE(_Connect, Name, ScaffoldType));
            HoldResult.AddRange(ER_DDL._ADD_COLUMNS(_Connect, Name, ColumnsList));
            HoldResult.AddRange(ER_DDL._ADD_KEY_UNIQUE(_Connect, Name + "_ID", Name, ColumnsList2));
            HoldResult.AddRange(gen.ADD_PROCEDURE_INSERT(_Connect, Name, ""));
            HoldResult.AddRange(gen.ADD_PROCEDURE_UPDATE(_Connect, Name, ""));
            HoldResult.AddRange(gen.ADD_PROCEDURE_DELETE(_Connect, Name, ""));
            HoldResult.Add(new CommandResult {
                _Response = "--EndScaffold " + Name + "", _Successful = true
            });

            return(HoldResult);
        }
Esempio n. 27
0
        //TOLEARN: This is important and has to be refactored for new system.
        public DataTable FindIDStatuses(IConnectToDB _Connect, long?identities_id)
        {
            ER_Query er_query = new ER_Query();

            ER_Query.Parameter_Run SQlin = new ER_Query.Parameter_Run();

            SQlin._dbParameters = new List <DBParameters>
            {
                new DBParameters {
                    ParamName = "IDENTITIES_ID", MSSqlParamDataType = SqlDbType.BigInt, ParamValue = identities_id
                }
            };

            SQlin.sqlIn = "Select distinct e.FORMS_ID, a.DT_CREATED 'Date_Submitted', a.DT_CREATED 'Date_Updated', a.IDENTITIES_ID, a.FORMS_DAT_OPT_ID, a.applications_id, d.application_name, a.PROPERTY_VALUE, a.VALUE from " + _Connect.Schema + ".FORMS_DAT_OPT a " +
                          "inner join CSA.Object_Sets b ON " +
                          "(a.OBJECT_SETS_ID = b.OBJECT_SETS_ID and a.Identities_id = @IDENTITIES_ID) " +
                          "inner join  CSA.[OBJ_PROP_SETS] c on (b.OBJECT_SETS_ID = c.OBJECT_SETS_ID) " +
                          "inner join CSA.[APPLICATIONS] d on (d.APPLICATIONS_ID = a.APPLICATIONS_ID) " +
                          "inner join CSA.FORMS e on (e.FORMS_ID = a.FORMS_ID) " +
                          "where c.PROPERTY_NAME in ('Status Check', 'Status Type', 'Status Message') " +
                          "and a.RENDITION in (Select MAX(RENDITION) from  CSA.VW__forms_dat_opt fdo2 where fdo2.FORMS_ID = a.FORMS_ID) " +
                          "ORDER BY a.FORMS_DAT_OPT_ID desc ";

            DataTable Result_DT = er_query.RUN_PARAMETER_QUERY(_Connect, SQlin);

            return(Result_DT);
        }
Esempio n. 28
0
        public string EP_SAVE_FILE(IConnectToDB _Connect, string serverpath)
        {
            //C:\Users\Eminent\Documents\Projects\perception\CMS\CMS\CMS\Files\_originals\Koala.jpg
            //string strPath = HttpContext.Current.Server.MapPath("/Files/_originals/Koala.jpg");
            string strPath     = serverpath;
            string ContentType = new FileInfo(strPath).Extension;
            string ContentSize = new FileInfo(strPath).Length.ToString();
            string FileName    = new FileInfo(strPath).Name;

            FileStream fs = new FileStream(strPath, FileMode.Open, FileAccess.Read);

            byte[] longRaw = new byte[fs.Length];
            fs.Read(longRaw, 0, longRaw.Length);
            fs.Close();

            add addHelp = new add();

            //OracleBinary OraclebinaryFile = new OracleBinary(longRaw);

            return("File Added" + addHelp.ADD_ENTRY_FILE(_Connect, new Values.AddFile
            {
                I_FILE_NAME = FileName,
                I_CONTENT_TYPE = ContentType,
                I_FILE_SIZE = longRaw.Length,
                I_FILE_DATA = longRaw
            }));
        }
Esempio n. 29
0
        public long?GetProfileId(IConnectToDB _Connect, string uuid)
        {
            _DynamicOutputProcedures DynamicOutput        = new _DynamicOutputProcedures();
            List <DynamicModels.RootReportFilter> Filters = new List <DynamicModels.RootReportFilter>();
            long?value = 0;

            Filters.Add(new DynamicModels.RootReportFilter {
                FilterName = "PROFILES_UUID_", DBType = SqlDbType.VarChar, ParamSize = -1, ParamValue = uuid
            });

            DataTable TempDataTable = DynamicOutput.DynoProcSearch(_Connect, "Custom Query", "SP_S_VW__PROFILES_SEARCH",
                                                                   new DataTableDotNetModelMetaData {
                columns = "PROFILES_ID", length = -1, order = "1 asc", start = 0, verify = "T"
            },
                                                                   Filters);

            DataColumnCollection _dccColumnID = TempDataTable.Columns;

            if (_dccColumnID.Contains("PROFILES_ID") && TempDataTable.Rows.Count > 0)
            {
                value = TempDataTable.Rows[0].Field <long?>("PROFILES_ID");
            }

            return(value);
        }
Esempio n. 30
0
        public List <CommandResult> REMOVE_SCAFFOLD(IConnectToDB _Connect, string Name, bool PreserveTable, bool PreserveProcedures)
        {
            List <CommandResult> results = new List <CommandResult>();
            CommandResult        _result = new CommandResult();
            ER_DDL ddl = new ER_DDL();

            results.Add(new CommandResult {
                _Response = "--Start Remove Scaffold " + Name + "", _Successful = true
            });

            if (!PreserveProcedures)
            {
                results.AddRange(ddl.DROP_PROCEDURE(_Connect, "SP_I_" + Name + ""));
                results.AddRange(ddl.DROP_PROCEDURE(_Connect, "SP_U_" + Name));
                results.AddRange(ddl.DROP_PROCEDURE(_Connect, "SP_D_" + Name));
                results.AddRange(ddl.DROP_PROCEDURE(_Connect, Name + "O_"));
                results.AddRange(ddl.DROP_PROCEDURE(_Connect, "SP_S_" + Name + "_SEARCH"));
                //results.AddRange(DROP_PROCEDURE(_Connect, Name + "_SEARCH_COUNT"));
            }

            if (!PreserveTable)
            {
                results.AddRange(ddl.DROP_TABLE(_Connect, Name));
            }


            results.Add(new CommandResult {
                _Response = "--End Remove Scaffold " + Name + "", _Successful = true
            });

            return(results);
        }
Esempio n. 31
0
 internal RiskActions(IConnectToDB connection)
 {
     this.connection = connection;
 }
Esempio n. 32
0
 internal UserActions(IConnectToDB connection)
 {
     this.connection = connection;
 }