예제 #1
0
        /// <summary>
        /// Gets the Email Content Object
        /// </summary>
        /// <param name="UserID">The integer object</param>
        /// <param name="RequestTransactionID">The integer object</param>
        /// <param name="RequestTemplateID">The integer object</param>
        /// <returns>list of Email Object object</returns>
        public EmailObject GetEmailContent(Int64 UserID, int RequestTransactionID, Int64 RequestTemplateID)
        {
            Logging.LogDebugMessage("Method: GetEmailContent, MethodType: Get, Layer: RequestTransactionDAL, Parameters: : UserID = " + UserID.ToString() + ",RequestTransactionID = " + RequestTransactionID.ToString() + ",RequestTemplateID = " + RequestTemplateID.ToString());
            var         dataSet     = new DataSet();
            EmailObject emailObject = new EmailObject();

            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.connectionString);
                    command.CommandText = "USP_GetEmailContent";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UserID", Value = UserID
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestTransactionID", Value = RequestTransactionID
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestTemplateID", Value = RequestTemplateID
                    });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            emailObject = EntityCollectionHelper.ConvertTo <EmailObject>(dataSet.Tables[0]).FirstOrDefault();
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: GetEmailContent, Layer: RequestTransactionDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: GetEmailContent, Layer: RequestTransactionDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(emailObject);
        }
예제 #2
0
        /// <summary>Insert The Role and User.</summary>
        /// <param name="RoleList">The InserRoleUser Object.</param>
        /// <param name="CreatedByUserID">The Integer Object.</param>
        /// <returns>The Boolean Value.</returns>
        public bool UserRoleInsertBulk(List <InserRoleUser> RoleList, int CreatedByUserID)
        {
            Logging.LogDebugMessage("Method: UserRoleInsertBulk ,MethodType: Post, Layer: RolesDAL, Parameters: RoleList = " + JsonConvert.SerializeObject(RoleList));
            var       checkInsertValue = false;
            DataSet   dataSet          = new DataSet();
            DataTable dataTable        = new DataTable();

            dataTable = EntityCollectionHelper.ConvertTo <InserRoleUser>(RoleList);

            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.connectionString);
                    command.CommandText = "USP_UserRoleInsertBulk";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@CreatedByUserID", Value = CreatedByUserID
                    });
                    SqlParameter structuredParam = new SqlParameter("@UserRoleTable", SqlDbType.Structured);
                    structuredParam.Value = dataTable;
                    command.Parameters.Add(structuredParam);
                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            checkInsertValue = true;
                        }
                        else
                        {
                            checkInsertValue = false;
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: UserRoleInsertBulk, Layer: RolesDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: UserRoleInsertBulk, Layer: RolesDAL, Stack Trace: " + ex.ToString());
                throw;
            }
            return(checkInsertValue);
        }
예제 #3
0
        /// <summary>Authenticates the specified user.</summary>
        /// <param name="user">The user object.</param>
        /// <returns>Object of User.</returns>
        public Users Authenticate(Users user)
        {
            Logging.LogDebugMessage("Method: Authenticate, MethodType: Post, Layer: UserDAL, Parameters: user = "******"USP_UserAuthenticate";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@EmailAddress", Value = user.EmailAddress
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@Password", Value = user.Password
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@IsAuthenticated", Value = 1
                    });
                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            users = EntityCollectionHelper.ConvertTo <Users>(dataSet.Tables[0]).FirstOrDefault();
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: Authenticate, Layer: UserDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: Authenticate, Layer: UserDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(users);
        }
예제 #4
0
        /// <summary> Get Lookup Details and Categories by comma seperated Lookup Names </summary>
        /// <param name="LookupNamesString">String Object</param>
        /// <returns>The DesignerLookupsWithCategories Object</returns>
        public DesignerLookupsWithCategories GetDesignerLookupsWithCategories(string LookupNamesString)
        {
            Logging.LogDebugMessage("Method: GetDesignerLookupsWithCategories, MethodType: Get, Layer: LookupsDAL, Parameters: LookupNamesString = " + LookupNamesString);
            var dataSet = new DataSet();
            DesignerLookupsWithCategories      designerLookupsWithCategories = new DesignerLookupsWithCategories();
            List <LookupDetailsWithLookupName> lookupDetails      = new List <LookupDetailsWithLookupName>();
            List <DesignerCategory>            designerCategories = new List <DesignerCategory>();

            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.ConnectionString);
                    command.CommandText = "USP_GetDesignerLookupsWithCategories";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupNames", Value = LookupNamesString
                    });
                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            lookupDetails = EntityCollectionHelper.ConvertTo <LookupDetailsWithLookupName>(dataSet.Tables[0]).ToList();
                        }
                        if (dataSet != null && dataSet.Tables.Count > 1)
                        {
                            designerCategories = EntityCollectionHelper.ConvertTo <DesignerCategory>(dataSet.Tables[1]).ToList();
                        }
                        designerLookupsWithCategories.lookupDetailsWithLookupNames = lookupDetails;
                        designerLookupsWithCategories.designerCategories           = designerCategories;
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: GetDesignerLookupsWithCategories, Layer: LookupsDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: GetDesignerLookupsWithCategories, Layer: LookupsDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(designerLookupsWithCategories);
        }
예제 #5
0
        /// <summary>Gets the List of all user roles by roleId.</summary>
        /// <param name="userid">The Int64 Object.</param>
        /// <returns>List of UserRoles.</returns>
        public List <UserRoles> GetAllUserRoles(Int64 roleId)
        {
            Logging.LogDebugMessage("Method: GetAllUserRoles, MethodType: Get, Layer: SecurityDAL, Parameters: roleId = " + roleId.ToString());
            // int userid = 2;
            var dataSet   = new DataSet();
            var userRoles = new List <UserRoles>();

            try
            {
                using (var command = new SqlCommand())
                {
                    Int64?userid = null;
                    command.Connection  = new SqlConnection(this.connectionString);
                    command.CommandText = "USP_UserRoleSelect";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UserID", Value = userid
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RoleID", Value = roleId
                    });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            userRoles = EntityCollectionHelper.ConvertTo <UserRoles>(dataSet.Tables[0]).ToList();
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: GetAllUserRoles, Layer: SecurityDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: GetAllUserRoles, Layer: SecurityDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(userRoles);
        }
