public QPS.NEW.Model.Integral GetModel(int Id) { QPS.NEW.Model.Integral integral = null; string strSql = "select UserID,WalletMoney,BankMoney,WalletMoney+BankMoney as TotalMoney from TUserInfo where UserID=@id"; DataTable dt = sqlHelper_.GetDataTable( strSql, CommandType.Text, new SqlParameter[] { new SqlParameter("@id", Id) } ); if (dt != null && dt.Rows.Count > 0) { integral = new Model.Integral(); integral.UserID = Convert.ToInt32(dt.Rows[0]["UserID"]); integral.BankMoney = Convert.ToInt32(dt.Rows[0]["BankMoney"]); integral.WalletMoney = Convert.ToInt32(dt.Rows[0]["WalletMoney"]); integral.TotalMoney = Convert.ToInt32(dt.Rows[0]["TotalMoney"]); } return(integral); }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.Integral DataRowToModel(DataRow row) { Model.Integral model = new Model.Integral(); if (row != null) { if (row["AutoID"] != null && row["AutoID"].ToString() != "") { model.AutoID = long.Parse(row["AutoID"].ToString()); } if (row["SimCardNo"] != null) { model.SimCardNo = row["SimCardNo"].ToString(); } if (row["Items"] != null && row["Items"].ToString() != "") { model.Items = row["Items"].ToString(); } if (row["IntegralAdded"] != null) { model.IntegralAdded = int.Parse(row["IntegralAdded"].ToString()); } if (row["TotalIntegral"] != null) { model.TotalIntegral = long.Parse(row["TotalIntegral"].ToString()); } if (row["LastModifyTime"] != null) { model.LastModifyTime = DateTime.Parse(row["LastModifyTime"].ToString()); } } return model; }
public QPS.NEW.Model.Integral GetModel(int Id) { QPS.NEW.Model.Integral integral = null; string strSql = "select UserID,WalletMoney,BankMoney,WalletMoney+BankMoney as TotalMoney from TUserInfo where UserID=@id"; DataTable dt = sqlHelper_.GetDataTable( strSql, CommandType.Text, new SqlParameter[] { new SqlParameter("@id",Id) } ); if (dt != null && dt.Rows.Count > 0) { integral = new Model.Integral(); integral.UserID =Convert.ToInt32( dt.Rows[0]["UserID"] ); integral.BankMoney = Convert.ToInt32(dt.Rows[0]["BankMoney"]); integral.WalletMoney = Convert.ToInt32(dt.Rows[0]["WalletMoney"]); integral.TotalMoney = Convert.ToInt32(dt.Rows[0]["TotalMoney"]); } return integral; }
protected void Bt_Modify_Click(object sender, EventArgs e) { Model.Integral igM = ig.GetModelList(1, SimID, 1, 5, true)[0]; Model.Log logM = new Model.Log(); logM.OperationItem = "修改积分"; logM.OperationDetail = "Sim:"+SimID+";原积分:"+igM.TotalIntegral+";当前积分:"+TB_TotalIntegral.Text; logM.OperationTime = DateTime.Now; logM.Operator = _user.UserInfo.UserID; logM.Memo = ""; int added = int.Parse((long.Parse(TB_TotalIntegral.Text) - igM.TotalIntegral).ToString()); bool isSet = false; try { Model.Integral newIgm = new Model.Integral(); newIgm.IntegralAdded = added; newIgm.Items = "手动设置-"+_user.UserInfo.UserName+"["+_user.UserInfo.UserID+"]"; newIgm.LastModifyTime = DateTime.Now; newIgm.SimCardNo = SimID; newIgm.TotalIntegral = long.Parse(TB_TotalIntegral.Text); isSet = ig.Add(newIgm); } catch (Exception ex) { logM.Memo += ex.Message; } finally { log.Add(logM); if (isSet) { ReadValue(); RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c4", "OpenAlert('恭喜,积分手动设置成功!');", true); } else RadScriptManager.RegisterStartupScript(this.Page, this.GetType(), "c5", "OpenAlert('抱歉,积分手动设置失败!');", true); } }
/// <summary> /// 得到一个对象实体 /// </summary> public Model.Integral GetModel(long AutoID) { StringBuilder strSql = new StringBuilder(); strSql.Append("select AutoID,SimCardNo,Items,IntegralAdded,TotalIntegral,LastModifyTime from Integral "); strSql.Append(" where AutoID=@AutoID"); MySqlParameter[] parameters = { new MySqlParameter("@AutoID", MySqlDbType.Int64) }; parameters[0].Value = AutoID; Model.Integral model = new Model.Integral(); DataSet ds = DbHelperMySQL.Query(strSql.ToString(), parameters); if (ds.Tables[0].Rows.Count > 0) { return DataRowToModel(ds.Tables[0].Rows[0]); } else { return null; } }