Example #1
0
        public Bill_xmzfd GetXmzfdByCode(string billCode)
        {
            string sql = "select * from bill_xmzfd where billCode=@billCode";

            SqlParameter[] sps   = { new SqlParameter("@billCode", billCode) };
            SqlDataReader  dr    = DataHelper.GetDataReader(sql, sps);
            Bill_xmzfd     xmzfd = new Bill_xmzfd();

            if (dr.Read())
            {
                xmzfd.Billcode = Convert.ToString(dr["billcode"]);
                xmzfd.Sj       = Convert.ToDateTime(dr["sj"]);
                xmzfd.ZfDept   = Convert.ToString(dr["zfDept"]);
                xmzfd.Zfxm     = Convert.ToString(dr["zfxm"]);
                xmzfd.Zynr     = Convert.ToString(dr["zynr"]);
                xmzfd.Sm       = Convert.ToString(dr["sm"]);
                xmzfd.Cbr      = Convert.ToString(dr["cbr"]);
                xmzfd.Ms       = Convert.ToString(dr["ms"]);
                xmzfd.Zfje     = Convert.ToDecimal(dr["zfje"]);
                return(xmzfd);
            }
            else
            {
                return(null);
            }
        }
Example #2
0
        public void InsertXmzfdDal(Bill_xmzfd xmzfd, SqlTransaction tran)
        {
            string sql = @"insert into bill_xmzfd(billcode,sj,zfDept,zfxm,zynr,sm,cbr,ms,zfje) values (@billcode,@sj,@zfDept,@zfxm,@zynr,@sm,@cbr,@ms,@zfje)";

            SqlParameter[] parameters =
            {
                new SqlParameter("@billcode", SqlNull(xmzfd.Billcode)),
                new SqlParameter("@sj",       SqlNull(xmzfd.Sj)),
                new SqlParameter("@zfDept",   SqlNull(xmzfd.ZfDept)),
                new SqlParameter("@zfxm",     SqlNull(xmzfd.Zfxm)),
                new SqlParameter("@zynr",     SqlNull(xmzfd.Zynr)),
                new SqlParameter("@sm",       SqlNull(xmzfd.Sm)),
                new SqlParameter("@cbr",      SqlNull(xmzfd.Cbr)),
                new SqlParameter("@ms",       SqlNull(xmzfd.Ms)),
                new SqlParameter("@zfje",     SqlNull(xmzfd.Zfje))
            };


            DataHelper.ExcuteNonQuery(sql, tran, parameters, false);
        }
Example #3
0
 public void InsertXmzfdDal(Bill_xmzfd xmzfd, Bill_Main main)
 {
     using (SqlConnection conn = new SqlConnection(DataHelper.constr))
     {
         conn.Open();
         SqlTransaction tran = conn.BeginTransaction();
         try
         {
             MainDal mainDal = new MainDal();
             if (GetXmzfdByCode(xmzfd.Billcode) != null)
             {
                 DeleteXmzfd(xmzfd.Billcode, tran);
             }
             mainDal.InsertMain(main, tran);
             InsertXmzfdDal(xmzfd, tran);
             tran.Commit();
         }
         catch
         {
             tran.Rollback();
             throw;
         }
     }
 }
Example #4
0
 public void InsertXmzfdDal(Bill_xmzfd xmzfd, Bill_Main main)
 {
     xmzfdal.InsertXmzfdDal(xmzfd, main);
 }