Exemplo n.º 1
0
        public bool Classify()
        {
            int            rst         = 0;
            IDbTransaction transaction = DBAccess.BeginDbTransaction(DB.Type, DB.ConnectionString);

            try
            {
                //清空表当前数据
                Clear();
                //归集数据,插入表
                string sql = @"insert into ClientClassification(Id,Amount,ClientName,LevelName,LevelTypeName) 
select NEWID() Id,t1.*,cl.LevelName,case cl.LevelType when 'SOTotalAmmount' then '销售订单总额' end LevelTypeName
from (select SUM(so.SaleCost) Amount,c.ClientName
from SaleOrder so 
left join Client c on so.ClientID=c.ClientID
where so.ClientID is not null and so.ClientID <> '' 
GROUP by so.ClientID,c.ClientName) t1,ClientLevel cl
where t1.Amount >= cl.LevelMin and t1.Amount < cl.LevelMax";
                rst = DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, sql);
                transaction.Commit();
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                base.Logger.LogError(ex);
                return(false);
            }
            return(rst > 0);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 复审
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateCheckS(BuyBill model, BOSecondCheck boc)
        {
            BOSecondCheckDAL bocDal = new BOSecondCheckDAL();

            StringBuilder strSql = new StringBuilder();

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

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

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

                transaction.Commit();
            }
            catch
            {
                transaction.Rollback();
            }
            return(true);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 删除公文
        /// </summary>
        /// <param name="OfficeDocID"></param>
        /// <returns></returns>
        public int DelOfficeDoc(string OfficeDocID)
        {
            StringBuilder strSql = new StringBuilder();

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

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

            try
            {
                OfficeDocItemDAL itemBll = new OfficeDocItemDAL();
                itemBll.DelOfficeDocItem(OfficeDocID);

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

                transaction.Commit();
            }
            catch
            {
                transaction.Rollback();
            }
            return(1);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 修改用户
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool Update(UserInfo model)
        {
            URrelationDAL urDal = new URrelationDAL();

            StringBuilder strSql = new StringBuilder();

            strSql.Append("update OA_User set ");
            strSql.Append("UserCode=@UserCode,");
            strSql.Append("UserName=@UserName,");
            strSql.Append("UserState=@UserState,");
            strSql.Append("DeptID=@DeptID,");
            strSql.Append("Operator=@Operator");
            strSql.Append(" where UserID=@UserID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserCode",  SqlDbType.NVarChar, 20),
                new SqlParameter("@UserName",  SqlDbType.VarChar,  20),
                new SqlParameter("@UserState", SqlDbType.Char,      1),
                new SqlParameter("@DeptID",    SqlDbType.VarChar,  36),
                new SqlParameter("@Operator",  SqlDbType.NVarChar, 30),
                new SqlParameter("@UserID",    SqlDbType.VarChar, 36)
            };
            parameters[0].Value = model.UserCode;
            parameters[1].Value = model.UserName;
            parameters[2].Value = model.UserState;
            parameters[3].Value = model.DeptID;
            parameters[4].Value = model.Operator;
            parameters[5].Value = model.UserID;

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

            try
            {
                int rows = DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), parameters);
                if (rows > 0)
                {
                    urDal.Delete(model.UserID);

                    URrelation ur = new URrelation();
                    ur.ID     = System.Guid.NewGuid().ToString();
                    ur.UserID = model.UserID;
                    ur.RoleID = model.RoleID;
                    urDal.Add(ur);

                    transaction.Commit();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                transaction.Rollback();
            }
            return(false);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 新增到货单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddReachGoodsBill(ReachGoodsBill model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into OA_ReachGoodsBill(");
            strSql.Append("ReachGoodsBillID,ReachGoodsBillCode,BuyOrderCode,ReachGoodsDate,CreateBillTime,CreateUserID,InforPerson,Remark,BuyOrderID)");
            strSql.Append(" values (");
            strSql.Append("@ReachGoodsBillID,@ReachGoodsBillCode,@BuyOrderCode,@ReachGoodsDate,@CreateBillTime,@CreateUserID,@InforPerson,@Remark,@BuyOrderID)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ReachGoodsBillID",   SqlDbType.VarChar,    36),
                new SqlParameter("@ReachGoodsBillCode", SqlDbType.NVarChar,   50),
                new SqlParameter("@BuyOrderCode",       SqlDbType.NVarChar,   50),
                new SqlParameter("@ReachGoodsDate",     SqlDbType.Char,        8),
                new SqlParameter("@CreateBillTime",     SqlDbType.DateTime),
                new SqlParameter("@CreateUserID",       SqlDbType.VarChar,    36),
                new SqlParameter("@InforPerson",        SqlDbType.VarChar,    36),
                new SqlParameter("@Remark",             SqlDbType.NVarChar,  300),
                new SqlParameter("@BuyOrderID",         SqlDbType.VarChar, 36)
            };
            parameters[0].Value = model.ReachGoodsBillID;
            parameters[1].Value = model.ReachGoodsBillCode;
            parameters[2].Value = model.BuyOrderCode;
            parameters[3].Value = model.ReachGoodsDate;
            parameters[4].Value = model.CreateBillTime;
            parameters[5].Value = model.CreateUserID;
            parameters[6].Value = model.InforPerson;
            parameters[7].Value = model.Remark;
            parameters[8].Value = model.BuyOrderID;

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

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

                ReachGoodsBillItemDAL item = new ReachGoodsBillItemDAL();
                item.Save(model.ReachGoodsBillID);

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

            return(1);
        }
