Exemple #1
0
        protected void LinkButton3_Click(object sender, EventArgs e)
        {
            if (txtCode.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('会员编号不能为空!');", true);
                return;
            }
            lgk.Model.tb_user model_user = userBLL.GetModel(" UserCode='" + txtCode.Text.Trim() + "'");
            if (model_user == null)
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('会员不存在!');", true);
                return;
            }
            if (model_user.AgentsID != agentBLL.GetIDByIDUser(getLoginID()))
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('所属报单中心不正确!');", true);
                return;
            }
            if (txtMoney.Value.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('消费金额不能为空!');", true);
                return;
            }
            decimal money = 0;

            try
            {
                money = Convert.ToDecimal(txtMoney.Value.Trim());
            }
            catch
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('消费金额格式不正确!');", true);
                return;
            }
            if (money <= 0)
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('消费金额要大于零!');", true);
                return;
            }
            if (money > model_user.StockAccount)
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('重复消费账户余额不足!');", true);
                return;
            }
            lgk.Model.tb_mix model = new lgk.Model.tb_mix();
            model.UserID  = model_user.UserID;
            model.Amount  = money;
            model.AddTime = DateTime.Now;
            model.Source  = "报单中心消费";
            if (mixBLL.Add(model) > 0)
            {
                AllCore acore = new AllCore();//1收入2支出
                acore.add_userRecord(new lgk.BLL.tb_user().GetModel(model.UserID).UserCode, DateTime.Now, money, 2);
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('操作成功!');window.location.href='agent_xf.aspx';", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('错误!');", true);
            }
        }
Exemple #2
0
        protected void LinkButton3_Click(object sender, EventArgs e)
        {
            if (txtCode.Text.Trim() == "")
            {
                MessageBox.MyShow(this, "会员编号不能为空!");
                return;
            }
            lgk.Model.tb_user model_user = userBLL.GetModel(" UserCode='" + txtCode.Text.Trim() + "'");
            if (model_user == null)
            {
                MessageBox.MyShow(this, "会员不存在!");
                return;
            }
            if (txtMoney.Value.Trim() == "")
            {
                MessageBox.MyShow(this, "消费金额不能为空!");
                return;
            }
            decimal money = 0;

            try
            {
                money = Convert.ToDecimal(txtMoney.Value.Trim());
            }
            catch
            {
                MessageBox.MyShow(this, "消费金额格式不正确!");
                return;
            }
            if (money <= 0)
            {
                MessageBox.MyShow(this, "消费金额要大于零!");
                return;
            }
            if (money > model_user.StockAccount)
            {
                MessageBox.MyShow(this, "重复消费账户余额不足!");
                return;
            }
            lgk.Model.tb_mix model = new lgk.Model.tb_mix();
            model.UserID  = model_user.UserID;
            model.Amount  = money;
            model.AddTime = DateTime.Now;
            model.Source  = "后台消费";
            if (mixBLL.Add(model) > 0)
            {
                AllCore acore = new AllCore();//1收入2支出
                acore.add_userRecord(new lgk.BLL.tb_user().GetModel(model.UserID).UserCode, DateTime.Now, money, 2);
                MessageBox.MyShow(this, "操作成功!");
            }
            else
            {
                MessageBox.MyShow(this, "错误!");
            }
        }
