本文整理汇总了C#中DBManager.AddParameter方法的典型用法代码示例。如果您正苦于以下问题:C# DBManager.AddParameter方法的具体用法?C# DBManager.AddParameter怎么用?C# DBManager.AddParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBManager
的用法示例。
在下文中一共展示了DBManager.AddParameter方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ExecuteCustomQuery
/// <summary>
/// Bu metot kendi kompleks sorgunuzu oluşturabilmenizi sağlar.
/// This method can be used to perform complex queries.
/// </summary>
/// <param name="query">Query statement.</param>
/// <param name="parameters">Query parameters. This is not a required.</param>
/// <returns>This method will return DbDataReader object.</returns>
public DbDataReader ExecuteCustomQuery(string query, object parameters = null)
{
var dbManager = new DBManager(OrmConfiguration);
dbManager.CreateCommand(query);
if (parameters != null)
dbManager.AddParameter(parameters);
var reader = dbManager.ExecuteReader();
return reader;
}
示例2: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
try
{
int uid = int.Parse(((GridViewRow)((Button)sender).Parent.Parent).Cells[0].Text);
DBManager manager = new DBManager("");
manager.AddParameter(uid);
manager.executeCommand("update APAS_PaymentAdviceList set intIsDeletedPAList = 0, LastModifiedBy = 833, LastModifiedTime = getdate(), LastAction = 'Recovered' where intIdPAList = @p0; update APAS_PaymentAdvice set intIsFrozenPA = 0 where intIDPAList = @p0");
GridView1.DataBind();
}
catch (Exception ex)
{
bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy");
if (rethrow) throw;
}
}
示例3: SubmitChanges
/// <summary>
/// Ekleme, silme veya güncelleme gibi yapılmış olan işlemleri, veritabanında uygulamayı sağlar.
/// Allows you to perform insert, delete or update operations on the database.
/// </summary>
/// <returns></returns>
public int SubmitChanges()
{
var dbManager = new DBManager(OrmConfiguration);
dbManager.CreateCommand(DBManager.CommandText);
if (DBManager.CommandParameters != null && DBManager.CommandParameters.Count > 0)
foreach (var loopParameter in DBManager.CommandParameters)
{
dbManager.AddParameter(loopParameter.Key.ToString(), loopParameter.Value);
}
int status = dbManager.ExecuteNonQuery();
return status;
}
示例4: btnCancelClass_Click
protected void btnCancelClass_Click(object sender, EventArgs e)
{
try
{
DBManager manager = new DBManager("table");
manager.AddParameter(int.Parse(lblID0.Text));
manager.executeCommand(
@"Update ASP_IntensiveClass set intIsCancelled = 1 where intID = @p0; ");
lblClassStatus.Text = "Cancelled";
MultiView1.ActiveViewIndex = 1;
}
catch (Exception ex)
{
bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy");
if (rethrow) throw;
}
}
示例5: btnSetPaid_Click
protected void btnSetPaid_Click(object sender, EventArgs e)
{
try
{
DBManager manager = new DBManager("table");
manager.AddParameter(int.Parse(lblStudentID.Text));
manager.executeCommand(
@"Update ASP_IntensiveClassContainer set inthasPaid = 1 where intStudentID = @p0; ");
GridView2.DataBind();
MultiView1.ActiveViewIndex = 1;
}
catch (Exception ex)
{
bool rethrow = ExceptionPolicy.HandleException(ex, "GenericPolicy");
if (rethrow) throw;
}
}
示例6: GridView2_RowDataBound
protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[5].Text == "0")
{
e.Row.Cells[5].Text = "Cash/Cheque";
e.Row.Cells[6].Text = e.Row.Cells[6].Text == "1" ? "Paid" : "Unpaid";
if (e.Row.Cells[6].Text == "Unpaid" && lblClassStatus.Text != "Cancelled")
{
((Button)e.Row.Cells[7].FindControl("btnPayment")).Visible = true;
}
}
else
{
try
{
DBManager manager = new DBManager("table");
manager.AddParameter(int.Parse(lblID.Text));
DataTable table = manager.queryTable(
@"select 'Credit/ATTID:' + convert(varchar, reg.intIdAttendance) + ' CID:' + convert(varchar,ClassSchedule.intIdClassSchedule) + ' (' + convert(varchar, s.strNameSubject) + ' ' + convert(varchar, l.strNameLevel) + ')' from MakeupAttendance
inner join Attendance ot on ot.intIdAttendance = MakeupAttendance.intIdAttendanceOnetimeMakeupAttendance
inner join Attendance reg on reg.intIdAttendance = MakeupAttendance.intIdAttendanceRegularMakeupAttendance
inner join ClassSchedule on ClassSchedule.intIdClassSchedule = reg.intIdClassAttendance
inner join [Subject] s on s.intIdSubject = ClassSchedule.intIdSubjectClassSchedule
inner join [Level] l on l.intIdLevel = ClassSchedule.intIdLevelClassSchedule
where ot.intIdClassAttendance = @p0 ");
if (table.Rows.Count > 0)
e.Row.Cells[5].Text = table.Rows[0][0].ToString();
else
e.Row.Cells[5].Text = "Undetected";
}
catch (Exception ex)
{
e.Row.Cells[5].Text = "Undetected";
}
e.Row.Cells[6].Text = "Paid";
}
}
}
示例7: GridView1_RowDataBound
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[9].Text == "1")
{
e.Row.Cells[9].Text = "Cancelled";
e.Row.Cells[10].FindControl("btnCancel").Visible = false;
}
else
e.Row.Cells[9].Text = "Running";
Label l = ((Label)e.Row.Cells[10].FindControl("lblCount"));
try
{
DBManager manager = new DBManager("Table");
manager.AddParameter(int.Parse(e.Row.Cells[0].Text));
l.Text =
manager.queryTable(
"select COUNT(*) from ASP_IntensiveClassContainer where intIntensiveClassID = @p0")
.Rows[0][0].ToString();
}
catch (Exception ex)
{
l.Text = "Undetected";
}
if (e.Row.Cells[9].Text == "Cancelled")
{
e.Row.BackColor = System.Drawing.Color.DarkBlue;
e.Row.ForeColor = System.Drawing.Color.White;
}
else
if (l.Text == "Undetected")
{
e.Row.BackColor = System.Drawing.Color.Red;
e.Row.ForeColor = System.Drawing.Color.White;
}
else if (int.Parse(l.Text) >= int.Parse(e.Row.Cells[8].Text))
{
e.Row.BackColor = System.Drawing.Color.Gold;
e.Row.ForeColor = System.Drawing.Color.Brown;
}
else if (int.Parse(l.Text) < int.Parse(e.Row.Cells[7].Text))
{
e.Row.BackColor = System.Drawing.Color.Tomato;
e.Row.ForeColor = System.Drawing.Color.White;
}
}
}