Exemplo n.º 6
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);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 新增公章申请
        /// </summary>
        /// <param name="model"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public bool Add(OA.Model.ApplyPublicPower model, IList <ApplyPublicPowerItem> list)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ApplyPublicPower(");
            strSql.Append("AppID,DeptID,ApplyDate,Creator,CreateTime,FirstChecker,SecondChecker)");
            strSql.Append(" values (");
            strSql.Append("@AppID,@DeptID,@ApplyDate,@Creator,@CreateTime,@FirstChecker,@SecondChecker)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@AppID",         SqlDbType.VarChar,   36),
                new SqlParameter("@DeptID",        SqlDbType.VarChar,   36),
                new SqlParameter("@ApplyDate",     SqlDbType.Char,       8),
                new SqlParameter("@Creator",       SqlDbType.VarChar,   36),
                new SqlParameter("@CreateTime",    SqlDbType.DateTime),
                new SqlParameter("@FirstChecker",  SqlDbType.VarChar,   36),
                new SqlParameter("@SecondChecker", SqlDbType.VarChar, 36)
            };
            parameters[0].Value = model.AppID;
            parameters[1].Value = model.DeptID;
            parameters[2].Value = model.ApplyDate;
            parameters[3].Value = model.Creator;
            parameters[4].Value = model.CreateTime;
            parameters[5].Value = model.FirstChecker;
            parameters[6].Value = model.SecondChecker;

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

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

                ApplyPublicPowerItemDAL itemBll = new ApplyPublicPowerItemDAL();

                for (int i = 0; i < list.Count; i++)
                {
                    ApplyPublicPowerItem item = list[i] as ApplyPublicPowerItem;
                    itemBll.Add(item);
                }
                transaction.Commit();
            }
            catch
            {
                transaction.Rollback();
            }
            return(true);
        }
Exemplo n.º 8
0
        /// <summary>
        /// 新增公文
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddOfficeDoc(OfficeDoc model, IList <OfficeDocItem> list)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into OA_OfficeDoc(");
            strSql.Append("OfficeDocID,Title,Contents,WriterID,WriteTime)");
            strSql.Append(" values (");
            strSql.Append("@OfficeDocID,@Title,@Contents,@WriterID,@WriteTime)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@OfficeDocID", SqlDbType.VarChar,   36),
                new SqlParameter("@Title",       SqlDbType.NVarChar, 100),
                new SqlParameter("@Contents",    SqlDbType.Text),
                new SqlParameter("@WriterID",    SqlDbType.VarChar,   36),
                new SqlParameter("@WriteTime",   SqlDbType.DateTime)
            };
            parameters[0].Value = model.OfficeDocID;
            parameters[1].Value = model.Title;
            parameters[2].Value = model.Contents;
            parameters[3].Value = model.WriterID;
            parameters[4].Value = model.WriteTime;

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

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

                OfficeDocItemDAL itemBll = new OfficeDocItemDAL();

                for (int i = 0; i < list.Count; i++)
                {
                    OfficeDocItem item = list[i] as OfficeDocItem;
                    itemBll.AddOfficeDocItem(item);
                }
                transaction.Commit();
            }
            catch
            {
                transaction.Rollback();
            }
            return(1);
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        /// <summary>
        /// 复审
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool SecondCheck(SaleOrder model, SOSecondCheck soc)
        {
            SOSecondCheckDAL socDal = new SOSecondCheckDAL();

            StringBuilder strSql = new StringBuilder();

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


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

            try
            {
                socDal.Check(soc);
                if (socDal.IsCheck(model.SaleOrderID))
                {
                    DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), parameters);
                }

                transaction.Commit();
            }
            catch
            {
                transaction.Rollback();
            }
            return(true);
        }
Exemplo n.º 11
0
        /// <summary>
        /// 复审
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool SecondCheck(AskPrice model, APSecondCheck apsc)
        {
            APSecondCheckDAL apscDal = new APSecondCheckDAL();

            StringBuilder strSql = new StringBuilder();

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


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

            try
            {
                apscDal.Check(apsc);
                if (apscDal.IsCheck(model.APID))
                {
                    DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), parameters);
                }

                transaction.Commit();
            }
            catch
            {
                transaction.Rollback();
            }
            return(true);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 新增采购单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddBuyBill(BuyBill model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into BuyOrder(");
            strSql.Append("BuyOrderID,BuyOrderCode,BuyOrderDate,SupplierID,DeliveryDate,Creator,CreateTime,Editor,EditTime,FirstChecker,RecCompany,RecTel,RecFax,OrderState,Remark,SecondCheckerName,ReaderName)");
            strSql.Append(" values (");
            strSql.Append("@BuyOrderID,@BuyOrderCode,@BuyOrderDate,@SupplierID,@DeliveryDate,@Creator,@CreateTime,@Editor,@EditTime,@FirstChecker,@RecCompany,@RecTel,@RecFax,@OrderState,@Remark,@SecondCheckerName,@ReaderName)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BuyOrderID",        SqlDbType.VarChar,     36),
                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("@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.BuyOrderID;
            parameters[1].Value  = model.BuyOrderCode;
            parameters[2].Value  = model.BuyOrderDate;
            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);

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

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

                BuyBillItemDAL item = new BuyBillItemDAL();
                item.Save(model.BuyOrderID, model.OldBuyOrderID);

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

            return(1);
        }
Exemplo n.º 13
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);
        }