예제 #6
0
        /// <summary>Delete DeleteRequestTemplate </summary>
        /// <param name="RequestTemplateIds">The Integer object</param>
        /// <param name="AdminUserID">THe long object</param>
        /// <returns>boolean value</returns>
        public bool DeleteRequestTemplate(DeletedRequestTemplateWithAdminUser deletedRequestTemplateWithAdminUser)
        {
            var dataset  = new DataSet();
            var response = false;

            Logging.LogDebugMessage("Method: DeleteRequestTemplate, MethodType: Get, Layer: RequestTemplateDAL, Parameters:  deletedRequestTemplateWithAdminUser = "******"USP_DeleteRequestTemplate";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestTemplateIds", Value = deletedRequestTemplateWithAdminUser.RequestTemplateIds
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@AdminUserID", Value = deletedRequestTemplateWithAdminUser.AdminUserID
                    });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataset);
                        if (dataset != null)
                        {
                            response = true;
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: DeleteRequestTemplate, Layer: RequestTemplateDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: DeleteRequestTemplate, Layer: RequestTemplateDAL, Stack Trace: " + ex.ToString());
                throw;
            }
            return(response);
        }
예제 #7
0
        /// <summary>Get the role exist by role name.</summary>
        /// <param name="roleName">The String Object.</param>
        /// <returns>Roles Object.</returns>
        public bool GetRoleExistsByRoleName(string roleName)
        {
            Logging.LogDebugMessage("Method: GetRoleExistsByRoleName, MethodType: Get, Layer: RolesDAL, Parameters: roleName = " + roleName);
            var checkroleexist = false;
            var dataset        = new DataSet();
            var dataTable      = new DataTable();

            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.connectionString);
                    command.CommandText = "USP_GetRoleExistsByRoleName";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RoleName", Value = roleName
                    });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataset);
                        if (dataset != null)
                        {
                            checkroleexist = (Boolean)dataset.Tables[0].Rows[0].ItemArray[0];
                            dataTable      = dataset.Tables[0];
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: GetRoleExistsByRoleName, Layer: RolesDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: GetRoleExistsByRoleName, Layer: RolesDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(checkroleexist);
        }
예제 #8
0
        /// <summary>Gets the list of roles.</summary>
        /// <returns>List of AdminRole.</returns>
        public List <SecurityRole> GetRoles()
        {
            Logging.LogDebugMessage("Method: GetRoles, MethodType: Get, Layer: SecurityDAL, Parameters: No Input Parameters");
            //int roleId = 2;
            var dataSet        = new DataSet();
            var adminRolesList = new List <SecurityRole>();

            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.connectionString);
                    command.CommandText = "USP_RoleSelect";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RoleID"
                    });
                    // command.Parameters.Add(new SqlParameter() { ParameterName = "@UserID", Value = 2 });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            adminRolesList = EntityCollectionHelper.ConvertTo <SecurityRole>(dataSet.Tables[0]).ToList();
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: GetRoles, Layer: SecurityDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: GetRoles, Layer: SecurityDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(adminRolesList);
        }
예제 #9
0
        /// <summary>Gets the list of all active roles.</summary>
        /// <returns>List of all active roles.</returns>
        public List <AdminRoles> GetAllActiveRoles()
        {
            Logging.LogDebugMessage("Method: GetAllActiveRoles, MethodType: Get, Layer: RolesDAL, Parameters: No Input Parameters");
            var dataSet        = new DataSet();
            var allActiveRoles = new List <AdminRoles>();

            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.connectionString);
                    command.CommandText = "USP_RoleSelect";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@ExcludeInactive", Value = 1
                    });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            allActiveRoles = EntityCollectionHelper.ConvertTo <AdminRoles>(dataSet.Tables[0]).ToList();
                            Logging.LogDebugMessage("Method: GetAllActiveRoles, MethodType: Get, Layer: RolesDAL, returnRolesList:" + JsonConvert.SerializeObject(allActiveRoles));
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: GetAllActiveRoles, Layer: RolesDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: GetAllActiveRoles, Layer: RolesDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(allActiveRoles);
        }
예제 #10
0
        /// <summary>Get the roles by name.</summary>
        /// <param name="roleName">The String Object.</param>
        /// <returns>Roles Object.</returns>
        public AdminRoles GetRolesByName(string roleName)
        {
            Logging.LogDebugMessage("Method: GetRolesByName, MethodType: Get, Layer: RolesDAL, Parameters: roleName = " + roleName);
            var        dataSet = new DataSet();
            AdminRoles roles   = new AdminRoles();

            try
            {
                using (SqlCommand command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.connectionString);
                    command.CommandText = "USP_RoleSelect";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RoleName", Value = roleName
                    });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            roles = EntityCollectionHelper.ConvertTo <AdminRoles>(dataSet.Tables[0]).FirstOrDefault();
                            Logging.LogDebugMessage("Method: GetRolesByName, MethodType: Get, Layer: RolesDAL, returnRolesList:" + JsonConvert.SerializeObject(roles));
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: GetRolesByName, Layer: RolesDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: GetRolesByName, Layer: RolesDAL, Stack Trace: " + ex.ToString());
                throw;
            }
            return(roles);
        }
예제 #11
0
        /// <summary>This method check Email exists or not</summary>
        /// <param name="usersEmail">The UsersEmail Object.</param>
        /// <returns>boolean Object.</returns>
        public bool CheckEmailExistsOrNot(UsersEmail usersEmail)
        {
            Logging.LogDebugMessage("Method: CheckEmailExistsOrNot, MethodType: Post, Layer: UserDAL, Parameters: UsersEmail = " + JsonConvert.SerializeObject(usersEmail));
            var  dataSet            = new DataSet();
            bool isEmailExistsOrNot = false;

            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.ConnectionString);
                    command.CommandText = "USP_CheckEmailExistsOrNot";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@Email", Value = usersEmail.EmailAddress
                    });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null)
                        {
                            isEmailExistsOrNot = Convert.ToBoolean(dataSet.Tables[0].Rows[0][0]);
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: CheckEmailExistsOrNot, Layer: UserDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: CheckEmailExistsOrNot, Layer: UserDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(isEmailExistsOrNot);
        }
예제 #12
0
        /// <summary> Get Loookup By LookupId </summary>
        /// <param name="LookupId">The Integer object</param>
        /// <returns>LookupObj object</returns>
        public LookupObj GetLookupById(int LookupId)
        {
            Logging.LogDebugMessage("Method: GetLookupById, MethodType: Get, Layer: LookupsDAL, Parameters: LookupId = " + LookupId.ToString());
            var       dataSet   = new DataSet();
            LookupObj lookupObj = new LookupObj();

            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.ConnectionString);
                    command.CommandText = "USP_GetLookupById";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupId", Value = LookupId
                    });
                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            lookupObj = EntityCollectionHelper.ConvertTo <LookupObj>(dataSet.Tables[0]).FirstOrDefault();
                            lookupObj.lookupDetails = EntityCollectionHelper.ConvertTo <LookupDetails>(dataSet.Tables[1]).ToList();
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: GetLookupById, Layer: LookupsDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: GetLookupById, Layer: LookupsDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(lookupObj);
        }
