public StorageService(string appSid, string appKey)
     : base(appSid, appKey)
 {
     AppSid = appSid;
     AppKey = appKey;
     File = new FileClass(AppSid, AppKey);
     Folder = new Folderlass(AppSid, AppKey);
 }
示例#2
0
 static ResourcesHelper()
 {
     FileClass[] classArray = new FileClass[6];
     classArray[0]  = FileClass.wmv;
     classArray[1]  = FileClass.mid;
     classArray[2]  = FileClass.mp3;
     classArray[4]  = FileClass.rmvb;
     classArray[5]  = FileClass.xv;
     mediaFileClass = classArray;
     flasFileClass  = new FileClass[] { FileClass.swf, FileClass.f4v };
 }
示例#3
0
 private BackgroundWorker CopyWorker;                             //复制文件的线程
 #endregion
 #region 功能函数
 public void BeginCopy(FileClass fclass)
 {
     if (CopyWorker == null)
     {
         InitBackgroundWorker();
     }
     if (!CopyWorker.IsBusy)
     {
         CopyWorker.RunWorkerAsync(GetNewImportFolderPath(fclass));
     }
 }
示例#4
0
        /// <summary>
        /// 插入违停附件
        /// </summary>
        /// <param name="wtid"></param>
        /// <param name="FC"></param>
        private void AddWTFiles(int wtid, FileClass FC)
        {
            case_wtfiles cfilemodel = new case_wtfiles();

            cfilemodel.wtid     = wtid;
            cfilemodel.filename = FC.OriginalName;
            cfilemodel.filepath = FC.OriginalPath;
            cfilemodel.filetype = FC.OriginalType;
            cfilemodel.filesize = FC.size;
            bll.AddWtFile(cfilemodel);
        }
示例#5
0
文件: PD.cs 项目: www30506/jCgRgOgSeS
    //這個接口是給 EditorWindow建立使用
    public void SetPDTxt(string[] p_name, string[] p_path)
    {
        m_file = new FileClass[p_path.Length];
        for (int i = 0; i < m_file.Length; i++)
        {
            m_file[i]        = new FileClass();
            m_file[i].m_name = p_name[i];
            m_file[i].m_path = p_path[i];
        }

        Init();
    }
示例#6
0
        private void generatePropPrivateDao(StringBuilder sb, FileClass item)
        {
            sb.Append("        private Dao");
            sb.Append("<");
            sb.Append(item.ToString());
            sb.Append(">");
            sb.Append(" ");
            //poe a primeira em minuscula
            string classe = item.ToString().FirstCharToLower();

            sb.Append(classe);
            sb.AppendLine("Dao;");
        }
示例#7
0
        // GET: FileClasses/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FileClass fileClass = db.FileClasses.Find(id);

            if (fileClass == null)
            {
                return(HttpNotFound());
            }
            return(View(fileClass));
        }
示例#8
0
        public HttpResponseMessage SpecialTaskFiring(Zxzz_TaskModel model)
        {
            HttpRequestBase request = ((HttpContextWrapper)this.Request.Properties["MS_HttpContext"]).Request;

            WorkFlowManagerBLL  bll   = new WorkFlowManagerBLL();
            WorkFlowClass       wf    = new WorkFlowClass();
            List <FileClass>    list  = new List <FileClass>();
            Zxzz_SpecialTaskBLL zpbll = new Zxzz_SpecialTaskBLL();

            string[] fileClass = model.uploadpanelValue;

            zxzz_tasks ztmodel = new zxzz_tasks();

            if (fileClass != null && fileClass.Length > 0)
            {
                foreach (var item in fileClass)
                {
                    FileClass infileClass = new FileClass();
                    JObject   jo          = new JObject();
                    jo = (JObject)JsonConvert.DeserializeObject(item);
                    infileClass.OriginalPath = jo["OriginalPath"] == null ? "" : jo["OriginalPath"].ToString();
                    infileClass.OriginalName = jo["OriginalName"] == null ? "" : jo["OriginalName"].ToString();
                    infileClass.OriginalType = jo["OriginalType"] == null ? "" : jo["OriginalType"].ToString();
                    infileClass.size         = jo["size"] == null ? 0 : (double)jo["size"];
                    list.Add(infileClass);
                }
            }

            #region 专项整治流程
            wf.FunctionName   = "zxzz_tasks";
            wf.WFID           = "2017041214100001";
            wf.WFDID          = model.wfdid;
            wf.NextWFDID      = model.nextwfdid;
            wf.processmode    = model.nextwfdid;
            wf.NextWFUSERIDS  = zpbll.GetUseridsByUnitids(model.xdzd);
            wf.WFSAID         = model.wfsaid;
            wf.WFSID          = model.wfsid;
            wf.DEALCONTENT    = model.dealcontent;
            wf.IsSendMsg      = "false";
            wf.WFCreateUserID = model.createuserid;
            wf.files          = list;
            #endregion

            string wf_data = bll.WF_Submit(wf, ztmodel);
            //初始化WFSU
            zpbll.ReloadWFSU(wf_data.Split(',')[1]);
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
            response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            return(response);
        }
