Exemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(lgk.Model.tb_systemMoney model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_systemMoney set ");
            strSql.Append("MoneyAccount=@MoneyAccount,");
            strSql.Append("AllBonusAccount=@AllBonusAccount,");
            strSql.Append("Money001=@Money001,");
            strSql.Append("Money002=@Money002");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MoneyAccount",    SqlDbType.Decimal, 9),
                new SqlParameter("@AllBonusAccount", SqlDbType.Decimal, 9),
                new SqlParameter("@Money001",        SqlDbType.Decimal, 9),
                new SqlParameter("@Money002",        SqlDbType.Decimal, 9),
                new SqlParameter("@ID",              SqlDbType.Int, 4)
            };
            parameters[0].Value = model.MoneyAccount;
            parameters[1].Value = model.AllBonusAccount;
            parameters[2].Value = model.Money001;
            parameters[3].Value = model.Money002;
            parameters[4].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(lgk.Model.tb_systemMoney model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_systemMoney(");
            strSql.Append("MoneyAccount,AllBonusAccount,Money001,Money002)");
            strSql.Append(" values (");
            strSql.Append("@MoneyAccount,@AllBonusAccount,@Money001,@Money002)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MoneyAccount",    SqlDbType.Decimal, 9),
                new SqlParameter("@AllBonusAccount", SqlDbType.Decimal, 9),
                new SqlParameter("@Money001",        SqlDbType.Decimal, 9),
                new SqlParameter("@Money002",        SqlDbType.Decimal, 9)
            };
            parameters[0].Value = model.MoneyAccount;
            parameters[1].Value = model.AllBonusAccount;
            parameters[2].Value = model.Money001;
            parameters[3].Value = model.Money002;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 审核分页申请记录
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            long   ID       = Convert.ToInt64(e.CommandArgument); //ID
            string filename = "";

            lgk.BLL.tb_systemMoney   sy     = new lgk.BLL.tb_systemMoney();
            lgk.Model.tb_systemMoney system = sy.GetModel(1);

            if (e.CommandName.Equals("Open"))        //确认
            {
                string        sql1 = "update  tb_takeMoney1 set Flag=1  where   ID= '" + ID + "'";
                SqlConnection conn = new SqlConnection(sconn);
                conn.Open();
                SqlCommand cmd   = new SqlCommand(sql1, conn);
                int        reInt = cmd.ExecuteNonQuery();
                conn.Close();
                if (reInt >= 1)
                {
                    MessageBox.MyShow(this, "操作成功!");
                    BindData();
                    return;
                }
                else
                {
                    MessageBox.MyShow(this, "数据不存在!");
                    return;
                }
            }
            if (e.CommandName.Equals("Remove"))        //删除
            {
                //加入流水账表

                string        sql1 = "delete from tb_takeMoney1 where ID= '" + ID + "'";
                SqlConnection conn = new SqlConnection(sconn);
                conn.Open();
                SqlCommand cmd   = new SqlCommand(sql1, conn);
                int        reInt = cmd.ExecuteNonQuery();
                conn.Close();

                if (reInt > 0)
                {
                    ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('取消成功!');window.location.href='TakeMoney.aspx';", true);        //取消成功
                }
                else
                {
                    ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('取消失败!');", true);        //取消失败
                }
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public lgk.Model.tb_systemMoney GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,MoneyAccount,AllBonusAccount,Money001,Money002 from tb_systemMoney ");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.Int, 4)
            };
            parameters[0].Value = ID;

            lgk.Model.tb_systemMoney model = new lgk.Model.tb_systemMoney();
            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 = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MoneyAccount"] != null && ds.Tables[0].Rows[0]["MoneyAccount"].ToString() != "")
                {
                    model.MoneyAccount = decimal.Parse(ds.Tables[0].Rows[0]["MoneyAccount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AllBonusAccount"] != null && ds.Tables[0].Rows[0]["AllBonusAccount"].ToString() != "")
                {
                    model.AllBonusAccount = decimal.Parse(ds.Tables[0].Rows[0]["AllBonusAccount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Money001"] != null && ds.Tables[0].Rows[0]["Money001"].ToString() != "")
                {
                    model.Money001 = decimal.Parse(ds.Tables[0].Rows[0]["Money001"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Money002"] != null && ds.Tables[0].Rows[0]["Money002"].ToString() != "")
                {
                    model.Money002 = decimal.Parse(ds.Tables[0].Rows[0]["Money002"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public lgk.Model.tb_systemMoney GetModel()
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 ID,MoneyAccount,AllBonusAccount,Money001,Money002 from tb_systemMoney ");

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["MoneyAccount"] != null && ds.Tables[0].Rows[0]["MoneyAccount"].ToString() != "")
                {
                    model.MoneyAccount = decimal.Parse(ds.Tables[0].Rows[0]["MoneyAccount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["AllBonusAccount"] != null && ds.Tables[0].Rows[0]["AllBonusAccount"].ToString() != "")
                {
                    model.AllBonusAccount = decimal.Parse(ds.Tables[0].Rows[0]["AllBonusAccount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Money001"] != null && ds.Tables[0].Rows[0]["Money001"].ToString() != "")
                {
                    model.Money001 = decimal.Parse(ds.Tables[0].Rows[0]["Money001"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Money002"] != null && ds.Tables[0].Rows[0]["Money002"].ToString() != "")
                {
                    model.Money002 = decimal.Parse(ds.Tables[0].Rows[0]["Money002"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 6
0
        protected void lbtnSubmit_Click(object sender, EventArgs e)
        {
            #region 充值金额验证
            if (this.txtMoney.Text == "")
            {
                MessageBox.MyShow(this, "充值金额不能为空!");
                return;
            }
            else if (Convert.ToDouble(this.txtMoney.Text.Trim()) <= 0)
            {
                MessageBox.MyShow(this, "金额需大于零!");
                return;
            }
            #endregion
            lgk.Model.tb_recharge    rechargeInfo = new lgk.Model.tb_recharge();
            lgk.Model.tb_systemMoney userInfo     = systemBll.GetModel(1);

            #region 充值实体
            rechargeInfo.RechargeStyle     = Convert.ToInt32(dropRechargeStyle.SelectedValue);
            rechargeInfo.RechargeableMoney = Convert.ToDecimal(this.txtMoney.Text.Trim());
            rechargeInfo.RechargeDate      = DateTime.Now;
            #endregion

            #region 加入流水账表
            lgk.Model.tb_journal jmodel = new lgk.Model.tb_journal();
            jmodel.JournalDate = DateTime.Now;
            jmodel.JournalType = 3;
            jmodel.UserID      = Convert.ToInt32("system");
            if (rechargeInfo.RechargeStyle == 1)
            {
                rechargeInfo.RechargeType = 2;
                rechargeInfo.YuAmount     = Convert.ToDecimal(userInfo.Money001) + Convert.ToDecimal(this.txtMoney.Text.Trim());
                jmodel.InAmount           = Convert.ToDecimal(this.txtMoney.Text.Trim());
                jmodel.OutAmount          = 0;
                jmodel.BalanceAmount      = Convert.ToDecimal(userInfo.Money001) + Convert.ToDecimal(this.txtMoney.Text.Trim());
                jmodel.Remark             = "后台充值慈善(增加)";
            }
            if (rechargeInfo.RechargeStyle == 0)
            {
                if (Convert.ToDecimal(this.txtMoney.Text) > userInfo.Money001)
                {
                    MessageBox.MyShow(this, "慈善余额不足!");
                    return;
                }
                rechargeInfo.RechargeType = 2;
                rechargeInfo.YuAmount     = Convert.ToDecimal(userInfo.Money001) - Convert.ToDecimal(this.txtMoney.Text.Trim());
                jmodel.InAmount           = 0;
                jmodel.OutAmount          = Convert.ToDecimal(this.txtMoney.Text.Trim());
                jmodel.BalanceAmount      = Convert.ToDecimal(userInfo.Money001) - Convert.ToDecimal(this.txtMoney.Text.Trim());
                jmodel.Remark             = "后台充值慈善(扣除)";
            }
            #endregion

            if (rechargeBLL.Add(rechargeInfo) > 0 && journalBLL.Add(jmodel) > 0)
            {
                if (rechargeInfo.RechargeStyle == 1)
                {
                    UpdateSystemAccount("Money001", Convert.ToDecimal(rechargeInfo.RechargeableMoney), 0);//公司账户减少
                }
                else
                {
                    UpdateSystemAccount("Money001", Convert.ToDecimal(rechargeInfo.RechargeableMoney), 1);//公司账户增加
                }
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('操作成功!');window.location.href='Addcishan.aspx';", true);
            }
            else
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('充值失败!');", true);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 审核分页申请记录
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            long   ID       = Convert.ToInt64(e.CommandArgument); //ID
            string filename = "";

            lgk.Model.tb_takeMoney cModel = takeBLL.GetModel(ID);
            lgk.BLL.tb_systemMoney sy     = new lgk.BLL.tb_systemMoney();
            //lgk.BLL.tb_rechargeable dotx = new lgk.BLL.tb_rechargeable();
            lgk.Model.tb_systemMoney system = sy.GetModel(1);
            if (cModel == null)
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('该记录已删除,无法再进行此操作!');window.location.href='TakeMoney.aspx';", true);
            }
            else
            {
                if (cModel.Flag == 1)
                {
                    ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('该记录已审核,无法再进行此操作!');window.location.href='TakeMoney.aspx';", true);
                }
                else
                {
                    lgk.Model.tb_user user = userBLL.GetModel(Convert.ToInt32(cModel.UserID));
                    if (e.CommandName.Equals("Open"))//确认
                    {
                        cModel.Flag    = 1;
                        cModel.Take006 = DateTime.Now;
                        if (takeBLL.Update(cModel) && UpdateSystemAccount("MoneyAccount", Convert.ToDecimal(cModel.RealityMoney), 0) > 0)
                        {
                            if (cModel.Take001 == 6)
                            {
                                user.Batch = 0;
                                userBLL.Update(user);
                            }

                            //发送短信通知
                            string content = GetLanguage("MessageTakeMoneyOK").Replace("{username}", user.UserCode).Replace("{time}", Convert.ToDateTime(cModel.TakeTime).ToString("yyyy年MM月dd日HH时mm分")).Replace("{timeEn}", Convert.ToDateTime(cModel.TakeTime).ToString("yyyy/MM/dd HH:mm"));
                            SendMessage(Convert.ToInt32(cModel.UserID), user.PhoneNum, content);
                            ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('操作成功!');", true);//window.location.href='TakeMoney.aspx';
                            BindData();
                        }
                    }
                    if (e.CommandName.Equals("Remove"))//删除
                    {
                        //加入流水账表
                        lgk.Model.tb_journal model = new lgk.Model.tb_journal();
                        lgk.Model.tb_user    users = userBLL.GetModel(cModel.UserID);
                        model.UserID    = cModel.UserID;
                        model.Remark    = "取消提现";
                        model.InAmount  = cModel.TakeMoney;
                        model.OutAmount = 0;
                        if (cModel.Take001 == 1)
                        {
                            model.BalanceAmount = user.Emoney + cModel.TakeMoney;
                            filename            = "emoney";
                            // model.Journal02 = 2;//奖励分
                            model.JournalType = 1;
                        }
                        if (cModel.Take001 == 2)
                        {
                            model.BalanceAmount = user.BonusAccount + cModel.TakeMoney;
                            filename            = "BonusAccount";
                            //  users.Emoney = users.Emoney + cModel.RealityMoney + cModel.TakePoundage;
                            //   users.StockMoney = users.BonusAccount + cModel.TakeMoney + cModel.TakePoundage;
                            //  model.Journal02 = 4; //原始积分
                            model.JournalType = 2;
                        }
                        //if (cModel.Take001 == 3)
                        //{
                        //    model.BalanceAmount = user.StockMoney + cModel.TakeMoney + cModel.TakePoundage;
                        //    filename = "StockMoney";
                        //    //users.BonusAccount = users.BonusAccount + cModel.TakeMoney + cModel.TakePoundage;
                        //    model.Journal02 = cModel.Take001;
                        //}
                        //if (cModel.Take001 == 4)
                        //{
                        //    model.BalanceAmount = user.ShopAccount + cModel.TakeMoney + cModel.TakePoundage;
                        //    filename = "ShopAccount";
                        //    users.Emoney = users.Emoney + cModel.RealityMoney;
                        //    users.BonusAccount = users.BonusAccount + cModel.TakeMoney + cModel.TakePoundage;
                        //    model.Journal02 = cModel.Take001;
                        //}
                        //if (cModel.Take001 == 5)
                        //{
                        //    model.BalanceAmount = user.GLmoney + cModel.TakeMoney + cModel.TakePoundage;
                        //    filename = "GLmoney";
                        //    users.BonusAccount = users.BonusAccount + cModel.TakeMoney + cModel.TakePoundage;
                        //    model.Journal02 = cModel.Take001;
                        //}
                        //if (cModel.Take001 == 6)
                        //{
                        //    model.BalanceAmount = user.RegMoney + cModel.TakeMoney + cModel.TakePoundage;
                        //    filename = "RegMoney";
                        //    users.Batch = 0;
                        //    model.Journal02 = cModel.Take001;
                        //}
                        model.JournalDate = DateTime.Now;

                        model.Journal01 = cModel.UserID;
                        if (journalBLL.Add(model) > 0 && userBLL.Update(users) && UpdateAccount(filename, user.UserID, cModel.TakeMoney, 1) > 0 && takeBLL.Delete(ID))
                        {
                            MessageBox.MyShow(this, "取消成功");
                            BindData();
                        }
                        else
                        {
                            MessageBox.MyShow(this, "取消失败");
                        }
                    }
                }
            }
        }
Exemplo n.º 8
0
        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            int ID = Convert.ToInt32(e.CommandArgument); //ID

            lgk.Model.tb_takeMoney   takeMoneyInfo = takeBLL.GetModel(ID);
            lgk.BLL.tb_systemMoney   sy            = new lgk.BLL.tb_systemMoney();
            lgk.Model.tb_systemMoney system        = sy.GetModel(1);
            if (takeMoneyInfo == null)
            {
                ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('该记录已删除,无法再进行此操作!');window.location.href='TakeMoney.aspx';", true);
            }
            else
            {
                if (takeMoneyInfo.Flag == 1)
                {
                    ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('该记录已审核,无法再进行此操作!');window.location.href='TakeMoney.aspx';", true);
                }
                else
                {
                    lgk.Model.tb_Stock stockInfo = stockBLL.GetModel("UserID=" + takeMoneyInfo.UserID);
                    lgk.Model.tb_user  userInfo  = userBLL.GetModel(Convert.ToInt32(takeMoneyInfo.UserID));
                    decimal            dProfit   = stockInfo.Number * (getParamAmount("shares5") - stockInfo.Price);

                    if (e.CommandName.Equals("Open"))//确认
                    {
                        takeMoneyInfo.Flag    = 1;
                        takeMoneyInfo.Take006 = DateTime.Now;
                        if (takeBLL.Update(takeMoneyInfo) && UpdateSystemAccount("MoneyAccount", Convert.ToDecimal(takeMoneyInfo.RealityMoney), 0) > 0)
                        {
                            //发送短信通知
                            string content = GetLanguage("MessageTakeMoneyOK").Replace("{username}", userInfo.UserCode).Replace("{time}", Convert.ToDateTime(takeMoneyInfo.TakeTime).ToString("yyyy年MM月dd日HH时mm分")).Replace("{timeEn}", Convert.ToDateTime(takeMoneyInfo.TakeTime).ToString("yyyy/MM/dd HH:mm"));
                            SendMessage(Convert.ToInt32(takeMoneyInfo.UserID), userInfo.PhoneNum, content);
                            ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('操作成功!');window.location.href='TakeMoney.aspx';", true);
                        }
                    }
                    if (e.CommandName.Equals("Remove"))//删除
                    {
                        //加入流水账表
                        lgk.Model.tb_journal model = new lgk.Model.tb_journal();
                        model.UserID        = takeMoneyInfo.UserID;
                        model.Remark        = "取消提现";
                        model.InAmount      = takeMoneyInfo.TakeMoney;
                        model.OutAmount     = 0;
                        model.BalanceAmount = dProfit + takeMoneyInfo.TakeMoney;
                        model.JournalDate   = DateTime.Now;
                        model.JournalType   = 1;
                        model.Journal01     = takeMoneyInfo.UserID;

                        bool bFalg = stockBLL.UpdateStockNumber(stockInfo.StockID, Convert.ToDecimal(takeMoneyInfo.TakeMoney), getParamAmount("shares5"), 1);

                        if (journalBLL.Add(model) > 0 && bFalg && takeBLL.Delete(ID))
                        {
                            MessageBox.MyShow(this, "取消成功");
                            BindData();
                        }
                        else
                        {
                            MessageBox.MyShow(this, "取消失败");
                        }
                    }
                }
            }
        }