コード例 #1
0
        /// <summary>
        /// 修改or新增
        /// </summary>
        /// <param name="sc"></param>
        /// <returns></returns>
        public ActionResult SaveParticulars(string particulars)
        {
            bool result = false;
            try
            {
                _productExtMgr = new ProductExtMgr(connectionString);
                List<ProductExtCustom> lists = JsonConvert.DeserializeObject<List<ProductExtCustom>>(particulars);
                Caller _caller = (Session["caller"] as Caller);
                string controlId = Request["eventUpdate"];
                if (_caller == null)
                {
                    throw new Exception("session is overdue!");
                }

                result = _productExtMgr.UpdateProductExt(lists, _caller, controlId);
            }
            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 = result });
        }
コード例 #2
0
 /// <summary>
 /// 查詢商品細項詳情
 /// </summary>
 /// <returns></returns>
 public ActionResult QueryParticulars(int condition, string ids)
 {
     int[] id = (from i in ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries) select int.Parse(i)).ToArray();
     try
     {
         _productExtMgr = new ProductExtMgr(connectionString);
         return Json(_productExtMgr.Query((ProductExtCustom.Condition)condition, id));
     }
     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 new EmptyResult();
     }
 }