示例#9
0
        /// <summary>檔案路徑讀取(可疊加)</summary>
        /// <param name="Path">路徑字串</param>
        /// <param name="MatchUid">對應資料</param>
        /// <returns>Files[a][b] (格式string[])</returns>
        /// 可用以下方式疊加
        /// rlt.Files = new List<object>();
        /// rlt.Files.Add(此函數);
        public static FileClass[] FilesLoad(string tPath, string MatchUid)
        {
            string[] FileCollection;
            //轉換路徑 (需判斷是絕對路徑還是相對路徑)
            string strPath  = "";
            string viewPath = "";

            if (Path.IsPathRooted(ConfigurationManager.AppSettings["FilesPath"]) == true)
            {
                //絕對路徑
                strPath = ConfigurationManager.AppSettings["FilesPath"] + tPath.Replace("/", @"\");
            }
            else
            {
                //相對路徑
                strPath = HttpContext.Current.Server.MapPath(ConfigurationManager.AppSettings["FilesPath"] + tPath);
            }
            //輸出閱覽路徑
            viewPath = ConfigurationManager.AppSettings["FilesViewPath"] + tPath;

            FileInfo         theFileInfo;
            List <FileClass> dataList = new List <FileClass>();

            //判斷檔案資料夾是否存在
            if (Directory.Exists(strPath))
            {
                //若存在則開始擷取檔案
                FileCollection = Directory.GetFiles(strPath, "*.*");
                //迴圈塞入名稱跟副檔名
                for (int i = 0; i < FileCollection.Length; i++)
                {
                    theFileInfo = new FileInfo(FileCollection[i]);

                    FileClass data = new FileClass();

                    data.MatchUid             = MatchUid;                                                      //對應資料
                    data.FilePath             = viewPath;                                                      //顯示路徑
                    data.FileName             = theFileInfo.Name.ToString();                                   //檔案名稱(包含附檔名)
                    data.FileNameNoExtension  = Path.GetFileNameWithoutExtension(theFileInfo.Name.ToString()); //檔案名稱(去除附檔名)
                    data.FileSize             = theFileInfo.Length.ToString();                                 //檔案大小
                    data.FileExtension        = theFileInfo.Extension.ToString().ToLower();                    //副檔名(轉小寫)
                    data.FileLastWriteTime    = theFileInfo.LastWriteTime.ToString();                          //最後一次存取的時間
                    data.FileLastWriteTimeUtc = theFileInfo.LastWriteTimeUtc.ToFileTimeUtc().ToString();       //最後一次存取的時間

                    dataList.Add(data);
                }
            }

            return(dataList.ToArray());
        }
示例#10
0
        /**
         * Gets the FileClass list and iterates through it
         * the items then gets added to a new list
         * with a name and path added to the list
         */

        public static List <FileClass> LoadList()
        {
            List <FileClass> FileList = new List <FileClass>();
            FileClass        files    = new FileClass();

            foreach (var file in files.FilePath())
            {
                FileList.Add(new FileClass()
                {
                    FileName = file.ToString(), ImageName = files.ImageName
                });
            }
            return(FileList);
        }
示例#11
0
 private void generatePropDao(StringBuilder sb, FileClass item)
 {
     //public Dao<T> TDao { get { return new Dao<T>(this); }  }
     sb.Append("        public Dao");
     sb.Append("<");
     sb.Append(item.ToString());
     sb.Append(">");
     sb.Append(item.ToString());
     sb.Append("Dao");
     sb.Append(" { get { return new Dao<");
     sb.Append(item.ToString());
     sb.Append(">");
     sb.AppendLine("(this); }  }");
 }
示例#12
0
        private FileType ParseSingleMutil(FileMutilType fmt)
        {
            //int importCount = fmt.Importes.Count;
            //int useCount = fmt.Uses.Count;
            int propertyCount = fmt.Propertieses.Count;
            int procCount     = fmt.Proces.Count;

            int enumCount  = fmt.Enumes.Count;
            int dimCount   = fmt.Dimes.Count;
            int classCount = fmt.Classes.Count;

            if (enumCount == 1 && dimCount == 0 && classCount == 0)
            {
                return(new FileEnum(fmt.FileContext, fmt.Enumes));
            }
            else if (enumCount == 0 && dimCount == 1 && classCount == 0)
            {
                return(new FileDim(fmt.FileContext, fmt.Dimes[0], fmt.ImporteSection));
            }
            else if (enumCount == 0 && classCount == 1) // (enumCount == 0 && dimCount == 0 && classCount == 1)
            {
                FileClass fsc = new FileClass(fmt.FileContext, fmt);
                //FileClass fsc = new FileClass()
                //{
                //    ClassSection = fmt.Classes[0],
                //    ImporteSection = fmt.ImporteSection,
                //    Proces = fmt.Proces,
                //    UseSection = fmt.UseSection

                //};
                //if (fmt.Dimes.Count > 0)
                //{
                //    fsc.DimSection = fmt.Dimes[0];
                //}
                //if (fmt.Propertieses.Count > 0)
                //{
                //    fsc.PropertiesesSection = fmt.Propertieses[0];
                //}
                return(fsc);
            }
            else if (enumCount == 0 && dimCount == 0 && classCount == 0)
            {
                return(null);
            }
            else
            {
                return(null);
            }
        }
示例#13
0
        private void generateInitDao(StringBuilder sb, FileClass item)
        {
            //this.tDao = new Dao<T>(this);
            //poe a primeira em minuscula
            string classe = item.ToString().FirstCharToLower();

            sb.Append("			this.");
            sb.Append(classe);
            sb.Append("Dao");
            sb.Append(" = ");
            sb.Append("new Dao<");
            sb.Append(item.ToString());
            sb.Append(">");
            sb.AppendLine("(this);");
        }
        /// <summary>  Get the selected authors path to the file.</summary>
        private void GetUnformattedDataFrom()
        {
            var dirFileOp = new FileClass();

            var dirPath = BookListPathsProperties.PathAuthorsDirectory;

            Debug.Assert(dirPath != null, nameof(dirPath) + " != null");

            var cls = new CombinePathsClass();

            BookListPathsProperties.PathToCurrentAuthorsFile = cls.CombineDirectoryPathWithFileName(dirPath,
                                                                                                    BookListPathsProperties.AuthorsNameCurrent);

            this.GetAuthorsName(BookListPathsProperties.AuthorsNameCurrent);
        }
示例#15
0
        private void simpleProduct_Click(object sender, EventArgs e)
        {
            Book.UI.Invoices.ChooseProductForm f = new Book.UI.Invoices.ChooseProductForm();
            if (f.ShowDialog(this) == DialogResult.OK)
            {
                foreach (Model.Product product in Book.UI.Invoices.ChooseProductForm.ProductList)
                {
                    if (product == null)
                    {
                        continue;
                    }
                    IList <Model.ProductImage> productImages = this._productImage.Select(product);
                    foreach (Model.ProductImage item in productImages)
                    {
                        if (item.Images.Length == 0)
                        {
                            continue;
                        }

                        #region 展示數據

                        MemoryStream ms    = new MemoryStream(item.Images);
                        Image        image = Image.FromStream(ms);
                        string       path  = Application.StartupPath + @"\Temp\" + System.DateTime.Now.ToString("yyyyMMddHHmmss") + DateTime.Now.Millisecond.ToString() + (string.IsNullOrEmpty(item.SuffixalName) ? ".jpg" : item.SuffixalName);
                        image.Save(path);
                        FileClass fc = new FileClass();
                        fc.filePath  = path;
                        fc.fileName  = product.ProductName;
                        fc.size      = item.Images.Length + "字节";
                        fc.image     = image;
                        fc.Extension = string.IsNullOrEmpty(item.SuffixalName) ? ".jpg" : item.SuffixalName;
                        list.Add(fc);

                        #endregion

                        //System.Net.Mime.ContentType ct = new System.Net.Mime.ContentType();
                        //ct.MediaType = System.Net.Mime.MediaTypeNames.Image.Jpeg;
                        //ct.Name = item.Description + ".jpg";
                        //Attachment at = new Attachment(ms, ct);
                        //System.Net.Mime.ContentDisposition disposition = at.ContentDisposition;
                        //disposition.ModificationDate = item.InsertTime.Value;
                        //disposition.ReadDate = System.DateTime.Now;
                        //mail.Attachments.Add(at);
                    }
                }
                this.gridControl1.RefreshDataSource();
            }
        }
示例#16
0
        static void Main(string[] args)
        {
            int    scrapedAmount = 0;
            int    sourcesAmount = 0;
            string pGood         = "{ + } ";
            string pNeutral      = "{ = } ";

            FileClass    fileClass    = new FileClass();
            LeecherClass leecherClass = new LeecherClass();

            Console.Title = $"tax0r's Proxyleecher 2021 - Scraped -> {scrapedAmount} | Sources -> {sourcesAmount}";

            Console.WriteLine($"{pGood}Drag&Drop sources.txt", Color.LightPink);

            string input     = Console.ReadLine();
            string toReplace = '"'.ToString();
            string path      = input.Replace(toReplace, string.Empty);

            string[]      sources = fileClass.Read(path);
            List <string> proxies = new List <string>();

            sourcesAmount = sources.Length;
            Console.Title = $"tax0r's Proxyleecher 2021 - Scraped -> {scrapedAmount} | Sources -> {sourcesAmount}";

            foreach (string source in sources)
            {
                Console.WriteLine(pNeutral + source, Color.Green);

                string[] proxiesFound = leecherClass.GetProxies(source);
                foreach (string proxieFound in proxiesFound)
                {
                    Console.WriteLine(pGood + proxieFound, Color.LightGreen);
                    proxies.Add(proxieFound);
                    scrapedAmount++;
                    Console.Title = $"tax0r's Proxyleecher 2021 - Scraped -> {scrapedAmount} | Sources -> {sourcesAmount}";
                }
            }

            string[] disctinctProxies = proxies.Distinct().ToArray();
            Console.WriteLine($"{pNeutral}Total proxies found -> " + proxies.ToArray().Length, Color.LightPink);
            Console.WriteLine($"{pNeutral}Distinct proxies found -> " + disctinctProxies.Length, Color.LightPink);

            path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\" + fileClass.Name(disctinctProxies.Length);
            fileClass.Save(path, disctinctProxies);

            Console.WriteLine("press any key to continue...");
            Console.ReadKey();
        }
示例#17
0
        // Навігація по файловій системі - подвійний клік на елементі ListView
        private void listView1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            // Отримуємо інформацію за кліком на елемент ListView за індексом та SubItems[0]
            try
            {
                int    selectedIndex = listView1.SelectedIndices[0];
                string rootPath      = listView1.Items[selectedIndex].SubItems[0].Text,
                       extens        = listView1.Items[selectedIndex].SubItems[2].Text;

                if (extens == @"Папка" || extens == @"Диск")
                {
                    RefreshListView(rootPath, listView1);
                    GlobalNavigationStr    = rootPath;
                    toolStripTextBox1.Text = rootPath;
                } //якщо обрана директорія
                else if (extens == @"text")
                {
                    Form3.FileToBeOpened = rootPath;
                    Form3 form3 = new Form3();
                    form3.Show();
                } //якщо обрана таблиця
                else if (extens == @"html")
                {
                    FileClass file = new FileClass(rootPath);
                    ParseHTML html = new ParseHTML(file.GetFullPath(), file.GetParentPath(), file.GetName());
                    html.Parse();
                } //якщо обраний html
                else if (extens == @"txt")
                {
                    TextEditor te = new TextEditor(rootPath);
                    te.Owner = this;
                    te.Show();
                } //якщо обраний текстовий файл
                else
                {
                    NewTestingClass n    = new NewTestingClass();
                    FileClass       file = new FileClass(rootPath);
                    if (n.TestGettingFileName(file))
                    {
                        MessageBox.Show("OK!!!");
                    }
                } //якщо обрано щось інше - не робити нічого
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
示例#18
0
        private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            //FormTypeTitle ftt = new FormTypeTitle();
            //ftt.Text = "报表名称";
            //ftt.TypeTitle = "报表名称";
            //if (ftt.ShowDialog() == DialogResult.OK)
            //{
            //    //FileClass.ExportToExcelOld(ftt.TypeTitle, "", this.gridControl1);



            //}
            DataTable dt = ConvertXtrTreeListToDataTable(treeList1);

            FileClass.ExportExcel(dt, forecastReport.Title, false, false);
        }
示例#19
0
        public static void Main()
        {
            // var items = new List<Item>();
            // var test = new Test();
            //test.AddTestObjects(items);
            //var users = new List<User>();
            //var testUsers = new TestUsers();
            //testUsers.AddTestObjects(users);
            //Register.Serialize(users);
            var file        = FileClass.Deserialize();
            var usersFile   = Login.Deserialize();
            var itemFactory = new ItemFactory();
            var commandMenu = new CommandMenu();

            commandMenu.Menu(file, itemFactory, usersFile);
        }
示例#20
0
文件: FileHelper.cs 项目: zkg642/JXXZ
        /// <summary>
        /// 二进制保存文件
        /// </summary>
        /// <param name="fileBytes">文件二进制数组</param>
        /// <param name="FileType">文件类型</param>
        /// <param name="FilePath">保存的路径</param>
        /// <returns></returns>
        public static FileClass FileSave(byte[] fileBytes, string FileType, string FilePath)
        {
            DateTime  dt = DateTime.Now;
            FileClass fc = new FileClass();

            //原图
            if (!Directory.Exists(FilePath))
            {
                Directory.CreateDirectory(FilePath);
            }
            string OriginalPathYear = FilePath + "\\" + dt.Year;

            if (!Directory.Exists(OriginalPathYear))
            {
                Directory.CreateDirectory(OriginalPathYear);
            }
            string OriginalPathdate = OriginalPathYear + "\\" + dt.ToString("yyyyMMdd");

            if (!Directory.Exists(OriginalPathdate))
            {
                Directory.CreateDirectory(OriginalPathdate);
            }
            string timeStr = dt.ToString("yyyyMMddHHmmssffff") + new Random().Next(10000, 99999);

            string fileName = timeStr + FileType;
            string OPath    = Path.Combine(OriginalPathdate, fileName);

            FileStream fstream = File.Create(OPath, fileBytes.Length);

            try
            {
                fstream.Write(fileBytes, 0, fileBytes.Length);   //二进制转换成文件
                fc.FilesPath = dt.Year + "/" + dt.ToString("yyyyMMdd") + "/" + fileName;
                fc.FilesName = fileName;
                fc.FilesType = FileType;
            }
            catch (Exception ex)
            {
                //抛出异常信息
            }
            finally
            {
                fstream.Close();
            }
            return(fc);
        }
示例#21
0
        public HttpResponseMessage AddLog(YH_YhLogModel model)
        {
            int success = bll.AddLog(model);

            string[]         fileClass = model.uploadpanelValue;
            List <FileClass> list      = new List <FileClass>();

            if (fileClass != null && fileClass.Length > 0)
            {
                foreach (var item in fileClass)
                {
                    FileClass file = new FileClass();
                    JObject   jo   = new JObject();
                    jo = (JObject)JsonConvert.DeserializeObject(item);
                    file.OriginalPath = jo["OriginalPath"] == null ? "" : jo["OriginalPath"].ToString();
                    file.OriginalName = jo["OriginalName"] == null ? "" : jo["OriginalName"].ToString();
                    file.OriginalType = jo["OriginalType"] == null ? "" : jo["OriginalType"].ToString();
                    file.size         = jo["size"] == null ? 0 : (double)jo["size"];
                    list.Add(file);
                }
            }

            foreach (var item in list)
            {
                YH_FileModel filemodel = new YH_FileModel();
                filemodel.filesource = 2;
                filemodel.sourceid   = success;
                filemodel.filename   = item.OriginalName;
                filemodel.filetype   = item.OriginalType;
                filemodel.filepath   = item.OriginalPath;
                filemodel.filesize   = item.size;
                filebll.AddFile(filemodel);
            }

            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);

            if (success > 0)
            {
                response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            }
            else
            {
                response.Content = new StringContent("{\"success\":false}", Encoding.GetEncoding("UTF-8"), "text/html");
            }
            return(response);
        }
        public ActionResult UploadFile(FileClass _file)
        {
            if (HttpContext.Request.Files[0].ContentLength == 0)
            {
                ModelState.AddModelError("file", "File is null , Please set Image");
                return(View());
            }

            _file.image = HttpContext.Request.Files[0];

            if (_file.image != null)
            {
                fileupload.UploadFile(_file, transactionRepository, Session["ID"].ToString());
            }

            return(RedirectToRoute(new { Controller = "Transaction", Action = "Transactionlist" }));
        }