예제 #13
0
        /// <summary>
        /// Get User Requests list by UserId
        /// </summary>
        /// <param name="UserId">the long object</param>
        /// <returns>List of UserRequestTransactions Object</returns>
        public List <UserRequestTransactions> GetRequestsByUserId(long UserId)
        {
            Logging.LogDebugMessage("Method: GetRequestsByUserId, MethodType: Get, Layer: RequestTransactionDAL, Parameters: : UserId = " + UserId.ToString());
            var dataSet = new DataSet();
            List <UserRequestTransactions> UserRequests = new List <UserRequestTransactions>();

            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.connectionString);
                    command.CommandText = "USP_GetRequestsByUserId";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UserId", Value = UserId
                    });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            UserRequests = EntityCollectionHelper.ConvertTo <UserRequestTransactions>(dataSet.Tables[0]).ToList();
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: GetRequestsByUserId, Layer: RequestTransactionDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: GetRequestsByUserId, Layer: RequestTransactionDAL, Stack Trace: " + ex.ToString());
                throw;
            }
            return(UserRequests);
        }
예제 #14
0
        /// <summary>Gets the search user by name List.</summary>
        /// <param name="userName">The String Object.</param>
        /// <returns>User Object.</returns>
        public List <UsersByName> SearchUserByNameList(String userName)
        {
            Logging.LogDebugMessage("Method: SearchUserByNameList, MethodType: Get, Layer: UserDAL, Parameters: userName = "******"USP_SearchUserByNameList";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UserName", Value = userName
                    });
                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            user = EntityCollectionHelper.ConvertTo <UsersByName>(dataSet.Tables[0]).ToList();
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: SearchUserByNameList, Layer: UserDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: SearchUserByNameList, Layer: UserDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(user);
        }
예제 #15
0
        /// <summary>This method deletes the selected roles.</summary>
        /// <param name="deletedRolesWithAdminUser">The DeletedRolesWithAdminUser Object.</param>
        /// <returns>List of Roles Object.</returns>
        public List <AdminRoles> DeleteRoles(DeletedRolesWithAdminUser deletedRolesWithAdminUser)
        {
            Logging.LogDebugMessage("Method: DeleteUsers, MethodType: Post, Layer: RolesDAL, Parameters: DeletedRolesWithAdminUser = "******"USP_RoleDelete";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RoleIDs", Value = deletedRolesWithAdminUser.RoleIds
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@AdminUserID", Value = deletedRolesWithAdminUser.AdminUserId
                    });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: DeleteRoles, Layer: RolesDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: DeleteRoles, Layer: RolesDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(this.GetAllRoles());
        }
예제 #16
0
        /// <summary>Gets the RequestTemplate List.</summary>
        /// <returns>returns RequestTemplate Object.<returns>
        public List <RequestTemplate> GetAllRequestTemplate()
        {
            Logging.LogDebugMessage("Method: GetAllRequestTemplate, MethodType: Get, Layer: RequestTemplateDAL, Parameters: No Input Parameters");
            var dataSet          = new DataSet();
            var requesttemplates = new List <RequestTemplate>();

            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.ConnectionString);
                    command.CommandText = "USP_GetAllRequestTemplates";
                    command.CommandType = CommandType.StoredProcedure;

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            requesttemplates = EntityCollectionHelper.ConvertTo <RequestTemplate>(dataSet.Tables[0]).ToList();
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: GetAllRequestTemplate, Layer: RequestTemplateDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: GetAllRequestTemplate, Layer: RequestTemplateDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(requesttemplates);
        }
예제 #17
0
        /// <summary>Update User.</summary>
        /// <param name="user">The AdminUser Object.</param>
        /// <returns>AdminUser Object.</returns>
        public bool UpdateUser(Users user)
        {
            Logging.LogDebugMessage("Method: UpdateUser, MethodType: Post, Layer: UserDAL, Parameters: user = "******"USP_UserUpdate";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UserID", Value = user.UserId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@AccessFailedCount", Value = user.AccessFailedCount
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UserName", Value = user.UserName
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@Password", Value = user.Password
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@FirstName", Value = user.FirstName
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LastName", Value = user.LastName
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@EmailAddress", Value = user.EmailAddress
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@PhoneNumber", Value = user.PhoneNumber
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@IsEmailConfirmed", Value = user.IsEmailConfirmed
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UpdatedByUserID", Value = user.UserId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UserImage", Value = user.UserImage
                    });


                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null)
                        {
                            checkUpdateValue = true;
                            //Audits audit = new Audits
                            //{
                            //    MainPageName = "Users",
                            //    PageTabName = "Users",
                            //    ActionName = "Save",
                            //    UserID = user.UpdateUserId,
                            //    RecordID = user.UserId
                            //};
                            //AuditDAL auditobj = new AuditDAL();
                            //auditobj.SaveAuditInfo(audit);
                        }
                        else
                        {
                            checkUpdateValue = false;
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: UpdateUser, Layer: UserDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: UpdateUser, Layer: UserDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(checkUpdateValue);
        }
