Example #1
0
 public void Insert(Folder entity)
 {
     using (var dbcontext = new FAXPECContext())
     {
         try
         {
             if (string.IsNullOrEmpty(entity.IdNome))
             {
                 double? idnome    = dbcontext.FOLDERS.Select(x => x.IDNOME).DefaultIfEmpty(0).Max();
                 decimal newidnome = default(decimal);
                 decimal.TryParse(idnome.ToString(), out newidnome);
                 entity.IdNome = (newidnome + 1).ToString();
             }
             decimal idnew = (decimal)dbcontext.FOLDERS.Select(x => x.ID).DefaultIfEmpty(0).Max();
             entity.Id = idnew;
             FOLDERS folder = DaoSQLServerDBHelper.MapToFolderDto(entity, true);
             dbcontext.FOLDERS.Add(folder);
             entity.Id = folder.ID;
             dbcontext.SaveChanges();
         }
         catch (Exception ex)
         {
             if (ex.GetType() == typeof(ManagedException))
             {
                 ManagedException mEx = new ManagedException(ex.Message, "FOL_ORA001", string.Empty, string.Empty, ex);
                 ErrorLogInfo     er  = new ErrorLogInfo(mEx);
                 log.Error(er);
                 throw mEx;
             }
         }
     }
 }
Example #2
0
 public void Insert(List <Folder> entity)
 {
     using (var dbcontext = new FAXPECContext())
     {
         using (var transaction = dbcontext.Database.BeginTransaction())
         {
             try
             {
                 double? idnome    = dbcontext.FOLDERS.Select(x => x.IDNOME).DefaultIfEmpty(0).Max();
                 decimal newidnome = default(decimal);
                 decimal.TryParse(idnome.ToString(), out newidnome);
                 foreach (Folder f in entity)
                 {
                     f.IdNome = newidnome.ToString();
                     FOLDERS folder = DaoSQLServerDBHelper.MapToFolderDto(f, true);
                     dbcontext.FOLDERS.Add(folder);
                 }
             }
             catch (Exception ex)
             {
                 if (ex.GetType() == typeof(ManagedException))
                 {
                     ManagedException mEx = new ManagedException(ex.Message, "FOL_ORA001", string.Empty, string.Empty, ex);
                     ErrorLogInfo     er  = new ErrorLogInfo(mEx);
                     log.Error(er);
                     throw mEx;
                 }
             }
         }
     }
 }
Example #3
0
        public async Task <MessageModel <string> > Post([FromBody] FOLDERS request)
        {
            var data = new MessageModel <string>();

            var id = await _FOLDERSServices.Add(request);

            data.success = id > 0;

            if (data.success)
            {
                data.response = id.ObjToString();
                data.msg      = "添加成功";
            }

            return(data);
        }
        internal static FOLDERS MapToFolderDto(Folder entity, bool v)
        {
            FOLDERS f = new FOLDERS()
            {
                ID     = entity.Id,
                IDNOME = double.Parse(entity.IdNome),
                NOME   = entity.Nome,
                SYSTEM = "0",
                TIPO   = entity.TipoFolder
            };

            if (v)
            {
                f.ID++;
            }
            return(f);
        }
Example #5
0
        public async Task <MessageModel <string> > Put([FromBody] FOLDERS request)
        {
            var data = new MessageModel <string>();

            if (request.ORIGREC > 0)
            {
                data.success = await _FOLDERSServices.Update(request);

                if (data.success)
                {
                    data.msg      = "更新成功";
                    data.response = request?.ORIGREC.ObjToString();
                }
            }

            return(data);
        }
Example #6
0
 public Folder GetById(long id)
 {
     ActiveUp.Net.Common.DeltaExt.Folder folder = null;
     using (var dbcontext = new FAXPECContext())
     {
         try
         {
             FOLDERS a = dbcontext.FOLDERS.Where(x => x.ID == id).FirstOrDefault();
             folder = AutoMapperConfiguration.MapToFolder(a);
         }
         catch (Exception ex)
         {
             ManagedException mEx = new ManagedException(ex.Message, "FOL_ORA003", string.Empty, string.Empty, ex);
             ErrorLogInfo     er  = new ErrorLogInfo(mEx);
             log.Error(er);
             throw mEx;
         }
         return(folder);
     }
 }
Example #7
0
        public Folder GetFolderByName(string name)
        {
            Folder folder = null;

            using (var dbcontext = new FAXPECContext())
            {
                try
                {
                    FOLDERS a = dbcontext.FOLDERS.Where(x => x.NOME.ToUpper() == name.ToUpper()).FirstOrDefault();
                    if (a != null)
                    {
                        folder = AutoMapperConfiguration.MapToFolder(a);
                    }
                }
                catch (Exception ex)
                {
                    ManagedException mEx = new ManagedException(ex.Message, "FOL_ORA005", string.Empty, string.Empty, ex);
                    ErrorLogInfo     er  = new ErrorLogInfo(mEx);
                    log.Error(er);
                    throw mEx;
                }
                return(folder);
            }
        }
Example #8
0
    void ChangeFolder(FOLDERS zFolderToChange)
    {
        switch (zFolderToChange)
        {
            case FOLDERS.USER:
                UserFolderSelector.color = SelectedFolder;
                ExamplesFolderSelector.color = UnselectedFolder;

                ExamplesFolderList.gameObject.SetActive(false);
                UserFolderList.gameObject.SetActive(true);
                MaskListSwapper.content = UserFolderList.GetComponent<RectTransform>();

                AddNewProfileButton.gameObject.SetActive(true);
                break;

            case FOLDERS.EXAMPLES:
                UserFolderSelector.color = UnselectedFolder;
                ExamplesFolderSelector.color = SelectedFolder;

                UserFolderList.gameObject.SetActive(false);
                ExamplesFolderList.gameObject.SetActive(true);
                MaskListSwapper.content = ExamplesFolderList.GetComponent<RectTransform>();
                AddNewProfileButton.gameObject.SetActive(false);
                break;
        }

        CurrentlyOpenedFolder = zFolderToChange;
    }