Exemplo n.º 14
0
        public override bool Save(params AskPrice[] entities)
        {
            if (entities == null || entities.Length < 1)
            {
                return(false);
            }
            //Logger.LogInfo(entities.SerializeToJson());
            StringBuilder       sbSqlAskPrice  = new StringBuilder();
            List <Func <bool> > saveItemsFuncs = new List <Func <bool> >();
            List <SqlParameter> sqlParams      = new List <SqlParameter>();
            AskPrice            entity         = null;

            for (int i = 0; i < entities.Length; i++)
            {
                entity = entities[i];
                //1、组织sql
                //①询价单
                if (ValidateUtil.isBlank(entity.APID))
                {
                    //新增,保存部分字段
                    entity.APID = Guid.NewGuid().ToString();
                    sbSqlAskPrice.AppendFormat("insert into {0}(APID,APCode,APType,AskDate,ClientID,PayTypeID,TrackDescription,ClientSurvey,APRemark,Creator,CreateTime,State)", TableName);
                    sbSqlAskPrice.AppendFormat(" values (@APID{0},@APCode{0},@APType{0},@AskDate{0},@ClientID{0},@PayTypeID{0},@TrackDescription{0},@ClientSurvey{0},@APRemark{0},@Creator{0},@CreateTime{0},@State{0});", i);
                    sqlParams.AddRange(new SqlParameter[] {
                        new SqlParameter {
                            ParameterName = "@Creator" + i, Value = entity.Creator
                        },
                        new SqlParameter {
                            ParameterName = "@CreateTime" + i, Value = entity.CreateTime
                        },
                        new SqlParameter {
                            ParameterName = "@State" + i, Value = entity.State
                        },
                    });
                }
                else
                {
                    //修改,只更新部分字段
                    sbSqlAskPrice.AppendFormat("update {0} set APType=@APType{1},AskDate=@AskDate{1},ClientID=@ClientID{1},PayTypeID=@PayTypeID{1},TrackDescription=@TrackDescription{1},ClientSurvey=@ClientSurvey{1},APRemark=@APRemark{1},Editor=@Editor{1},EditTime=@EditTime{1}", TableName, i);
                    sbSqlAskPrice.AppendFormat(" where APID=@APID{0};", i);
                    sqlParams.AddRange(new SqlParameter[] {
                        new SqlParameter {
                            ParameterName = "@Editor" + i, Value = entity.Editor
                        },
                        new SqlParameter {
                            ParameterName = "@EditTime" + i, Value = entity.EditTime
                        },
                    });
                }
                //不管新增或修改, 参数都一样
                sqlParams.AddRange(new SqlParameter[] {
                    new SqlParameter {
                        ParameterName = "@APID" + i, Value = entity.APID
                    },
                    new SqlParameter {
                        ParameterName = "@APCode" + i, Value = entity.APCode
                    },
                    new SqlParameter {
                        ParameterName = "@APType" + i, Value = entity.APType
                    },
                    new SqlParameter {
                        ParameterName = "@AskDate" + i, Value = entity.AskDate
                    },
                    new SqlParameter {
                        ParameterName = "@ClientID" + i, Value = entity.ClientID
                    },
                    new SqlParameter {
                        ParameterName = "@PayTypeID" + i, Value = entity.PayTypeID
                    },
                    new SqlParameter {
                        ParameterName = "@TrackDescription" + i, Value = entity.TrackDescription
                    },
                    new SqlParameter {
                        ParameterName = "@ClientSurvey" + i, Value = entity.ClientSurvey
                    },
                    new SqlParameter {
                        ParameterName = "@APRemark" + i, Value = entity.APRemark
                    },
                });
                //②询价单行
                if (entity.Items != null && entity.Items.Count > 0)
                {
                    foreach (var item in entity.Items)
                    {
                        item.APID = entity.APID;
                        saveItemsFuncs.Add(() =>
                        {
                            //调用AskPriceItemDAL.Save
                            return(apItemDAL.Save(entity.Items.ToArray()));
                        });
                    }
                }
            }
            //2、执行sql
            IDbTransaction transaction = DBAccess.BeginDbTransaction(DB.Type, DB.ConnectionString);
            int            rst         = 0;

            try
            {
                rst = DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, sbSqlAskPrice.ToString(), sqlParams.ToArray());
                //保存询价单行
                if (saveItemsFuncs.Count > 0)
                {
                    foreach (var func in saveItemsFuncs)
                    {
                        func();
                    }
                }
                //提交
                transaction.Commit();
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                base.Logger.LogError(ex);
                return(false);
            }
            //3、返回成功或失败的标志
            return(rst > 0);
        }