예제 #18
0
        /// <summary>Gets the list of all privileges.</summary>
        /// <returns>List of AdminModules.</returns>
        public List <CSTMModule> GetAllPrivileges()
        {
            Logging.LogDebugMessage("Method: GetAllPrivileges, MethodType: Get, Layer: SecurityDAL, Parameters: No Input Parameters");
            DataSet ds_result_modules   = new DataSet();
            DataSet ds_result_privilege = new DataSet();

            DataSet ds_result_page = new DataSet();

            var Modules        = new List <CSTMModule>();
            var Pages          = new List <CSTMpage>();
            var PagePrivileges = new List <CSTMPrivilege>();

            try
            {
                using (var command = new SqlCommand())
                {
                    try
                    {
                        command.Connection  = new SqlConnection(this.connectionString);
                        command.CommandText = "USP_ModuleSelect";
                        command.CommandType = CommandType.StoredProcedure;
                        using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                        {
                            adapter.Fill(ds_result_modules);
                            if (ds_result_modules != null && ds_result_modules.Tables.Count > 0)
                            {
                                Modules = EntityCollectionHelper.ConvertTo <CSTMModule>(ds_result_modules.Tables[0]).ToList();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logging.LogErrorMessage("Logging Error Message for GetAllPrivileges of Modules " + ex.Message);
                        throw ex;
                    }
                }
                using (var command = new SqlCommand())
                {
                    try
                    {
                        command.Connection  = new SqlConnection(this.connectionString);
                        command.CommandText = "USP_PageSelect";
                        command.CommandType = CommandType.StoredProcedure;
                        command.Parameters.Add(new SqlParameter()
                        {
                            ParameterName = "@PageID"
                        });
                        using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                        {
                            adapter.Fill(ds_result_page);
                            if (ds_result_page.Tables.Count > 0 && ds_result_page.Tables[0] != null)
                            {
                                Pages = EntityCollectionHelper.ConvertTo <CSTMpage>(ds_result_page.Tables[0]).ToList();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logging.LogErrorMessage("Logging Error Message for Get AllPrivileges of Pages " + ex.Message);
                        throw ex;
                    }
                }

                using (var command = new SqlCommand())
                {
                    try
                    {
                        command.Connection  = new SqlConnection(this.connectionString);
                        command.CommandText = "USP_PrivilegeSelect";
                        command.CommandType = CommandType.StoredProcedure;
                        using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                        {
                            adapter.Fill(ds_result_privilege);
                            if (ds_result_privilege.Tables.Count > 0 && ds_result_privilege.Tables[0] != null)
                            {
                                PagePrivileges = EntityCollectionHelper.ConvertTo <CSTMPrivilege>(ds_result_privilege.Tables[0]).ToList();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        Logging.LogErrorMessage("Logging Error Message for Get AllPrivileges for Privilege Select " + ex.Message);
                        throw ex;
                    }
                }

                foreach (CSTMModule mod in Modules)
                {
                    List <CSTMpage> ModPages = Pages.Where(p => p.ModuleId == mod.ModuleID).ToList();
                    foreach (CSTMpage pag in ModPages)
                    {
                        List <CSTMPrivilege> ModPagePrivileges = PagePrivileges.Where(p => p.PageId == pag.PageID).ToList();
                        if (ModPagePrivileges != null && ModPagePrivileges.Count > 0)
                        {
                            pag.Privileges = ModPagePrivileges;
                        }
                    }
                    if (ModPages != null && ModPages.Count > 0)
                    {
                        mod.Pages = ModPages;
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: GetAllPrivileges, Layer: SecurityDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: GetAllPrivileges, Layer: SecurityDAL, Stack Trace: " + ex.ToString());
                throw;
            }
            return(Modules);
        }
예제 #19
0
        /// <summary>
        /// Get My request details by TransactionId
        /// </summary>
        /// <param name="RequestTransactionId">the Integer object</param>
        /// <returns>MyRequestDetails Object</returns>
        public MyRequestDetails GetMyRequestDetailsByTransactionId(int RequestTransactionId)
        {
            Logging.LogDebugMessage("Method: GetMyRequestDetailsByTransactionId, MethodType: Get, Layer: RequestTransactionDAL, Parameters: : RequestTransactionId = " + RequestTransactionId.ToString());
            var dataSet = new DataSet();
            MyRequestDetails myRequestDetails = new MyRequestDetails();
            List <MyRequestDetailControls> myRequestDetailControlsList = new List <MyRequestDetailControls>();
            List <MyRequestDetailControls> ControlsList  = new List <MyRequestDetailControls>();
            List <RequestPhoto>            requestPhotos = new List <RequestPhoto>();

            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.connectionString);
                    command.CommandText = "USP_GetMyrequestDetailsByTransactionId";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestTransactionId", Value = RequestTransactionId
                    });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            myRequestDetails = EntityCollectionHelper.ConvertTo <MyRequestDetails>(dataSet.Tables[0]).FirstOrDefault();
                        }
                        if (dataSet != null && dataSet.Tables.Count > 1)
                        {
                            ControlsList = EntityCollectionHelper.ConvertTo <MyRequestDetailControls>(dataSet.Tables[1]).ToList();
                        }
                        if (dataSet != null && dataSet.Tables.Count > 2)
                        {
                            requestPhotos = EntityCollectionHelper.ConvertTo <RequestPhoto>(dataSet.Tables[2]).ToList();
                        }
                        myRequestDetails.requestPhotos = requestPhotos;


                        foreach (MyRequestDetailControls Control in ControlsList)
                        {
                            Control.Label = Control.Label.Split("(")[0];
                            if (myRequestDetailControlsList.Where(control => control.SeqNo == Control.SeqNo) == null ||
                                myRequestDetailControlsList.Where(control => control.SeqNo == Control.SeqNo).Count() == 0)
                            {
                                myRequestDetailControlsList.Add(Control);
                            }
                        }
                        foreach (MyRequestDetailControls Control in myRequestDetailControlsList)
                        {
                            if (ControlsList.Where(cntrl => cntrl.Type.ToLower() == appConstants.CheckBox && cntrl.SeqNo == Control.SeqNo).ToList() != null && ControlsList.Where(cntrl => cntrl.Type.ToLower() == appConstants.CheckBox && cntrl.SeqNo == Control.SeqNo).ToList().Count() > 0)
                            {
                                List <MyRequestDetailControlOptions> myRequestDetailControlOptions = ControlsList.Where(cntrl => cntrl.Type.ToLower() == appConstants.CheckBox && cntrl.SeqNo == Control.SeqNo).Select(controlOptions => new MyRequestDetailControlOptions()
                                {
                                    RequestTemplateSectionControlId = controlOptions.RequestTemplateSectionControlId,
                                    Value = controlOptions.Value != null && controlOptions.Value != "" && controlOptions.RequestTransactionDetailId != 0 ? true : false,
                                    Label = controlOptions.Value,
                                    Key   = Regex.Replace(controlOptions.Value.ToLower(), @"\s+", "")
                                }).ToList();
                                myRequestDetailControlOptions = myRequestDetailControlOptions.OrderBy(requestDetails => requestDetails.RequestTemplateSectionControlId).ToList();
                                Control.CheckBoxOptions       = myRequestDetailControlOptions;
                            }
                        }

                        myRequestDetails.myRequestDetailControls = myRequestDetailControlsList;
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: GetMyRequestDetailsByTransactionId, Layer: RequestTransactionDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: GetMyRequestDetailsByTransactionId, Layer: RequestTransactionDAL, Stack Trace: " + ex.ToString());
                throw;
            }
            return(myRequestDetails);
        }
예제 #20
0
        /// <summary> Saves New User </summary>
        /// <param name="user">Users Object.</param>
        /// <returns>Users Object.</returns>
        public Users userInsert(Users user)
        {
            var   ds  = new DataSet();
            Users res = new Users();

            Logging.LogDebugMessage("Method: userInsert, MethodType: Post, Layer: UserDAL, Parameters:  user = "******"USP_UserInsert";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@AccessFailedCount", Value = user.AccessFailedCount
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UserName", Value = user.UserName
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@Password", Value = user.Password
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@FirstName", Value = user.FirstName
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LastName", Value = user.LastName
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@EmailAddress", Value = user.EmailAddress
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@PhoneNumber", Value = user.PhoneNumber
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@IsEmailConfirmed", Value = user.IsEmailConfirmed
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@CreatedByUserID", Value = user.UserId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UserID", Value = user.UserId
                    });

                    // command.Parameters["@UserID"].Direction = ParameterDirection.Output;

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(ds);
                        if (ds != null && ds.Tables.Count > 0)
                        {
                            res = EntityCollectionHelper.ConvertTo <Users>(ds.Tables[0]).FirstOrDefault();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Logging Error Message for user Insert " + ex.Message);
                throw ex;
            }
            return(res);
        }
예제 #21
0
        /// <summary> Submit or track the Request </summary>
        /// <param name="requestTransaction">The object of type RequestTransaction</param>
        /// <returns> Integer object </returns>
        public int SubmitOrTrackRequest(RequestTransaction request)
        {
            int transactionID = 0;

            Logging.LogDebugMessage("Method: SubmitOrTrackRequest, MethodType: Post, Layer: RequestTransactionDAL, Parameters: request = " + JsonConvert.SerializeObject(request));
            var       ds           = new DataSet();
            DataTable dataTableOne = new DataTable();

            dataTableOne = EntityCollectionHelper.ConvertTo <RequestLocation>(request.requestLocation);
            DataTable dataTableTwo = new DataTable();

            dataTableTwo = EntityCollectionHelper.ConvertTo <RequestPhoto>(request.requestPhotos);
            DataTable dataTableThree = new DataTable();

            dataTableThree = EntityCollectionHelper.ConvertTo <RequestTransactionDetails>(request.requestTransactionDetails);
            DataTable dataTableFour = new DataTable();

            dataTableFour = EntityCollectionHelper.ConvertTo <RequestTransactionTrack>(request.requestTransactionTracks);
            DataTable dataTableFive = new DataTable();

            dataTableFive = EntityCollectionHelper.ConvertTo <RequestTransactionHistory>(request.requestTransactionHistory);
            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.connectionString);
                    command.CommandText = "USP_SumitOrTrackRequest";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestTransactionId", Value = request.RequestTransactionId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestTemplateId", Value = request.RequestTemplateId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestStatus", Value = request.RequestStatus
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UserId", Value = request.UserId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RowStatus", Value = request.RowStatus
                    });
                    SqlParameter structuredParamOne = new SqlParameter("@RequestLocation", SqlDbType.Structured);
                    structuredParamOne.Value = dataTableOne;
                    command.Parameters.Add(structuredParamOne);
                    SqlParameter structuredParamTwo = new SqlParameter("@RequestPhotos", SqlDbType.Structured);
                    structuredParamTwo.Value = dataTableTwo;
                    command.Parameters.Add(structuredParamTwo);
                    SqlParameter structuredParamthree = new SqlParameter("@RequestTransactionDetails", SqlDbType.Structured);
                    structuredParamthree.Value = dataTableThree;
                    command.Parameters.Add(structuredParamthree);
                    SqlParameter structuredParamFour = new SqlParameter("@RequestTransactionTrack", SqlDbType.Structured);
                    structuredParamFour.Value = dataTableFour;
                    command.Parameters.Add(structuredParamFour);
                    SqlParameter structuredParamFive = new SqlParameter("@RequestTransactionHistory", SqlDbType.Structured);
                    structuredParamFive.Value = dataTableFive;
                    command.Parameters.Add(structuredParamFive);

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(ds);
                        if (ds != null && ds.Tables.Count > 0)
                        {
                            transactionID = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: SubmitOrTrackRequest, Layer: RequestTransactionDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: SubmitOrTrackRequest, Layer: RequestTransactionDAL, Stack Trace: " + ex.ToString());
                throw;
            }
            return(transactionID);
        }
