Ejemplo n.º 1
0
        /// <summary>
        /// 保存美安類別關係
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase SavetMarketProductMap()
        {

            string json = string.Empty;
            try
            {
                MarketProductMapQuery query = new MarketProductMapQuery();
                if (!string.IsNullOrEmpty(Request.Params["map_id"]))
                {
                    query.map_id = Convert.ToInt32(Request.Params["map_id"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["comboFrontCage_hide"]))
                {
                    query.product_category_id = Convert.ToInt32(Request.Params["comboFrontCage_hide"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["comboMarket_hide"]))
                {
                    query.market_category_id = Convert.ToInt32(Request.Params["comboMarket_hide"]);
                }

                query.kuser = (Session["caller"] as Caller).user_id;
                query.muser = (Session["caller"] as Caller).user_id;
                query.created = DateTime.Now;
                query.modified = query.created;
                _IMarketProductMap = new MarketProductMapMgr(mySqlConnectionString);
                int result = 0;
                //新增修改都在Mgr裡面判斷
                //通過map_id 是否為零 判斷新增還是編輯
                result = _IMarketProductMap.SavetMarketProductMap(query);
                if (result > 0)
                {
                    json = "{success:true,msg:\"" + result + "\"}";
                }
                else
                {
                    json = "{success:true,msg:\"" + result + "\"}";
                }

            }
            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,msg:'0'}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 刪除美安類別關係
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase DeleteMarketProductMap()
        {
            //MarketProductMapQuery query = new MarketProductMapQuery();
            string json = string.Empty;
            try
            {
                string Row_id = "";
                if (!string.IsNullOrEmpty(Request.Params["rowId"]))
                {
                    Row_id = Request.Params["rowId"];
                    Row_id = Row_id.TrimEnd(',');
                    //query.map_id_in = Row_id;
                }
                _IMarketProductMap = new MarketProductMapMgr(mySqlConnectionString);
                int result = _IMarketProductMap.DeleteMarketProductMap(Row_id);
                if (result > 0)
                {
                    json = "{success:true,msg:\"" + result + "\"}";
                }
                else
                {
                    json = "{success:false,msg:\"" + result + "\"}";
                }
            }
            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,msg:'0'}";
            }
            this.Response.Clear();
            this.Response.Write(json);
            this.Response.End();
            return this.Response;

        }
Ejemplo n.º 3
0
        /// <summary>
        /// 美安類別關係設定列表頁
        /// </summary>
        /// <returns></returns>
        public HttpResponseBase GetMarketProductMapList()
        {
            string jsonStr = string.Empty;
            int tranInt = 0;
            try
            {
                MarketProductMapQuery query = new MarketProductMapQuery();
                query.Start = Convert.ToInt32(Request.Params["start"] ?? "0");
                if (!string.IsNullOrEmpty(Request.Params["limit"]))
                {
                    query.Limit = Convert.ToInt32(Request.Params["limit"]);
                }
                if (!string.IsNullOrEmpty(Request.Params["search"]))
                {
                    if (int.TryParse(Request.Params["search"].ToString(), out tranInt))
                    {
                        query.product_number = Request.Params["search"].ToString();
                    }
                    else
                    {
                        query.product_name = Request.Params["search"].ToString();
                    }
                }
                int totalCount = 0;
                _IMarketProductMap = new MarketProductMapMgr(mySqlConnectionString);

                DataTable _dt = _IMarketProductMap.GetMarketProductMapList(query, out totalCount);

                IsoDateTimeConverter timeConverter = new IsoDateTimeConverter();
                //这里使用自定义日期格式,如果不使用的话,默认是ISO8601格式     
                timeConverter.DateTimeFormat = "yyyy-MM-dd HH:mm:ss";
                jsonStr = "{success:true,totalCount:" + totalCount + ",data:" + JsonConvert.SerializeObject(_dt, Formatting.Indented, timeConverter) + "}";//返回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);
                jsonStr = "{success:false,msg:0}";
            }
            this.Response.Clear();
            this.Response.Write(jsonStr.ToString());
            this.Response.End();
            return this.Response;
        }