/// <summary>
        /// 获得数据List
        /// </summary>
        public DDML_ConfirmList GetDataList(DDML_ConfirmQueryCondition QueryCondition)
        {
            SqlParameter[] sqlParams;
            StringBuilder  strSqlOption = new StringBuilder();

            QueryCondition.OutPut(out strSqlOption, out sqlParams);
            StringBuilder strSql = new StringBuilder();

            if (QueryCondition.page == 0)
            {
                strSql.Append("select * ");
                strSql.Append(" FROM TAB_DDML_Confirm where 1=1 " + strSqlOption.ToString());
            }
            else
            {
                strSql.Append(@"select top " + QueryCondition.rows.ToString() + " * from TAB_DDML_Confirm where 1 = 1 " +
                              strSqlOption.ToString() + " and nID not in ( select top " + (QueryCondition.page - 1) * QueryCondition.rows +
                              " nID from TAB_DDML_Confirm where  1=1 " + strSqlOption.ToString() + " order by nID desc) order by nID desc");
            }
            DataTable        dt   = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0];
            DDML_ConfirmList list = new DDML_ConfirmList();

            foreach (DataRow dr in dt.Rows)
            {
                DDML_Confirm _DDML_Confirm = new DDML_Confirm();
                DataRowToModel(_DDML_Confirm, dr);
                list.Add(_DDML_Confirm);
            }
            return(list);
        }
        /// <summary>
        /// 更新数据
        /// </summary>
        public bool Update(DDML_Confirm model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("Update TAB_DDML_Confirm set ");
            strSql.Append(" strGUID = @strGUID, ");
            strSql.Append(" strWorkShopGUID = @strWorkShopGUID, ");
            strSql.Append(" strWorkShopNumber = @strWorkShopNumber, ");
            strSql.Append(" strWorkShopName = @strWorkShopName, ");
            strSql.Append(" dtConfirmTime = @dtConfirmTime, ");
            strSql.Append(" strDutyUserNumber = @strDutyUserNumber, ");
            strSql.Append(" strDutyUserName = @strDutyUserName ");
            strSql.Append(" where nID = @nID ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@strGUID",           model.strGUID),
                new SqlParameter("@strWorkShopGUID",   model.strWorkShopGUID),
                new SqlParameter("@strWorkShopNumber", model.strWorkShopNumber),
                new SqlParameter("@strWorkShopName",   model.strWorkShopName),
                new SqlParameter("@dtConfirmTime",     model.dtConfirmTime),
                new SqlParameter("@strDutyUserNumber", model.strDutyUserNumber),
                new SqlParameter("@strDutyUserName",   model.strDutyUserName),
                new SqlParameter("@nID",               model.nID)
            };

            return(SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.Text, strSql.ToString(), parameters) > 0);
        }
Beispiel #3
0
 /// <summary>
 /// 读取DataRow数据到Model中
 /// </summary>
 private void DataRowToModel(DDML_Confirm model, DataRow dr)
 {
     model.nID               = ObjectConvertClass.static_ext_int(dr["nID"]);
     model.strWorkShopGUID   = ObjectConvertClass.static_ext_string(dr["strWorkShopGUID"]);
     model.strWorkShopNumber = ObjectConvertClass.static_ext_string(dr["strWorkShopNumber"]);
     model.strWorkShopName   = ObjectConvertClass.static_ext_string(dr["strWorkShopName"]);
     model.dtConfirmTime     = ObjectConvertClass.static_ext_date(dr["dtConfirmTime"]);
     model.strDutyUserNumber = ObjectConvertClass.static_ext_string(dr["strDutyUserNumber"]);
     model.strDutyUserName   = ObjectConvertClass.static_ext_string(dr["strDutyUserName"]);
 }
        /// <summary>
        /// 检查数据是否存在
        /// </summary>
        public bool Exists(DDML_Confirm _DDML_Confirm)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select count(*) from TAB_DDML_Confirm where strWorkShopGUID=@strWorkShopGUID");
            SqlParameter[] parameters =
            {
                new SqlParameter("strWorkShopGUID", _DDML_Confirm.strWorkShopGUID)
            };

            return(Convert.ToInt32(SqlHelper.ExecuteScalar(ConnectionString, CommandType.Text, strSql.ToString(), parameters)) > 0);
        }
        /// <summary>
        /// 获得一个实体对象
        /// </summary>
        public DDML_Confirm GetModel(DDML_ConfirmQueryCondition QueryCondition)
        {
            SqlParameter[] sqlParams;
            StringBuilder  strSqlOption = new StringBuilder();

            QueryCondition.OutPut(out strSqlOption, out sqlParams);
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1 * ");
            strSql.Append(" FROM TAB_DDML_Confirm where 1=1 " + strSqlOption.ToString());
            DataTable    dt            = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0];
            DDML_Confirm _DDML_Confirm = null;

            if (dt.Rows.Count > 0)
            {
                _DDML_Confirm = new DDML_Confirm();
                DataRowToModel(_DDML_Confirm, dt.Rows[0]);
            }
            return(_DDML_Confirm);
        }
