DAL/dalEquipment.cs

(开头部分) 7KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

using Model;

namespace DAL
{
    /*设备清单业务逻辑层实现*/
    public class dalEquipment
    {
        /*待执行的sql语句*/
        public static string sql = "";

        /*添加设备清单实现*/
        public static bool AddEquipment(Equipment equipment)
        {
            string sql = "insert into Equipment(orderNumber,fixedAssetsType,fixedAssetsName,specification,unit,total,price,dateOfUse,department,useLocation,state,remarks) values(@orderNumber,@fixedAssetsType,@fixedAssetsName,@specification,@unit,@total,@price,@dateOfUse,@department,@useLocation,@state,@remarks)";
            /*构建sql参数*/
            SqlParameter[] parm = new SqlParameter[] {
             new SqlParameter("@orderNumber",SqlDbType.Int),
             new SqlParameter("@fixedAssetsType",SqlDbType.VarChar),
             new SqlParameter("@fixedAssetsName",SqlDbType.VarChar),
             new SqlParameter("@specification",SqlDbType.VarChar),
             new SqlParameter("@unit",SqlDbType.VarChar),
             new SqlParameter("@total",SqlDbType.Int),
             new SqlParameter("@price",SqlDbType.Float),
             new SqlParameter("@dateOfUse",SqlDbType.DateTime),
             new SqlParameter("@department",SqlDbType.VarChar),
             new SqlParameter("@useLocation",SqlDbType.VarChar),
             new SqlParameter("@state",SqlDbType.VarChar),
             new SqlParameter("@remarks",SqlDbType.VarChar)
            };
            /*给参数赋值*/
            parm[0].Value = equipment.orderNumber; //序号
            parm[1].Value = equipment.fixedAssetsType; //固定资产类别
            parm[2].Value = equipment.fixedAssetsName; //固定资产名称
            parm[3].Value = equipment.specification; //规格型号
            parm[4].Value = equipment.unit; //计量单位
            parm[5].Value = equipment.total; //数量
            parm[6].Value = equipment.price; //原值
            parm[7].Value = equipment.dateOfUse; //使用日期
            parm[8].Value = equipment.department; //部门单位
            parm[9].Value = equipment.useLocation; //在用地点
            parm[10].Value = equipment.state; //设备状态
            parm[11].Value = equipment.remarks; //备注

            /*执行sql进行添加*/
            return (DBHelp.ExecuteNonQuery(sql, parm) > 0) ? true : false;
        }

        /*根据equipmentID获取某条设备清单记录*/
        public static Equipment getSomeEquipment(int equipmentID)
        {
            /*构建查询sql*/
            string sql = "select * from Equipment where equipmentID=" + equipmentID;
            SqlDataReader DataRead = DBHelp.ExecuteReader(sql, null);
后面还有 101 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。