예제 #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.T_Instrument model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into T_Instrument(");
            strSql.Append("InstrumentID,InstrumentName,InstrumentModel,InstrumentType,SupplierId,ExcelServerRCID,ExcelServerRN,ExcelServerCN,ExcelServerRC1,ExcelServerWIID,ExcelServerRTID,ExcelServerCHG,KingdeeId,InnerId,Remark)");
            strSql.Append(" values (");
            strSql.Append("@InstrumentID,@InstrumentName,@InstrumentModel,@InstrumentType,@SupplierId,@ExcelServerRCID,@ExcelServerRN,@ExcelServerCN,@ExcelServerRC1,@ExcelServerWIID,@ExcelServerRTID,@ExcelServerCHG,@KingdeeId,@InnerId,@Remark)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@InstrumentID",    SqlDbType.Int,        4),
                new SqlParameter("@InstrumentName",  SqlDbType.NVarChar, 255),
                new SqlParameter("@InstrumentModel", SqlDbType.NVarChar, 100),
                new SqlParameter("@InstrumentType",  SqlDbType.NVarChar,  50),
                new SqlParameter("@SupplierId",      SqlDbType.Int,        4),
                new SqlParameter("@ExcelServerRCID", SqlDbType.NVarChar,  20),
                new SqlParameter("@ExcelServerRN",   SqlDbType.Int,        4),
                new SqlParameter("@ExcelServerCN",   SqlDbType.Int,        4),
                new SqlParameter("@ExcelServerRC1",  SqlDbType.NVarChar,  20),
                new SqlParameter("@ExcelServerWIID", SqlDbType.NVarChar,  20),
                new SqlParameter("@ExcelServerRTID", SqlDbType.NVarChar,  20),
                new SqlParameter("@ExcelServerCHG",  SqlDbType.Int,        4),
                new SqlParameter("@KingdeeId",       SqlDbType.NVarChar,  20),
                new SqlParameter("@InnerId",         SqlDbType.NVarChar,  20),
                new SqlParameter("@Remark",          SqlDbType.NVarChar, 255)
            };
            parameters[0].Value  = model.InstrumentID;
            parameters[1].Value  = model.InstrumentName;
            parameters[2].Value  = model.InstrumentModel;
            parameters[3].Value  = model.InstrumentType;
            parameters[4].Value  = model.SupplierId;
            parameters[5].Value  = model.ExcelServerRCID;
            parameters[6].Value  = model.ExcelServerRN;
            parameters[7].Value  = model.ExcelServerCN;
            parameters[8].Value  = model.ExcelServerRC1;
            parameters[9].Value  = model.ExcelServerWIID;
            parameters[10].Value = model.ExcelServerRTID;
            parameters[11].Value = model.ExcelServerCHG;
            parameters[12].Value = model.KingdeeId;
            parameters[13].Value = model.InnerId;
            parameters[14].Value = model.Remark;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.T_Instrument GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 InstrumentID,InstrumentName,InstrumentModel,InstrumentType,SupplierId,ExcelServerRCID,ExcelServerRN,ExcelServerCN,ExcelServerRC1,ExcelServerWIID,ExcelServerRTID,ExcelServerCHG,KingdeeId,InnerId,Remark from T_Instrument ");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
            };

            Maticsoft.Model.T_Instrument model = new Maticsoft.Model.T_Instrument();
            DataSet ds = DbBaseHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.T_Instrument model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update T_Instrument set ");
            strSql.Append("InstrumentID=@InstrumentID,");
            strSql.Append("InstrumentName=@InstrumentName,");
            strSql.Append("InstrumentModel=@InstrumentModel,");
            strSql.Append("InstrumentType=@InstrumentType,");
            strSql.Append("SupplierId=@SupplierId,");
            strSql.Append("ExcelServerRCID=@ExcelServerRCID,");
            strSql.Append("ExcelServerRN=@ExcelServerRN,");
            strSql.Append("ExcelServerCN=@ExcelServerCN,");
            strSql.Append("ExcelServerRC1=@ExcelServerRC1,");
            strSql.Append("ExcelServerWIID=@ExcelServerWIID,");
            strSql.Append("ExcelServerRTID=@ExcelServerRTID,");
            strSql.Append("ExcelServerCHG=@ExcelServerCHG,");
            strSql.Append("KingdeeId=@KingdeeId,");
            strSql.Append("InnerId=@InnerId,");
            strSql.Append("Remark=@Remark");
            strSql.Append(" where ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@InstrumentID",    SqlDbType.Int,        4),
                new SqlParameter("@InstrumentName",  SqlDbType.NVarChar, 255),
                new SqlParameter("@InstrumentModel", SqlDbType.NVarChar, 100),
                new SqlParameter("@InstrumentType",  SqlDbType.NVarChar,  50),
                new SqlParameter("@SupplierId",      SqlDbType.Int,        4),
                new SqlParameter("@ExcelServerRCID", SqlDbType.NVarChar,  20),
                new SqlParameter("@ExcelServerRN",   SqlDbType.Int,        4),
                new SqlParameter("@ExcelServerCN",   SqlDbType.Int,        4),
                new SqlParameter("@ExcelServerRC1",  SqlDbType.NVarChar,  20),
                new SqlParameter("@ExcelServerWIID", SqlDbType.NVarChar,  20),
                new SqlParameter("@ExcelServerRTID", SqlDbType.NVarChar,  20),
                new SqlParameter("@ExcelServerCHG",  SqlDbType.Int,        4),
                new SqlParameter("@KingdeeId",       SqlDbType.NVarChar,  20),
                new SqlParameter("@InnerId",         SqlDbType.NVarChar,  20),
                new SqlParameter("@Remark",          SqlDbType.NVarChar, 255)
            };
            parameters[0].Value  = model.InstrumentID;
            parameters[1].Value  = model.InstrumentName;
            parameters[2].Value  = model.InstrumentModel;
            parameters[3].Value  = model.InstrumentType;
            parameters[4].Value  = model.SupplierId;
            parameters[5].Value  = model.ExcelServerRCID;
            parameters[6].Value  = model.ExcelServerRN;
            parameters[7].Value  = model.ExcelServerCN;
            parameters[8].Value  = model.ExcelServerRC1;
            parameters[9].Value  = model.ExcelServerWIID;
            parameters[10].Value = model.ExcelServerRTID;
            parameters[11].Value = model.ExcelServerCHG;
            parameters[12].Value = model.KingdeeId;
            parameters[13].Value = model.InnerId;
            parameters[14].Value = model.Remark;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.T_Instrument DataRowToModel(DataRow row)
 {
     Maticsoft.Model.T_Instrument model = new Maticsoft.Model.T_Instrument();
     if (row != null)
     {
         if (row["InstrumentID"] != null && row["InstrumentID"].ToString() != "")
         {
             model.InstrumentID = int.Parse(row["InstrumentID"].ToString());
         }
         if (row["InstrumentName"] != null)
         {
             model.InstrumentName = row["InstrumentName"].ToString();
         }
         if (row["InstrumentModel"] != null)
         {
             model.InstrumentModel = row["InstrumentModel"].ToString();
         }
         if (row["InstrumentType"] != null)
         {
             model.InstrumentType = row["InstrumentType"].ToString();
         }
         if (row["SupplierId"] != null && row["SupplierId"].ToString() != "")
         {
             model.SupplierId = int.Parse(row["SupplierId"].ToString());
         }
         if (row["ExcelServerRCID"] != null)
         {
             model.ExcelServerRCID = row["ExcelServerRCID"].ToString();
         }
         if (row["ExcelServerRN"] != null && row["ExcelServerRN"].ToString() != "")
         {
             model.ExcelServerRN = int.Parse(row["ExcelServerRN"].ToString());
         }
         if (row["ExcelServerCN"] != null && row["ExcelServerCN"].ToString() != "")
         {
             model.ExcelServerCN = int.Parse(row["ExcelServerCN"].ToString());
         }
         if (row["ExcelServerRC1"] != null)
         {
             model.ExcelServerRC1 = row["ExcelServerRC1"].ToString();
         }
         if (row["ExcelServerWIID"] != null)
         {
             model.ExcelServerWIID = row["ExcelServerWIID"].ToString();
         }
         if (row["ExcelServerRTID"] != null)
         {
             model.ExcelServerRTID = row["ExcelServerRTID"].ToString();
         }
         if (row["ExcelServerCHG"] != null && row["ExcelServerCHG"].ToString() != "")
         {
             model.ExcelServerCHG = int.Parse(row["ExcelServerCHG"].ToString());
         }
         if (row["KingdeeId"] != null)
         {
             model.KingdeeId = row["KingdeeId"].ToString();
         }
         if (row["InnerId"] != null)
         {
             model.InnerId = row["InnerId"].ToString();
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
     }
     return(model);
 }