Ejemplo n.º 1
0
        public int Upload(String fileName)
        {
            db = new CrowdfundingEntities();

            String[] substrings = fileName.Split('.');
            String   firstname  = "";
            String   secondname = "";

            for (int i = 0; i < (substrings.Length - 1); i++)
            {
                if (i != 0)
                {
                    firstname = firstname + "." + substrings[i];
                }
                else
                {
                    firstname = substrings[i];
                }
            }
            secondname = substrings[(substrings.LongLength - 1)];


            secondname = secondname.ToLower();

            System.DateTime nowTime = System.DateTime.Now;
            this.mTime = nowTime;
            String datestrs = nowTime.ToString("yyyy/MM/dd hh:mm:ss");

            this.temp_str_array = datestrs.Split(' ');
            this.temp_str_array = this.temp_str_array[0].Split('/');

            var query = from d in db.CfFile select d;

            Models.CfFile qfile = new Models.CfFile();
            qfile.firstName  = firstname;
            qfile.secondName = secondname;
            qfile.makeTime   = nowTime;
            qfile.stEnable   = "Y";

            db.CfFile.Add(qfile);
            db.SaveChanges();

            this.lastid = qfile.id;

            return(this.lastid);
        }