Пример #1
0
        // 變更數量--丟棄
        public HttpResponseBase UpdProdqty()
        {
            Iinvd m = new Iinvd();
            IinvdLog il = new IinvdLog();
            _iinvd = new IinvdMgr(mySqlConnectionString);
            string jsonStr = String.Empty;
            StringBuilder sb = new StringBuilder();
            _iasdMgr = new AseldMgr(mySqlConnectionString);
            try
            {
                il.nvd_id = Int32.Parse(Request.Params["row_id"].ToString());
                il.change_num = Int32.Parse(Request.Params["change_num"].ToString());
                il.from_num = Int32.Parse(Request.Params["from_num"].ToString());
                il.create_user = (Session["caller"] as Caller).user_id;
                il.create_date = DateTime.Now;

                m.row_id = il.nvd_id;
                m.prod_qty = il.change_num + il.from_num;
                m.change_dtim = DateTime.Now;
                m.change_user = (Session["caller"] as Caller).user_id;
                if (m.prod_qty >= 0)
                {
                    sb.Append(_iinvd.UpdProdqty(m));
                    sb.Append(_iinvd.InsertIinvdLog(il));
                    _iasdMgr.InsertSql(sb.ToString());//執行SQL語句裡面有事物處理
                    jsonStr = "{success:true,msg:0}";
                }
                else
                {
                    jsonStr = "{success:true,msg:1}";
                }
            }
            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}";
            }
            this.Response.Clear();
            this.Response.Write(jsonStr.ToString());
            this.Response.End();
            return this.Response;
        }