Beispiel #1
0
        protected override string btnAdd_Click()
        {
            int      count   = int.Parse(Request.Form["txtCount"]);
            DateTime payDate = DateTime.Now;
            string   msg     = Request.Form["txtRemark"];
            string   picurl  = Request.Form["hduploadPic1"];

            if (string.IsNullOrEmpty(picurl))
            {
                return("请上传打款凭证");
            }
            Model.BuyActiveCode buy = new Model.BuyActiveCode();
            buy.CodeCount  = count;
            buy.CreateTime = DateTime.Now;
            buy.FromMID    = TModel.MID;
            buy.ToMID      = BLL.Member.ManageMember.TModel.MID;
            buy.State      = 0;
            buy.PicUrl     = picurl;
            buy.Remark     = msg;
            buy.PayTime    = payDate;
            if (BLL.BuyActiveCode.Insert(buy))
            {
                return("1");
            }
            return("申请失败");
        }
Beispiel #2
0
        protected override void SetValue(string id)
        {
            BuyActiveCodeModel = BLL.BuyActiveCode.GetModel(id);
            if (BuyActiveCodeModel.State == 1)
            {
                btnOK.Visible = false;
            }
            hidId.Value = id;
            string picUrl = BuyActiveCodeModel.PicUrl;

            string[] array = picUrl.Split(',');
            foreach (string str in array)
            {
                picImgs += "<div class='appDiv'><img class='appImg' src='" + str + "'  style='max-width: 700px;'/></div>";
            }
        }
Beispiel #3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static Hashtable Update(Model.BuyActiveCode model, Hashtable MyHs)
        {
            string        guid   = Guid.NewGuid().ToString();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BuyActiveCode set ");

            strSql.Append(" CodeCount = @CodeCount , ");
            strSql.Append(" FromMID = @FromMID , ");
            strSql.Append(" ToMID = @ToMID , ");
            strSql.Append(" PayTime = @PayTime , ");
            strSql.Append(" ConfirmTime = @ConfirmTime , ");
            strSql.Append(" PicUrl = @PicUrl , ");
            strSql.Append(" Remark = @Remark , ");
            strSql.Append(" State = @State , ");
            strSql.Append(" CreateTime = @CreateTime  ");
            strSql.Append(" where Id=@Id ");
            strSql.AppendFormat(" ;select '{0}'", guid);

            SqlParameter[] parameters =
            {
                new SqlParameter("@Id",          SqlDbType.Int,         4),
                new SqlParameter("@CodeCount",   SqlDbType.Int,         4),
                new SqlParameter("@FromMID",     SqlDbType.VarChar,    50),
                new SqlParameter("@ToMID",       SqlDbType.VarChar,    50),
                new SqlParameter("@PayTime",     SqlDbType.DateTime),
                new SqlParameter("@ConfirmTime", SqlDbType.DateTime),
                new SqlParameter("@PicUrl",      SqlDbType.VarChar,   500),
                new SqlParameter("@Remark",      SqlDbType.VarChar,   500),
                new SqlParameter("@State",       SqlDbType.Int,         4),
                new SqlParameter("@CreateTime",  SqlDbType.DateTime)
            };

            parameters[0].Value = model.Id;
            parameters[1].Value = model.CodeCount;
            parameters[2].Value = model.FromMID;
            parameters[3].Value = model.ToMID;
            parameters[4].Value = model.PayTime;
            parameters[5].Value = model.ConfirmTime;
            parameters[6].Value = model.PicUrl;
            parameters[7].Value = model.Remark;
            parameters[8].Value = model.State;
            parameters[9].Value = model.CreateTime;
            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }
Beispiel #4
0
        protected override string btnAdd_Click()
        {
            if (!TModel.Role.IsAdmin)
            {
                return("失败");
            }
            BuyActiveCodeModel = BLL.BuyActiveCode.GetModel(Request.Form["hidId"]);
            if (BuyActiveCodeModel != null)
            {
                Hashtable hs = new Hashtable();
                BuyActiveCodeModel.ConfirmTime = DateTime.Now;
                BuyActiveCodeModel.State       = 1;
                BLL.BuyActiveCode.Update(BuyActiveCodeModel, hs);
                //发送校验码
                lock (new object())
                {
                    //List<Model.ActiveCode> codeList = BLL.ActiveCode.GetTopList("UseState=0", BuyActiveCodeModel.CodeCount);
                    List <Model.ActiveCode> codeList = BLL.ActiveCode.GetTopList("UseState=0 and MID='" + BuyActiveCodeModel.ToMID + "'", BuyActiveCodeModel.CodeCount);
                    int i = 0;
                    foreach (Model.ActiveCode ac in codeList)
                    {
                        i++;
                        ac.MID = BuyActiveCodeModel.FromMID;
                        //ac.UseState = 1;
                        BLL.ChangeMoney.InsertTran(new Model.ChangeMoney {
                            FromMID = BuyActiveCodeModel.ToMID, ToMID = BuyActiveCodeModel.FromMID, CompleteTime = DateTime.Now, ChangeType = "Active", MoneyType = "Active", CRemarks = ac.Code, ChangeDate = DateTime.Now, CState = true
                        }, hs);
                        BLL.ActiveCode.Update(ac, hs);
                    }
                    if (i == BuyActiveCodeModel.CodeCount)
                    {
                        if (BLL.CommonBase.RunHashtable(hs))
                        {
                            return("1");
                        }
                    }
                    else
                    {
                        return("0");
                    }
                }
            }

            return("0");
        }
