示例#1
0
        public bool Update(fund_accountInfoModle model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update fund_accountInfo set ");
            builder.Append("accountNum=@accountNum,");
            builder.Append("opMoney=@opMoney,");
            builder.Append("opType=@opType,");
            builder.Append("opTime=@opTime,");
            builder.Append("opMan=@opMan,");
            builder.Append("isValid=@isValid,");
            builder.Append("sysPeop=@sysPeop,");
            builder.Append("opClass=@opClass");
            builder.Append(" where id=@id");
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@accountNum", SqlDbType.NVarChar, 50), new SqlParameter("@opMoney", SqlDbType.Decimal, 9), new SqlParameter("@opType", SqlDbType.Int, 4), new SqlParameter("@opTime", SqlDbType.DateTime), new SqlParameter("@opMan", SqlDbType.NVarChar, 50), new SqlParameter("@isValid", SqlDbType.Int, 4), new SqlParameter("@sysPeop", SqlDbType.NVarChar, 50), new SqlParameter("@opClass", SqlDbType.Int, 4), new SqlParameter("@id", SqlDbType.Int, 4) };
            commandParameters[0].Value = model.accountNum;
            commandParameters[1].Value = model.opMoney;
            commandParameters[2].Value = model.opType;
            commandParameters[3].Value = model.opTime;
            commandParameters[4].Value = model.opMan;
            commandParameters[5].Value = model.isValid;
            commandParameters[6].Value = model.sysPeop;
            commandParameters[7].Value = model.opClass;
            commandParameters[8].Value = model.id;
            return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters) > 0);
        }
示例#2
0
        public fund_accountInfoModle GetModel(int id)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("select  top 1 id,accountNum,opMoney,opType,opTime,opMan,isValid,sysPeop,opClass from fund_accountInfo ");
            builder.Append(" where id=@id");
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@id", SqlDbType.Int, 4) };
            commandParameters[0].Value = id;
            fund_accountInfoModle modle = new fund_accountInfoModle();
            DataTable             table = SqlHelper.ExecuteQuery(CommandType.Text, builder.ToString(), commandParameters);

            if (table.Rows.Count <= 0)
            {
                return(null);
            }
            if (table.Rows[0]["id"].ToString() != "")
            {
                modle.id = int.Parse(table.Rows[0]["id"].ToString());
            }
            modle.accountNum = table.Rows[0]["accountNum"].ToString();
            if (table.Rows[0]["opMoney"].ToString() != "")
            {
                modle.opMoney = new decimal?(decimal.Parse(table.Rows[0]["opMoney"].ToString()));
            }
            if (table.Rows[0]["opType"].ToString() != "")
            {
                modle.opType = new int?(int.Parse(table.Rows[0]["opType"].ToString()));
            }
            if (table.Rows[0]["opTime"].ToString() != "")
            {
                modle.opTime = new DateTime?(DateTime.Parse(table.Rows[0]["opTime"].ToString()));
            }
            modle.opMan = table.Rows[0]["opMan"].ToString();
            if (table.Rows[0]["isValid"].ToString() != "")
            {
                modle.isValid = new int?(int.Parse(table.Rows[0]["isValid"].ToString()));
            }
            modle.sysPeop = table.Rows[0]["sysPeop"].ToString();
            if (table.Rows[0]["opClass"].ToString() != "")
            {
                modle.opClass = new int?(int.Parse(table.Rows[0]["opClass"].ToString()));
            }
            return(modle);
        }
示例#3
0
        public List <fund_accountInfoModle> DataTableToList(DataTable dt)
        {
            List <fund_accountInfoModle> list = new List <fund_accountInfoModle>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    fund_accountInfoModle item = new fund_accountInfoModle();
                    if (dt.Rows[i]["id"].ToString() != "")
                    {
                        item.id = int.Parse(dt.Rows[i]["id"].ToString());
                    }
                    item.accountNum = dt.Rows[i]["accountNum"].ToString();
                    if (dt.Rows[i]["opMoney"].ToString() != "")
                    {
                        item.opMoney = new decimal?(decimal.Parse(dt.Rows[i]["opMoney"].ToString()));
                    }
                    if (dt.Rows[i]["opType"].ToString() != "")
                    {
                        item.opType = new int?(int.Parse(dt.Rows[i]["opType"].ToString()));
                    }
                    if (dt.Rows[i]["opTime"].ToString() != "")
                    {
                        item.opTime = new DateTime?(DateTime.Parse(dt.Rows[i]["opTime"].ToString()));
                    }
                    item.opMan = dt.Rows[i]["opMan"].ToString();
                    if (dt.Rows[i]["isValid"].ToString() != "")
                    {
                        item.isValid = new int?(int.Parse(dt.Rows[i]["isValid"].ToString()));
                    }
                    item.sysPeop = dt.Rows[i]["sysPeop"].ToString();
                    if (dt.Rows[i]["opClass"].ToString() != "")
                    {
                        item.opClass = new int?(int.Parse(dt.Rows[i]["opClass"].ToString()));
                    }
                    list.Add(item);
                }
            }
            return(list);
        }