Beispiel #6
0
        /// <summary>
        /// 添加数据
        /// </summary>
        public bool Add(DDML_Confirm model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TAB_DDML_Confirm_Record");
            strSql.Append("(nID,strWorkShopGUID,strWorkShopNumber,strWorkShopName,dtConfirmTime,strDutyUserNumber,strDutyUserName)");
            strSql.Append("values(@nID,@strWorkShopGUID,@strWorkShopNumber,@strWorkShopName,@dtConfirmTime,@strDutyUserNumber,@strDutyUserName)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@nID",               model.nID),
                new SqlParameter("@strWorkShopGUID",   model.strWorkShopGUID),
                new SqlParameter("@strWorkShopNumber", model.strWorkShopNumber),
                new SqlParameter("@strWorkShopName",   model.strWorkShopName),
                new SqlParameter("@dtConfirmTime",     model.dtConfirmTime),
                new SqlParameter("@strDutyUserNumber", model.strDutyUserNumber),
                new SqlParameter("@strDutyUserName",   model.strDutyUserName)
            };

            return(SqlHelper.ExecuteNonQuery(ConnectionString, CommandType.Text, strSql.ToString(), parameters) > 0);
        }
        /// <summary>
        /// 保存审核记录
        /// </summary>
        public bool Save(DDML_Confirm _ddml_confirm)
        {
            DBDDML_Confirm_Record      db_record = new DBDDML_Confirm_Record(this.ConnectionString);
            DDML_ConfirmQueryCondition contion   = new DDML_ConfirmQueryCondition();

            contion.strWorkShopGUID = _ddml_confirm.strWorkShopGUID;
            DDML_Confirm _existDlCF = GetModel(contion);

            if (_existDlCF != null)
            {
                _ddml_confirm.nID = _existDlCF.nID;
                Update(_ddml_confirm);
            }
            else
            {
                Add(_ddml_confirm);
            }
            db_record.Add(_ddml_confirm);

            return(true);
        }
        /// <summary>
        /// 添加数据
        /// </summary>
        public int Add(DDML_Confirm model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TAB_DDML_Confirm");
            strSql.Append("(strGUID,strWorkShopGUID,strWorkShopNumber,strWorkShopName,dtConfirmTime,strDutyUserNumber,strDutyUserName)");
            strSql.Append("values(@strGUID,@strWorkShopGUID,@strWorkShopNumber,@strWorkShopName,@dtConfirmTime,@strDutyUserNumber,@strDutyUserName)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@strGUID",           model.strGUID),
                new SqlParameter("@strWorkShopGUID",   model.strWorkShopGUID),
                new SqlParameter("@strWorkShopNumber", model.strWorkShopNumber),
                new SqlParameter("@strWorkShopName",   model.strWorkShopName),
                new SqlParameter("@dtConfirmTime",     model.dtConfirmTime),
                new SqlParameter("@strDutyUserNumber", model.strDutyUserNumber),
                new SqlParameter("@strDutyUserName",   model.strDutyUserName)
            };

            return(Convert.ToInt32(SqlHelper.ExecuteScalar(ConnectionString, CommandType.Text, strSql.ToString(), parameters)));
        }
        public DDML_Confirm GetModel(string strClientGUID)
        {
            SqlParameter[] sqlParams =
            {
                new SqlParameter("strSiteGUID", strClientGUID)
            };
            StringBuilder strSqlOption = new StringBuilder();
            //QueryCondition.OutPut(out strSqlOption, out sqlParams);
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1 * ");
            strSql.Append("from tab_base_Site where strSiteGUID = @strSiteGUID ");
            DataTable    dt            = SqlHelper.ExecuteDataset(ConnectionString, CommandType.Text, strSql.ToString(), sqlParams).Tables[0];
            DDML_Confirm _DDML_Confirm = null;

            if (dt.Rows.Count > 0)
            {
                DDML_ConfirmQueryCondition QueryCondition = new DDML_ConfirmQueryCondition();
                QueryCondition.strWorkShopGUID = ObjectConvertClass.static_ext_string(dt.Rows[0]["strWorkShopGUID"]);
                _DDML_Confirm = GetModel(QueryCondition);
            }
            return(_DDML_Confirm);
        }