예제 #22
0
        /// <summary>
        /// Gets the similar requests list
        /// </summary>
        /// <param name="Latitude">The string object</param>
        /// <param name="Longitude">The string object</param>
        /// <param name="RequestTemplateId">The integer object</param>
        /// <returns>list of SimilarRequestTransactions object</returns>
        public List <SimilarRequestTransaction> GetSimilarRequests(string Latitude, string Longitude, int RequestTemplateID)
        {
            Logging.LogDebugMessage("Method: GetSimilarRequests, MethodType: Get, Layer: RequestTransactionDAL, Parameters: : Latitude = " + Latitude + ",Longitude = " + Longitude + ",RequestTemplateID = " + RequestTemplateID.ToString());
            var dataSet = new DataSet();
            List <SimilarRequestTransaction> SimilarRequests = new List <SimilarRequestTransaction>();

            List <RequestLocation>                      RequestLocationList                   = new List <RequestLocation>();
            List <RequestPhoto>                         RequestPhotosList                     = new List <RequestPhoto>();
            List <RequestTransactionDetails>            RequestTransactionDetailsList         = new List <RequestTransactionDetails>();
            List <RequestTransactionDetailsControls>    RequestTransactionDetailsControlsList = new List <RequestTransactionDetailsControls>();
            List <RequestTransactionDetailsControls>    ControlsList = new List <RequestTransactionDetailsControls>();
            List <RequestTransactionDetailsControlType> RequestTransactionDetailsControlTypeList = new List <RequestTransactionDetailsControlType>();

            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.connectionString);
                    command.CommandText = "USP_GetSimilarRequests";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@Latitude", Value = Latitude
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@Longitude", Value = Longitude
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestTemplateID", Value = RequestTemplateID
                    });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null && dataSet.Tables.Count > 0)
                        {
                            SimilarRequests = EntityCollectionHelper.ConvertTo <SimilarRequestTransaction>(dataSet.Tables[0]).ToList();
                        }
                        if (dataSet != null && dataSet.Tables.Count > 1)
                        {
                            RequestLocationList = EntityCollectionHelper.ConvertTo <RequestLocation>(dataSet.Tables[1]).ToList();
                        }
                        if (dataSet != null && dataSet.Tables.Count > 2)
                        {
                            RequestPhotosList = EntityCollectionHelper.ConvertTo <RequestPhoto>(dataSet.Tables[2]).ToList();
                        }
                        if (dataSet != null && dataSet.Tables.Count > 3)
                        {
                            RequestTransactionDetailsList = EntityCollectionHelper.ConvertTo <RequestTransactionDetails>(dataSet.Tables[3]).ToList();
                        }

                        if (dataSet != null && dataSet.Tables.Count > 4)
                        {
                            RequestTransactionDetailsControlsList = EntityCollectionHelper.ConvertTo <RequestTransactionDetailsControls>(dataSet.Tables[4]).ToList();
                        }
                        if (dataSet != null && dataSet.Tables.Count > 5)
                        {
                            RequestTransactionDetailsControlTypeList = EntityCollectionHelper.ConvertTo <RequestTransactionDetailsControlType>(dataSet.Tables[5]).ToList();
                            foreach (RequestTransactionDetailsControlType transactionDetailsControlType in RequestTransactionDetailsControlTypeList)
                            {
                                transactionDetailsControlType.ControlLabel = transactionDetailsControlType.ControlLabel.Split("(")[0];
                            }
                        }

                        foreach (RequestTransactionDetailsControls requestTransactionDetailsControl in RequestTransactionDetailsControlsList)
                        {
                            if (ControlsList.Where(control => control.RequestTransactionId == requestTransactionDetailsControl.RequestTransactionId && control.SeqNo == requestTransactionDetailsControl.SeqNo) == null ||
                                ControlsList.Where(control => control.RequestTransactionId == requestTransactionDetailsControl.RequestTransactionId && control.SeqNo == requestTransactionDetailsControl.SeqNo).Count() == 0)
                            {
                                requestTransactionDetailsControl.ControlLabel = requestTransactionDetailsControl.ControlLabel.Split("(")[0];
                                ControlsList.Add(requestTransactionDetailsControl);
                            }
                        }

                        foreach (RequestTransactionDetailsControls requestTransactionDetailsControl in ControlsList)
                        {
                            requestTransactionDetailsControl.CheckBoxOptions = RequestTransactionDetailsControlTypeList.Where(control => control.RequestTransactionId == requestTransactionDetailsControl.RequestTransactionId && control.SeqNo == requestTransactionDetailsControl.SeqNo).ToList();
                        }

                        if (SimilarRequests != null && SimilarRequests.Count > 0)
                        {
                            foreach (SimilarRequestTransaction similarRequest in SimilarRequests)
                            {
                                similarRequest.requestLocation           = RequestLocationList.Where(location => location.RequestTransactionId == similarRequest.RequestTransactionId).FirstOrDefault();
                                similarRequest.requestPhotos             = RequestPhotosList.Where(photo => photo.RequestTransactionId == similarRequest.RequestTransactionId).ToList();
                                similarRequest.requestTransactionDetails = RequestTransactionDetailsList.Where(transactionDetails => transactionDetails.RequestTransactionId == similarRequest.RequestTransactionId).ToList();
                                similarRequest.Controls = ControlsList.Where(control => control.RequestTransactionId == similarRequest.RequestTransactionId).ToList();
                            }
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: GetSimilarRequests, Layer: RequestTransactionDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: GetSimilarRequests, Layer: RequestTransactionDAL, Stack Trace: " + ex.ToString());
                throw;
            }

            return(SimilarRequests);
        }