Exemple #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(lgk.Model.tb_mix model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_mix(");
            strSql.Append("UserID,BonusID,Amount,AddTime,Source,FromUserID,Mix001,Mix002,Mix003,Mix004,Mix005,Mix006,Mix007)");
            strSql.Append(" values (");
            strSql.Append("@UserID,@BonusID,@Amount,@AddTime,@Source,@FromUserID,@Mix001,@Mix002,@Mix003,@Mix004,@Mix005,@Mix006,@Mix007)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserID",     SqlDbType.BigInt,     8),
                new SqlParameter("@BonusID",    SqlDbType.Int,        4),
                new SqlParameter("@Amount",     SqlDbType.Decimal,    9),
                new SqlParameter("@AddTime",    SqlDbType.DateTime),
                new SqlParameter("@Source",     SqlDbType.VarChar,   50),
                new SqlParameter("@FromUserID", SqlDbType.Int,        4),
                new SqlParameter("@Mix001",     SqlDbType.Int,        4),
                new SqlParameter("@Mix002",     SqlDbType.Int,        4),
                new SqlParameter("@Mix003",     SqlDbType.VarChar,   50),
                new SqlParameter("@Mix004",     SqlDbType.VarChar,   50),
                new SqlParameter("@Mix005",     SqlDbType.Decimal,    9),
                new SqlParameter("@Mix006",     SqlDbType.Decimal,    9),
                new SqlParameter("@Mix007",     SqlDbType.DateTime)
            };
            parameters[0].Value  = model.UserID;
            parameters[1].Value  = model.BonusID;
            parameters[2].Value  = model.Amount;
            parameters[3].Value  = model.AddTime;
            parameters[4].Value  = model.Source;
            parameters[5].Value  = model.FromUserID;
            parameters[6].Value  = model.Mix001;
            parameters[7].Value  = model.Mix002;
            parameters[8].Value  = model.Mix003;
            parameters[9].Value  = model.Mix004;
            parameters[10].Value = model.Mix005;
            parameters[11].Value = model.Mix006;
            parameters[12].Value = model.Mix007;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt64(obj));
            }
        }
Exemple #4
0
 protected void btnSearch_Click(object sender, EventArgs e)
 {
     lgk.Model.tb_user umodel = userBLL.GetModel(getIntRequest("userid"));
     if (this.txtMoney.Value == "")
     {
         ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('修改金额不能为空!');", true);
         return;
     }
     if (Convert.ToDecimal(this.txtMoney.Value.Trim()) < 0)
     {
         ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('修改金额需大于零!');", true);
         return;
     }
     if (Convert.ToDecimal(this.txtMoney.Value.Trim()) > umodel.BonusAccount)
     {
         ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('修改金额不能大于会员重消账户余额!');", true);
         return;
     }
     lgk.Model.tb_mix model = new lgk.Model.tb_mix();
     model.UserID  = umodel.UserID;
     model.Amount  = umodel.BonusAccount;
     model.AddTime = DateTime.Now;
     model.Mix005  = umodel.BonusAccount - Convert.ToDecimal(txtMoney.Value.Trim());
     model.Mix006  = Convert.ToDecimal(txtMoney.Value.Trim());
     //加入流水账表
     lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal();
     jmodel.UserID        = getIntRequest("userid");
     jmodel.JournalDate   = DateTime.Now;
     jmodel.JournalType   = 1;
     jmodel.InAmount      = 0;
     jmodel.OutAmount     = umodel.BonusAccount - Convert.ToDecimal(txtMoney.Value.Trim());
     jmodel.BalanceAmount = Convert.ToDecimal(txtMoney.Value.Trim());
     jmodel.Remark        = "B网消费";
     umodel.BonusAccount  = Convert.ToDecimal(txtMoney.Value.Trim());
     if (userBLL.Update(umodel) && mixBLL.Add(model) > 0 && journalBLL.Add(jmodel) > 0)
     {
         ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('修改成功!');window.location.href='chongxiaoList.aspx'", true);
     }
     else
     {
         ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('修改失败!');", true);
     }
 }
