Пример #1
0
        public HttpResponseBase VendorAdd(VendorQuery venQuery)
        {
            string jsonStr = "{success:false}";
            try
            {
                _vendorMgr = new VendorMgr(connectionString);

                if (!string.IsNullOrEmpty(Request.Params["pm"]))
                {
                    venQuery.product_manage = Convert.ToUInt32(Request.Params["pm"]);
                }
                int result = _vendorMgr.Add(venQuery);
                if (result > 0)
                {

                    jsonStr = "{success:true}";

                }
                else if (result == -1)
                {
                    jsonStr = "{success:false,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;
        }