/// <summary>
        /// 设备配件添加操作
        /// </summary>
        /// <param name="model">设备配件信息</param>
        /// <returns>添加是否成功 false:失败,true:成功</returns>
        public static bool AddEquipmentFitInfo(EquipmentFitModel EquipFitModel)
        {
            try
            {
                StringBuilder sql = new StringBuilder();
                sql.AppendLine("INSERT INTO officedba.EquipmentFittings");
                sql.AppendLine("		(FitXH      ");
                sql.AppendLine("		,FittingNO        ");
                sql.AppendLine("		,CompanyCD        ");
                sql.AppendLine("		,EquipmentID        ");
                sql.AppendLine("		,FittingName        ");
                sql.AppendLine("		,FittingDescription        ");
                sql.AppendLine("		,EquiName        ");
                sql.AppendLine("		,ModifiedDate        ");
                sql.AppendLine("		,ModifiedUserID)        ");
                sql.AppendLine("VALUES                  ");
                sql.AppendLine("		(@FitXH     ");
                sql.AppendLine("		,@FittingNO       ");
                sql.AppendLine("		,@CompanyCD       ");
                sql.AppendLine("		,@EquipmentID       ");
                sql.AppendLine("		,@FittingName       ");
                sql.AppendLine("		,@FittingDescription       ");
                sql.AppendLine("		,@EquiName       ");
                sql.AppendLine("		,@ModifiedDate       ");
                sql.AppendLine("		,@ModifiedUserID)       ");
                //设置参数
                SqlParameter[] param;
                param = new SqlParameter[9];
                param[0] = SqlHelper.GetParameter("@FitXH", EquipFitModel.FitXH);
                param[1] = SqlHelper.GetParameter("@FittingNO", EquipFitModel.FittingNO);
                param[2] = SqlHelper.GetParameter("@CompanyCD", EquipFitModel.CompanyCD);
                param[3] = SqlHelper.GetParameter("@EquipmentID", EquipFitModel.EquipmentID);
                param[4] = SqlHelper.GetParameter("@FittingName", EquipFitModel.FittingName);
                param[5] = SqlHelper.GetParameter("@FittingDescription", EquipFitModel.FittingDescription);
                param[6] = SqlHelper.GetParameter("@EquiName", EquipFitModel.EquiName);
                param[7] = SqlHelper.GetParameter("@ModifiedDate", EquipFitModel.ModifiedDate);
                param[8] = SqlHelper.GetParameter("@ModifiedUserID", EquipFitModel.ModifiedUserID);

                SqlHelper.ExecuteTransSql(sql.ToString(), param);
                return SqlHelper.Result.OprateCount > 0 ? true : false;
            }
            catch
            {
                return false;
            }
        }
Ejemplo n.º 2
0
  /// <summary>
  /// 添加设备
  /// </summary>
  /// <param name="EquipModel">设备信息</param>
  /// <returns>添加是否成功 false:失败,true:成功</returns>
 public static bool AddEquipInfo(EquipmentFitModel EquipFitModel)
  {
      return EquipmentFitDBHelper.AddEquipmentFitInfo(EquipFitModel);
  }
       /// <summary>
       /// 设备和配件添加操作
       /// </summary>
       /// <param name="model">设备信息</param>
       /// <returns>添加是否成功 false:失败,true:成功</returns>
       public static bool UpdateAll(string UpdateEquipInfoSql, string FitInfo, string EquipmentNo, string CompanyCD)
       {
           EquipmentFitModel EquipFitM = new EquipmentFitModel();
           string[] strarray = null;
           string recorditems = "";
           string[] inseritems = null;
           try
           {
               strarray = FitInfo.Split('|');
               string[] sqlarray = new string[strarray.Length+1];
               sqlarray[0] = UpdateEquipInfoSql;
               sqlarray[1] = "DELETE officedba.EquipmentFittings WHERE EquipmentNo = '" + EquipmentNo + "'";
               for (int i = 1; i < strarray.Length; i++)
               {
                   StringBuilder fitsql = new StringBuilder();
                   recorditems = strarray[i];
                   inseritems = recorditems.Split(',');
                   if (recorditems.Length != 0)
                   {
                       string fitname = inseritems[0].ToString();//配件名称
                       string fitdesc = inseritems[1].ToString();//描述


                       fitsql.AppendLine("INSERT INTO officedba.EquipmentFittings");
                       fitsql.AppendLine("		(CompanyCD      ");
                       fitsql.AppendLine("		,EquipmentNo        ");
                       fitsql.AppendLine("		,FittingName        ");
                       fitsql.AppendLine("		,FittingDescription)        ");
                       fitsql.AppendLine("VALUES                  ");
                       fitsql.AppendLine("		('" + CompanyCD + "'     ");
                       fitsql.AppendLine("		,'" + EquipmentNo + "'       ");
                       fitsql.AppendLine("		,'" + fitname + "'       ");
                       fitsql.AppendLine("		,'" + fitdesc + "')       ");
                       sqlarray[i+1] = fitsql.ToString();
                   }
               }
               SqlHelper.ExecuteTransForListWithSQL(sqlarray);
               return SqlHelper.Result.OprateCount > 0 ? true : false;
           }
           catch
           {
               return false;
           }
       }