示例#23
0
        private void simpleAdd_Click(object sender, EventArgs e)
        {
            FileClass fc = null;

            this.openFileDialog.Multiselect      = true;
            this.openFileDialog.RestoreDirectory = true;
            this.openFileDialog.Filter           = "文本文件(*.txt)|*.txt|图片文件(*.jpg)|*.jpg|压缩文件(*.zip)|*.zip|所有文件(*.*)|*.*";
            if (this.openFileDialog.ShowDialog() == DialogResult.OK)
            {
                string[] filenames = this.openFileDialog.FileNames;
                for (int i = 0; i < filenames.Length; i++)
                {
                    FileInfo f   = new FileInfo(filenames[i]);
                    string   ext = f.Extension.ToLower();
                    switch (ext)
                    {
                    //case ".rtf":
                    //case ".pdf":
                    //case ".txt":
                    //case ".doc":
                    //case ".cs":
                    case ".jpg":
                        fc           = new FileClass();
                        fc.filePath  = filenames[i];
                        fc.fileName  = f.Name;
                        fc.size      = f.Length + "字節";
                        fc.Desc      = f.Name;
                        fc.Extension = ext;
                        fc.image     = Image.FromFile(filenames[i]);
                        list.Add(fc);
                        break;

                    default:
                        fc           = new FileClass();
                        fc.filePath  = filenames[i];
                        fc.fileName  = f.Name;
                        fc.Extension = ext;
                        fc.size      = f.Length + "字節";
                        list.Add(fc);
                        break;
                    }
                }
                this.gridControl1.RefreshDataSource();
            }
        }
