Exemplo n.º 1
0
 /// <summary>
 /// 展示数据
 /// </summary>
 /// <param name="id">记录Id</param>
 private void ShowInfo(int id)
 {
     LNoPassReasonBB noPassReasonBB = new LNoPassReasonBB();
     vLNoPassReasonData model = new vLNoPassReasonData();
     try
     {
         model = noPassReasonBB.GetVModel(id);
         this.tbNoPassReasonNo.Text = model.noPassReasonNo;
         this.tbNoPassReasonNm.Text = model.noPassReasonNm;
         this.ddlCheckItem.SelectedValue = model.checkItemId.ToString();
     }
     finally
     {
         noPassReasonBB.Dispose();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 得到一个视图model
        /// </summary>
        /// <param name="id">主键值</param>
        /// <returns>model</returns>
        public vLNoPassReasonData GetVModel(int id)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append(@"select id,noPassReasonNo,noPassReasonNm,checkItemId,isDel,isrtEmpId,isrtDt,updtEmpId,updtDt,checkItemNo,checkItemNm,
                            isrtEmpNm,updtEmpNm from vLNoPassReason");
            strSql.Append(" where id = @id ");
            SqlParameter[] parameters = {
                    new SqlParameter("@id", SqlDbType.Int)
                };
            parameters[0].Value = id;

            vLNoPassReasonData model = new vLNoPassReasonData();
            DataSet ds = SqlHelper.ExecuteDataset(this.connection, this.transaction, CommandType.Text, strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                DataRow row =ds.Tables[0].Rows[0];
                if (row["id"] != DBNull.Value)
                {
                    model.id = Convert.ToInt32(row["id"]);
                }
                if (row["noPassReasonNo"] != DBNull.Value)
                {
                    model.noPassReasonNo = Convert.ToString(row["noPassReasonNo"]);
                }
                if (row["noPassReasonNm"] != DBNull.Value)
                {
                    model.noPassReasonNm = Convert.ToString(row["noPassReasonNm"]);
                }
                if (row["checkItemId"] != DBNull.Value)
                {
                    model.checkItemId = Convert.ToInt32(row["checkItemId"]);
                }
                if (row["isDel"] != DBNull.Value)
                {
                    model.isDel = Convert.ToBoolean(row["isDel"]);
                }
                if (row["isrtEmpId"] != DBNull.Value)
                {
                    model.isrtEmpId = Convert.ToInt32(row["isrtEmpId"]);
                }
                if (row["isrtDt"] != DBNull.Value)
                {
                    model.isrtDt = Convert.ToString(row["isrtDt"]);
                }
                if (row["updtEmpId"] != DBNull.Value)
                {
                    model.updtEmpId = Convert.ToInt32(row["updtEmpId"]);
                }
                if (row["updtDt"] != DBNull.Value)
                {
                    model.updtDt = Convert.ToString(row["updtDt"]);
                }
                if (row["checkItemNo"] != DBNull.Value)
                {
                    model.checkItemNo = Convert.ToString(row["checkItemNo"]);
                }
                if (row["checkItemNm"] != DBNull.Value)
                {
                    model.checkItemNm = Convert.ToString(row["checkItemNm"]);
                }
                if (row["isrtEmpNm"] != DBNull.Value)
                {
                    model.isrtEmpNm = Convert.ToString(row["isrtEmpNm"]);
                }
                if (row["updtEmpNm"] != DBNull.Value)
                {
                    model.updtEmpNm = Convert.ToString(row["updtEmpNm"]);
                }
                return model;
            }
            else
            {
                return null;
            }
        }