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

            Prefix = "ContentImage1";
            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 = "ContentImage2";
            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 = "ContentImage3";
            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(AboutService_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(AboutService_Info data)
        {
            long newID = 0;

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

            result.setMessage("Done");

            if (data.IsActive == 1)
            {
                //審核專用
                var verdata = AboutSrv.GetBySN(data.AboutServiceId);
                verdata.IsActive     = 1;
                verdata.VerifiedDate = DateTime.Now;
                AboutSrv.Update(verdata);
                return(Json(result, JsonRequestBehavior.DenyGet));
            }
            else
            {
                //一但有任何異動,自動下架
                data.IsActive = 0;
            }
            //check is there are any data under the categoary.
            if (data.UnitName == null || data.UnitName.Trim().Length == 0)
            {
                result.setErrorMessage("單元名稱不得為空白");
            }
            if (result.JsonReturnCode > -1)
            {
                data.LastUpdate  = DateTime.Now;
                data.LastUpdator = sessionData.trading.LoginId;

                if (data.AboutServiceId > 0)
                {
                    var olddata = AboutSrv.GetBySN(data.AboutServiceId);
                    checkSrvUploadfiles(data, olddata);

                    AboutSrv.Update(data);
                }
                else
                {
                    checkSrvUploadfiles(data, new AboutService_Info()
                    {
                    });
                    AboutSrv.Insert(data);
                }
            }
            return(Json(result, JsonRequestBehavior.DenyGet));
        }
Пример #7
0
 public bool Update(AboutService_Info data)
 {
     return(new AboutService_Repo().Update(data) > 0);
 }
Пример #8
0
 public bool Update(long AboutServiceId, AboutService_Info data, IEnumerable <string> columns)
 {
     return(new AboutService_Repo().Update(AboutServiceId, data, columns) > 0);
 }