示例#1
0
        /// <summary>
        ///  实体转换
        /// <summary>
        private static WE_Project.Model.FDConfig TranEntity(DataRow dr)
        {
            if (dr != null)
            {
                WE_Project.Model.FDConfig model = new WE_Project.Model.FDConfig();

                model.FDName        = dr["FDName"].ToString();
                model.FDCloseRemark = dr["FDCloseRemark"].ToString();
                if (!string.IsNullOrEmpty(dr["FDState"].ToString()))
                {
                    model.FDState = bool.Parse(dr["FDState"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["FDCFFloat"].ToString()))
                {
                    model.FDCFFloat = decimal.Parse(dr["FDCFFloat"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["FDMHBFloat"].ToString()))
                {
                    model.FDMHBFloat = decimal.Parse(dr["FDMHBFloat"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["FDMGPFloat"].ToString()))
                {
                    model.FDMGPFloat = decimal.Parse(dr["FDMGPFloat"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["FDMCWFloat"].ToString()))
                {
                    model.FDMCWFloat = decimal.Parse(dr["FDMCWFloat"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["FDSellCount"].ToString()))
                {
                    model.FDSellCount = int.Parse(dr["FDSellCount"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["FDPrice"].ToString()))
                {
                    model.FDPrice = decimal.Parse(dr["FDPrice"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["FDStartTime"].ToString()))
                {
                    model.FDStartTime = DateTime.Parse(dr["FDStartTime"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["FDEndTime"].ToString()))
                {
                    model.FDEndTime = DateTime.Parse(dr["FDEndTime"].ToString());
                }
                model.ChaiFenCode = Convert.ToInt32(DAL.CommonBase.GetSingle("select isnull(max(ChaiFenCode),0) from FDSellList where SellFDName='" + model.FDName + "'"));

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

            strSql.Append("update FDConfig set ");

            strSql.Append(" FDName = @FDName , ");
            strSql.Append(" FDCloseRemark = @FDCloseRemark , ");
            strSql.Append(" FDState = @FDState , ");
            strSql.Append(" FDCFFloat = @FDCFFloat , ");
            strSql.Append(" FDMHBFloat = @FDMHBFloat , ");
            strSql.Append(" FDMGPFloat = @FDMGPFloat , ");
            strSql.Append(" FDMCWFloat = @FDMCWFloat , ");
            strSql.Append(" FDSellCount = @FDSellCount , ");
            strSql.Append(" FDPrice = @FDPrice , ");
            strSql.Append(" FDStartTime = @FDStartTime , ");
            strSql.Append(" FDEndTime = @FDEndTime  ");
            strSql.Append(" where FDName=@FDName  ");
            strSql.AppendFormat(" ;select '{0}'", guid);

            SqlParameter[] parameters =
            {
                new SqlParameter("@FDName",        SqlDbType.VarChar,    10),
                new SqlParameter("@FDCloseRemark", SqlDbType.VarChar,   200),
                new SqlParameter("@FDState",       SqlDbType.Bit,         1),
                new SqlParameter("@FDCFFloat",     SqlDbType.Decimal,     9),
                new SqlParameter("@FDMHBFloat",    SqlDbType.Decimal,     9),
                new SqlParameter("@FDMGPFloat",    SqlDbType.Decimal,     9),
                new SqlParameter("@FDMCWFloat",    SqlDbType.Decimal,     9),
                new SqlParameter("@FDSellCount",   SqlDbType.Int,         4),
                new SqlParameter("@FDPrice",       SqlDbType.Decimal,     9),
                new SqlParameter("@FDStartTime",   SqlDbType.DateTime),
                new SqlParameter("@FDEndTime",     SqlDbType.DateTime)
            };

            parameters[0].Value  = model.FDName;
            parameters[1].Value  = model.FDCloseRemark;
            parameters[2].Value  = model.FDState;
            parameters[3].Value  = model.FDCFFloat;
            parameters[4].Value  = model.FDMHBFloat;
            parameters[5].Value  = model.FDMGPFloat;
            parameters[6].Value  = model.FDMCWFloat;
            parameters[7].Value  = model.FDSellCount;
            parameters[8].Value  = model.FDPrice;
            parameters[9].Value  = model.FDStartTime;
            parameters[10].Value = model.FDEndTime;
            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }
示例#3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static bool Update(WE_Project.Model.FDConfig model)
 {
     return(DAL.CommonBase.RunHashtable(Update(model, new Hashtable())));
 }
示例#4
0
 public static bool Update(WE_Project.Model.FDConfig model)
 {
     return(WE_Project.DAL.FDConfig.Update(model));
 }
示例#5
0
 public static Hashtable Update(WE_Project.Model.FDConfig model, Hashtable MyHs)
 {
     return(WE_Project.DAL.FDConfig.Update(model, MyHs));
 }
示例#6
0
 public static bool Insert(WE_Project.Model.FDConfig model)
 {
     return(WE_Project.DAL.FDConfig.Insert(model));
 }
示例#7
0
 public static Hashtable Insert(WE_Project.Model.FDConfig model, Hashtable MyHs)
 {
     return(WE_Project.DAL.FDConfig.Insert(model, MyHs));
 }