47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Data;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
using dccdc.Models;
|
|||
|
|
using Dapper;
|
|||
|
|
|
|||
|
|
namespace dccdc.DAL
|
|||
|
|
{
|
|||
|
|
public class infectionRedMoneyDal
|
|||
|
|
{
|
|||
|
|
public object Update(infectionRedMoneyModel model)
|
|||
|
|
{
|
|||
|
|
string sql = @"Update [dbo].[infection_red_money] Set [days] = @days,[daymoney] = @daymoney,
|
|||
|
|
[testmoney] = @testmoney,[questionnairemoney] = @questionnairemoney Where [id] = 1";
|
|||
|
|
using (IDbConnection conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
try
|
|||
|
|
{
|
|||
|
|
int result = conn.Execute(sql, model);
|
|||
|
|
if (result > 0)
|
|||
|
|
return new { State = 1, Message = "保存成功!" };
|
|||
|
|
else
|
|||
|
|
return new { State = 0, Message = "保存失败!" };
|
|||
|
|
}
|
|||
|
|
catch (Exception ex)
|
|||
|
|
{
|
|||
|
|
return new { State = 0, Message = ex.Message };
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
public infectionRedMoneyModel getInitData()
|
|||
|
|
{
|
|||
|
|
string sql = "SELECT * FROm infection_red_money order by id desc ";
|
|||
|
|
|
|||
|
|
using (IDbConnection conn = CommHelper.GetSqlConnection())
|
|||
|
|
{
|
|||
|
|
return conn.Query<infectionRedMoneyModel>(sql).ToList().FirstOrDefault();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|