Beispiel #1
0
        public override EditData GetData(int id, out Notification notification)
        {
            notification = new Notification()
            {
                Type = NotificationType.Success
            };

            EditData data = new EditData()
            {
                Data = new ClientPermissionDTO()
                {
                    ClientPermissionDetailDTOs = new List <ClientPermissionDetailDTO>()
                },
                //Employees = new System.Collections.Generic.List<Support.DTO.Employee>()
            };

            try
            {
                if (id > 0)
                {
                    using (var context = this.CreateContext())
                    {
                        ClientPermissionMng_ClientPermission_View item = context.ClientPermissionMng_ClientPermission_View.Include("ClientPermissionMng_ClientPermissionDetail_View").FirstOrDefault(o => o.ClientPermissionID == id);
                        if (item == null)
                        {
                            notification = new Notification()
                            {
                                Type = NotificationType.Error, Message = "Can not find data."
                            };
                        }
                        else
                        {
                            data.Data = this.converter.DB2DTO_OneClientPermissionView(item);
                        }
                        //Module.Support.DAL.DataFactory support_factory = new Support.DAL.DataFactory();

                        //data.Employees = support_factory.GetEmployee();
                    }
                }
            }
            catch (System.Exception ex)
            {
                notification = new Notification()
                {
                    Type = NotificationType.Error, Message = Library.Helper.GetInnerException(ex).Message
                };
            }

            return(data);
        }
Beispiel #2
0
 public DTO.ClientPermissionDTO DB2DTO_OneClientPermissionView(ClientPermissionMng_ClientPermission_View dbItem)
 {
     return(AutoMapper.Mapper.Map <ClientPermissionMng_ClientPermission_View, DTO.ClientPermissionDTO>(dbItem));
 }