Exemplo n.º 15
0
        public override bool Save(params GoodsMovement[] entities)
        {
            if (entities == null || entities.Length < 1)
            {
                return(false);
            }
            //Logger.LogInfo(entities.SerializeToJson());
            StringBuilder       sbSqlGM        = new StringBuilder();
            List <Func <bool> > saveItemsFuncs = new List <Func <bool> >();
            List <SqlParameter> sqlParams      = new List <SqlParameter>();
            GoodsMovement       entity         = null;

            for (int i = 0; i < entities.Length; i++)
            {
                entity = entities[i];
                //1、组织sql
                //①货物移动
                if (ValidateUtil.isBlank(entity.GoodsMovementID))
                {
                    //新增,保存部分字段
                    entity.GoodsMovementID = Guid.NewGuid().ToString();
                    sbSqlGM.AppendFormat("insert into {0}(GoodsMovementID,BusinessType,MoveTypeCode,GoodsMovementCode,CreateDate,ReceiptDate,RecDeptID,RecHandler,RecWHID,RecWHEmpID,IssDate,IssDeptID,IssHandler,IssWHID,IssWHEmpID,PurDeptID,PurEmpID,SupplierID,SalesDepID,SalesEmpID,CustomerID,ProDepID,ProEmpID,ConDepID,ConEmpID,Creator,CreateTime,BillState,IsRed,Remark)", TableName);
                    sbSqlGM.AppendFormat(" values (@GoodsMovementID{0},@BusinessType{0},@MoveTypeCode{0},@GoodsMovementCode{0},@CreateDate{0},@ReceiptDate{0},@RecDeptID{0},@RecHandler{0},@RecWHID{0},@RecWHEmpID{0},@IssDate{0},@IssDeptID{0},@IssHandler{0},@IssWHID{0},@IssWHEmpID{0},@PurDeptID{0},@PurEmpID{0},@SupplierID{0},@SalesDepID{0},@SalesEmpID{0},@CustomerID{0},@ProDepID{0},@ProEmpID{0},@ConDepID{0},@ConEmpID{0},@Creator{0},@CreateTime{0},@BillState{0},@IsRed{0},@Remark{0});", i);
                    sqlParams.AddRange(new SqlParameter[] {
                        new SqlParameter {
                            ParameterName = "@Creator" + i, Value = entity.Creator
                        },
                        new SqlParameter {
                            ParameterName = "@CreateTime" + i, Value = entity.CreateTime
                        },
                        new SqlParameter {
                            ParameterName = "@BillState" + i, Value = entity.BillState
                        },
                    });
                }
                else
                {
                    //修改,只更新部分字段
                    sbSqlGM.AppendFormat("update {0} set BusinessType=@BusinessType{1},MoveTypeCode=@MoveTypeCode{1},CreateDate=@CreateDate{1},ReceiptDate=@ReceiptDate{1},RecDeptID=@RecDeptID{1},RecHandler=@RecHandler{1},RecWHID=@RecWHID{1},RecWHEmpID=@RecWHEmpID{1},IssDate=@IssDate{1},IssDeptID=@IssDeptID{1},IssHandler=@IssHandler{1},IssWHID=@IssWHID{1},IssWHEmpID=@IssWHEmpID{1},PurDeptID=@PurDeptID{1},PurEmpID=@PurEmpID{1},SupplierID=@SupplierID{1},SalesDepID=@SalesDepID{1},SalesEmpID=@SalesEmpID{1},CustomerID=@CustomerID{1},ProDepID=@ProDepID{1},ProEmpID=@ProEmpID{1},ConDepID=@ConDepID{1},ConEmpID=@ConEmpID{1},IsRed=@IsRed{1},Remark=@Remark{1},Editor=@Editor{1},EditTime=@EditTime{1}", TableName, i);
                    sbSqlGM.AppendFormat(" where GoodsMovementID=@GoodsMovementID{0};", i);
                    sqlParams.AddRange(new SqlParameter[] {
                        new SqlParameter {
                            ParameterName = "@Editor" + i, Value = entity.Editor
                        },
                        new SqlParameter {
                            ParameterName = "@EditTime" + i, Value = entity.EditTime
                        },
                    });
                }
                //不管新增或修改, 参数都一样
                sqlParams.AddRange(new SqlParameter[] {
                    new SqlParameter {
                        ParameterName = "@GoodsMovementID" + i, Value = entity.GoodsMovementID
                    },
                    new SqlParameter {
                        ParameterName = "@BusinessType" + i, Value = entity.BusinessType
                    },
                    new SqlParameter {
                        ParameterName = "@MoveTypeCode" + i, Value = entity.MoveTypeCode
                    },
                    new SqlParameter {
                        ParameterName = "@GoodsMovementCode" + i, Value = entity.GoodsMovementCode
                    },
                    new SqlParameter {
                        ParameterName = "@CreateDate" + i, Value = string.IsNullOrEmpty(entity.CreateDate)?null:entity.CreateDate.Replace("-", "")
                    },
                    new SqlParameter {
                        ParameterName = "@ReceiptDate" + i, Value = string.IsNullOrEmpty(entity.ReceiptDate)?null:entity.ReceiptDate.Replace("-", "")
                    },
                    new SqlParameter {
                        ParameterName = "@RecDeptID" + i, Value = entity.RecDeptID
                    },
                    new SqlParameter {
                        ParameterName = "@RecHandler" + i, Value = entity.RecHandler
                    },
                    new SqlParameter {
                        ParameterName = "@RecWHID" + i, Value = entity.RecWHID
                    },
                    new SqlParameter {
                        ParameterName = "@RecWHEmpID" + i, Value = entity.RecWHEmpID
                    },
                    new SqlParameter {
                        ParameterName = "@IssDate" + i, Value = string.IsNullOrEmpty(entity.IssDate)?null:entity.IssDate.Replace("-", "")
                    },
                    new SqlParameter {
                        ParameterName = "@IssDeptID" + i, Value = entity.IssDeptID
                    },
                    new SqlParameter {
                        ParameterName = "@IssHandler" + i, Value = entity.IssHandler
                    },
                    new SqlParameter {
                        ParameterName = "@IssWHID" + i, Value = entity.IssWHID
                    },
                    new SqlParameter {
                        ParameterName = "@IssWHEmpID" + i, Value = entity.IssWHEmpID
                    },
                    new SqlParameter {
                        ParameterName = "@PurDeptID" + i, Value = entity.PurDeptID
                    },
                    new SqlParameter {
                        ParameterName = "@PurEmpID" + i, Value = entity.PurEmpID
                    },
                    new SqlParameter {
                        ParameterName = "@SupplierID" + i, Value = entity.SupplierID
                    },
                    new SqlParameter {
                        ParameterName = "@SalesDepID" + i, Value = entity.SalesDepID
                    },
                    new SqlParameter {
                        ParameterName = "@SalesEmpID" + i, Value = entity.SalesEmpID
                    },
                    new SqlParameter {
                        ParameterName = "@CustomerID" + i, Value = entity.CustomerID
                    },
                    new SqlParameter {
                        ParameterName = "@ProDepID" + i, Value = entity.ProDepID
                    },
                    new SqlParameter {
                        ParameterName = "@ProEmpID" + i, Value = entity.ProEmpID
                    },
                    new SqlParameter {
                        ParameterName = "@ConDepID" + i, Value = entity.ConDepID
                    },
                    new SqlParameter {
                        ParameterName = "@ConEmpID" + i, Value = entity.ConEmpID
                    },
                    new SqlParameter {
                        ParameterName = "@IsRed" + i, Value = entity.IsRed
                    },
                    new SqlParameter {
                        ParameterName = "@Remark" + i, Value = entity.Remark
                    },
                });
                //②货物移动行
                if (entity.Items != null && entity.Items.Count > 0)
                {
                    foreach (var item in entity.Items)
                    {
                        item.GoodsMovementID = entity.GoodsMovementID;
                        saveItemsFuncs.Add(() =>
                        {
                            //调用GoodsMovementItemDAL.Save
                            return(gmItemDAL.Save(entity.Items.ToArray()));
                        });
                    }
                }
            }
            //2、执行sql
            IDbTransaction transaction = DBAccess.BeginDbTransaction(DB.Type, DB.ConnectionString);
            int            rst         = 0;

            try
            {
                rst = DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, sbSqlGM.ToString(), sqlParams.ToArray());
                //保存货物移动行
                if (saveItemsFuncs.Count > 0)
                {
                    foreach (var func in saveItemsFuncs)
                    {
                        func();
                    }
                }
                //提交
                transaction.Commit();
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                base.Logger.LogError(ex);
                return(false);
            }
            //3、返回成功或失败的标志
            return(rst > 0);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model">用户实体类</param>
        /// <returns>用户ID</returns>
        public bool Add(OA.Model.UserInfo userInfo)
        {
            URrelationDAL urDal = new URrelationDAL();

            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into OA_User(");
            strSql.Append("UserID,UserCode,UserName,UserPwd,UserState,CreateTime,CreateUserID,DeptID,Operator)");
            strSql.Append(" values (");
            strSql.Append("@UserID,@UserCode,@UserName,@UserPwd,@UserState,@CreateTime,@CreateUserID,@DeptID,@Operator)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserID",       SqlDbType.VarChar,   36),
                new SqlParameter("@UserCode",     SqlDbType.NVarChar,  20),
                new SqlParameter("@UserName",     SqlDbType.VarChar,   20),
                new SqlParameter("@UserPwd",      SqlDbType.VarChar,   36),
                new SqlParameter("@UserState",    SqlDbType.Char,       1),
                new SqlParameter("@CreateTime",   SqlDbType.DateTime),
                new SqlParameter("@CreateUserID", SqlDbType.VarChar,   36),
                new SqlParameter("@DeptID",       SqlDbType.VarChar,   36),
                new SqlParameter("@Operator",     SqlDbType.NVarChar, 30)
            };
            parameters[0].Value = userInfo.UserID;
            parameters[1].Value = userInfo.UserCode;
            parameters[2].Value = userInfo.UserName;
            parameters[3].Value = userInfo.UserPwd;
            parameters[4].Value = userInfo.UserState;
            parameters[5].Value = userInfo.CreateTime;
            parameters[6].Value = userInfo.CreateUserID;
            parameters[7].Value = userInfo.DeptID;
            parameters[8].Value = userInfo.Operator;

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

            try
            {
                int obj = DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, strSql.ToString(), parameters);
                if (obj > 0)
                {
                    urDal.Delete(userInfo.UserID);

                    URrelation ur = new URrelation();
                    ur.ID     = System.Guid.NewGuid().ToString();
                    ur.UserID = userInfo.UserID;
                    ur.RoleID = userInfo.RoleID;
                    urDal.Add(ur);

                    transaction.Commit();
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch
            {
                transaction.Rollback();
            }
            return(false);
        }
Exemplo n.º 17
0
        public override bool Save(params BuyOrder[] entities)
        {
            if (entities == null || entities.Length < 1)
            {
                return(false);
            }
            //Logger.LogInfo(entities.SerializeToJson());
            StringBuilder       sbSqlSaleOrder = new StringBuilder();
            List <Func <bool> > saveItemsFuncs = new List <Func <bool> >();
            List <SqlParameter> sqlParams      = new List <SqlParameter>();
            BuyOrder            entity         = null;

            for (int i = 0; i < entities.Length; i++)
            {
                entity = entities[i];
                //1、组织sql
                //①采购订单
                if (ValidateUtil.isBlank(entity.BuyOrderID))
                {
                    //新增,保存部分字段
                    entity.BuyOrderID = Guid.NewGuid().ToString();
                    sbSqlSaleOrder.AppendFormat("insert into {0}(BuyOrderID,BuyOrderCode,BuyOrderDate,SupplierID,DeliveryDate,Creator,CreateTime,OrderState,Remark)", TableName);
                    sbSqlSaleOrder.AppendFormat(" values (@BuyOrderID{0},@BuyOrderCode{0},@BuyOrderDate{0},@SupplierID{0},@DeliveryDate{0},@Creator{0},@CreateTime{0},@OrderState{0},@Remark{0});", i);
                    sqlParams.AddRange(new SqlParameter[] {
                        new SqlParameter {
                            ParameterName = "@Creator" + i, Value = entity.Creator
                        },
                        new SqlParameter {
                            ParameterName = "@CreateTime" + i, Value = entity.CreateTime
                        },
                        new SqlParameter {
                            ParameterName = "@OrderState" + i, Value = entity.OrderState
                        },
                    });
                }
                else
                {
                    //修改,只更新部分字段
                    sbSqlSaleOrder.AppendFormat("update {0} set BuyOrderDate=@BuyOrderDate{1},SupplierID=@SupplierID{1},DeliveryDate=@DeliveryDate{1},Editor=@Editor{1},EditTime=@EditTime{1},Remark=@Remark{1}", TableName, i);
                    sbSqlSaleOrder.AppendFormat(" where BuyOrderID=@BuyOrderID{0};", i);
                    sqlParams.AddRange(new SqlParameter[] {
                        new SqlParameter {
                            ParameterName = "@Editor" + i, Value = entity.Editor
                        },
                        new SqlParameter {
                            ParameterName = "@EditTime" + i, Value = entity.EditTime
                        },
                    });
                }
                //不管新增或修改, 参数都一样
                sqlParams.AddRange(new SqlParameter[] {
                    new SqlParameter {
                        ParameterName = "@BuyOrderID" + i, Value = entity.BuyOrderID
                    },
                    new SqlParameter {
                        ParameterName = "@BuyOrderCode" + i, Value = entity.BuyOrderCode
                    },
                    new SqlParameter {
                        ParameterName = "@BuyOrderDate" + i, Value = entity.BuyOrderDate.Replace("-", "")
                    },
                    new SqlParameter {
                        ParameterName = "@SupplierID" + i, Value = entity.SupplierID
                    },
                    new SqlParameter {
                        ParameterName = "@DeliveryDate" + i, Value = entity.DeliveryDate.Replace("-", "")
                    },
                    new SqlParameter {
                        ParameterName = "@Remark" + i, Value = entity.Remark
                    }
                });
                //②采购订单行
                if (entity.Items != null && entity.Items.Count > 0)
                {
                    foreach (var item in entity.Items)
                    {
                        item.BuyOrderID = entity.BuyOrderID;
                        saveItemsFuncs.Add(() =>
                        {
                            //调用BuyOrderItemDAL.Save
                            return(boItemDAL.Save(entity.Items.ToArray()));
                        });
                    }
                }
            }
            //2、执行sql
            IDbTransaction transaction = DBAccess.BeginDbTransaction(DB.Type, DB.ConnectionString);
            int            rst         = 0;

            try
            {
                rst = DBAccess.ExecuteNonQuery(DB.Type, DB.ConnectionString, CommandType.Text, sbSqlSaleOrder.ToString(), sqlParams.ToArray());
                //保存销售订单行
                if (saveItemsFuncs.Count > 0)
                {
                    foreach (var func in saveItemsFuncs)
                    {
                        func();
                    }
                }
                //提交
                transaction.Commit();
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                base.Logger.LogError(ex);
                return(false);
            }
            //3、返回成功或失败的标志
            return(rst > 0);
        }
Exemplo n.º 18
0
        /// <summary>
        /// 新增销售订单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddSaleOrder(SaleOrder model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into SaleOrder(");
            strSql.Append("SaleOrderID,SaleOrderCode,BillTypeID,MaterialID,SaleUnitID,ClientID,SaleDate,SaleQty,SalePrice,SaleCost,FinishDate,Creator,CreateTime,Editor,EditTime,FirstChecker,FirstCheckTime,FirstCheckView,RoutingID,SaleState,Remark,SecondCheckerName,ReaderName,Routing)");
            strSql.Append(" values (");
            strSql.Append("@SaleOrderID,@SaleOrderCode,@BillTypeID,@MaterialID,@SaleUnitID,@ClientID,@SaleDate,@SaleQty,@SalePrice,@SaleCost,@FinishDate,@Creator,@CreateTime,@Editor,@EditTime,@FirstChecker,@FirstCheckTime,@FirstCheckView,@RoutingID,@SaleState,@Remark,@SecondCheckerName,@ReaderName,@Routing)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@SaleOrderID",       SqlDbType.VarChar,     36),
                new SqlParameter("@SaleOrderCode",     SqlDbType.VarChar,     60),
                new SqlParameter("@BillTypeID",        SqlDbType.VarChar,     36),
                new SqlParameter("@MaterialID",        SqlDbType.VarChar,     36),
                new SqlParameter("@SaleUnitID",        SqlDbType.VarChar,     36),
                new SqlParameter("@ClientID",          SqlDbType.VarChar,     36),
                new SqlParameter("@SaleDate",          SqlDbType.Char,         8),
                new SqlParameter("@SaleQty",           SqlDbType.Decimal,     13),
                new SqlParameter("@SalePrice",         SqlDbType.Decimal,     13),
                new SqlParameter("@SaleCost",          SqlDbType.Decimal,     13),
                new SqlParameter("@FinishDate",        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("@FirstCheckTime",    SqlDbType.DateTime),
                new SqlParameter("@FirstCheckView",    SqlDbType.VarChar,    255),
                new SqlParameter("@RoutingID",         SqlDbType.VarChar,     36),
                new SqlParameter("@SaleState",         SqlDbType.Char,         1),
                new SqlParameter("@Remark",            SqlDbType.VarChar,   1024),
                new SqlParameter("@SecondCheckerName", SqlDbType.VarChar,    255),
                new SqlParameter("@ReaderName",        SqlDbType.VarChar,    255),
                new SqlParameter("@Routing",           SqlDbType.VarChar, 1024)
            };
            parameters[0].Value  = model.SaleOrderID;
            parameters[1].Value  = model.SaleOrderCode;
            parameters[2].Value  = model.BillTypeID;
            parameters[3].Value  = model.MaterialID;
            parameters[4].Value  = model.SaleUnitID;
            parameters[5].Value  = model.ClientID;
            parameters[6].Value  = model.SaleDate;
            parameters[7].Value  = model.SaleQty;
            parameters[8].Value  = model.SalePrice;
            parameters[9].Value  = model.SaleCost;
            parameters[10].Value = model.FinishDate;
            parameters[11].Value = model.Creator;
            parameters[12].Value = model.CreateTime;
            parameters[13].Value = model.Editor;
            parameters[14].Value = model.EditTime;
            parameters[15].Value = model.FirstChecker;
            parameters[16].Value = model.FirstCheckTime;
            parameters[17].Value = model.FirstCheckView;
            parameters[18].Value = model.RoutingID;
            parameters[19].Value = model.SaleState;
            parameters[20].Value = model.Remark;
            parameters[21].Value = model.SecondCheckerName;
            parameters[22].Value = model.ReaderName;
            parameters[23].Value = model.Routing;

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

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

                SOSecondCheckDAL soSC = new SOSecondCheckDAL();
                int socount           = model.SOList.Count;
                if (socount > 0)
                {
                    for (int i = 0; i < socount; i++)
                    {
                        SOSecondCheck sosc = model.SOList[i] as SOSecondCheck;
                        soSC.Add(sosc);
                    }
                }

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

                SaleOrderItemDAL item = new SaleOrderItemDAL();
                item.Save(model.SaleOrderID, model.OldSaleOrderID);

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

            return(1);
        }
