/// <summary>
            /// Get Type Permission Name By Specific ID
            /// </summary>
            /// <param name="request">TypePermissionID</param>
            /// <returns>Type Permission Name By Specific ID</returns>
            public static GetTypePermissionResponse GetTypePermissionName(int request)
            {
                GetTypePermissionResponse response = new GetTypePermissionResponse();

                response.Error          = new Handler.ErrorObject();
                response.TypePermission = new TypePermission();
                try
                {
                    var TypePermission = TypePermissionData.Select.GetTypePermissionName(request);
                    if (!TypePermission.Item1.Error)
                    {
                        response.TypePermission = new TypePermission()
                        {
                            name = TypePermission.Item2.name
                        };
                    }
                    else
                    {
                        response.Error.InfoError(TypePermission.Item1);
                    }
                }
                catch (Exception ex)
                {
                    response.Error.InfoError(ex);
                }

                return(response);
            }
            /// <summary>
            /// Return Affected Row Or Error If Exist
            /// </summary>
            /// <param name="request">TypePermission Information</param>
            /// <returns>Affected Row Or Error If Exist</returns>
            public static GetTypePermissionResponse TypePermission(GetTypePermissionResponse request)
            {
                GetTypePermissionResponse response = new GetTypePermissionResponse();

                try
                {
                    tblTypePermission TypePermission = new tblTypePermission()
                    {
                        id          = request.TypePermission.id,
                        name        = request.TypePermission.name,
                        detail      = request.TypePermission.detail,
                        numberLevel = request.TypePermission.numberLevel,
                        createDate  = request.TypePermission.createDate,
                        upDateDate  = DateTime.Now,
                        deleteDate  = null,
                        state       = "Active"
                    };

                    var result = TypePermissionData.Update.TypePermission(TypePermission);
                    if (result.Item1.Error)
                    {
                        response.Error.InfoError(result.Item1);
                    }
                    else
                    {
                        response.Message = result.Item2;
                    }
                }
                catch (Exception ex)
                {
                    response.Error.InfoError(ex);
                }

                return(response);
            }
            /// <summary>
            /// Return TypePermission Information
            /// </summary>
            /// <param name="request">TypePermission ID</param>
            /// <returns>TypePermission Information</returns>
            public static GetTypePermissionResponse GetTypePermission(GetTypePermissionRequest request)
            {
                GetTypePermissionResponse response = new GetTypePermissionResponse();

                response.Error          = new Handler.ErrorObject();
                response.TypePermission = new TypePermission();
                try
                {
                    var TypePermission = TypePermissionData.Select.GetTypePermission(request.TypePermissionID);
                    if (!TypePermission.Item1.Error)
                    {
                        response.TypePermission = new TypePermission()
                        {
                            id         = TypePermission.Item2.id,
                            name       = TypePermission.Item2.name,
                            detail     = TypePermission.Item2.detail,
                            createDate = TypePermission.Item2.createDate,
                            upDateDate = TypePermission.Item2.upDateDate,
                            deleteDate = TypePermission.Item2.deleteDate,
                            state      = TypePermission.Item2.state
                        };
                    }
                    else
                    {
                        response.Error.InfoError(TypePermission.Item1);
                    }
                }
                catch (Exception ex)
                {
                    response.Error.InfoError(ex);
                }

                return(response);
            }
            /// <summary>
            /// Return Affected Row Or Error If Exist
            /// </summary>
            /// <param name="TypePermissionID">TypePermission ID</param>
            /// <param name="state">State</param>
            /// <returns>Affected Row Or Error If Exist</returns>
            public static GetTypePermissionResponse TypePermissionDisable(int TypePermissionID, string state)
            {
                GetTypePermissionResponse response = new GetTypePermissionResponse();

                try
                {
                    var result = TypePermissionData.Delete.TypePermissionDisable(TypePermissionID, state);
                    if (result.Item1.Error)
                    {
                        response.Error.InfoError(result.Item1);
                    }
                    else
                    {
                        response.Message = result.Item2;
                    }
                }
                catch (Exception ex)
                {
                    response.Error.InfoError(ex);
                }
                return(response);
            }
            /// <summary>
            /// Return Type Permission List
            /// </summary>
            /// <returns>Type Permission List</returns>
            public static GetTypePermissionResponse GetTypePermissionList()
            {
                GetTypePermissionResponse response = new GetTypePermissionResponse();

                response.TypePermissionList = new List <TypePermission>();
                response.Error = new Handler.ErrorObject();

                try
                {
                    var TypePermission = TypePermissionData.Select.GetTypePermissionList();
                    if (!TypePermission.Item1.Error)
                    {
                        foreach (var item in TypePermission.Item2)
                        {
                            response.TypePermissionList.Add(new TypePermission()
                            {
                                id         = item.id,
                                name       = item.name,
                                detail     = item.detail,
                                createDate = item.createDate,
                                upDateDate = item.upDateDate,
                                deleteDate = item.deleteDate,
                                state      = item.state
                            });
                        }
                    }
                    else
                    {
                        response.Error.InfoError(TypePermission.Item1);
                    }
                }
                catch (Exception ex)
                {
                    response.Error.InfoError(ex);
                }
                return(response);
            }