示例#1
0
        /// <summary>
        /// 删除采购订单
        /// </summary>
        /// <param name="BuyOrderID"></param>
        /// <returns></returns>
        public bool Delete(string BuyOrderID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("delete from BuyOrder ");
            strSql.Append(" where BuyOrderID=@BuyOrderID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BuyOrderID", SqlDbType.VarChar, 36)
            };
            parameters[0].Value = BuyOrderID;

            int rows = 0;

            IDbTransaction transaction = DBAccess.BeginDbTransaction(DB.Type, DB.ConnectionString);

            try
            {
                //删除分录
                BuyBillItemDAL item = new BuyBillItemDAL();
                item.Delete(BuyOrderID);

                //删除分阅人
                BOReaderDAL bor = new BOReaderDAL();
                bor.Delete(BuyOrderID);

                //删除复核人
                BOSecondCheckDAL bos = new BOSecondCheckDAL();
                bos.Delete(BuyOrderID);

                rows = DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), parameters);

                transaction.Commit();
            }
            catch
            {
                transaction.Rollback();
            }

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        /// <summary>
        /// 取消提交
        /// </summary>
        /// <param name="BuyOrderID">采购订单ID</param>
        /// <returns></returns>
        public bool UnSubmit(string BuyOrderID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BuyOrder set ");
            strSql.Append("OrderState='1',");
            strSql.Append("FirstChecker='',");
            strSql.Append("FirstCheckView='',");
            strSql.Append("SecondCheckerName='',");
            strSql.Append("ReaderName=''");
            strSql.Append(" where BuyOrderID=@BuyOrderID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BuyOrderID", SqlDbType.VarChar, 36)
            };
            parameters[0].Value = BuyOrderID;

            IDbTransaction transaction = DBAccess.BeginDbTransaction(DB.Type, DB.ConnectionString);

            try
            {
                DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), parameters);

                BOSecondCheckDAL boSC = new BOSecondCheckDAL();
                boSC.Delete(BuyOrderID);

                BOReaderDAL bSC = new BOReaderDAL();
                bSC.Delete(BuyOrderID);

                transaction.Commit();
                return(true);
            }
            catch
            {
                transaction.Rollback();
            }
            return(false);
        }
示例#3
0
        /// <summary>
        /// 修改采购单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateBuyBill(BuyBill model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BuyOrder set ");
            strSql.Append("BuyOrderCode=@BuyOrderCode,");
            strSql.Append("BuyOrderDate=@BuyOrderDate,");
            strSql.Append("SupplierID=@SupplierID,");
            strSql.Append("DeliveryDate=@DeliveryDate,");
            strSql.Append("Editor=@Editor,");
            strSql.Append("EditTime=@EditTime,");
            strSql.Append("FirstChecker=@FirstChecker,");
            strSql.Append("FirstCheckTime=@FirstCheckTime,");
            strSql.Append("FirstCheckView=@FirstCheckView,");
            strSql.Append("RecCompany=@RecCompany,");
            strSql.Append("RecTel=@RecTel,");
            strSql.Append("RecFax=@RecFax,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("SecondCheckerName=@SecondCheckerName,");
            strSql.Append("ReaderName=@ReaderName");
            strSql.Append(" where BuyOrderID=@BuyOrderID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BuyOrderCode",      SqlDbType.VarChar,     60),
                new SqlParameter("@BuyOrderDate",      SqlDbType.Char,         8),
                new SqlParameter("@SupplierID",        SqlDbType.VarChar,     36),
                new SqlParameter("@DeliveryDate",      SqlDbType.Char,         8),
                new SqlParameter("@Editor",            SqlDbType.VarChar,     36),
                new SqlParameter("@EditTime",          SqlDbType.DateTime),
                new SqlParameter("@FirstChecker",      SqlDbType.VarChar,     36),
                new SqlParameter("@FirstCheckTime",    SqlDbType.DateTime),
                new SqlParameter("@FirstCheckView",    SqlDbType.VarChar,    255),
                new SqlParameter("@RecCompany",        SqlDbType.VarChar,    255),
                new SqlParameter("@RecTel",            SqlDbType.VarChar,     30),
                new SqlParameter("@RecFax",            SqlDbType.VarChar,     30),
                new SqlParameter("@Remark",            SqlDbType.VarChar,   1024),
                new SqlParameter("@SecondCheckerName", SqlDbType.VarChar,    255),
                new SqlParameter("@ReaderName",        SqlDbType.VarChar,    255),
                new SqlParameter("@BuyOrderID",        SqlDbType.VarChar, 36)
            };
            parameters[0].Value  = model.BuyOrderCode;
            parameters[1].Value  = model.BuyOrderDate;
            parameters[2].Value  = model.SupplierID;
            parameters[3].Value  = model.DeliveryDate;
            parameters[4].Value  = model.Editor;
            parameters[5].Value  = model.EditTime;
            parameters[6].Value  = model.FirstChecker;
            parameters[7].Value  = model.FirstCheckTime;
            parameters[8].Value  = model.FirstCheckView;
            parameters[9].Value  = model.RecCompany;
            parameters[10].Value = model.RecTel;
            parameters[11].Value = model.RecFax;
            parameters[12].Value = model.Remark;
            parameters[13].Value = model.SecondCheckerName;
            parameters[14].Value = model.ReaderName;
            parameters[15].Value = model.BuyOrderID;

            IDbTransaction transaction = DBAccess.BeginDbTransaction(DB.Type, DB.ConnectionString);

            try
            {
                DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), parameters);

                BOSecondCheckDAL boSC = new BOSecondCheckDAL();
                int socount           = model.CList.Count;
                if (socount > 0)
                {
                    boSC.Delete(model.BuyOrderID);
                    for (int i = 0; i < socount; i++)
                    {
                        BOSecondCheck bosc = model.CList[i] as BOSecondCheck;
                        boSC.Add(bosc);
                    }
                }

                BOReaderDAL rSC    = new BOReaderDAL();
                int         rcount = model.RList.Count;
                if (rcount > 0)
                {
                    rSC.Delete(model.BuyOrderID);
                    for (int i = 0; i < rcount; i++)
                    {
                        BOReader sor = model.RList[i] as BOReader;
                        rSC.Add(sor);
                    }
                }

                transaction.Commit();
            }
            catch
            {
                transaction.Rollback();
            }

            return(true);
        }