Exemplo n.º 19
0
        /// <summary>
        /// 修改销售订单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateSaleOrder(SaleOrder model)
        {
            StringBuilder strSql = new StringBuilder();;

            strSql.Append("update SaleOrder set ");
            strSql.Append("BillTypeID=@BillTypeID,");
            strSql.Append("MaterialID=@MaterialID,");
            strSql.Append("SaleUnitID=@SaleUnitID,");
            strSql.Append("ClientID=@ClientID,");
            strSql.Append("SaleDate=@SaleDate,");
            strSql.Append("SaleQty=@SaleQty,");
            strSql.Append("SalePrice=@SalePrice,");
            strSql.Append("SaleCost=@SaleCost,");
            strSql.Append("FinishDate=@FinishDate,");
            strSql.Append("Editor=@Editor,");
            strSql.Append("EditTime=@EditTime,");
            strSql.Append("FirstChecker=@FirstChecker,");
            strSql.Append("RoutingID=@RoutingID,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("SecondCheckerName=@SecondCheckerName,");
            strSql.Append("ReaderName=@ReaderName,");
            strSql.Append("Routing=@Routing");
            strSql.Append(" where SaleOrderID=@SaleOrderID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@BillTypeID",        SqlDbType.VarChar,     36),
                new SqlParameter("@MaterialID",        SqlDbType.VarChar,     36),
                new SqlParameter("@SaleUnitID",        SqlDbType.VarChar,     36),
                new SqlParameter("@ClientID",          SqlDbType.VarChar,     36),
                new SqlParameter("@SaleDate",          SqlDbType.Char,         8),
                new SqlParameter("@SaleQty",           SqlDbType.Decimal,     13),
                new SqlParameter("@SalePrice",         SqlDbType.Decimal,     13),
                new SqlParameter("@SaleCost",          SqlDbType.Decimal,     13),
                new SqlParameter("@FinishDate",        SqlDbType.Char,         8),
                new SqlParameter("@Editor",            SqlDbType.VarChar,     36),
                new SqlParameter("@EditTime",          SqlDbType.DateTime),
                new SqlParameter("@FirstChecker",      SqlDbType.VarChar,     36),
                new SqlParameter("@RoutingID",         SqlDbType.VarChar,     36),
                new SqlParameter("@Remark",            SqlDbType.VarChar,   1024),
                new SqlParameter("@SecondCheckerName", SqlDbType.VarChar,    255),
                new SqlParameter("@ReaderName",        SqlDbType.VarChar,    255),
                new SqlParameter("@Routing",           SqlDbType.VarChar,   1024),
                new SqlParameter("@SaleOrderID",       SqlDbType.VarChar, 36)
            };
            parameters[0].Value  = model.BillTypeID;
            parameters[1].Value  = model.MaterialID;
            parameters[2].Value  = model.SaleUnitID;
            parameters[3].Value  = model.ClientID;
            parameters[4].Value  = model.SaleDate;
            parameters[5].Value  = model.SaleQty;
            parameters[6].Value  = model.SalePrice;
            parameters[7].Value  = model.SaleCost;
            parameters[8].Value  = model.FinishDate;
            parameters[9].Value  = model.Editor;
            parameters[10].Value = model.EditTime;
            parameters[11].Value = model.FirstChecker;
            parameters[12].Value = model.RoutingID;
            parameters[13].Value = model.Remark;
            parameters[14].Value = model.SecondCheckerName;
            parameters[15].Value = model.ReaderName;
            parameters[16].Value = model.Routing;
            parameters[17].Value = model.SaleOrderID;

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

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

                SOSecondCheckDAL soSC = new SOSecondCheckDAL();
                int socount           = model.SOList.Count;
                if (socount > 0)
                {
                    soSC.Delete(model.SaleOrderID);
                    for (int i = 0; i < socount; i++)
                    {
                        SOSecondCheck sosc = model.SOList[i] as SOSecondCheck;
                        soSC.Add(sosc);
                    }
                }

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

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

            return(true);
        }