Beispiel #5
0
        /// <summary>
        ///  实体转换
        /// <summary>
        private static Model.BuyActiveCode TranEntity(DataRow dr)
        {
            if (dr != null)
            {
                Model.BuyActiveCode model = new Model.BuyActiveCode();

                if (!string.IsNullOrEmpty(dr["Id"].ToString()))
                {
                    model.Id = int.Parse(dr["Id"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["CodeCount"].ToString()))
                {
                    model.CodeCount = int.Parse(dr["CodeCount"].ToString());
                }
                model.FromMID = dr["FromMID"].ToString();
                model.ToMID   = dr["ToMID"].ToString();
                if (!string.IsNullOrEmpty(dr["PayTime"].ToString()))
                {
                    model.PayTime = DateTime.Parse(dr["PayTime"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["ConfirmTime"].ToString()))
                {
                    model.ConfirmTime = DateTime.Parse(dr["ConfirmTime"].ToString());
                }
                model.PicUrl = dr["PicUrl"].ToString();
                model.Remark = dr["Remark"].ToString();
                if (!string.IsNullOrEmpty(dr["State"].ToString()))
                {
                    model.State = int.Parse(dr["State"].ToString());
                }
                if (!string.IsNullOrEmpty(dr["CreateTime"].ToString()))
                {
                    model.CreateTime = DateTime.Parse(dr["CreateTime"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static Hashtable Insert(Model.BuyActiveCode model, Hashtable MyHs)
        {
            string        guid   = Guid.NewGuid().ToString();
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into BuyActiveCode(");
            strSql.Append("CodeCount,FromMID,ToMID,PayTime,ConfirmTime,PicUrl,Remark,State,CreateTime");
            strSql.Append(") values (");
            strSql.Append("@CodeCount,@FromMID,@ToMID,@PayTime,@ConfirmTime,@PicUrl,@Remark,@State,@CreateTime");
            strSql.Append(") ");
            strSql.AppendFormat(";select '{0}'", guid);
            SqlParameter[] parameters =
            {
                new SqlParameter("@CodeCount",   SqlDbType.Int,         4),
                new SqlParameter("@FromMID",     SqlDbType.VarChar,    50),
                new SqlParameter("@ToMID",       SqlDbType.VarChar,    50),
                new SqlParameter("@PayTime",     SqlDbType.DateTime),
                new SqlParameter("@ConfirmTime", SqlDbType.DateTime),
                new SqlParameter("@PicUrl",      SqlDbType.VarChar,   500),
                new SqlParameter("@Remark",      SqlDbType.VarChar,   500),
                new SqlParameter("@State",       SqlDbType.Int,         4),
                new SqlParameter("@CreateTime",  SqlDbType.DateTime)
            };

            parameters[0].Value = model.CodeCount;
            parameters[1].Value = model.FromMID;
            parameters[2].Value = model.ToMID;
            parameters[3].Value = model.PayTime;
            parameters[4].Value = model.ConfirmTime;
            parameters[5].Value = model.PicUrl;
            parameters[6].Value = model.Remark;
            parameters[7].Value = model.State;
            parameters[8].Value = model.CreateTime;
            MyHs.Add(strSql.ToString(), parameters);
            return(MyHs);
        }
Beispiel #7
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public static bool Insert(Model.BuyActiveCode model)
 {
     return(DAL.CommonBase.RunHashtable(Insert(model, new Hashtable())));
 }
Beispiel #8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public static bool Update(Model.BuyActiveCode model)
 {
     return(DAL.CommonBase.RunHashtable(Update(model, new Hashtable())));
 }
Beispiel #9
0
 public static bool Update(Model.BuyActiveCode model)
 {
     return(WE_Project.DAL.BuyActiveCode.Update(model));
 }
Beispiel #10
0
 public static Hashtable Update(Model.BuyActiveCode model, Hashtable MyHs)
 {
     return(WE_Project.DAL.BuyActiveCode.Update(model, MyHs));
 }
Beispiel #11
0
 public static bool Insert(Model.BuyActiveCode model)
 {
     return(WE_Project.DAL.BuyActiveCode.Insert(model));
 }
Beispiel #12
0
 public static Hashtable Insert(Model.BuyActiveCode model, Hashtable MyHs)
 {
     return(WE_Project.DAL.BuyActiveCode.Insert(model, MyHs));
 }