예제 #1
0
 public int Update(WebDownload_Info data)
 {
     using (var db = new DBExecutor().GetDatabase())
     {
         return(db.Update(data));
     }
 }
예제 #2
0
 public int Update(long WebDownLoadID, WebDownload_Info data, IEnumerable <string> columns)
 {
     using (var db = new DBExecutor().GetDatabase())
     {
         return(db.Update(data, WebDownLoadID, columns));
     }
 }
예제 #3
0
        public JsonResult SaveDownLoad(WebDownload_Info data)
        {
            data.DeptName = getDeptName(sessionData.trading.Dept.Value);
            ResultBase result = new ResultBase();

            result.setMessage("Done");
            if (string.IsNullOrEmpty(data.DocumentName))
            {
                result.setErrorMessage("檔案名稱不得為空白");
            }
            if (result.JsonReturnCode > -1)
            {
                if (data.IsActive == 1)
                {
                    //審核專用
                    var verdata = DownloadMan.GetBySN(data.WebDownLoadID);
                    verdata.IsActive     = 1;
                    verdata.VerifiedDate = DateTime.Now;
                    DownloadMan.Update(verdata);
                    return(Json(result, JsonRequestBehavior.DenyGet));
                }
                else
                {
                    //一但有任何異動,自動下架
                    data.IsActive = 0;
                }

                data.LastUpdate  = DateTime.Now;
                data.LastUpdator = sessionData.trading.LoginId;
                var olddata = DownloadMan.GetBySN(data.WebDownLoadID);
                //check must has uploaded files.
                try
                {
                    checkUploadfilesWDD(data, olddata);
                    if (string.IsNullOrEmpty(data.File1))
                    {
                        throw new Exception();
                    }
                }
                catch (Exception)
                {
                    result.setErrorMessage("檔案必需上傳。");
                }
                if (data.WebDownLoadID > 0)
                {
                    DownloadMan.Update(data);
                }
                else
                {
                    DownloadMan.Insert(data);
                }
            }
            return(Json(result, JsonRequestBehavior.DenyGet));
        }
예제 #4
0
 public long Insert(WebDownload_Info data)
 {
     using (var db = new DBExecutor().GetDatabase())
     {
         long NewID  = 0;
         var  result = db.Insert(data);
         if (result != null)
         {
             long.TryParse(result.ToString(), out NewID);
         }
         return(NewID);
     }
 }
예제 #5
0
        public long Insert(WebDownload_Info data)
        {
            long newID = 0;

            try
            {
                newID = new WebDownload_Repo().Insert(data);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
            }
            return(newID);
        }
예제 #6
0
        private void checkUploadfilesWDD(WebDownload_Info NewData, WebDownload_Info OldData)
        {
            string Prefix = string.Empty;

            Prefix = "WebDownLoadFile1";
            if (sessionData.trading.UploadFiles.Keys.Contains(Prefix))
            {
                if (string.Compare("DELETE", sessionData.trading.UploadFiles[Prefix], true) == 0)
                {
                    NewData.File1 = string.Empty;
                }
                else
                {
                    NewData.File1 = CopyFile(sessionData.trading.UploadFiles[Prefix]);
                }
            }
            else
            {
                NewData.File1 = OldData.File1;
            }
        }
예제 #7
0
 public bool Update(WebDownload_Info data)
 {
     return(new WebDownload_Repo().Update(data) > 0);
 }
예제 #8
0
 public bool Update(long WebDownLoadID, WebDownload_Info data, IEnumerable <string> columns)
 {
     return(new WebDownload_Repo().Update(WebDownLoadID, data, columns) > 0);
 }