示例#4
0
        public int Add(fund_accountInfoModle model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into fund_accountInfo(");
            builder.Append("accountNum,opMoney,opType,opTime,opMan,isValid,sysPeop,opClass)");
            builder.Append(" values (");
            builder.Append("@accountNum,@opMoney,@opType,@opTime,@opMan,@isValid,@sysPeop,@opClass)");
            builder.Append(";select @@IDENTITY");
            SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@accountNum", SqlDbType.NVarChar, 50), new SqlParameter("@opMoney", SqlDbType.Decimal, 9), new SqlParameter("@opType", SqlDbType.Int, 4), new SqlParameter("@opTime", SqlDbType.DateTime), new SqlParameter("@opMan", SqlDbType.NVarChar, 50), new SqlParameter("@isValid", SqlDbType.Int, 4), new SqlParameter("@sysPeop", SqlDbType.NVarChar, 50), new SqlParameter("@opClass", SqlDbType.Int, 4) };
            commandParameters[0].Value = model.accountNum;
            commandParameters[1].Value = model.opMoney;
            commandParameters[2].Value = model.opType;
            commandParameters[3].Value = model.opTime;
            commandParameters[4].Value = model.opMan;
            commandParameters[5].Value = model.isValid;
            commandParameters[6].Value = model.sysPeop;
            commandParameters[7].Value = model.opClass;
            return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters));
        }
示例#5
0
 protected void BtnInAccount(object sender, EventArgs e)
 {
     using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString))
     {
         sqlConnection.Open();
         SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();
         try
         {
             string        message = "";
             List <string> list    = new List <string>();
             foreach (GridViewRow gridViewRow in this.gvMony.Rows)
             {
                 CheckBox checkBox = gridViewRow.FindControl("cbBox") as CheckBox;
                 fund_accountInfoModle    fund_accountInfoModle    = new fund_accountInfoModle();
                 fund_AccountOperateModle fund_AccountOperateModle = new fund_AccountOperateModle();
                 if (checkBox != null && checkBox.Checked)
                 {
                     try
                     {
                         fund_AccountOperateModle         = this.bll.GetModel(int.Parse(checkBox.ToolTip));
                         fund_accountInfoModle.accountNum = fund_AccountOperateModle.AccountNum;
                         fund_accountInfoModle.isValid    = new int?(0);
                         if (Convert.ToDecimal(((TextBox)gridViewRow.FindControl("tbxmony")).Text) > 0m)
                         {
                             fund_accountInfoModle.opClass = new int?(0);
                         }
                         else
                         {
                             fund_accountInfoModle.opClass = new int?(1);
                         }
                         int id = int.Parse(checkBox.ToolTip);
                         fund_accountInfoModle.opMoney = new decimal?(Math.Abs(Convert.ToDecimal(((TextBox)gridViewRow.FindControl("tbxmony")).Text)));
                         DateTime now = DateTime.Now;
                         fund_accountInfoModle.opTime  = new DateTime?(now);
                         fund_accountInfoModle.opType  = fund_AccountOperateModle.AccounType;
                         fund_accountInfoModle.sysPeop = base.UserCode.ToString();
                         fund_accountInfoModle.opMan   = base.UserCode.ToString();
                         if (this.Addbll.Add(fund_accountInfoModle) <= 0 || !this.bll.UpdateBoth(base.UserCode, now, Convert.ToDecimal(((TextBox)gridViewRow.FindControl("tbxmony")).Text), id))
                         {
                             list.Clear();
                             message = "alert('系统提示:\\n\\入账失败!')";
                             break;
                         }
                         list.Add(checkBox.ToolTip);
                         message = "alert('系统提示:\\n\\n入账成功!');location='AccountOperate.aspx'";
                     }
                     catch
                     {
                         list.Clear();
                         message = "alert('系统提示:\\n\\入账失败!')";
                     }
                 }
             }
             base.RegisterScript(message);
             sqlTransaction.Commit();
             this.BindGv();
         }
         catch (Exception)
         {
             sqlTransaction.Rollback();
             base.RegisterScript("alert('系统提示:\\n\\n对不起入账失败!');");
         }
     }
 }
示例#6
0
 public int Add(fund_accountInfoModle model)
 {
     return(this.dal.Add(model));
 }
示例#7
0
 public bool Update(fund_accountInfoModle model)
 {
     return(this.dal.Update(model));
 }