Esempio n. 1
0
 public RepositoryResponse <FileViewModel> SaveFile(IFormFile file, string filename, string folder)
 {
     V_0 = new RepositoryResponse <FileViewModel>();
     try
     {
         if (file.get_Length() <= (long)0)
         {
             V_0.set_IsSucceed(false);
             V_0.get_Errors().Add("File not found");
         }
         else
         {
             this.CreateDirectoryIfNotExist(folder);
             stackVariable14    = new string[2];
             stackVariable14[0] = folder;
             stackVariable14[1] = filename;
             V_1 = CommonHelper.GetFullPath(stackVariable14);
             if (File.Exists(V_1))
             {
                 dummyVar0 = this.DeleteFile(V_1);
             }
             V_2 = new FileStream(V_1, 2);
             try
             {
                 file.CopyTo(V_2);
             }
             finally
             {
                 if (V_2 != null)
                 {
                     ((IDisposable)V_2).Dispose();
                 }
             }
             V_0.set_IsSucceed(true);
             stackVariable30 = new FileViewModel();
             stackVariable30.set_Filename(filename.Substring(0, file.get_FileName().LastIndexOf('.')));
             stackVariable30.set_Extension(filename.Substring(file.get_FileName().LastIndexOf('.')));
             stackVariable30.set_FileFolder(folder);
             V_0.set_Data(stackVariable30);
         }
     }
     catch (Exception exception_0)
     {
         V_3 = exception_0;
         V_0.set_IsSucceed(false);
         V_0.set_Exception(V_3);
         V_0.get_Errors().Add(V_3.get_Message());
     }
     return(V_0);
 }
Esempio n. 2
0
		public static RepositoryResponse<UpdateViewModel> GetTemplateByPath(string path, string culture, MixCmsContext _context = null, IDbContextTransaction _transaction = null)
		{
			V_0 = new UpdateViewModel.u003cu003ec__DisplayClass92_0();
			V_1 = new RepositoryResponse<UpdateViewModel>();
			stackVariable2 = V_0;
			if (path != null)
			{
				stackVariable7 = path.Split('/', 0);
			}
			else
			{
				stackVariable7 = null;
			}
			stackVariable2.temp = stackVariable7;
			if (V_0.temp == null || (int)V_0.temp.Length < 2)
			{
				V_1.set_IsSucceed(false);
				V_1.get_Errors().Add("Template Not Found");
			}
			else
			{
				V_0.activeThemeId = MixService.GetConfig<int>("ThemeId", culture);
				V_0.name = V_0.temp[1].Split('.', 0)[0];
				stackVariable35 = ViewModelBase<MixCmsContext, MixTemplate, UpdateViewModel>.Repository;
				V_2 = Expression.Parameter(Type.GetTypeFromHandle(// 
Esempio n. 3
0
		public static RepositoryResponse<string> ExportAttributeToExcel(List<JObject> lstData, string sheetName, string folderPath, string fileName, List<string> headers = null)
		{
			V_0 = new RepositoryResponse<string>();
			try
			{
				if (lstData.get_Count() <= 0)
				{
					V_0.get_Errors().Add("Can not export data of empty list");
					V_16 = V_0;
				}
				else
				{
					V_3 = DateTime.get_Now();
					V_1 = string.Concat(fileName, "-", V_3.ToString("yyyyMMdd"), ".xlsx");
					V_2 = new DataTable();
					if (headers != null)
					{
						V_6 = headers.GetEnumerator();
						try
						{
							while (V_6.MoveNext())
							{
								V_7 = V_6.get_Current();
								dummyVar1 = V_2.get_Columns().Add(V_7, Type.GetTypeFromHandle(// 
								// Current member / type: Mix.Domain.Core.ViewModels.RepositoryResponse`1<System.String> Mix.Cms.Lib.ViewModels.MixAttributeSetDatas.Helper::ExportAttributeToExcel(System.Collections.Generic.List`1<Newtonsoft.Json.Linq.JObject>,System.String,System.String,System.String,System.Collections.Generic.List`1<System.String>)
								// Exception in: Mix.Domain.Core.ViewModels.RepositoryResponse<System.String> ExportAttributeToExcel(System.Collections.Generic.List<Newtonsoft.Json.Linq.JObject>,System.String,System.String,System.String,System.Collections.Generic.List<System.String>)
								// Specified method is not supported.
								// 
								// mailto: [email protected]


		public static async Task<RepositoryResponse<PaginationModel<TView>>> FilterByKeywordAsync<TView>(string culture, string attributeSetName, RequestPaging request, string keyword, Dictionary<string, StringValues> queryDictionary = null, MixCmsContext _context = null, IDbContextTransaction _transaction = null)
			V_0 = Expression.Parameter(Type.GetTypeFromHandle(// 
			// Current member / type: System.Void Mix.Cms.Lib.ViewModels.MixThemes.UpdateViewModel::ExpandView(Mix.Cms.Lib.Models.Cms.MixCmsContext,Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction)
			// Exception in: System.Void ExpandView(Mix.Cms.Lib.Models.Cms.MixCmsContext,Microsoft.EntityFrameworkCore.Storage.IDbContextTransaction)
			// Specified method is not supported.
			// 
			// mailto: [email protected]


		private RepositoryResponse<bool> ImportAssetsAsync(MixCmsContext _context = null, IDbContextTransaction _transaction = null)
		{
			V_0 = new RepositoryResponse<bool>();
			V_1 = string.Concat(this.get_Asset().get_FileFolder(), "/", this.get_Asset().get_Filename(), this.get_Asset().get_Extension());
			if (!File.Exists(V_1))
			{
				V_0.get_Errors().Add("Cannot saved asset file");
			}
			else
			{
				FileRepository.get_Instance().UnZipFile(V_1, this.get_Asset().get_FileFolder());
				V_0.set_IsSucceed(true);
			}
			return V_0;
		}