Ejemplo n.º 1
0
 /// <summary>
 /// 獲取ScheduleParamer的list
 /// </summary>
 /// <param name="query">查詢條件</param>
 /// <returns></returns>
 public List<ScheduleParamer> GetScheduleParameterList(ScheduleParamer query, out int totalCount)
 {
     StringBuilder sb = new StringBuilder();
     StringBuilder sbcount = new StringBuilder();
     StringBuilder sbwhere = new StringBuilder();
     totalCount = 0;
     try
     {
         sbcount.Append("SELECT count(para_id) ");
         sb.AppendFormat(@"SELECT para_id,para_value,para_name,para_status,schedule_code");
         sbwhere.Append(" FROM schedule_paramer WHERE 1=1 ");
         sbwhere.AppendFormat("ORDER BY para_id DESC ");
         DataTable _dt = new DataTable();
         _dt = _dbAccess.getDataTable(sbcount.ToString() + sbwhere.ToString());
         if (_dt != null)
         {
             totalCount = Convert.ToInt32(_dt.Rows[0][0]);
         }
         sbwhere.AppendFormat(" LIMIT {0},{1} ", query.Start, query.Limit);
         return _dbAccess.getDataTableForObj<ScheduleParamer>(sb.ToString() + sbwhere.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("ScheduleParamerDao-->GetScheduleParameterList" + ex.Message + sb.ToString() + sbwhere.ToString(), ex);
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// ScheduleParamer表新增
 /// </summary>
 /// <param name="query">新增數據</param>
 /// <returns></returns>
 public int InsertScheduleParamer(ScheduleParamer query)
 {
     try
     {
         return _scheduleDao.InsertScheduleParamer(query);
     }
     catch (Exception ex)
     {
         throw new Exception("ScheduleParamerMgr-->InsertScheduleParamer" + ex.Message, ex);
     }
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 獲取ScheduleParamer表的list
 /// </summary>
 /// <param name="query">查詢條件</param>
 /// <returns></returns>
 public List<ScheduleParamer> GetScheduleParameterList(ScheduleParamer query, out int totaoCount)
 {
     try
     {
         return _scheduleDao.GetScheduleParameterList(query, out totaoCount);
     }
     catch (Exception ex)
     {
         throw new Exception("ScheduleParamerMgr-->GetScheduleParameterList" + ex.Message, ex);
     }
 }
 public HttpResponseBase ScheduleParamerAll()
 {
     string json = string.Empty;
     ScheduleParamer sp = new ScheduleParamer();
     try
     {
         //if (!string.IsNullOrEmpty(Request.Params["schedule_code"]))//判斷id是不是存在.也就是說是否選擇了運送方式.當id不為0時表示選擇了運送方式.
         //{
         //    sp.schedule_code = Request.Params["schedule_code"];
         //}
         sp.schedule_code = Request.Params["code"];
         _schmerMgr = new ScheduleParamerMgr(mySqlConnectionString);
         DataTable _dt = _schmerMgr.GetScheduleParamerList(sp.schedule_code);
         //根據行para_value和行para_name拼接成一個json
         int lenght = _dt.Rows.Count;
         json = "{";
         for (int i = 1; i <= _dt.Rows.Count; i++)
         {
             json = json + "\"" + _dt.Rows[i - 1]["para_name"] + "\":\"" + _dt.Rows[i - 1]["para_value"] + "\"";
             if (lenght == i)
             {
                 continue;
             }
             else
             {
                 json = json + ",";
             }
         }
         if (lenght > 0)
         {
             json = json + "}";
         }
         else
         {
             json = "{\"msg\":\"無數據信息\"}";
         }
     }
     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 = "{success:false}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// ScheduleParamer表新增
 /// </summary>
 /// <param name="query">新增數據</param>
 /// <returns></returns>
 public int InsertScheduleParamer(ScheduleParamer query)
 {
     StringBuilder sb = new StringBuilder();
     try
     {
         sb.AppendFormat("INSERT INTO schedule_paramer (para_value,para_name,para_status,schedule_code) VALUES (");
         sb.AppendFormat(" '{0}','{1}','{2}','{3}')", query.para_value, query.para_name, query.para_status, query.schedule_code);
         return _dbAccess.execCommand(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("ScheduleParamerDao-->InsertScheduleParamer" + ex.Message + sb.ToString(), ex);
     }
 }
 public HttpResponseBase ScheduleParamerList()
 {
     string json = string.Empty;
     ScheduleParamer sp = new ScheduleParamer();
     List<ScheduleParamer> spList = new List<ScheduleParamer>();
     int totalCount = 0;
     try
     {
         _schmerMgr = new ScheduleParamerMgr(mySqlConnectionString);
         sp.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
         sp.Limit = Convert.ToInt32(Request.Params["limit"] ?? "25");
         spList = _schmerMgr.GetScheduleParameterList(sp, out totalCount);
         json = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(spList, Formatting.Indented) + "}";//返回json數據
     }
     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 = "{success:false}";
     }
     this.Response.Clear();
     this.Response.Write(json);
     this.Response.End();
     return this.Response;
 }
        public HttpResponseBase DeleteScheduleParameter()
        {
            string json = string.Empty;
            ScheduleParamer sp = new ScheduleParamer();
            try
            {
                _schmerMgr = new ScheduleParamerMgr(mySqlConnectionString);
                string id = string.Empty;
                if (!string.IsNullOrEmpty(Request.Params["rowID"]))
                {
                    id = Request.Params["rowID"].ToString();
                }
                string[] ids = id.Split('|');
                for (int i = 0; i < ids.Length - 1; i++)
                {
                    sp.para_id = Convert.ToInt32(ids[i]);
                    if (sp.para_id > 0)
                    {
                        int delresult = _schmerMgr.DelScheduleParamer(sp);
                        if (delresult <= 0)
                        {
                            json = "{success:true,msg:'" + i + 1 + "'}";
                            break;
                        }
                    }
                    else
                    {
                        json = "{success:false}";
                        break;
                    }
                }
                json = "{success:true,msg:''}";//返回json數據
            }
            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 = "{success:false}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;

        }
 public JsonResult UpdateActive()
 {
     ScheduleParamer sp = new ScheduleParamer();
     try
     {
         _schmerMgr = new ScheduleParamerMgr(mySqlConnectionString);
         if (!string.IsNullOrEmpty(Request.Params["id"]))
         {
             sp.para_id = Convert.ToInt32(Request.Params["id"]);
         }
         if (!string.IsNullOrEmpty(Request.Params["active"]))
         {
             sp.para_status = Convert.ToInt32(Request.Params["active"].ToString());
         }
         if (sp.para_id != 0)
         {
             int res = _schmerMgr.UpdateActive(sp);
             if (res > 0)
             {
                 return Json(new { success = "true" });
             }
             else
             {
                 return Json(new { success = "false" });
             }
         }
         else
         {
             return Json(new { success = "false" });
         }
     }
     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);
         return Json(new { success = "false" });
     }
 }
        public HttpResponseBase ScheduleParamerSave()
        {
            string json = string.Empty;
            ScheduleParamer sp = new ScheduleParamer();
            try
            {
                _schmerMgr = new ScheduleParamerMgr(mySqlConnectionString);
                if (!string.IsNullOrEmpty(Request.Params["para_id"]))
                {
                    sp.para_id = Convert.ToInt32(Request.Params["para_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["para_value"]))
                {
                    sp.para_value = Request.Params["para_value"].ToString();
                }
                if (!string.IsNullOrEmpty(Request.Params["para_name"]))
                {
                    sp.para_name = Request.Params["para_name"].ToString();
                }
                if (!string.IsNullOrEmpty(Request.Params["schedule_code"]))
                {
                    sp.schedule_code = Request.Params["schedule_code"].ToString();
                }
                sp.para_status = 1;
                if (sp.para_id != 0)
                {
                    int res = _schmerMgr.UpdateScheduleParamer(sp);
                    if (res > 0)
                    {
                        json = "{success:true}";//返回json數據
                    }
                    else
                    {
                        json = "{success:false}";//返回json數據
                    }
                }
                else
                {
                    int res = _schmerMgr.InsertScheduleParamer(sp);
                    if (res > 0)
                    {
                        json = "{success:true}";//返回json數據
                    }
                    else
                    {
                        json = "{success:false}";//返回json數據
                    }
                }

            }
            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 = "{success:false}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 10
0
 /// <summary>
 /// ScheduleParamer表更改狀態
 /// </summary>
 /// <param name="query">更改信息</param>
 /// <returns></returns>
 public int UpdateActive(ScheduleParamer query)
 {
     try
     {
         return _scheduleDao.UpdateActive(query);
     }
     catch (Exception ex)
     {
         throw new Exception("ScheduleParamerMgr-->UpdateActive" + ex.Message, ex);
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// ScheduleParamer表編輯
 /// </summary>
 /// <param name="query">編輯信息</param>
 /// <returns></returns>
 public int UpdateScheduleParamer(ScheduleParamer query)
 {
     StringBuilder sb = new StringBuilder();
     try
     {
         sb.AppendFormat("UPDATE schedule_paramer SET para_value='{0}',para_name='{1}',schedule_code='{2}'", query.para_value, query.para_name, query.schedule_code);
         sb.AppendFormat("  WHERE para_id='{0}'", query.para_id);
         return _dbAccess.execCommand(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("ScheduleParamerDao-->UpdateScheduleParamer" + ex.Message + sb.ToString(), ex);
     }
 }
Ejemplo n.º 12
0
 /// <summary>
 /// ScheduleParamer表根據para_id刪除數據
 /// </summary>
 /// <param name="query">刪除數據信息</param>
 /// <returns></returns>
 public int DelScheduleParamer(ScheduleParamer query)
 {
     StringBuilder sb = new StringBuilder();
     try
     {
         sb.AppendFormat("DELETE FROM schedule_paramer WHERE para_id='{0}'", query.para_id);
         return _dbAccess.execCommand(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("ScheduleParamerDao-->DelScheduleParamer" + ex.Message + sb.ToString(), ex);
     }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// ScheduleParamer表更改狀態
 /// </summary>
 /// <param name="query">更改信息</param>
 /// <returns></returns>
 public int UpdateActive(ScheduleParamer query)
 {
     StringBuilder sb = new StringBuilder();
     try
     {
         sb.AppendFormat("UPDATE schedule_paramer SET para_status='{0}' WHERE 1=1 ", query.para_status);
         if (query.para_id != 0)
         {
             sb.AppendFormat("  and para_id='{0}'", query.para_id);
         }
         return _dbAccess.execCommand(sb.ToString());
     }
     catch (Exception ex)
     {
         throw new Exception("ScheduleParamerDao-->UpdateActive" + ex.Message + sb.ToString(), ex);
     }
 }