Exemple #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(lgk.Model.tb_mix model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_mix set ");
            strSql.Append("UserID=@UserID,");
            strSql.Append("BonusID=@BonusID,");
            strSql.Append("Amount=@Amount,");
            strSql.Append("AddTime=@AddTime,");
            strSql.Append("Source=@Source,");
            strSql.Append("FromUserID=@FromUserID,");
            strSql.Append("Mix001=@Mix001,");
            strSql.Append("Mix002=@Mix002,");
            strSql.Append("Mix003=@Mix003,");
            strSql.Append("Mix004=@Mix004,");
            strSql.Append("Mix005=@Mix005,");
            strSql.Append("Mix006=@Mix006,");
            strSql.Append("Mix007=@Mix007");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@UserID",     SqlDbType.BigInt,     8),
                new SqlParameter("@BonusID",    SqlDbType.Int,        4),
                new SqlParameter("@Amount",     SqlDbType.Decimal,    9),
                new SqlParameter("@AddTime",    SqlDbType.DateTime),
                new SqlParameter("@Source",     SqlDbType.VarChar,   50),
                new SqlParameter("@FromUserID", SqlDbType.Int,        4),
                new SqlParameter("@Mix001",     SqlDbType.Int,        4),
                new SqlParameter("@Mix002",     SqlDbType.Int,        4),
                new SqlParameter("@Mix003",     SqlDbType.VarChar,   50),
                new SqlParameter("@Mix004",     SqlDbType.VarChar,   50),
                new SqlParameter("@Mix005",     SqlDbType.Decimal,    9),
                new SqlParameter("@Mix006",     SqlDbType.Decimal,    9),
                new SqlParameter("@Mix007",     SqlDbType.DateTime),
                new SqlParameter("@ID",         SqlDbType.BigInt, 8)
            };
            parameters[0].Value  = model.UserID;
            parameters[1].Value  = model.BonusID;
            parameters[2].Value  = model.Amount;
            parameters[3].Value  = model.AddTime;
            parameters[4].Value  = model.Source;
            parameters[5].Value  = model.FromUserID;
            parameters[6].Value  = model.Mix001;
            parameters[7].Value  = model.Mix002;
            parameters[8].Value  = model.Mix003;
            parameters[9].Value  = model.Mix004;
            parameters[10].Value = model.Mix005;
            parameters[11].Value = model.Mix006;
            parameters[12].Value = model.Mix007;
            parameters[13].Value = model.ID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public lgk.Model.tb_mix GetModel(long ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,UserID,BonusID,Amount,AddTime,Source,FromUserID,Mix001,Mix002,Mix003,Mix004,Mix005,Mix006,Mix007 from tb_mix ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.BigInt)
            };
            parameters[0].Value = ID;

            lgk.Model.tb_mix model = new lgk.Model.tb_mix();
            DataSet          ds    = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = long.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UserID"] != null && ds.Tables[0].Rows[0]["UserID"].ToString() != "")
                {
                    model.UserID = long.Parse(ds.Tables[0].Rows[0]["UserID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["BonusID"] != null && ds.Tables[0].Rows[0]["BonusID"].ToString() != "")
                {
                    model.BonusID = int.Parse(ds.Tables[0].Rows[0]["BonusID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Amount"] != null && ds.Tables[0].Rows[0]["Amount"].ToString() != "")
                {
                    model.Amount = decimal.Parse(ds.Tables[0].Rows[0]["Amount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AddTime"] != null && ds.Tables[0].Rows[0]["AddTime"].ToString() != "")
                {
                    model.AddTime = DateTime.Parse(ds.Tables[0].Rows[0]["AddTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Source"] != null && ds.Tables[0].Rows[0]["Source"].ToString() != "")
                {
                    model.Source = ds.Tables[0].Rows[0]["Source"].ToString();
                }
                if (ds.Tables[0].Rows[0]["FromUserID"] != null && ds.Tables[0].Rows[0]["FromUserID"].ToString() != "")
                {
                    model.FromUserID = int.Parse(ds.Tables[0].Rows[0]["FromUserID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Mix001"] != null && ds.Tables[0].Rows[0]["Mix001"].ToString() != "")
                {
                    model.Mix001 = int.Parse(ds.Tables[0].Rows[0]["Mix001"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Mix002"] != null && ds.Tables[0].Rows[0]["Mix002"].ToString() != "")
                {
                    model.Mix002 = int.Parse(ds.Tables[0].Rows[0]["Mix002"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Mix003"] != null && ds.Tables[0].Rows[0]["Mix003"].ToString() != "")
                {
                    model.Mix003 = ds.Tables[0].Rows[0]["Mix003"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Mix004"] != null && ds.Tables[0].Rows[0]["Mix004"].ToString() != "")
                {
                    model.Mix004 = ds.Tables[0].Rows[0]["Mix004"].ToString();
                }
                if (ds.Tables[0].Rows[0]["Mix005"] != null && ds.Tables[0].Rows[0]["Mix005"].ToString() != "")
                {
                    model.Mix005 = decimal.Parse(ds.Tables[0].Rows[0]["Mix005"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Mix006"] != null && ds.Tables[0].Rows[0]["Mix006"].ToString() != "")
                {
                    model.Mix006 = decimal.Parse(ds.Tables[0].Rows[0]["Mix006"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Mix007"] != null && ds.Tables[0].Rows[0]["Mix007"].ToString() != "")
                {
                    model.Mix007 = DateTime.Parse(ds.Tables[0].Rows[0]["Mix007"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }