/// <summary>
        /// User Exists in Chat Table or no. DLL Member.
        /// </summary>
        /// <param name="inputModel" cref="SocialCommunicationModels.ChatInputAndOutputModels.InputModel.addFriend">Chat Common Input Model.</param>
        /// <returns cref="CommonLibary.CommonModels.ResponseModel">Common Response Model.</returns>
        public ResponseModel UserExistsOrNotInFrndsTable(InputModel inputModel)
        {
            ResponseModel responseModel;

            SqlCommand command = SqlServerCommon.GetSpCommandByConnectToDb(SqlServerCommon.SqlServerDBs.DbAdmin, "usp_UserExistsOrNotInFrndsTable");

            command.AddParameter("@UserID", SqlDbType.Int, inputModel.addFriend.UserId.ToString());

            command.AddParameter("@AddingUserId", SqlDbType.Int, inputModel.addFriend.AddingFriendUserId.ToString());

            command.AddParameter("@Exists", SqlDbType.Bit, false.ToString(), ParameterDirection.Output);

            command.AddCommonInputParams();

            command.ExecuteNonQuery();

            responseModel = new ResponseModel();
            responseModel.ResponseData = command.GetOutputParam("@Exists", false);

            command.GetCommonOutputParams(responseModel);

            command.Connection.Close();

            return(responseModel);
        }
        /// <summary>
        /// Get Chat user Application Details DLL Method.
        /// </summary>
        /// <param name="inputModel" cref="InputModel.chatRegisterUserModel">Chat Common input Model.</param>
        /// <returns cref="OutputModel.userApplicationDetailsModel">Chat Common Output Model.</returns>
        /// <seealso cref="OutputModel.responseModel"/>
        public OutputModel GetChatUserApplicationDetails(InputModel inputModel)
        {
            OutputModel outputModel;

            SqlCommand command = SqlServerCommon.GetSpCommandByConnectToDb(SqlServerCommon.SqlServerDBs.DbAdmin, "usp_ChatUsersApplicationDetails_Get");

            command.AddParameter("@UserID", SqlDbType.Int, inputModel.chatRegisterUserModel.UserId.ToString());

            command.AddCommonInputParams();

            using (IDataReader reader = command.ExecuteReader())
            {
                outputModel = new OutputModel();

                if (reader.Read())
                {
                    outputModel.userApplicationDetailsModel = new UserApplicationDetailsModel()
                    {
                        UserName = reader.GetDbValue("UserName", string.Empty)
                    };
                }
            }

            outputModel.responseModel = new ResponseModel();
            command.GetCommonOutputParams(outputModel.responseModel);

            command.ConnectionDispose();

            return(outputModel);
        }
Example #3
0
        public AdminKeysModels GetAdminKey(AdminKeyIds adminKeyIds)
        {
            AdminKeysModels adminKeysModels = null;

            SqlCommand command = SqlServerCommon.GetSpCommandByConnectToDb(SqlServerCommon.SqlServerDBs.DbAdmin, "usp_AdminKeys_Get");

            command.AddParameter("@KeyEnumID", SqlDbType.TinyInt, ((int)adminKeyIds).ToString());

            command.AddCommonInputParams();

            using (IDataReader reader = command.ExecuteReader())
            {
                adminKeysModels = new AdminKeysModels();

                if (reader.Read())
                {
                    adminKeysModels.Key            = reader.GetDbStriing("KeyValue");
                    adminKeysModels.KeyName        = reader.GetDbStriing("KeyName");
                    adminKeysModels.KeyDescription = reader.GetDbStriing("KeyDescription");
                    adminKeysModels.KeyId          = reader.GetDbTinyInt("KeyEnumId");
                }
                else
                {
                    command.GetCommonOutputParams(adminKeysModels.responseModel);
                }
            }
            command.Connection.Close();

            return(adminKeysModels);
        }
