Ejemplo n.º 1
0
        /// <summary>
        ///  实体转换
        /// <summary>
        private static WE_Project.Model.FDSellList TranEntity(DataRow dr)
        {
            if (dr != null)
            {
                WE_Project.Model.FDSellList model = new WE_Project.Model.FDSellList();

                if (!string.IsNullOrEmpty(dr["SellID"].ToString()))
                {
                    model.SellID = int.Parse(dr["SellID"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["BuyID"].ToString()))
                {
                    model.BuyID = int.Parse(dr["BuyID"].ToString());
                }
                model.SellMID = dr["SellMID"].ToString();
                if (!string.IsNullOrEmpty(dr["SellTotalCount"].ToString()))
                {
                    model.SellTotalCount = int.Parse(dr["SellTotalCount"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["SellCount"].ToString()))
                {
                    model.SellCount = int.Parse(dr["SellCount"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["SellPrice"].ToString()))
                {
                    model.SellPrice = decimal.Parse(dr["SellPrice"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["SellMoney"].ToString()))
                {
                    model.SellMoney = decimal.Parse(dr["SellMoney"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["SellDate"].ToString()))
                {
                    model.SellDate = DateTime.Parse(dr["SellDate"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["LastSellDate"].ToString()))
                {
                    model.LastSellDate = DateTime.Parse(dr["LastSellDate"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["BuyDate"].ToString()))
                {
                    model.BuyDate = DateTime.Parse(dr["BuyDate"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["SellState"].ToString()))
                {
                    model.SellState = int.Parse(dr["SellState"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["ChaiFenCode"].ToString()))
                {
                    model.ChaiFenCode = int.Parse(dr["ChaiFenCode"].ToString());
                }
                model.SellFDName = dr["SellFDName"].ToString();

                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static Hashtable Update(WE_Project.Model.FDSellList model, Hashtable MyHs)
        {
            string        guid   = Guid.NewGuid().ToString();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update FDSellList set ");

            strSql.Append(" BuyID = @BuyID , ");
            strSql.Append(" SellMID = @SellMID , ");
            strSql.Append(" SellTotalCount = @SellTotalCount , ");
            strSql.Append(" SellCount = @SellCount , ");
            strSql.Append(" SellPrice = @SellPrice , ");
            strSql.Append(" SellMoney = @SellMoney , ");
            strSql.Append(" SellDate = @SellDate , ");
            strSql.Append(" LastSellDate = @LastSellDate , ");
            strSql.Append(" SellFDName = @SellFDName , ");
            strSql.Append(" BuyDate = @BuyDate , ");
            strSql.Append(" ChaiFenCode = @ChaiFenCode , ");
            strSql.Append(" SellState = @SellState  ");
            strSql.Append(" where SellID=@SellID ");
            strSql.AppendFormat(" ;select '{0}'", guid);

            SqlParameter[] parameters =
            {
                new SqlParameter("@SellID",         SqlDbType.Int,        4),
                new SqlParameter("@BuyID",          SqlDbType.Int,        4),
                new SqlParameter("@SellMID",        SqlDbType.VarChar,   50),
                new SqlParameter("@SellTotalCount", SqlDbType.Int,        4),
                new SqlParameter("@SellCount",      SqlDbType.Int,        4),
                new SqlParameter("@SellPrice",      SqlDbType.Decimal,    9),
                new SqlParameter("@SellMoney",      SqlDbType.Decimal,    9),
                new SqlParameter("@SellDate",       SqlDbType.DateTime),
                new SqlParameter("@LastSellDate",   SqlDbType.DateTime),
                new SqlParameter("@SellState",      SqlDbType.Int,        4),
                new SqlParameter("@SellFDName",     SqlDbType.VarChar,   10),
                new SqlParameter("@BuyDate",        SqlDbType.DateTime),
                new SqlParameter("@ChaiFenCode",    SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.SellID;
            parameters[1].Value  = model.BuyID;
            parameters[2].Value  = model.SellMID;
            parameters[3].Value  = model.SellTotalCount;
            parameters[4].Value  = model.SellCount;
            parameters[5].Value  = model.SellPrice;
            parameters[6].Value  = model.SellMoney;
            parameters[7].Value  = model.SellDate;
            parameters[8].Value  = model.LastSellDate;
            parameters[9].Value  = model.SellState;
            parameters[10].Value = model.SellFDName;
            parameters[11].Value = model.BuyDate;
            parameters[12].Value = model.ChaiFenCode;
            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static Hashtable Insert(WE_Project.Model.FDSellList model, Hashtable MyHs)
        {
            string        guid   = Guid.NewGuid().ToString();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into FDSellList(");
            strSql.Append("BuyID,SellMID,SellTotalCount,SellCount,SellPrice,SellMoney,SellDate,LastSellDate,SellState,SellFDName,BuyDate,ChaiFenCode");
            strSql.Append(") values (");
            strSql.Append("@BuyID,@SellMID,@SellTotalCount,@SellCount,@SellPrice,@SellMoney,@SellDate,@LastSellDate,@SellState,@SellFDName,@BuyDate,@ChaiFenCode");
            strSql.Append(") ");
            strSql.AppendFormat(";select '{0}'", guid);
            SqlParameter[] parameters =
            {
                new SqlParameter("@BuyID",          SqlDbType.Int,        4),
                new SqlParameter("@SellMID",        SqlDbType.VarChar,   50),
                new SqlParameter("@SellTotalCount", SqlDbType.Int,        4),
                new SqlParameter("@SellCount",      SqlDbType.Int,        4),
                new SqlParameter("@SellPrice",      SqlDbType.Decimal,    9),
                new SqlParameter("@SellMoney",      SqlDbType.Decimal,    9),
                new SqlParameter("@SellDate",       SqlDbType.DateTime),
                new SqlParameter("@LastSellDate",   SqlDbType.DateTime),
                new SqlParameter("@SellState",      SqlDbType.Int,        4),
                new SqlParameter("@SellFDName",     SqlDbType.VarChar,   10),
                new SqlParameter("@BuyDate",        SqlDbType.DateTime),
                new SqlParameter("@ChaiFenCode",    SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.BuyID;
            parameters[1].Value  = model.SellMID;
            parameters[2].Value  = model.SellTotalCount;
            parameters[3].Value  = model.SellCount;
            parameters[4].Value  = model.SellPrice;
            parameters[5].Value  = model.SellMoney;
            parameters[6].Value  = model.SellDate;
            parameters[7].Value  = model.LastSellDate;
            parameters[8].Value  = model.SellState;
            parameters[9].Value  = model.SellFDName;
            parameters[10].Value = model.BuyDate;
            parameters[11].Value = model.ChaiFenCode;
            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static bool Insert(WE_Project.Model.FDSellList model)
 {
     return(DAL.CommonBase.RunHashtable(Insert(model, new Hashtable())));
 }
Ejemplo n.º 5
0
 public static bool Update(WE_Project.Model.FDSellList model)
 {
     return(WE_Project.DAL.FDSellList.Update(model));
 }
Ejemplo n.º 6
0
 public static Hashtable Update(WE_Project.Model.FDSellList model, Hashtable MyHs)
 {
     return(WE_Project.DAL.FDSellList.Update(model, MyHs));
 }
Ejemplo n.º 7
0
 public static bool Insert(WE_Project.Model.FDSellList model)
 {
     return(WE_Project.DAL.FDSellList.Insert(model));
 }
Ejemplo n.º 8
0
 public static Hashtable Insert(WE_Project.Model.FDSellList model, Hashtable MyHs)
 {
     return(WE_Project.DAL.FDSellList.Insert(model, MyHs));
 }