Beispiel #1
0
        public i9Message Login(i9Message RequestMessage)
        {
            i9Message response = new i9Message();

            LoginMessage oLoginMessage = (LoginMessage)i9Message.XMLDeserializeMessage(typeof(LoginMessage), RequestMessage.MsgBody);
            SQLAccess    da            = new SQLAccess();

            string    SQLLogin = "******" + SQLUtility.SQLString(oLoginMessage.UserName) + " and Password = "******"i9SysPersonnel");

            if (dt.Rows.Count <= 0)
            {
                //Just send back an empty table

                return(response);
            }

            string i9SysPersonnelID = dt.Rows[0]["i9SysPersonnelID"].ToString();

            //Give an activision code to the login user
            string UpdateSql = "UPDATE i9SysPersonnel SET ActivationGuid = '" + Guid.NewGuid() + "' WHERE i9SysPersonnelID = " + SQLUtility.SQLString(i9SysPersonnelID);

            if (da.ExecuteSQL(UpdateSql) <= 0)
            {
                //Nothing was updated.
            }

            //SyncModuleManagerToDB();


            Dictionary <string, string> tableMapping = new Dictionary <string, string>()
            {
                { "Table", "i9SysPersonnel" },
                { "Table1", "xxSecurityGroupTask" },
                { "Table2", "xxSecurityGroupModule" },
            };

            string SQL = "SELECT * FROM i9SysPersonnel WHERE i9SysPersonnelID = @i9SysPersonnelID";

            SQL = SQL + Environment.NewLine + @"
                    SELECT sgt.TaskName, sp.BadgeNumber
                    FROM i9SecurityGroup sg
                            inner join i9SecurityGroupTask sgt
                            on sgt.SecurityGroupName = sg.SecurityGroupName	
                            inner join i9SecurityGroupPersonnel sgp 
                            on sgp.i9SecurityGroupID = sg.i9SecurityGroupID
                            inner join i9SysPersonnel sp
                            on sp.i9SysPersonnelID = sgp.i9SysPersonnelID
                    WHERE sp.i9SysPersonnelID = @i9SysPersonnelID
                    Group by TaskName, BadgeNumber                        
                    order by BadgeNumber, TaskName 
                    ";

            SQL = SQL + Environment.NewLine + @"
                    SELECT sgm.ModuleName, sp.BadgeNumber
                    FROM i9SecurityGroup sg
                            inner join i9SecurityGroupModule sgm
                            on sgm.SecurityGroupName = sg.SecurityGroupName	
                            inner join i9SecurityGroupPersonnel sgp 
                            on sgp.i9SecurityGroupID = sg.i9SecurityGroupID
                            inner join i9SysPersonnel sp
                            on sp.i9SysPersonnelID = sgp.i9SysPersonnelID
                    WHERE sp.i9SysPersonnelID = @i9SysPersonnelID
                    Group by ModuleName, BadgeNumber                        
                    order by BadgeNumber, ModuleName     
                    ";

            SQL = SQL.Replace("@i9SysPersonnelID", SQLUtility.SQLString(i9SysPersonnelID));

            response.MsgBodyDataSet      = response.MsgBodyDataSet = da.GetDataSet(SQL, tableMapping);
            response.ErrorStatus.IsError = false;


            return(response);
        }