예제 #23
0
        /// <summary> Get RequestTemplate By RequestTemplateById </summary>
        /// <param name="RequestTemplateId">The Integer object</param>
        /// <returns>requestTemplateObj object</returns>
        public RequestTemplateDetail GetRequestTemplateById(int RequestTemplateId)
        {
            Logging.LogDebugMessage("Method: GetRequestTemplateById, MethodType: Get, Layer: RequestTemplateDAL, Parameters: RequestTemplateId = " + RequestTemplateId.ToString());
            RequestTemplateDetail                 requestFormTemplate     = new RequestTemplateDetail();
            List <RequestFormTemplateDetails>     TemplateDetails         = new List <RequestFormTemplateDetails>();
            List <RequestTemplateSectionControls> TemplateSectionControls = new List <RequestTemplateSectionControls>();
            List <TemplateSectionControls>        TemplateControls        = new List <TemplateSectionControls>();

            try
            {
                using (var command = new SqlCommand())
                {
                    command.CommandText = "USP_GetRequestTemplateByTemplateId";
                    command.Connection  = new SqlConnection(this.ConnectionString);
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestTemplateId", Value = RequestTemplateId
                    });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        DataSet ds = new DataSet();
                        adapter.Fill(ds);
                        if (ds != null && ds.Tables.Count > 0)
                        {
                            requestFormTemplate = EntityCollectionHelper.ConvertTo <RequestTemplateDetail>(ds.Tables[0]).FirstOrDefault();
                        }
                        if (ds != null && ds.Tables.Count > 1)
                        {
                            TemplateDetails = EntityCollectionHelper.ConvertTo <RequestFormTemplateDetails>(ds.Tables[1]).ToList();
                        }
                        if (ds != null && ds.Tables.Count > 2)
                        {
                            TemplateSectionControls = EntityCollectionHelper.ConvertTo <RequestTemplateSectionControls>(ds.Tables[2]).ToList();
                        }
                        List <int> controlGroupList = (from obj in TemplateSectionControls select obj.SeqNo).Distinct().ToList();
                        int        incrCount        = 1;
                        for (int count = 0; count < controlGroupList.Count; count++)
                        {
                            List <RequestTemplateSectionControls> GroupSectionControls = TemplateSectionControls.Where(sectionControl => sectionControl.SeqNo == controlGroupList[count]).ToList();
                            if (GroupSectionControls.Count == 1)
                            {
                                TemplateSectionControls templateControl = new TemplateSectionControls();
                                templateControl.RequestTemplateSectionId = GroupSectionControls[0].RequestTemplateSectionId;
                                templateControl.Type        = GroupSectionControls[0].ControlName.ToLower();
                                templateControl.Name        = GroupSectionControls[0].ControlName.ToLower() + incrCount.ToString();
                                templateControl.ControlType = GroupSectionControls[0].ControlType;
                                templateControl.RequestTemplateSectionControlId = GroupSectionControls[0].RequestTemplateSectionControlId;
                                templateControl.Label    = GroupSectionControls[0].ControlLabel.Split("(")[0];
                                templateControl.Value    = "";
                                templateControl.Required = GroupSectionControls[0].IsRequired;
                                if (GroupSectionControls[0].ControlName.ToLower() == appConstants.TextArea)
                                {
                                    templateControl.Input = "this.inputChange.bind(this)";
                                }
                                else if (GroupSectionControls[0].ControlName.ToLower() == appConstants.CheckBox)
                                {
                                    templateControl.Input = "this.checkValue.bind(this)";
                                }
                                else if (GroupSectionControls[0].ControlName.ToLower() == appConstants.TextBox)
                                {
                                    templateControl.Input = "this.inputChange.bind(this)";
                                }
                                else
                                {
                                    templateControl.Input = "";
                                }
                                templateControl.SeqNO                  = GroupSectionControls[0].SeqNo;
                                templateControl.MaxLen                 = GroupSectionControls[0].MaxLen;
                                templateControl.RowLength              = GroupSectionControls[0].RowLength;
                                templateControl.DisplayField           = GroupSectionControls[0].DisplayField;
                                templateControl.ValueField             = GroupSectionControls[0].ValueField;
                                templateControl.SourceName             = GroupSectionControls[0].SourceName;
                                templateControl.IsChecked              = GroupSectionControls[0].IsChecked;
                                templateControl.TemplateControlOptions = new List <TemplateSectionControlOptions>();
                                TemplateControls.Add(templateControl);

                                incrCount++;
                            }
                            else if (GroupSectionControls.Count > 1)
                            {
                                TemplateSectionControls templateControl = new TemplateSectionControls();
                                List <TemplateSectionControlOptions> templateControlOptions        = new List <TemplateSectionControlOptions>();
                                RequestTemplateSectionControls       requestTemplateSectionControl = GroupSectionControls.Where(sectionControl => sectionControl.ControlName.ToLower() == appConstants.Label).FirstOrDefault();

                                templateControl.RequestTemplateSectionId        = requestTemplateSectionControl.RequestTemplateSectionId;
                                templateControl.RequestTemplateSectionControlId = requestTemplateSectionControl.RequestTemplateSectionControlId;
                                templateControl.Label = requestTemplateSectionControl.ControlLabel.Split("(")[0];
                                //templateControl.ControlType = requestTemplateSectionControl.ControlType;
                                templateControl.Value        = "";
                                templateControl.Required     = requestTemplateSectionControl.IsRequired;
                                templateControl.Input        = "";
                                templateControl.SeqNO        = requestTemplateSectionControl.SeqNo;
                                templateControl.MaxLen       = requestTemplateSectionControl.MaxLen;
                                templateControl.RowLength    = requestTemplateSectionControl.RowLength;
                                templateControl.DisplayField = requestTemplateSectionControl.DisplayField;
                                templateControl.ValueField   = requestTemplateSectionControl.ValueField;
                                templateControl.SourceName   = requestTemplateSectionControl.SourceName;
                                templateControl.IsChecked    = requestTemplateSectionControl.IsChecked;
                                incrCount = incrCount + 1;

                                foreach (RequestTemplateSectionControls item in GroupSectionControls)
                                {
                                    if (item.ControlName.ToLower() != appConstants.Label)
                                    {
                                        if (templateControl.Type == null)
                                        {
                                            templateControl.Type        = item.ControlName.ToLower();
                                            templateControl.Name        = item.ControlName.ToLower() + incrCount.ToString();
                                            templateControl.ControlType = item.ControlType;

                                            incrCount = incrCount + 1;
                                        }
                                        TemplateSectionControlOptions templateSectionControlOptions = new TemplateSectionControlOptions();
                                        templateSectionControlOptions.RequestTemplateSectionControlId = item.RequestTemplateSectionControlId;
                                        templateSectionControlOptions.RequestTemplateSectionId        = item.RequestTemplateSectionId;
                                        templateSectionControlOptions.Value = false;
                                        templateSectionControlOptions.Key   = string.Join("", item.ControlLabel.ToLower().Split(" "));
                                        templateSectionControlOptions.Label = item.ControlLabel;
                                        templateSectionControlOptions.Name  = item.ControlName.ToLower() + incrCount.ToString();
                                        incrCount = incrCount + 1;
                                        if (item.ControlName.ToLower() == appConstants.CheckBox)
                                        {
                                            templateControl.Input = "this.checkValue.bind(this)";
                                        }
                                        else
                                        {
                                            templateControl.Input = "";
                                        }

                                        templateControlOptions.Add(templateSectionControlOptions);
                                    }
                                }
                                templateControl.TemplateControlOptions = templateControlOptions;
                                TemplateControls.Add(templateControl);
                            }
                        }
                        foreach (RequestFormTemplateDetails item in TemplateDetails)
                        {
                            List <TemplateSectionControls> templateControls = TemplateControls.Where(control => control.RequestTemplateSectionId == item.RequestTemplateSectionId).ToList();
                            if (templateControls == null || templateControls.Count == 0)
                            {
                                templateControls = new List <TemplateSectionControls>();
                            }
                            item.TemplateControls = templateControls;
                        }
                        if (TemplateDetails == null || TemplateDetails.Count == 0)
                        {
                            TemplateDetails = new List <RequestFormTemplateDetails>();
                        }
                        requestFormTemplate.TemplateDetailsList = TemplateDetails;
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: GetRequestTemplateById, Layer: RequestTemplateDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: GetRequestTemplateById, Layer: RequestTemplateDAL, Stack Trace: " + ex.ToString());
                throw;
            }
            return(requestFormTemplate);
        }