示例#24
0
        private Task DoAsync(List<string> inFiles, string outFile, IProgress<int> progress, IProgress<string> progress_str)
        {
            return Task.Run(() =>
				{
					int no_parsed = 0;
					FileClass the_file = new FileClass(this, progress, progress_str);

					progress.Report(no_parsed);

					foreach (string filename in inFiles)
					{
						the_file.processFile(filename);
						progress.Report(no_parsed += (100 / inFiles.Count));
					}

					the_file.outputFile(outFile);
				});
        }
示例#25
0
        public ActionResult Create([Bind(Include = "FileClassId,Name,File")] FileClass fileClass, HttpPostedFileBase upload)
        {
            if (ModelState.IsValid)
            {
                if (upload != null)
                {
                    int    filelength = upload.ContentLength;
                    byte[] Myfile     = new byte[filelength];
                    upload.InputStream.Read(Myfile, 0, filelength);
                    fileClass.File = Myfile;
                    db.FileClasses.Add(fileClass);
                    db.SaveChanges();
                    return(RedirectToAction("Index"));
                }
            }

            return(View(fileClass));
        }
示例#26
0
        public ActionResult RemoveForm(string keyValue)
        {
            //删除图片
            var model = BannerBLL.Instance.GetEntity(keyValue);

            if (model != null)
            {
                //删除文件
                FileClass.DeleteFile(model.ImgPath);
                //删除数据
                BannerBLL.Instance.Delete(keyValue);
                return(Success("删除成功。"));
            }
            else
            {
                return(Error("删除失败。"));
            }
        }
