Exemplo n.º 1
0
Arquivo: PrjDac.cs Projeto: ue96/ue96
        public int Update(PrjItemFilterInfo oParam)
        {
            string sql = @"UPDATE prj_item_filter SET
                            PrjItemSysNo=@PrjItemSysNo, Filter=@Filter,PriceFrom=@PriceFrom,PriceTo=@PriceTo
                            WHERE SysNo=@SysNo";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramPrjItemSysNo = new SqlParameter("@PrjItemSysNo", SqlDbType.Int, 4);
            SqlParameter paramFilter = new SqlParameter("@Filter", SqlDbType.NVarChar, 2000);
            SqlParameter paramPriceFrom = new SqlParameter("@PriceFrom", SqlDbType.Decimal, 9);
            SqlParameter paramPriceTo = new SqlParameter("@PriceTo", SqlDbType.Decimal, 9);

            if(oParam.SysNo != AppConst.IntNull)
                paramSysNo.Value = oParam.SysNo;
            else
                paramSysNo.Value = System.DBNull.Value;
            if (oParam.PrjItemSysNo != AppConst.IntNull)
                paramPrjItemSysNo.Value = oParam.PrjItemSysNo;
            else
                paramPrjItemSysNo.Value = System.DBNull.Value;
            if (oParam.Filter != AppConst.StringNull)
                paramFilter.Value = oParam.Filter;
            else
                paramFilter.Value = System.DBNull.Value;
            if (oParam.PriceFrom != AppConst.DecimalNull)
                paramPriceFrom.Value = oParam.PriceFrom;
            else
                paramPriceFrom.Value = System.DBNull.Value;
            if (oParam.PriceTo != AppConst.DecimalNull)
                paramPriceTo.Value = oParam.PriceTo;
            else
                paramPriceTo.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramPrjItemSysNo);
            cmd.Parameters.Add(paramFilter);
            cmd.Parameters.Add(paramPriceFrom);
            cmd.Parameters.Add(paramPriceTo);

            return SqlHelper.ExecuteNonQuery(cmd);
        }
Exemplo n.º 2
0
Arquivo: PrjDac.cs Projeto: ue96/ue96
        public int Insert(PrjItemFilterInfo oParam)
        {
            string sql = @"INSERT INTO prj_item_filter
                            (
                            PrjItemSysNo, Filter,PriceFrom,PriceTo
                            )
                            VALUES (
                            @PrjItemSysNo, @Filter,@PriceFrom,@PriceTo
                            );set @SysNo = SCOPE_IDENTITY();";
            SqlCommand cmd = new SqlCommand(sql);

            SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4);
            SqlParameter paramPrjItemSysNo = new SqlParameter("@PrjItemSysNo", SqlDbType.Int, 4);
            SqlParameter paramFilter = new SqlParameter("@Filter", SqlDbType.NVarChar, 2000);
            SqlParameter paramPriceFrom = new SqlParameter("@PriceFrom", SqlDbType.Decimal, 9);
            SqlParameter paramPriceTo = new SqlParameter("@PriceTo", SqlDbType.Decimal, 9);

            paramSysNo.Direction = ParameterDirection.Output;
            if (oParam.PrjItemSysNo != AppConst.IntNull)
                paramPrjItemSysNo.Value = oParam.PrjItemSysNo;
            else
                paramPrjItemSysNo.Value = System.DBNull.Value;
            if (oParam.Filter != AppConst.StringNull)
                paramFilter.Value = oParam.Filter;
            else
                paramFilter.Value = System.DBNull.Value;
            if (oParam.PriceFrom != AppConst.DecimalNull)
                paramPriceFrom.Value = oParam.PriceFrom;
            else
                paramPriceFrom.Value = System.DBNull.Value;
            if (oParam.PriceTo != AppConst.DecimalNull)
                paramPriceTo.Value = oParam.PriceTo;
            else
                paramPriceTo.Value = System.DBNull.Value;

            cmd.Parameters.Add(paramSysNo);
            cmd.Parameters.Add(paramPrjItemSysNo);
            cmd.Parameters.Add(paramFilter);
            cmd.Parameters.Add(paramPriceFrom);
            cmd.Parameters.Add(paramPriceTo);

            return SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo);
        }
Exemplo n.º 3
0
 public int InsertUpdatePrjItemFilter(PrjItemFilterInfo oParam)
 {
     string sql = "select * from prj_item_filter where prjitemsysno = " + oParam.PrjItemSysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     if (Util.HasMoreRow(ds))
     {
         oParam.SysNo = Util.TrimIntNull(ds.Tables[0].Rows[0]["sysno"]);
         return new PrjDac().Update(oParam);
     }
     else
     {
         return new PrjDac().Insert(oParam);
     }
 }
Exemplo n.º 4
0
 public PrjItemFilterInfo LoadPrjItemFilter(int PrjItemSysNo)
 {
     string sql = "select * from prj_item_filter where prjitemsysno=" + PrjItemSysNo;
     DataSet ds = SqlHelper.ExecuteDataSet(sql);
     PrjItemFilterInfo oParam = new PrjItemFilterInfo();
     if (Util.HasMoreRow(ds))
         mapPrjItemFilterInfo(oParam, ds.Tables[0].Rows[0]);
     else
         oParam = null;
     return oParam;
 }
Exemplo n.º 5
0
 private void mapPrjItemFilterInfo(PrjItemFilterInfo oParam, DataRow tempdr)
 {
     oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]);
     oParam.PrjItemSysNo = Util.TrimIntNull(tempdr["PrjItemSysNo"]);
     oParam.Filter = Util.TrimNull(tempdr["Filter"]);
     oParam.PriceFrom = Util.TrimDecimalNull(tempdr["PriceFrom"]);
     oParam.PriceTo = Util.TrimDecimalNull(tempdr["PriceTo"]);
 }