예제 #24
0
        /// <summary>Upadte The Role Details.</summary>
        /// <param name="role">The AdminRole Object.</param>
        /// <returns>The Boolean Value.</returns>
        public bool UpdateRole(AdminRoles role)
        {
            Logging.LogDebugMessage("Method: UpdateRole ,MethodType: Post, Layer: RolesDAL, Parameters: role = " + JsonConvert.SerializeObject(role));
            var  dataSet          = new DataSet();
            bool checkUpdateValue = false;

            try
            {
                using (SqlCommand command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.connectionString);
                    command.CommandText = "USP_RoleUpdate";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RoleName", Value = role.RoleName
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@IsActive", Value = role.IsActive
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UpdatedByUserID", Value = role.UpdateUserId
                    });

                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RoleID", Value = role.RoleId
                    });
                    //command.Parameters["@RoleID"].Direction = ParameterDirection.Output;
                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataSet);
                        if (dataSet != null)
                        {
                            checkUpdateValue = true;
                            //Audits audit = new Audits
                            //{
                            //    MainPageName = "Roles",
                            //    PageTabName = "Roles",
                            //    ActionName = "Save",
                            //    UserID = role.UpdateUserId,
                            //    RecordID = role.RoleId
                            //};
                            //AuditDAL auditobj = new AuditDAL();
                            //auditobj.SaveAuditInfo(audit);
                        }
                        Logging.LogDebugMessage("Method: UpdateRole, MethodType: Post, Layer: RolesDAL, returnStatus:" + checkUpdateValue.ToString());
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: UpdateRole, Layer: RolesDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: UpdateRole, Layer: RolesDAL, Stack Trace: " + ex.ToString());
                throw;
            }
            return(checkUpdateValue);
        }
