当前位置: 首页>>代码示例>>C#>>正文


C# DBDataHelper.GetRowsAffected方法代码示例

本文整理汇总了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;
 }
开发者ID:priyanshu92,项目名称:Department-Management-System,代码行数:28,代码来源:HODRepository.cs

示例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;
 }
开发者ID:priyanshu92,项目名称:Department-Management-System,代码行数:22,代码来源:FacultyRepository.cs

示例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;
 }
开发者ID:priyanshu92,项目名称:Department-Management-System,代码行数:27,代码来源:FacultyRepository.cs

示例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;
     }
 }
开发者ID:priyanshu92,项目名称:Department-Management-System,代码行数:19,代码来源:HODRepository.cs

示例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;
 }
开发者ID:priyanshu92,项目名称:Department-Management-System,代码行数:19,代码来源:HODRepository.cs


注:本文中的DBDataHelper.GetRowsAffected方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。