예제 #1
0
파일: Department.cs 프로젝트: ZwPandora/GIL
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        private thesis.model.Department GetModelByCondition(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select   ");
            strSql.Append(" ID,NAME,MASTER,ADDRESS,COMPANYID ");
            strSql.Append(" from Department ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            thesis.model.Department model = new thesis.model.Department();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                model.NAME      = ds.Tables[0].Rows[0]["NAME"].ToString();
                model.MASTER    = ds.Tables[0].Rows[0]["MASTER"].ToString();
                model.ADDRESS   = ds.Tables[0].Rows[0]["ADDRESS"].ToString();
                model.COMPANYID = int.Parse(ds.Tables[0].Rows[0]["COMPANYID"].ToString());
                return(model);
            }
            else
            {
                return(null);
            }
        }
예제 #2
0
파일: Department.cs 프로젝트: ZwPandora/GIL
        /// <summary>
        /// 获得数据列表
        /// </summary>
        private List <Department> GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,NAME,MASTER,ADDRESS,COMPANYID");
            strSql.Append(" FROM Department ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            DataSet           ds   = DbHelperSQL.Query(strSql.ToString());
            List <Department> list = new List <Department>();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                thesis.model.Department model = new thesis.model.Department();
                if (ds.Tables[0].Rows[i]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[i]["ID"].ToString());
                }
                model.NAME      = ds.Tables[0].Rows[i]["NAME"].ToString();
                model.MASTER    = ds.Tables[0].Rows[i]["MASTER"].ToString();
                model.ADDRESS   = ds.Tables[0].Rows[i]["ADDRESS"].ToString();
                model.COMPANYID = int.Parse(ds.Tables[0].Rows[i]["COMPANYID"].ToString());
                list.Add(model);
            }
            return(list);
        }
예제 #3
0
파일: Department.cs 프로젝트: ZwPandora/GIL
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(thesis.model.Department model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update DEPARTMENT set ");
            strSql.Append("NAME='" + model.NAME + "',");
            strSql.Append("MASTER='" + model.MASTER + "',");
            strSql.Append("ADDRESS='" + model.ADDRESS + "',");
            strSql.Append("COMPANYID=" + model.COMPANYID + "");
            strSql.Append(" where ID=" + model.ID + " ");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
예제 #4
0
파일: Department.cs 프로젝트: ZwPandora/GIL
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(thesis.model.Department model)
        {
            model.ID = GetMaxID() + 1;
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into department(");
            strSql.Append("ID,NAME,MASTER,ADDRESS,COMPANYID");
            strSql.Append(")");
            strSql.Append(" values (");
            strSql.Append("" + model.ID + ",");
            strSql.Append("'" + model.NAME + "',");
            strSql.Append("'" + model.MASTER + "',");
            strSql.Append("'" + model.ADDRESS + "',");
            strSql.Append("" + model.COMPANYID + "");
            strSql.Append(")");
            DbHelperSQL.ExecuteSql(strSql.ToString());
        }
예제 #5
0
파일: Department.cs 프로젝트: ZwPandora/GIL
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(thesis.model.Department model)
 {
     dal.Update(model);
 }
예제 #6
0
파일: Department.cs 프로젝트: ZwPandora/GIL
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(thesis.model.Department model)
 {
     dal.Add(model);
 }