Ejemplo n.º 1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <JMP.MDL.CoSettlementChannelCost> DataTableToList(DataTable dt)
        {
            List <JMP.MDL.CoSettlementChannelCost> modelList = new List <JMP.MDL.CoSettlementChannelCost>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                JMP.MDL.CoSettlementChannelCost model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new JMP.MDL.CoSettlementChannelCost();
                    if (dt.Rows[n]["Id"].ToString() != "")
                    {
                        model.Id = int.Parse(dt.Rows[n]["Id"].ToString());
                    }
                    if (dt.Rows[n]["TotalAmount"].ToString() != "")
                    {
                        model.TotalAmount = decimal.Parse(dt.Rows[n]["TotalAmount"].ToString());
                    }
                    if (dt.Rows[n]["CostRatio"].ToString() != "")
                    {
                        model.CostRatio = decimal.Parse(dt.Rows[n]["CostRatio"].ToString());
                    }
                    if (dt.Rows[n]["CostFee"].ToString() != "")
                    {
                        model.CostFee = decimal.Parse(dt.Rows[n]["CostFee"].ToString());
                    }
                    if (dt.Rows[n]["CreatedOn"].ToString() != "")
                    {
                        model.CreatedOn = DateTime.Parse(dt.Rows[n]["CreatedOn"].ToString());
                    }
                    model.SettlementDay = DateTime.Parse(dt.Rows[n]["SettlementDay"].ToString());
                    if (dt.Rows[n]["DeveloperId"].ToString() != "")
                    {
                        model.DeveloperId = int.Parse(dt.Rows[n]["DeveloperId"].ToString());
                    }
                    model.DeveloperName = dt.Rows[n]["DeveloperName"].ToString();
                    if (dt.Rows[n]["AppId"].ToString() != "")
                    {
                        model.AppId = int.Parse(dt.Rows[n]["AppId"].ToString());
                    }
                    model.AppName = dt.Rows[n]["AppName"].ToString();
                    if (dt.Rows[n]["ChannelId"].ToString() != "")
                    {
                        model.ChannelId = int.Parse(dt.Rows[n]["ChannelId"].ToString());
                    }
                    model.ChannelName = dt.Rows[n]["ChannelName"].ToString();
                    if (dt.Rows[n]["OrderCount"].ToString() != "")
                    {
                        model.OrderCount = int.Parse(dt.Rows[n]["OrderCount"].ToString());
                    }


                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(JMP.MDL.CoSettlementChannelCost model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into CoSettlementChannelCost(");
            strSql.Append("TotalAmount,CostRatio,CostFee,CreatedOn,SettlementDay,DeveloperId,DeveloperName,AppId,AppName,ChannelId,ChannelName,OrderCount");
            strSql.Append(") values (");
            strSql.Append("@TotalAmount,@CostRatio,@CostFee,@CreatedOn,@SettlementDay,@DeveloperId,@DeveloperName,@AppId,@AppName,@ChannelId,@ChannelName,@OrderCount");
            strSql.Append(") ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TotalAmount",   SqlDbType.Money,      8),
                new SqlParameter("@CostRatio",     SqlDbType.Decimal,    5),
                new SqlParameter("@CostFee",       SqlDbType.Decimal,    9),
                new SqlParameter("@CreatedOn",     SqlDbType.DateTime),
                new SqlParameter("@SettlementDay", SqlDbType.VarChar,   10),
                new SqlParameter("@DeveloperId",   SqlDbType.Int,        4),
                new SqlParameter("@DeveloperName", SqlDbType.NVarChar,  -1),
                new SqlParameter("@AppId",         SqlDbType.Int,        4),
                new SqlParameter("@AppName",       SqlDbType.NVarChar,  -1),
                new SqlParameter("@ChannelId",     SqlDbType.Int,        4),
                new SqlParameter("@ChannelName",   SqlDbType.NVarChar,  -1),
                new SqlParameter("@OrderCount",    SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.TotalAmount;
            parameters[1].Value  = model.CostRatio;
            parameters[2].Value  = model.CostFee;
            parameters[3].Value  = model.CreatedOn;
            parameters[4].Value  = model.SettlementDay;
            parameters[5].Value  = model.DeveloperId;
            parameters[6].Value  = model.DeveloperName;
            parameters[7].Value  = model.AppId;
            parameters[8].Value  = model.AppName;
            parameters[9].Value  = model.ChannelId;
            parameters[10].Value = model.ChannelName;
            parameters[11].Value = model.OrderCount;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(JMP.MDL.CoSettlementChannelCost model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update CoSettlementChannelCost set ");

            strSql.Append(" TotalAmount = @TotalAmount , ");
            strSql.Append(" CostRatio = @CostRatio , ");
            strSql.Append(" CostFee = @CostFee , ");
            strSql.Append(" CreatedOn = @CreatedOn , ");
            strSql.Append(" SettlementDay = @SettlementDay , ");
            strSql.Append(" DeveloperId = @DeveloperId , ");
            strSql.Append(" DeveloperName = @DeveloperName , ");
            strSql.Append(" AppId = @AppId , ");
            strSql.Append(" AppName = @AppName , ");
            strSql.Append(" ChannelId = @ChannelId , ");
            strSql.Append(" ChannelName = @ChannelName , ");
            strSql.Append(" OrderCount = @OrderCount  ");
            strSql.Append(" where Id=@Id ");

            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",            SqlDbType.Int,        4),
                new SqlParameter("@TotalAmount",   SqlDbType.Money,      8),
                new SqlParameter("@CostRatio",     SqlDbType.Decimal,    5),
                new SqlParameter("@CostFee",       SqlDbType.Decimal,    9),
                new SqlParameter("@CreatedOn",     SqlDbType.DateTime),
                new SqlParameter("@SettlementDay", SqlDbType.VarChar,   10),
                new SqlParameter("@DeveloperId",   SqlDbType.Int,        4),
                new SqlParameter("@DeveloperName", SqlDbType.NVarChar,  -1),
                new SqlParameter("@AppId",         SqlDbType.Int,        4),
                new SqlParameter("@AppName",       SqlDbType.NVarChar,  -1),
                new SqlParameter("@ChannelId",     SqlDbType.Int,        4),
                new SqlParameter("@ChannelName",   SqlDbType.NVarChar,  -1),
                new SqlParameter("@OrderCount",    SqlDbType.Int, 4)
            };

            parameters[0].Value  = model.Id;
            parameters[1].Value  = model.TotalAmount;
            parameters[2].Value  = model.CostRatio;
            parameters[3].Value  = model.CostFee;
            parameters[4].Value  = model.CreatedOn;
            parameters[5].Value  = model.SettlementDay;
            parameters[6].Value  = model.DeveloperId;
            parameters[7].Value  = model.DeveloperName;
            parameters[8].Value  = model.AppId;
            parameters[9].Value  = model.AppName;
            parameters[10].Value = model.ChannelId;
            parameters[11].Value = model.ChannelName;
            parameters[12].Value = model.OrderCount;
            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public JMP.MDL.CoSettlementChannelCost GetModel(int Id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select Id, TotalAmount, CostRatio, CostFee, CreatedOn, SettlementDay, DeveloperId, DeveloperName, AppId, AppName, ChannelId, ChannelName, OrderCount  ");
            strSql.Append("  from CoSettlementChannelCost ");
            strSql.Append(" where Id=@Id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Id", SqlDbType.Int, 4)
            };
            parameters[0].Value = Id;


            JMP.MDL.CoSettlementChannelCost model = new JMP.MDL.CoSettlementChannelCost();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["Id"].ToString() != "")
                {
                    model.Id = int.Parse(ds.Tables[0].Rows[0]["Id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TotalAmount"].ToString() != "")
                {
                    model.TotalAmount = decimal.Parse(ds.Tables[0].Rows[0]["TotalAmount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CostRatio"].ToString() != "")
                {
                    model.CostRatio = decimal.Parse(ds.Tables[0].Rows[0]["CostRatio"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CostFee"].ToString() != "")
                {
                    model.CostFee = decimal.Parse(ds.Tables[0].Rows[0]["CostFee"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CreatedOn"].ToString() != "")
                {
                    model.CreatedOn = DateTime.Parse(ds.Tables[0].Rows[0]["CreatedOn"].ToString());
                }
                model.SettlementDay = DateTime.Parse(ds.Tables[0].Rows[0]["SettlementDay"].ToString());
                if (ds.Tables[0].Rows[0]["DeveloperId"].ToString() != "")
                {
                    model.DeveloperId = int.Parse(ds.Tables[0].Rows[0]["DeveloperId"].ToString());
                }
                model.DeveloperName = ds.Tables[0].Rows[0]["DeveloperName"].ToString();
                if (ds.Tables[0].Rows[0]["AppId"].ToString() != "")
                {
                    model.AppId = int.Parse(ds.Tables[0].Rows[0]["AppId"].ToString());
                }
                model.AppName = ds.Tables[0].Rows[0]["AppName"].ToString();
                if (ds.Tables[0].Rows[0]["ChannelId"].ToString() != "")
                {
                    model.ChannelId = int.Parse(ds.Tables[0].Rows[0]["ChannelId"].ToString());
                }
                model.ChannelName = ds.Tables[0].Rows[0]["ChannelName"].ToString();
                if (ds.Tables[0].Rows[0]["OrderCount"].ToString() != "")
                {
                    model.OrderCount = int.Parse(ds.Tables[0].Rows[0]["OrderCount"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(JMP.MDL.CoSettlementChannelCost model)
 {
     return(dal.Update(model));
 }
Ejemplo n.º 6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(JMP.MDL.CoSettlementChannelCost model)
 {
     return(dal.Add(model));
 }