Пример #1
0
 public int Update(Guide_Info data)
 {
     using (var db = new DBExecutor().GetDatabase())
     {
         return(db.Update(data));
     }
 }
Пример #2
0
 public int Update(long GuideId, Guide_Info data, IEnumerable <string> columns)
 {
     using (var db = new DBExecutor().GetDatabase())
     {
         return(db.Update(data, GuideId, columns));
     }
 }
Пример #3
0
        private void checkUploadfiles(Guide_Info NewData, Guide_Info OldData)
        {
            if (OldData == null)
            {
                OldData = new Guide_Info();
            }
            string Prefix = string.Empty;

            Prefix = "GuideImage1";
            if (sessionData.trading.UploadFiles.Keys.Contains(Prefix))
            {
                if (string.Compare("DELETE", sessionData.trading.UploadFiles[Prefix], true) == 0)
                {
                    NewData.Image1 = string.Empty;
                }
                else
                {
                    NewData.Image1 = CopyFile(sessionData.trading.UploadFiles[Prefix]);
                }
            }
            else
            {
                NewData.Image1 = OldData.Image1;
            }

            Prefix = "GuideImage2";
            if (sessionData.trading.UploadFiles.Keys.Contains(Prefix))
            {
                if (string.Compare("DELETE", sessionData.trading.UploadFiles[Prefix], true) == 0)
                {
                    NewData.Image2 = string.Empty;
                }
                else
                {
                    NewData.Image2 = CopyFile(sessionData.trading.UploadFiles[Prefix]);
                }
            }
            else
            {
                NewData.Image2 = OldData.Image2;
            }

            Prefix = "GuideImage3";
            if (sessionData.trading.UploadFiles.Keys.Contains(Prefix))
            {
                if (string.Compare("DELETE", sessionData.trading.UploadFiles[Prefix], true) == 0)
                {
                    NewData.Image3 = string.Empty;
                }
                else
                {
                    NewData.Image3 = CopyFile(sessionData.trading.UploadFiles[Prefix]);
                }
            }
            else
            {
                NewData.Image3 = OldData.Image3;
            }
        }
Пример #4
0
 public long Insert(Guide_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(Guide_Info data)
        {
            long newID = 0;

            try
            {
                newID = new Guide_Repo().Insert(data);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
            }
            return(newID);
        }
Пример #6
0
        public JsonResult SaveGuide(Guide_Info data)
        {
            ResultBase result = new ResultBase();

            result.setMessage("Done");
            if (data.IsActive == 1)
            {
                //審核專用
                var verdata = GuideMan.GetBySN(data.GuideId);
                verdata.IsActive     = 1;
                verdata.VerifiedDate = DateTime.Now;
                GuideMan.Update(verdata);
                return(Json(result, JsonRequestBehavior.DenyGet));
            }
            else
            {
                //一但有任何異動,自動下架
                data.IsActive = 0;
            }
            if (string.IsNullOrEmpty(data.ItemName))
            {
                result.setErrorMessage("項目名稱不得為空白");
            }
            if (result.JsonReturnCode > -1)
            {
                data.LastUpdate  = DateTime.Now;
                data.LastUpdator = sessionData.trading.LoginId;
                var olddata = GuideMan.GetBySN(data.GuideId);
                checkUploadfiles(data, olddata);
                if (data.GuideId > 0)
                {
                    GuideMan.Update(data);
                }
                else
                {
                    GuideMan.Insert(data);
                }
            }
            return(Json(result, JsonRequestBehavior.DenyGet));
        }
Пример #7
0
 public bool Update(Guide_Info data)
 {
     return(new Guide_Repo().Update(data) > 0);
 }
Пример #8
0
 public bool Update(long GuideId, Guide_Info data, IEnumerable <string> columns)
 {
     return(new Guide_Repo().Update(GuideId, data, columns) > 0);
 }