public ActionResult ImportToTAX(string zmInfo) { ZMInfo resMode = null; try { byte[] data_byte = Encoding.UTF8.GetBytes(zmInfo); string date = Encoding.UTF8.GetString(data_byte, 0, data_byte.Length); if (!string.IsNullOrEmpty(date)) { resMode = Newtonsoft.Json.JsonConvert.DeserializeObject <ZMInfo>(date); TAXModels model = CreateModel(resMode); TAXDAL dal = new TAXDAL(); dal.Insert(model); InsertLog(resMode, date, "成功", true); } } catch (Exception ex) { InsertLog(resMode, zmInfo, ex.Message, false); return(Json(ex.Message)); } return(null); }
private void InsertLog(ZMInfo resMode, string json, string msg, bool flag) { TaxLogModel tm = new TaxLogModel(); tm.HTBAH = resMode.HTBAH; tm.SQBH = resMode.SQBH; tm.Json = json; tm.IsSuccess = flag.ToString(); tm.Message = msg; tm.CreateTime = DateTime.Now; TAXDAL dal = new TAXDAL(); dal.InserTaxLog(tm); }