Exemplo n.º 20
0
        /// <summary>
        /// 修改询价单
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public bool UpdateAskPrice(AskPrice model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update AskPrice set ");
            strSql.Append("APCode=@APCode,");
            strSql.Append("AskDate=@AskDate,");
            strSql.Append("ClientName=@ClientName,");
            strSql.Append("ClientContact=@ClientContact,");
            strSql.Append("ClientTel=@ClientTel,");
            strSql.Append("ClientAddress=@ClientAddress,");
            strSql.Append("MaterialCode=@MaterialCode,");
            strSql.Append("MaterialName=@MaterialName,");
            strSql.Append("Specs=@Specs,");
            strSql.Append("Routing=@Routing,");
            strSql.Append("PlanPrice=@PlanPrice,");
            strSql.Append("Issued=@Issued,");
            strSql.Append("IssuedCount=@IssuedCount,");
            strSql.Append("ActualPrice=@ActualPrice,");
            strSql.Append("PayTypeID=@PayTypeID,");
            strSql.Append("TrackDescription=@TrackDescription,");
            strSql.Append("ClientSurvey=@ClientSurvey,");
            strSql.Append("APRemark=@APRemark,");
            strSql.Append("Creator=@Creator,");
            strSql.Append("Editor=@Editor,");
            strSql.Append("EditTime=@EditTime,");
            strSql.Append("FirstChecker=@FirstChecker,");
            strSql.Append("State=@State,");
            strSql.Append("SecondCheckerName=@SecondCheckerName,");
            strSql.Append("ReaderName=@ReaderName,");
            strSql.Append("Qty=@Qty,");
            strSql.Append("UnitID=@UnitID,");
            strSql.Append("IsTax=@IsTax,");
            strSql.Append("IsShipping=@IsShipping");
            strSql.Append(" where APID=@APID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@APCode",            SqlDbType.VarChar,     30),
                new SqlParameter("@AskDate",           SqlDbType.Char,         8),
                new SqlParameter("@ClientName",        SqlDbType.VarChar,     60),
                new SqlParameter("@ClientContact",     SqlDbType.VarChar,     30),
                new SqlParameter("@ClientTel",         SqlDbType.VarChar,     30),
                new SqlParameter("@ClientAddress",     SqlDbType.VarChar,     90),
                new SqlParameter("@MaterialCode",      SqlDbType.VarChar,     60),
                new SqlParameter("@MaterialName",      SqlDbType.VarChar,     90),
                new SqlParameter("@Specs",             SqlDbType.VarChar,     90),
                new SqlParameter("@Routing",           SqlDbType.VarChar,   1024),
                new SqlParameter("@PlanPrice",         SqlDbType.Decimal,      9),
                new SqlParameter("@Issued",            SqlDbType.Char,         1),
                new SqlParameter("@IssuedCount",       SqlDbType.Int,          4),
                new SqlParameter("@ActualPrice",       SqlDbType.Decimal,      9),
                new SqlParameter("@PayTypeID",         SqlDbType.VarChar,     36),
                new SqlParameter("@TrackDescription",  SqlDbType.VarChar,   1024),
                new SqlParameter("@ClientSurvey",      SqlDbType.VarChar,   1024),
                new SqlParameter("@APRemark",          SqlDbType.VarChar,   1024),
                new SqlParameter("@Creator",           SqlDbType.VarChar,     36),
                new SqlParameter("@Editor",            SqlDbType.VarChar,     36),
                new SqlParameter("@EditTime",          SqlDbType.DateTime),
                new SqlParameter("@FirstChecker",      SqlDbType.VarChar,     36),
                new SqlParameter("@State",             SqlDbType.Char,         1),
                new SqlParameter("@SecondCheckerName", SqlDbType.VarChar,    255),
                new SqlParameter("@ReaderName",        SqlDbType.VarChar,    255),
                new SqlParameter("@Qty",               SqlDbType.Decimal,      9),
                new SqlParameter("@UnitID",            SqlDbType.VarChar,     36),
                new SqlParameter("@IsTax",             SqlDbType.Char,         1),
                new SqlParameter("@IsShipping",        SqlDbType.Char,         1),
                new SqlParameter("@APID",              SqlDbType.VarChar, 36)
            };
            parameters[0].Value  = model.APCode;
            parameters[1].Value  = model.AskDate;
            parameters[2].Value  = model.ClientName;
            parameters[3].Value  = model.ClientContact;
            parameters[4].Value  = model.ClientTel;
            parameters[5].Value  = model.ClientAddress;
            parameters[6].Value  = model.MaterialCode;
            parameters[7].Value  = model.MaterialName;
            parameters[8].Value  = model.Specs;
            parameters[9].Value  = model.Routing;
            parameters[10].Value = model.PlanPrice;
            parameters[11].Value = model.Issued;
            parameters[12].Value = model.IssuedCount;
            parameters[13].Value = model.ActualPrice;
            parameters[14].Value = model.PayTypeID;
            parameters[15].Value = model.TrackDescription;
            parameters[16].Value = model.ClientSurvey;
            parameters[17].Value = model.APRemark;
            parameters[18].Value = model.Creator;
            parameters[19].Value = model.Editor;
            parameters[20].Value = model.EditTime;
            parameters[21].Value = model.FirstChecker;
            parameters[22].Value = model.State;
            parameters[23].Value = model.SecondCheckerName;
            parameters[24].Value = model.ReaderName;
            parameters[25].Value = model.Qty;
            parameters[26].Value = model.UnitID;
            parameters[27].Value = model.IsTax;
            parameters[28].Value = model.IsShipping;
            parameters[29].Value = model.APID;

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

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

                APSecondCheckDAL soSC = new APSecondCheckDAL();
                int socount           = model.SCList.Count;
                if (socount > 0)
                {
                    soSC.Delete(model.APID);
                    for (int i = 0; i < socount; i++)
                    {
                        APSecondCheck sosc = model.SCList[i] as APSecondCheck;
                        soSC.Add(sosc);
                    }
                }

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

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

            return(true);
        }