Example #4
0
        /// <summary>
        /// Chat User Registration Member with Db(Data Base) Call.
        /// </summary>
        /// <param name="inputModel" cref="SocialCommunicationModels.ChatInputAndOutputModels.InputModel.chatRegisterUserModel">Chat Common Input Model</param>
        /// <returns cref="SocialCommunicationModels.ChatInputAndOutputModels.OutputModel.ChatRegisterUserOutput">Chat Common Output Model. With User Id and User Name.</returns>
        /// <seealso cref="SocialCommunicationModels.ChatInputAndOutputModels.InputModel.chatRegisterUserModel"/>
        /// <seealso cref="SocialCommunicationModels.ChatInputAndOutputModels.OutputModel.ChatRegisterUserOutput"/>
        public OutputModel UserRegistration(InputModel inputModel)
        {
            OutputModel outputModel = null;

            SqlCommand command = SqlServerCommon.GetSpCommandByConnectToDb(SqlServerCommon.SqlServerDBs.DbAdmin, "usp_ChatUserRegister_insert_Get");

            command.AddParameter("@UserName", SqlDbType.VarChar, inputModel.chatRegisterUserModel.UserName, 50);

            command.AddParameter("@UserID", SqlDbType.Int, null, ParameterDirection.Output);

            command.AddCommonInputParams();

            command.ExecuteNonQuery();

            outputModel = new OutputModel();
            outputModel.ChatRegisterUserOutput = new ChatRegisterUserModel()
            {
                UserId   = command.GetOutputParam("@UserID", 0),
                UserName = command.GetOutputParam("@UserName", string.Empty)
            };

            outputModel.responseModel = new ResponseModel();
            command.GetCommonOutputParams(outputModel.responseModel);

            command.Connection.Close();

            return(outputModel);
        }
        /// <summary>
        /// Get Chat Registered User List Golbal Chat Users List DLL.
        /// </summary>
        /// <param name="inputModel" cref="SocialCommunicationModels.ChatInputAndOutputModels.InputModel.chatRegisterUserModel">Chat Common Input Model.</param>
        /// <returns cref="SocialCommunicationModels.ChatInputAndOutputModels.OutputModel.ChatRegisteredUsers">Chat Common output Model.</returns>
        /// <seealso cref="SocialCommunicationModels.ChatInputAndOutputModels.InputModel.chatRegisterUserModel"/>
        /// <seealso cref="SocialCommunicationModels.ChatInputAndOutputModels.OutputModel.ChatRegisteredUsers"/>
        public OutputModel ChatRegisteredUsersGet(InputModel inputModel)
        {
            OutputModel           outputModel = null;
            ChatRegisterUserModel ChatUser;

            SqlCommand command = SqlServerCommon.GetSpCommandByConnectToDb(SqlServerCommon.SqlServerDBs.DbAdmin, "usp_ChatRegisterUsers_Get");

            command.AddParameter("@UserID", SqlDbType.Int, inputModel.chatRegisterUserModel.UserId.ToString());

            command.AddCommonInputParams();

            using (IDataReader reader = command.ExecuteReader())
            {
                outputModel = new OutputModel();
                outputModel.ChatRegisteredUsers = new List <ChatRegisterUserModel>();

                reader.AddCol("UserName");
                reader.AddCol("UserId");

                while (reader.Read())
                {
                    ChatUser = new ChatRegisterUserModel()
                    {
                        UserName = reader.GetDbColValue("UserName", string.Empty),
                        UserId   = reader.GetDbColValue("UserId", -1),
                    };
                    outputModel.ChatRegisteredUsers.Add(ChatUser);
                }
            }

            if (outputModel.ChatRegisteredUsers.Count == 0)
            {
                outputModel.responseModel = new ResponseModel();
                command.GetCommonOutputParams(outputModel.responseModel);
            }

            command.ConnectionDispose();

            return(outputModel);
        }
        /// <summary>
        /// Chat User Without Friends of Particular User DLL Member.
        /// </summary>
        /// <param name="inputModel" cref="SocialCommunicationModels.ChatInputAndOutputModels.InputModel.chatRegisterUserModel">Chat Common Input Model.</param>
        /// <returns cref="SocialCommunicationModels.ChatInputAndOutputModels.OutputModel.ChatRegisteredUsers">Chat Common Output Model.</returns>
        /// <seealso cref="SocialCommunicationModels.ChatInputAndOutputModels.InputModel.chatRegisterUserModel"/>
        /// <seealso cref="SocialCommunicationModels.ChatInputAndOutputModels.OutputModel.ChatRegisteredUsers"/>
        public OutputModel ChatUsersWithoutFriendsGet(InputModel inputModel)
        {
            OutputModel           outputModel;
            ChatRegisterUserModel Frined;

            SqlCommand command = SqlServerCommon.GetSpCommandByConnectToDb(SqlServerCommon.SqlServerDBs.DbAdmin, "usp_ChatRegisterUsersWithoutFriends_Get");

            command.AddParameter("@UserID", System.Data.SqlDbType.Int, inputModel.chatRegisterUserModel.UserId.ToString());

            command.AddCommonInputParams();

            using (IDataReader reader = command.ExecuteReader())
            {
                outputModel         = new OutputModel();
                outputModel.Friends = new List <ChatRegisterUserModel>();

                reader.AddCol("UserId");
                reader.AddCol("UserName");

                while (reader.Read())
                {
                    Frined = new ChatRegisterUserModel();

                    Frined.UserId   = reader.GetDbColValue("UserId", 0);
                    Frined.UserName = reader.GetDbColValue("UserName", string.Empty);

                    outputModel.Friends.Add(Frined);
                }
            }

            if (outputModel?.Friends?.Count == 0)
            {
                outputModel.responseModel = new ResponseModel();
                command.GetCommonOutputParams(outputModel.responseModel);
            }

            command.ConnectionDispose();

            return(outputModel);
        }
        /// <summary>
        /// Get users Friends Colunm Data. DLL Memnber.
        /// </summary>
        /// <param name="inputModel" cref="InputModel">Chat Common input Model.</param>
        /// <returns cref="ResponseModel">Common Response Model.</returns>
        public ResponseModel GetUserFriendsColunmData(InputModel inputModel)
        {
            ResponseModel response;

            SqlCommand command = SqlServerCommon.GetSpCommandByConnectToDb(SqlServerCommon.SqlServerDBs.DbAdmin, "usp_GetUserFriendsColunmData");

            command.AddParameter("@UserID", SqlDbType.Int, inputModel.addFriend.UserId.ToString());

            command.AddParameter("@UserFrinedsColData", SqlDbType.VarChar, null, 2048, ParameterDirection.Output);

            command.AddCommonInputParams();

            command.ExecuteNonQuery();

            response = new ResponseModel();
            response.ResponseData = command.GetOutputParam("@UserFrinedsColData", string.Empty);

            command.GetCommonOutputParams(response);

            command.Connection.Close();

            return(response);
        }