示例#27
0
        public HttpResponseMessage AddContract(YH_ContractModel model)
        {
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);

            HttpRequestBase request = ((HttpContextWrapper)this.Request.Properties["MS_HttpContext"]).Request;

            string[]         fileClass = model.uploadpanelValue;
            List <FileClass> list      = new List <FileClass>();

            if (fileClass != null && fileClass.Length > 0)
            {
                foreach (var item in fileClass)
                {
                    FileClass file = new FileClass();
                    JObject   jo   = new JObject();
                    jo = (JObject)JsonConvert.DeserializeObject(item);
                    file.OriginalPath = jo["OriginalPath"] == null ? "" : jo["OriginalPath"].ToString();
                    file.OriginalName = jo["OriginalName"] == null ? "" : jo["OriginalName"].ToString();
                    file.OriginalType = jo["OriginalType"] == null ? "" : jo["OriginalType"].ToString();
                    file.size         = jo["size"] == null ? 0 : (double)jo["size"];
                    list.Add(file);
                }
            }


            if (!string.IsNullOrEmpty(request.Form["userid"]))
            {
                model.createuserid = Convert.ToInt32(request.Form["userid"]);
            }
            model.contactendtime = model.endtime;
            model.currentmoney   = model.summoney;
            int success = bll.AddContract(model, list);

            if (success > 0)
            {
                response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            }
            else
            {
                response.Content = new StringContent("{\"success\":false}", Encoding.GetEncoding("UTF-8"), "text/html");
            }
            return(response);
        }
