本文整理汇总了C#中DBDataHelper.GetRowsAffected方法的典型用法代码示例。如果您正苦于以下问题:C# DBDataHelper.GetRowsAffected方法的具体用法?C# DBDataHelper.GetRowsAffected怎么用?C# DBDataHelper.GetRowsAffected使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBDataHelper
的用法示例。
在下文中一共展示了DBDataHelper.GetRowsAffected方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AssignTaskToFaculties
/// <summary>
/// This method assigns the task to different persons.
/// </summary>
/// <param name="task">An object of type Task containing the details of the task.</param>
/// <returns>It returns true if the task is successfully assigned to all the persons.</returns>
public bool AssignTaskToFaculties(Task task)
{
DataTable table = new DataTable("data");
table.Columns.Add("TaskID");
table.Columns.Add("PersonID");
table.Columns.Add("TaskStatusID");
foreach (Faculty faculty in task.AssignedTo)
{
table.Rows.Add(new object[] { task.ID, faculty.ID, 1 });
}
int result = 0;
SqlParameter TaskFacultiesTVP = new SqlParameter("TaskFacultiesTVP", table);
TaskFacultiesTVP.SqlDbType = SqlDbType.Structured;
List<SqlParameter> parameterCollection = new List<SqlParameter>() { TaskFacultiesTVP };
using (DBDataHelper helper = new DBDataHelper())
{
result = helper.GetRowsAffected("dbo.AssignTaskToFaculties", SQLTextType.Stored_Proc, parameterCollection);
}
if (result > 0)
return true;
else
return false;
}
示例2: UpdateTaskStatus
/// <summary>
/// This method updates the status of a task.
/// </summary>
/// <param name="taskID">An integer parameter containing the ID of the task.</param>
/// <param name="status">An object of Enum TaskStatusType containing the updated status.</param>
/// <returns>It returns true if the status is successfully updated.</returns>
public bool UpdateTaskStatus(int taskID,TaskStatusType status,int facultyID)
{
SqlParameter TaskID = new SqlParameter("taskID", taskID);
SqlParameter TaskStatusID = new SqlParameter("taskStatusID", (int)status);
SqlParameter FacultyID = new SqlParameter("facultyID", facultyID);
List<SqlParameter> parameterCollection = new List<SqlParameter>() { TaskID, TaskStatusID, FacultyID };
int rowsAffected = 0;
using(DBDataHelper helper = new DBDataHelper())
{
rowsAffected = helper.GetRowsAffected("dbo.UpdateTaskStatus", SQLTextType.Stored_Proc, parameterCollection);
}
if (rowsAffected != 0)
return true;
else
return false;
}
示例3: UpdateFacultyDetails
/// <summary>
/// This method updates the details of the faculty in the database.
/// </summary>
/// <param name="faculty">An object of Faculty class containing the details of the faculty.</param>
/// <returns>It returns true if the details are updated successfully otherwise false.</returns>
public bool UpdateFacultyDetails(Faculty faculty)
{
SqlParameter FacultyID = new SqlParameter("facultyID", faculty.ID);
SqlParameter Name = new SqlParameter("name", faculty.Name);
SqlParameter ImageURL = new SqlParameter("imageURL", faculty.ImageURL);
SqlParameter EmailID = new SqlParameter("emailID", faculty.EmailID);
SqlParameter ContactNo = new SqlParameter("contactNo", faculty.ContactNo);
SqlParameter DepartmentID = new SqlParameter("departmentID", (int)faculty.Department);
SqlParameter DesignationID = new SqlParameter("designationID", (int)faculty.Designation);
List<SqlParameter> parameterCollection = new List<SqlParameter>(){
FacultyID,Name,ImageURL,EmailID,ContactNo,DepartmentID,DesignationID
};
int result = 0;
using(DBDataHelper helper = new DBDataHelper())
{
result = helper.GetRowsAffected("dbo.UpdateFacultyDetails", SQLTextType.Stored_Proc, parameterCollection);
}
if (result > 0)
return true;
else
return false;
}
示例4: DeleteTask
public bool DeleteTask(int taskID)
{
SqlParameter TaskID = new SqlParameter("taskID", taskID);
List<SqlParameter> parameterCollection = new List<SqlParameter>();
parameterCollection.Add(TaskID);
int taskDeleted;
using (DBDataHelper helper = new DBDataHelper())
{
taskDeleted = helper.GetRowsAffected("dbo.DeleteTask", SQLTextType.Stored_Proc, parameterCollection);
}
if (taskDeleted != 0)
{
return true;
}
else
{
return false;
}
}
示例5: UpdateTaskDetails
/// <summary>
/// This method updates the details of the task in the database.
/// </summary>
/// <param name="taskID">An integer parameter containing the ID of the task to be updated.</param>
/// <returns>It returns true if the task is updated otherwise false.</returns>
public bool UpdateTaskDetails(int taskID)
{
SqlParameter TaskID = new SqlParameter("taskID", taskID);
List<SqlParameter> parameterCollection = new List<SqlParameter> { TaskID };
int result;
using (DBDataHelper helper = new DBDataHelper())
{
result = helper.GetRowsAffected("dbo.UpdateTaskDetails", SQLTextType.Stored_Proc, parameterCollection);
}
if (result > 0)
return true;
else
return false;
}