コード例 #1
0
ファイル: TrialPictureDao.cs プロジェクト: lxh2014/gigade-net
 public string DeletePic(TrialPictureQuery query)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat("set sql_safe_updates=0;delete from trial_picture where share_id={0};set sql_safe_updates = 1; ", query.share_id);
         return sql.ToString();
     }
     catch (Exception ex)
     {
         throw new Exception("TrialPictureDao.DeletePic-->"+sql.ToString()+ex.Message,ex);
     }
 }
コード例 #2
0
ファイル: TrialPictureDao.cs プロジェクト: lxh2014/gigade-net
 public List<TrialPictureQuery> QueryPic(TrialPictureQuery query)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat("SELECT tp.share_id,tp.image_filename,tp.image_sort,tp.image_state,tp.image_createdate from trial_picture tp where tp.share_id={0};", query.share_id);
         return _access.getDataTableForObj<TrialPictureQuery>(sql.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("TrialRecordDao-->QueryPic-->" + sql.ToString() + ex.Message, ex);
     }
 }
コード例 #3
0
ファイル: TrialPictureDao.cs プロジェクト: lxh2014/gigade-net
 public string SavePic(TrialPictureQuery query)
 {
     StringBuilder sql = new StringBuilder();
     try
     {
         sql.AppendFormat("insert into trial_picture (share_id,image_filename,image_sort,image_state,image_createdate) VALUES({0},'{1}',{2},{3},{4});", query.share_id, query.image_filename, query.image_sort, query.image_state, CommonFunction.GetPHPTime());
         return sql.ToString();
     }
     catch (Exception ex)
     {
         throw new Exception("TrialPictureDao.SavePic-->"+sql.ToString()+ex.Message,ex);
     }
     throw new NotImplementedException();
 }
コード例 #4
0
ファイル: TrialPictureMgr.cs プロジェクト: lxh2014/gigade-net
           public int DeleteAllPic(TrialPictureQuery query)
           {
               try
               {
                   return _ITrialPictureDao.DeleteAllPic(query);
               }
               catch (Exception ex)
               {
                   throw new Exception("TrialPictureMgr.DeleteAllPic-->" + ex.Message, ex);
               }

           }
コード例 #5
0
        public HttpResponseBase TrialRecordSave()
        {
            string json = string.Empty;
            string jsonStr = string.Empty;
            TrialShareQuery query = new TrialShareQuery();
            TrialPictureQuery trialP = new TrialPictureQuery();
            List<TrialPictureQuery> trialPList = new List<TrialPictureQuery>();
            _ITrialPictureMgr = new TrialPictureMgr(mySqlConnectionString);
            try
            {
                query.share_id = Convert.ToInt32(Request["share_id"]);
                #region 處理圖片
                try
                {
                    if (!string.IsNullOrEmpty(Request.Params["picInfo"]))
                    {

                        string[] picInfo = Request.Params["picInfo"].Split(';');
                        for (int i = 0; i < picInfo.Length - 1; i++)
                        {
                            string[] perValue = picInfo[i].Split(',');
                            trialP = new TrialPictureQuery();
                            if (!string.IsNullOrEmpty(perValue[0])) { trialP.share_id = query.share_id; }
                            if (!string.IsNullOrEmpty(perValue[1])) { trialP.image_filename = perValue[1]; }
                            if (!string.IsNullOrEmpty(perValue[2])) { trialP.image_sort = Convert.ToUInt32(perValue[2]); }
                            if (!string.IsNullOrEmpty(perValue[3])) { trialP.image_state = Convert.ToUInt32(perValue[3]); }
                            trialPList.Add(trialP);
                        }
                        _ITrialPictureMgr = new TrialPictureMgr(mySqlConnectionString);
                        _ITrialPictureMgr.SavePic(trialPList, trialP);
                    }
                    else
                    {
                        _ITrialPictureMgr.DeleteAllPic(trialP);
                    }
                }
                catch (Exception ex)
                {
                    Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                    logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                    logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                    log.Error(logMessage);
                    json = "{failure:true}";
                }
                #endregion
                _ITrialRecordMgr = new TrialRecordMgr(mySqlConnectionString);
                if (!string.IsNullOrEmpty(Request.Params["trial_id"]))
                {
                    query.trial_id = Convert.ToInt32(Request.Params["trial_id"].ToString());
                }
                if (!string.IsNullOrEmpty(Request.Params["user_name"]))
                {
                    query.user_name = Request.Params["user_name"].ToString();
                }
                if (!string.IsNullOrEmpty(Request.Params["user_gender"]))
                {
                    query.user_gender = Convert.ToInt32(Request.Params["user_gender"].ToString());
                }
                if (!string.IsNullOrEmpty(Request.Params["niming"]))
                {
                    if (Request.Params["niming"] == "on")
                    {
                        query.is_show_name = 0;//匿名
                    }
                    else
                    {
                        query.is_show_name = 1;//不匿名
                    }
                }
                if (!string.IsNullOrEmpty(Request.Params["content"]))
                {
                    query.content = Request.Params["content"].ToString();
                }
                if (!string.IsNullOrEmpty(Request.Params["status"]))
                {
                    query.status = Convert.ToInt32(Request.Params["status"].ToString());
                }
                int j = _ITrialRecordMgr.TrialRecordSave(query);
                if (j > 0)
                {
                    json = "{success:true}";
                }
                else
                {
                    json = "{failure:true}";
                }
            }
            catch (Exception ex)
            {
                Log4NetCustom.LogMessage logMessage = new Log4NetCustom.LogMessage();
                logMessage.Content = string.Format("TargetSite:{0},Source:{1},Message:{2}", ex.TargetSite.Name, ex.Source, ex.Message);
                logMessage.MethodName = System.Reflection.MethodBase.GetCurrentMethod().Name;
                log.Error(logMessage);
                json = "{failure:true}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
コード例 #6
0
 public string QueryPic()
 {
     string json = string.Empty;
     string serverElePath = imgServerPath + elementPath;
     List<TrialPictureQuery> picList = new List<TrialPictureQuery>();
     TrialPictureQuery query = new TrialPictureQuery();
     _ITrialPictureMgr = new TrialPictureMgr(mySqlConnectionString);
     if (!string.IsNullOrEmpty(Request.Params["share_id"]))
     {
         query.share_id = Convert.ToInt32(Request.Params["share_id"]);
     }
     picList = _ITrialPictureMgr.QueryPic(query);
     foreach (var item in picList)
     {
         if (item.image_filename != "")
         {
             //item.image_filename = serverElePath + GetDetailFolder(item.image_filename) + item.image_filename;
             item.image_filename = serverElePath + item.image_filename;
         }
     }
     json = "{success:true,items:" + JsonConvert.SerializeObject(picList) + "}";
     return json;
 }