示例#28
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int er = 0;

            if (cmbProduct.SelectedValue == null || cmbProduct.SelectedValue == "")
            {
                er++;
                ep.SetError(cmbProduct, "Required");
            }
            if (string.IsNullOrEmpty(txtTitle.Text))
            {
                er++;
                ep.SetError(txtTitle, "Required");
            }
            if (pbImage.Image == null)
            {
                er++;
                ep.SetError(pbImage, "Required");
            }
            if (er > 0)
            {
                return;
            }

            ProductImage productImage = new ProductImage();

            productImage.ProductId = Convert.ToInt32(cmbProduct.SelectedValue);
            productImage.Title     = txtTitle.Text;
            productImage.Image     = FileClass.ImageToByte(pbImage.Image);

            if (productImage.Insert())
            {
                MessageBox.Show("Image Saved");
                cmbProduct.SelectedValue = -1;
                txtTitle.Text            = "";
                pbImage.Image            = null;
                cmbProduct.Focus();
            }
            else
            {
                MessageBox.Show(productImage.Error);
            }
        }
示例#29
0
        public HttpResponseMessage AddApproveInf(LicenseModel model)
        {
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);

            HttpRequestBase request = ((HttpContextWrapper)this.Request.Properties["MS_HttpContext"]).Request;

            string[]         fileClass = model.uploadpanelValue;
            List <FileClass> list      = new List <FileClass>();

            if (fileClass != null && fileClass.Length > 0)
            {
                foreach (var item in fileClass)
                {
                    FileClass file = new FileClass();
                    JObject   jo   = new JObject();
                    jo = (JObject)JsonConvert.DeserializeObject(item);
                    file.OriginalPath = jo["OriginalPath"] == null ? "" : jo["OriginalPath"].ToString();
                    file.OriginalName = jo["OriginalName"] == null ? "" : jo["OriginalName"].ToString();
                    file.OriginalType = jo["OriginalType"] == null ? "" : jo["OriginalType"].ToString();
                    file.size         = jo["size"] == null ? 0 : (double)jo["size"];
                    list.Add(file);
                }
            }

            if (!string.IsNullOrEmpty(request.Form["userid"]))
            {
                model.createuserid = Convert.ToInt32(request.Form["userid"]);
            }

            int success = bll.AddApproveInf(model, list);

            if (success > 0)
            {
                #region 添加日志
                SystemLogBLL slbll = new SystemLogBLL();
                slbll.WriteSystemLog("行政许可", "", Convert.ToInt32(request.Form["userid"]));
                #endregion

                response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            }
            return(response);
        }
