Beispiel #1
0
        /// <summary>
        /// 复审
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateCheckS(BuyApplyBill model, BOASecondCheck boc)
        {
            BOASecondCheckDAL bocDal = new BOASecondCheckDAL();

            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BuyApplyOrder set ");
            strSql.Append("OrderState=@OrderState");
            strSql.Append(" where BuyApplyOrderID=@BuyApplyOrderID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OrderState",      SqlDbType.Char,    1),
                new SqlParameter("@BuyApplyOrderID", SqlDbType.VarChar, 36)
            };
            parameters[0].Value = model.OrderState;
            parameters[1].Value = model.BuyApplyOrderID;

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

            try
            {
                bocDal.Check(boc);
                if (bocDal.IsCheck(model.BuyApplyOrderID))
                {
                    DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), parameters);
                }

                transaction.Commit();
            }
            catch
            {
                transaction.Rollback();
            }
            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// 删除采购订单
        /// </summary>
        /// <param name="BuyOrderID"></param>
        /// <returns></returns>
        public bool Delete(string BuyApplyOrderID)
        {
            StringBuilder strSql = new StringBuilder();

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

            int rows = 0;

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

            try
            {
                //删除分录
                BuyApplyBillItemDAL item = new BuyApplyBillItemDAL();
                item.Delete(BuyApplyOrderID);

                //删除分阅人
                BOAReaderDAL bor = new BOAReaderDAL();
                bor.Delete(BuyApplyOrderID);

                //删除复核人
                BOASecondCheckDAL bos = new BOASecondCheckDAL();
                bos.Delete(BuyApplyOrderID);

                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);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 取消提交
        /// </summary>
        /// <param name="BuyOrderID">采购订单ID</param>
        /// <returns></returns>
        public bool UnSubmit(string BuyApplyOrderID)
        {
            StringBuilder strSql = new StringBuilder();

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

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

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

                BOASecondCheckDAL boSC = new BOASecondCheckDAL();
                boSC.Delete(BuyApplyOrderID);

                BOAReaderDAL bSC = new BOAReaderDAL();
                bSC.Delete(BuyApplyOrderID);

                transaction.Commit();
                return(true);
            }
            catch
            {
                transaction.Rollback();
            }
            return(false);
        }
Beispiel #4
0
        /// <summary>
        /// 新增采购单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddBuyApplyBill(BuyApplyBill model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into BuyApplyOrder(");
            strSql.Append("BuyApplyOrderID,BuyApplyOrderCode,BuyApplyOrderDate,SupplierID,DeliveryDate,Creator,CreateTime,Editor,EditTime,FirstChecker,RecCompany,RecTel,RecFax,OrderState,Remark,SecondCheckerName,ReaderName)");
            strSql.Append(" values (");
            strSql.Append("@BuyApplyOrderID,@BuyApplyOrderCode,@BuyApplyOrderDate,@SupplierID,@DeliveryDate,@Creator,@CreateTime,@Editor,@EditTime,@FirstChecker,@RecCompany,@RecTel,@RecFax,@OrderState,@Remark,@SecondCheckerName,@ReaderName)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BuyApplyOrderID",   SqlDbType.VarChar,     36),
                new SqlParameter("@BuyApplyOrderCode", SqlDbType.VarChar,     60),
                new SqlParameter("@BuyApplyOrderDate", SqlDbType.Char,         8),
                new SqlParameter("@SupplierID",        SqlDbType.VarChar,     36),
                new SqlParameter("@DeliveryDate",      SqlDbType.Char,         8),
                new SqlParameter("@Creator",           SqlDbType.VarChar,     36),
                new SqlParameter("@CreateTime",        SqlDbType.DateTime),
                new SqlParameter("@Editor",            SqlDbType.VarChar,     36),
                new SqlParameter("@EditTime",          SqlDbType.DateTime),
                new SqlParameter("@FirstChecker",      SqlDbType.VarChar,     36),
                new SqlParameter("@RecCompany",        SqlDbType.VarChar,    255),
                new SqlParameter("@RecTel",            SqlDbType.VarChar,     30),
                new SqlParameter("@RecFax",            SqlDbType.VarChar,     30),
                new SqlParameter("@OrderState",        SqlDbType.Char,         1),
                new SqlParameter("@Remark",            SqlDbType.VarChar,   1024),
                new SqlParameter("@SecondCheckerName", SqlDbType.VarChar,    255),
                new SqlParameter("@ReaderName",        SqlDbType.VarChar, 255)
            };
            parameters[0].Value  = model.BuyApplyOrderID;
            parameters[1].Value  = model.BuyApplyOrderCode;
            parameters[2].Value  = model.BuyApplyOrderDate;
            parameters[3].Value  = model.SupplierID;
            parameters[4].Value  = model.DeliveryDate;
            parameters[5].Value  = model.Creator;
            parameters[6].Value  = model.CreateTime;
            parameters[7].Value  = model.Editor;
            parameters[8].Value  = model.EditTime;
            parameters[9].Value  = model.FirstChecker;
            parameters[10].Value = model.RecCompany;
            parameters[11].Value = model.RecTel;
            parameters[12].Value = model.RecFax;
            parameters[13].Value = model.OrderState;
            parameters[14].Value = model.Remark;
            parameters[15].Value = model.SecondCheckerName;
            parameters[16].Value = model.ReaderName;

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

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

                BOASecondCheckDAL boSC = new BOASecondCheckDAL();
                int ccount             = model.CList.Count;
                if (ccount > 0)
                {
                    for (int i = 0; i < ccount; i++)
                    {
                        BOASecondCheck sosc = model.CList[i] as BOASecondCheck;
                        boSC.Add(sosc);
                    }
                }

                BOAReaderDAL rSC    = new BOAReaderDAL();
                int          rcount = model.RList.Count;
                if (rcount > 0)
                {
                    for (int i = 0; i < rcount; i++)
                    {
                        BOAReader bor = model.RList[i] as BOAReader;
                        rSC.Add(bor);
                    }
                }

                BuyApplyBillItemDAL item = new BuyApplyBillItemDAL();
                item.Save(model.BuyApplyOrderID, model.OldBuyOrderID);

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

            return(1);
        }
Beispiel #5
0
        /// <summary>
        /// 修改采购单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateBuyApplyBill(BuyApplyBill model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BuyApplyOrder set ");
            strSql.Append("BuyApplyOrderCode=@BuyApplyOrderCode,");
            strSql.Append("BuyApplyOrderDate=@BuyApplyOrderDate,");
            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 BuyApplyOrderID=@BuyApplyOrderID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BuyApplyOrderCode", SqlDbType.VarChar,     60),
                new SqlParameter("@BuyApplyOrderDate", 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("@BuyApplyOrderID",   SqlDbType.VarChar, 36)
            };
            parameters[0].Value  = model.BuyApplyOrderCode;
            parameters[1].Value  = model.BuyApplyOrderDate;
            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.BuyApplyOrderID;

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

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

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

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

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

            return(true);
        }