1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
 
namespace DAL
{
    /// <summary>
    /// 资源能力
    /// </summary>
    public class ClsGy_PlanShifts_Ctl
    {
        public string MvarItemKey;
        public string MvarReportTitle;
        SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); 
        public Model.ClsGy_PlanShifts_Model oModel = new Model.ClsGy_PlanShifts_Model();
        //新增
        public   bool AddNew()
        {
            
            try
            {
                oCn.BeginTran();
                Delete(oModel.HSourceID,oModel.HDate.ToShortDateString());
                oCn.RunProc("Insert into " + MvarItemKey + " " +
                    " (HDate,HSourceID,HShiftsID,HOverTimes,HRemark) " +
                    " Values('" + oModel.HDate.ToShortDateString() + "'," + oModel.HSourceID.ToString() + "," + oModel.HShiftsID.ToString() +
                    "," + oModel.HOverTimes.ToString()+",'"+ oModel.HRemark + "')", ref DBUtility.ClsPub.sExeReturnInfo);
                oCn.Commit();
                return true;
            }
            catch (Exception e)
            {
                oCn.RollBack();
                throw (e);
            }
        }
 
        //删除
        public bool Delete(Int64 sItemID,string sDate)
        {
            try
            {
                oCn.RunProc("Delete From Gy_PlanShifts where HSourceID=" + sItemID.ToString() + " and HDate='" + sDate + "'");
                return true;
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
         
        //构造函数
        public ClsGy_PlanShifts_Ctl()
        {
            MvarItemKey = "Gy_PlanShifts";
            MvarReportTitle = "资源能力设置";
            oModel = new Model.ClsGy_PlanShifts_Model();
        } 
    }
}