示例#30
0
        public object SmmemberDeal(Audit_project_wModel model)
        {
            HttpRequestBase request = ((HttpContextWrapper)this.Request.Properties["MS_HttpContext"]).Request;
            //文件上传
            List <FileClass> list       = new List <FileClass>();
            string           OriginPath = ConfigManageClass.AdminApprovalOrignalPath;
            string           smallPath  = ConfigManageClass.AdminApprovalSmallPath;

            if (model.base64 != null)
            {
                for (int i = 0; i < model.base64.Length; i++)
                {
                    string   imgArray = model.base64[i];
                    string[] spilt    = imgArray.Split(',');
                    if (spilt.Length > 0)
                    {
                        byte[]    imgByte = Convert.FromBase64String(spilt[1]);
                        FileClass imgFile = FileFactory.FileUpload(imgByte, ".jpg", OriginPath, smallPath, 100, 100);
                        list.Add(imgFile);
                    }
                }
            }
            model.filelist = list;
            int success = bll.memberDeal(model);

            if (success > 0)
            {
                return(new
                {
                    success = true,
                    msg = "流程处理成功"
                });
            }
            else
            {
                return(new
                {
                    success = false,
                    msg = "流程派遣失败",
                });
            }
        }
示例#31
0
        private void generateMetodoDao(StringBuilder sb, FileClass item)
        {
            //public Dao<T> TDao { get { return tDao; }  }
            string classe = item.ToString();

            sb.Append("        public Dao");
            sb.Append("<");
            sb.Append(classe);
            sb.Append(">");
            sb.Append(" ");
            sb.Append(classe);
            sb.Append("Dao");
            sb.Append("{ get {");
            sb.Append("return ");
            //poe novamente a primeira em minuscula
            classe = classe.FirstCharToLower();
            sb.Append(classe);
            sb.Append("Dao");
            sb.AppendLine(";}  }");
        }
示例#32
0
        private void generateDbSet(StringBuilder sb, FileClass item)
        {
            //public virtual DbSet<T> TEntity { get; set; }
            //poe novamente a primeira em maiuscula
            string classe = item.ToString();

            sb.Append("        public virtual DbSet");
            sb.Append("<");
            sb.Append(classe);
            sb.Append(">");
            sb.Append(" ");

            if (classe.EndsWith("ao"))
            {
                string plural = classe.RemoverLastCharCount(2);
                sb.Append(plural);
                sb.Append("oes");//pluraliza
            }
            else if (classe.EndsWith("l"))
            {
                string plural = classe.RemoverLastCharCount(2);
                sb.Append(plural);
                sb.Append("ais");//pluraliza
            }
            else if (classe.EndsWith("r"))
            {
                string plural = classe + "es";
                sb.Append(plural);//pluraliza
            }
            else if (classe.EndsWith("s"))
            {
                string plural = classe.PluralizeStringOnUpperCase();
                sb.Append(plural);//pluraliza
            }
            else
            {
                sb.Append(classe);
                sb.Append("s");//pluraliza
            }
            sb.AppendLine("{ get; set; } ");
        }