Пример #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public IPSP.Model.T_InFiles GetModel(int n_FileID, int n_ClientID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 n_FileID,n_FileCodeID,s_FileType,n_ClientID,n_GovOfficeID,s_Officer,s_OfficialNO,s_OFileStatus,s_NeedTransfer,s_Lock,s_Locker,n_AgencyOfficeID,dt_TransmitDate,s_GetCertificater,dt_GetCertificatedate,s_Distribute,s_Note,s_Urgent,n_ParentID,s_IsPreChange from T_InFiles ");
            strSql.Append(" where n_FileID=@n_FileID and n_ClientID=@n_ClientID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_FileID",   SqlDbType.Int, 4),
                new SqlParameter("@n_ClientID", SqlDbType.Int, 4)
            };
            parameters[0].Value = n_FileID;
            parameters[1].Value = n_ClientID;

            IPSP.Model.T_InFiles model = new IPSP.Model.T_InFiles();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Пример #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(IPSP.Model.T_InFiles model)
 {
     return(dal.Update(model));
 }
Пример #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(IPSP.Model.T_InFiles model)
 {
     return(dal.Add(model));
 }
Пример #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(IPSP.Model.T_InFiles model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_InFiles(");
            strSql.Append("n_FileID,n_FileCodeID,s_FileType,n_ClientID,n_GovOfficeID,s_Officer,s_OfficialNO,s_OFileStatus,s_NeedTransfer,s_Lock,s_Locker,n_AgencyOfficeID,dt_TransmitDate,s_GetCertificater,dt_GetCertificatedate,s_Distribute,s_Note,s_Urgent,n_ParentID,s_IsPreChange)");
            strSql.Append(" values (");
            strSql.Append("@n_FileID,@n_FileCodeID,@s_FileType,@n_ClientID,@n_GovOfficeID,@s_Officer,@s_OfficialNO,@s_OFileStatus,@s_NeedTransfer,@s_Lock,@s_Locker,@n_AgencyOfficeID,@dt_TransmitDate,@s_GetCertificater,@dt_GetCertificatedate,@s_Distribute,@s_Note,@s_Urgent,@n_ParentID,@s_IsPreChange)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@n_FileID",              SqlDbType.Int,         4),
                new SqlParameter("@n_FileCodeID",          SqlDbType.Int,         4),
                new SqlParameter("@s_FileType",            SqlDbType.NVarChar,   50),
                new SqlParameter("@n_ClientID",            SqlDbType.Int,         4),
                new SqlParameter("@n_GovOfficeID",         SqlDbType.Int,         4),
                new SqlParameter("@s_Officer",             SqlDbType.NVarChar,   50),
                new SqlParameter("@s_OfficialNO",          SqlDbType.NVarChar,   50),
                new SqlParameter("@s_OFileStatus",         SqlDbType.NVarChar,    1),
                new SqlParameter("@s_NeedTransfer",        SqlDbType.NVarChar,    1),
                new SqlParameter("@s_Lock",                SqlDbType.NVarChar,    1),
                new SqlParameter("@s_Locker",              SqlDbType.NVarChar,   50),
                new SqlParameter("@n_AgencyOfficeID",      SqlDbType.Int,         4),
                new SqlParameter("@dt_TransmitDate",       SqlDbType.DateTime),
                new SqlParameter("@s_GetCertificater",     SqlDbType.NVarChar,  200),
                new SqlParameter("@dt_GetCertificatedate", SqlDbType.DateTime),
                new SqlParameter("@s_Distribute",          SqlDbType.NVarChar,    1),
                new SqlParameter("@s_Note",                SqlDbType.NVarChar,  500),
                new SqlParameter("@s_Urgent",              SqlDbType.NVarChar,    2),
                new SqlParameter("@n_ParentID",            SqlDbType.Int,         4),
                new SqlParameter("@s_IsPreChange",         SqlDbType.NVarChar, 1)
            };
            parameters[0].Value  = model.n_FileID;
            parameters[1].Value  = model.n_FileCodeID;
            parameters[2].Value  = model.s_FileType;
            parameters[3].Value  = model.n_ClientID;
            parameters[4].Value  = model.n_GovOfficeID;
            parameters[5].Value  = model.s_Officer;
            parameters[6].Value  = model.s_OfficialNO;
            parameters[7].Value  = model.s_OFileStatus;
            parameters[8].Value  = model.s_NeedTransfer;
            parameters[9].Value  = model.s_Lock;
            parameters[10].Value = model.s_Locker;
            parameters[11].Value = model.n_AgencyOfficeID;
            parameters[12].Value = model.dt_TransmitDate;
            parameters[13].Value = model.s_GetCertificater;
            parameters[14].Value = model.dt_GetCertificatedate;
            parameters[15].Value = model.s_Distribute;
            parameters[16].Value = model.s_Note;
            parameters[17].Value = model.s_Urgent;
            parameters[18].Value = model.n_ParentID;
            parameters[19].Value = model.s_IsPreChange;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public IPSP.Model.T_InFiles DataRowToModel(DataRow row)
 {
     IPSP.Model.T_InFiles model = new IPSP.Model.T_InFiles();
     if (row != null)
     {
         if (row["n_FileID"] != null && row["n_FileID"].ToString() != "")
         {
             model.n_FileID = int.Parse(row["n_FileID"].ToString());
         }
         if (row["n_FileCodeID"] != null && row["n_FileCodeID"].ToString() != "")
         {
             model.n_FileCodeID = int.Parse(row["n_FileCodeID"].ToString());
         }
         if (row["s_FileType"] != null)
         {
             model.s_FileType = row["s_FileType"].ToString();
         }
         if (row["n_ClientID"] != null && row["n_ClientID"].ToString() != "")
         {
             model.n_ClientID = int.Parse(row["n_ClientID"].ToString());
         }
         if (row["n_GovOfficeID"] != null && row["n_GovOfficeID"].ToString() != "")
         {
             model.n_GovOfficeID = int.Parse(row["n_GovOfficeID"].ToString());
         }
         if (row["s_Officer"] != null)
         {
             model.s_Officer = row["s_Officer"].ToString();
         }
         if (row["s_OfficialNO"] != null)
         {
             model.s_OfficialNO = row["s_OfficialNO"].ToString();
         }
         if (row["s_OFileStatus"] != null)
         {
             model.s_OFileStatus = row["s_OFileStatus"].ToString();
         }
         if (row["s_NeedTransfer"] != null)
         {
             model.s_NeedTransfer = row["s_NeedTransfer"].ToString();
         }
         if (row["s_Lock"] != null)
         {
             model.s_Lock = row["s_Lock"].ToString();
         }
         if (row["s_Locker"] != null)
         {
             model.s_Locker = row["s_Locker"].ToString();
         }
         if (row["n_AgencyOfficeID"] != null && row["n_AgencyOfficeID"].ToString() != "")
         {
             model.n_AgencyOfficeID = int.Parse(row["n_AgencyOfficeID"].ToString());
         }
         if (row["dt_TransmitDate"] != null && row["dt_TransmitDate"].ToString() != "")
         {
             model.dt_TransmitDate = DateTime.Parse(row["dt_TransmitDate"].ToString());
         }
         if (row["s_GetCertificater"] != null)
         {
             model.s_GetCertificater = row["s_GetCertificater"].ToString();
         }
         if (row["dt_GetCertificatedate"] != null && row["dt_GetCertificatedate"].ToString() != "")
         {
             model.dt_GetCertificatedate = DateTime.Parse(row["dt_GetCertificatedate"].ToString());
         }
         if (row["s_Distribute"] != null)
         {
             model.s_Distribute = row["s_Distribute"].ToString();
         }
         if (row["s_Note"] != null)
         {
             model.s_Note = row["s_Note"].ToString();
         }
         if (row["s_Urgent"] != null)
         {
             model.s_Urgent = row["s_Urgent"].ToString();
         }
         if (row["n_ParentID"] != null && row["n_ParentID"].ToString() != "")
         {
             model.n_ParentID = int.Parse(row["n_ParentID"].ToString());
         }
         if (row["s_IsPreChange"] != null)
         {
             model.s_IsPreChange = row["s_IsPreChange"].ToString();
         }
     }
     return(model);
 }