/// <summary> /// 增加一条数据 /// </summary> public void Add(InvoiceRegister model) { using (DBHelper db = DBHelper.Create()) { db.Insert<InvoiceRegister>(model); } }
/// <summary> /// 新增票据登记 /// </summary> /// <param name="IR"></param> /// <returns></returns> public ActionResult AddInvoice(InvoiceRegister IR) { AjaxResult result = new AjaxResult(); IR.ID = Guid.NewGuid().ToString("N"); IR.RegisterTime = DateTime.Now; IR.OperatorID = MyTicket.CurrentTicket.EmployeeID; IR.UseStatus = 0; try { new InvoiceRegisterRule().Add(IR); result.Success = true; result.Message = "票据已经成功登记。"; } catch (Exception ex) { result.Success = false; result.Message = "票据登记失败" + ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(InvoiceRegister model) { Dictionary<string, object> param = new Dictionary<string, object>(); string strSql = @"update T_InvoiceRegister set BeginCode=@beginCode,EndCode=@endCode ,InvoiceType=@InvoiceType where ID=@ID"; param.Add("beginCode", model.BeginCode); param.Add("endCode", model.EndCode); param.Add("InvoiceType", model.InvoiceType); param.Add("ID", model.ID); using (DBHelper db = DBHelper.Create()) { int effectLine=db.ExecuteNonQuery(strSql, param); return effectLine>0?true:false; } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(Ajax.Model.InvoiceRegister model) { return(dal.Update(model)); }
/// <summary> /// 增加一条数据 /// </summary> public void Add(Ajax.Model.InvoiceRegister model) { dal.Add(model); }
/// <summary> /// 编辑票据 /// </summary> /// <param name="IR"></param> /// <returns></returns> public ActionResult ModifyInvoice(InvoiceRegister IR) { AjaxResult result = new AjaxResult(); try { result.Success = new InvoiceRegisterRule().Update(IR); result.Message = result.Success ? "更新成功" : "更新失败"; } catch (Exception ex) { result.Success = false; result.Message = ex.Message; } return Json(result, JsonRequestBehavior.AllowGet); }