Exemplo n.º 21
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public int AddAskPrice(AskPrice model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into AskPrice(");
            strSql.Append("APID,APCode,AskDate,ClientName,ClientContact,ClientTel,ClientAddress,MaterialCode,MaterialName,Specs,Routing,PlanPrice,Issued,IssuedCount,ActualPrice,PayTypeID,TrackDescription,ClientSurvey,APRemark,Creator,CreateTime,Editor,EditTime,FirstChecker,State,SecondCheckerName,ReaderName,Qty,UnitID,IsTax,IsShipping)");
            strSql.Append(" values (");
            strSql.Append("@APID,@APCode,@AskDate,@ClientName,@ClientContact,@ClientTel,@ClientAddress,@MaterialCode,@MaterialName,@Specs,@Routing,@PlanPrice,@Issued,@IssuedCount,@ActualPrice,@PayTypeID,@TrackDescription,@ClientSurvey,@APRemark,@Creator,@CreateTime,@Editor,@EditTime,@FirstChecker,@State,@SecondCheckerName,@ReaderName,@Qty,@UnitID,@IsTax,@IsShipping)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@APID",              SqlDbType.VarChar,     36),
                new SqlParameter("@APCode",            SqlDbType.VarChar,     30),
                new SqlParameter("@AskDate",           SqlDbType.Char,         8),
                new SqlParameter("@ClientName",        SqlDbType.VarChar,     60),
                new SqlParameter("@ClientContact",     SqlDbType.VarChar,     30),
                new SqlParameter("@ClientTel",         SqlDbType.VarChar,     30),
                new SqlParameter("@ClientAddress",     SqlDbType.VarChar,     90),
                new SqlParameter("@MaterialCode",      SqlDbType.VarChar,     60),
                new SqlParameter("@MaterialName",      SqlDbType.VarChar,     90),
                new SqlParameter("@Specs",             SqlDbType.VarChar,     90),
                new SqlParameter("@Routing",           SqlDbType.VarChar,   1024),
                new SqlParameter("@PlanPrice",         SqlDbType.Decimal,      9),
                new SqlParameter("@Issued",            SqlDbType.Char,         1),
                new SqlParameter("@IssuedCount",       SqlDbType.Int,          4),
                new SqlParameter("@ActualPrice",       SqlDbType.Decimal,      9),
                new SqlParameter("@PayTypeID",         SqlDbType.VarChar,     36),
                new SqlParameter("@TrackDescription",  SqlDbType.VarChar,   1024),
                new SqlParameter("@ClientSurvey",      SqlDbType.VarChar,   1024),
                new SqlParameter("@APRemark",          SqlDbType.VarChar,   1024),
                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("@State",             SqlDbType.Char,         1),
                new SqlParameter("@SecondCheckerName", SqlDbType.VarChar,    255),
                new SqlParameter("@ReaderName",        SqlDbType.VarChar,    255),
                new SqlParameter("@Qty",               SqlDbType.Decimal,      9),
                new SqlParameter("@UnitID",            SqlDbType.VarChar,     36),
                new SqlParameter("@IsTax",             SqlDbType.Char,         1),
                new SqlParameter("@IsShipping",        SqlDbType.Char, 1)
            };
            parameters[0].Value = model.APID;
            parameters[1].Value = model.APCode;
            if (string.IsNullOrEmpty(model.APCode))
            {
                parameters[1].Value = "XJ" + System.DateTime.Now.Year +
                                      System.DateTime.Now.Month +
                                      System.DateTime.Now.Day +
                                      System.DateTime.Now.Hour +
                                      System.DateTime.Now.Minute +
                                      System.DateTime.Now.Second +
                                      System.DateTime.Now.Millisecond;
            }
            parameters[2].Value  = model.AskDate;
            parameters[3].Value  = model.ClientName;
            parameters[4].Value  = model.ClientContact;
            parameters[5].Value  = model.ClientTel;
            parameters[6].Value  = model.ClientAddress;
            parameters[7].Value  = model.MaterialCode;
            parameters[8].Value  = model.MaterialName;
            parameters[9].Value  = model.Specs;
            parameters[10].Value = model.Routing;
            parameters[11].Value = model.PlanPrice;
            parameters[12].Value = model.Issued;
            parameters[13].Value = model.IssuedCount;
            parameters[14].Value = model.ActualPrice;
            parameters[15].Value = model.PayTypeID;
            parameters[16].Value = model.TrackDescription;
            parameters[17].Value = model.ClientSurvey;
            parameters[18].Value = model.APRemark;
            parameters[19].Value = model.Creator;
            parameters[20].Value = model.CreateTime;
            parameters[21].Value = model.Editor;
            parameters[22].Value = model.EditTime;
            parameters[23].Value = model.FirstChecker;
            parameters[24].Value = model.State;
            parameters[25].Value = model.SecondCheckerName;
            parameters[26].Value = model.ReaderName;
            parameters[27].Value = model.Qty;
            parameters[28].Value = model.UnitID;
            parameters[29].Value = model.IsTax;
            parameters[30].Value = model.IsShipping;

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

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

                APSecondCheckDAL apSC = new APSecondCheckDAL();
                int socount           = model.SCList.Count;
                if (socount > 0)
                {
                    for (int i = 0; i < socount; i++)
                    {
                        APSecondCheck apsc = model.SCList[i] as APSecondCheck;
                        apSC.Add(apsc);
                    }
                }

                APReaderDAL apR    = new APReaderDAL();
                int         rcount = model.RList.Count;
                if (rcount > 0)
                {
                    for (int i = 0; i < rcount; i++)
                    {
                        APReader sor = model.RList[i] as APReader;
                        apR.Add(sor);
                    }
                }

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

            return(1);
        }