예제 #1
0
        public override SearchFormData GetDataWithFilter(Hashtable filters, int pageSize, int pageIndex, string orderBy, string orderDirection, out int totalRows, out Notification notification)
        {
            DTO.SearchFormData searchFormData = new DTO.SearchFormData();
            notification = new Library.DTO.Notification()
            {
                Type = Library.DTO.NotificationType.Success
            };
            totalRows = 0;
            try
            {
                //int? companyID = null;
                string statusUD  = null;
                string statusNM  = null;
                int?   moduleID  = null;
                bool?  isActived = null;

                if (filters.ContainsKey("statusUD") && !string.IsNullOrEmpty(filters["statusUD"].ToString()))
                {
                    statusUD = filters["statusUD"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("statusNM") && !string.IsNullOrEmpty(filters["statusNM"].ToString()))
                {
                    statusNM = filters["statusNM"].ToString().Replace("'", "''");
                }
                if (filters.ContainsKey("moduleID") && !string.IsNullOrEmpty(filters["moduleID"].ToString()))
                {
                    moduleID = Convert.ToInt32(filters["moduleID"].ToString());
                }
                if (filters.ContainsKey("isActived") && filters["isActived"] != null && !string.IsNullOrEmpty(filters["isActived"].ToString()))
                {
                    isActived = (filters["isActived"].ToString() == "true") ? true : false;
                }
                using (ModuleStatusMngEntities context = CreateContext())
                {
                    totalRows = context.ModuleStatusMng_function_SearchModuleStatus(statusUD, moduleID, statusNM, isActived, orderBy, orderDirection).Count();
                    var result = context.ModuleStatusMng_function_SearchModuleStatus(statusUD, moduleID, statusNM, isActived, orderBy, orderDirection);
                    searchFormData.Data = converter.DB2DTO_Search(result.Skip(pageSize * (pageIndex - 1)).Take(pageSize).ToList());
                }

                return(searchFormData);
            }
            catch (Exception ex)
            {
                notification.Type    = Library.DTO.NotificationType.Error;
                notification.Message = ex.Message;
                notification.DetailMessage.Add(ex.Message);
                if (ex.GetBaseException() != null)
                {
                    notification.DetailMessage.Add(ex.GetBaseException().Message);
                }
                return(searchFormData);
            }
        }
예제 #2
0
        //
        // CUSTOM FUNCTION HERE
        //

        public SupportFormData GetInitData(out Notification notification)
        {
            notification      = new Notification();
            notification.Type = NotificationType.Success;

            SupportFormData data = new SupportFormData();

            try
            {
                using (ModuleStatusMngEntities context = CreateContext())
                {
                    data.Modules = converter.DB2DTO_Modules(context.ModuleStatusMng_Module_View.ToList());
                }
            }
            catch (Exception ex)
            {
                notification.Type    = NotificationType.Error;
                notification.Message = Helper.GetInnerException(ex).Message;
            }

            return(data);
        }