Example #1
0
 public ContentResult SetDefult(int ID)
 {
     PDAApp.UpdateIsOK();
     if (PDAApp.SetIDIsOK(ID) > 0)
     {
         return(Content("ok"));
     }
     else
     {
         return(Content("设置失败!"));
     }
 }
Example #2
0
        public ContentResult ToAddApp(FormCollection userform)
        {
            string msg = string.Empty;
            PDAApp app = new PDAApp();

            app.Ver     = userform["Ver"];
            app.AppName = userform["AppName"];

            if (userform["IsOK"] != null)
            {
                app.IsOK = userform["IsOK"] == "on" ? true : false;
            }
            var file = Request.Files[0];

            string FilePath = "/File/APP/";
            string FileName = "";
            string errMsg   = "";

            if (!FileDeal(Request.Files[0], FilePath, out FileName, out errMsg))
            {
                return(Content(errMsg));
            }

            SizeUnit sizeObj = StorageUnit.AutoConver(Request.Files[0].ContentLength);

            app.Size      = sizeObj.size.ToString() + sizeObj.unit;
            app.AppName   = Request.Files[0].FileName;
            app.AppPath   = FilePath + Request.Files[0].FileName;
            app.CreatTime = CommonFunc.GetNowTimestamp();

            if (app.IsOK)
            {
                PDAApp.UpdateIsOK();
            }

            if (app.InsertAndReturnIdentity() > 0)
            {
                msg = "ok";
            }
            else
            {
                msg = "添加失败!";
            }

            return(Content(msg));
        }