예제 #25
0
        /// <summary> Save or Update RequestFormTemplate </summary>
        /// <param name="requestTemplate">RequestTemplate Object</param>
        /// <returns>Integer Object</returns>
        public Int64 SaveRequestFormTemplate(RequestTemplateDetails requestTemplate)
        {
            var   dataset    = new DataSet();
            Int64 templateId = 0;

            Logging.LogDebugMessage("Method: SaveRequestFormTemplate, MethodType: Post, Layer: RequestFormDAL, Parameters:  requestTemplate = " + JsonConvert.SerializeObject(requestTemplate));
            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.connectionString);
                    command.CommandText = "USP_SaveRequestFormTemplate_V1";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestTemplateId", Value = requestTemplate.RequestTemplateId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestName", Value = requestTemplate.RequestName
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestDescription", Value = requestTemplate.RequestDescription
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@DisplayType", Value = requestTemplate.DisplayType
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RequestCategoryId", Value = requestTemplate.RequestCategoryId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@UserId", Value = requestTemplate.UserId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@Visibility", Value = requestTemplate.Visibility
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@Priority", Value = requestTemplate.Priority
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RowStatus", Value = requestTemplate.RowStatus
                    });
                    DataTable dataTableOne = new DataTable();
                    dataTableOne = EntityCollectionHelper.ConvertTo <RequestTemplateSection>(requestTemplate.requestTemplateSection);
                    DataTable dataTableTwo = new DataTable();
                    dataTableTwo = EntityCollectionHelper.ConvertTo <RequestTemplateSectionControl>(requestTemplate.requestTemplateSectionControl);
                    DataTable    dataTableThree     = new DataTable();
                    SqlParameter structuredParamOne = new SqlParameter("@RequestTemplateSection", SqlDbType.Structured);
                    structuredParamOne.Value = dataTableOne;
                    command.Parameters.Add(structuredParamOne);
                    SqlParameter structuredParamTwo = new SqlParameter("@RequestTemplateSectionControl", SqlDbType.Structured);
                    structuredParamTwo.Value = dataTableTwo;
                    command.Parameters.Add(structuredParamTwo);
                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataset);
                        if (dataset != null)
                        {
                            templateId = Convert.ToInt64(dataset.Tables[0].Rows[0][0]);
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: SaveRequestFormTemplate, Layer: RequestFormDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: SaveRequestFormTemplate, Layer: RequestFormDAL, Stack Trace: " + ex.ToString());
                throw;
            }
            return(templateId);
        }
예제 #26
0
        /// <summary> Save or Update Lookup Details </summary>
        /// <param name="lookupDetail">LookupDetails Object</param>
        /// <returns>LookupDetails Object</returns>
        public LookupDetails SaveLookupDetails(LookupDetails lookupDetail)
        {
            var           dataset       = new DataSet();
            LookupDetails lookupDetails = new LookupDetails();

            Logging.LogDebugMessage("Method: SaveLookupDetails, MethodType: Post, Layer: LookupsDAL, Parameters:  lookupDetail = " + JsonConvert.SerializeObject(lookupDetail));
            try
            {
                using (var command = new SqlCommand())
                {
                    command.Connection  = new SqlConnection(this.ConnectionString);
                    command.CommandText = "USP_SaveLookupDetails";
                    command.CommandType = CommandType.StoredProcedure;
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsId", Value = lookupDetail.LookupDetailsId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupId", Value = lookupDetail.LookupId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsDescription", Value = lookupDetail.LookupDetailsDescription
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsValue", Value = lookupDetail.LookupDetailsValue
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsLongDescription", Value = lookupDetail.LookupDetailsLongDescription
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsSequenceOrder", Value = lookupDetail.LookupDetailsSequenceOrder
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsCrossWalkValue", Value = lookupDetail.LookupDetailsCrossWalkValue
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsCategory", Value = lookupDetail.LookupDetailsCategory
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsType", Value = lookupDetail.LookupDetailsType
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsSubSequenceOrder", Value = lookupDetail.LookupDetailsSubSequenceOrder
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsSubCategory", Value = lookupDetail.LookupDetailsSubCategory
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsSubType", Value = lookupDetail.LookupDetailsSubType
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsShortDescription", Value = lookupDetail.LookupDetailsShortDescription
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsDisplayDescription", Value = lookupDetail.LookupDetailsDisplayDescription
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@IsUsedInDisplay", Value = lookupDetail.IsUsedInDisplay
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsEffectiveFrom", Value = lookupDetail.LookupDetailsEffectiveFrom
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@LookupDetailsEffectiveTo", Value = lookupDetail.LookupDetailsEffectiveTo
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@CreatedByUserID", Value = lookupDetail.CreateUserId
                    });
                    command.Parameters.Add(new SqlParameter()
                    {
                        ParameterName = "@RowStatus", Value = lookupDetail.RowStatus
                    });

                    using (SqlDataAdapter adapter = new SqlDataAdapter(command))
                    {
                        adapter.Fill(dataset);
                        if (dataset != null)
                        {
                            lookupDetails = EntityCollectionHelper.ConvertTo <LookupDetails>(dataset.Tables[0]).FirstOrDefault();
                        }
                    }
                }
            }
            catch (SqlException sqlEx)
            {
                Logging.LogErrorMessage("Method: SaveLookupDetails, Layer: LookupsDAL, Stack Trace: " + sqlEx.ToString());
                throw;
            }
            catch (Exception ex)
            {
                Logging.LogErrorMessage("Method: SaveLookupDetails, Layer: LookupsDAL, Stack Trace: " + ex.ToString());
                throw;
            }
            return(lookupDetails);
        }