Example #1
0
 public int Update(TeamIntroduce_Info data)
 {
     using (var db = new DBExecutor().GetDatabase())
     {
         return(db.Update(data));
     }
 }
Example #2
0
 public int Update(long TeamIntroduceId, TeamIntroduce_Info data, IEnumerable <string> columns)
 {
     using (var db = new DBExecutor().GetDatabase())
     {
         return(db.Update(data, TeamIntroduceId, columns));
     }
 }
Example #3
0
        public JsonResult SaveTeamIntroduce(TeamIntroduce_Info data)
        {
            ResultBase result = new ResultBase();

            result.setMessage("Done");
            if (data.IsActive == 1)
            {
                //審核專用
                var verdata = TeamMan.GetBySN(data.TeamIntroduceId);
                verdata.IsActive     = 1;
                verdata.VerifiedDate = DateTime.Now;
                TeamMan.Update(verdata);
                return(Json(result, JsonRequestBehavior.DenyGet));
            }
            else
            {
                //一但有任何異動,自動下架
                data.IsActive = 0;
            }
            if (string.IsNullOrEmpty(data.DeptName) || data.DeptName.StartsWith("請選擇"))
            {
                result.setErrorMessage("門診類別為必選");
            }
            if (string.IsNullOrEmpty(data.CostName) || data.CostName.StartsWith("請選擇"))
            {
                result.setErrorMessage("科別為必選");
            }
            if (string.IsNullOrEmpty(data.WebMenuCode))
            {
                result.setErrorMessage("網頁選單代號不得為空白");
            }
            if (string.IsNullOrEmpty(data.WebMenuName))
            {
                result.setErrorMessage("內容不得為空白");
            }
            if (result.JsonReturnCode > -1)
            {
                data.Dept        = data.DeptName;
                data.DeptName    = getDeptName(EnumHelper.GetEnumByName <WS_Dept_type>(data.Dept));
                data.LastUpdate  = DateTime.Now;
                data.LastUpdator = sessionData.trading.LoginId;
                var olddata = TeamMan.GetBySN(data.TeamIntroduceId);
                checkUploadfilesTeamIntro(data, olddata);
                if (data.TeamIntroduceId > 0)
                {
                    TeamMan.Update(data);
                }
                else
                {
                    TeamMan.Insert(data);
                }
            }
            return(Json(result, JsonRequestBehavior.DenyGet));
        }
Example #4
0
 public long Insert(TeamIntroduce_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);
     }
 }
Example #5
0
        public long Insert(TeamIntroduce_Info data)
        {
            long newID = 0;

            try
            {
                newID = new TeamIntroduce_Repo().Insert(data);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
            }
            return(newID);
        }
Example #6
0
 public bool Update(TeamIntroduce_Info data)
 {
     return(new TeamIntroduce_Repo().Update(data) > 0);
 }
Example #7
0
 public bool Update(long TeamIntroduceId, TeamIntroduce_Info data, IEnumerable <string> columns)
 {
     return(new TeamIntroduce_Repo().Update(TeamIntroduceId, data, columns) > 0);
 }
Example #8
0
        private void checkUploadfilesTeamIntro(TeamIntroduce_Info NewData, TeamIntroduce_Info OldData)
        {
            if (OldData == null)
            {
                OldData = new TeamIntroduce_Info();
            }
            string Prefix = string.Empty;

            Prefix = "TeamIntroduceImage1";
            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 = "TeamIntroduceImage2";
            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 = "TeamIntroduceImage3";
            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;
            }
            Prefix = "TeamIntroduceImage4";
            if (sessionData.trading.UploadFiles.Keys.Contains(Prefix))
            {
                if (string.Compare("DELETE", sessionData.trading.UploadFiles[Prefix], true) == 0)
                {
                    NewData.Image4 = string.Empty;
                }
                else
                {
                    NewData.Image4 = CopyFile(sessionData.trading.UploadFiles[Prefix]);
                }
            }
            else
            {
                NewData.Image4 = OldData.Image4;
            }
        }