本文整理汇总了C#中WindowsFormsApplication13.DataManager.TaskAddNewTask方法的典型用法代码示例。如果您正苦于以下问题:C# DataManager.TaskAddNewTask方法的具体用法?C# DataManager.TaskAddNewTask怎么用?C# DataManager.TaskAddNewTask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WindowsFormsApplication13.DataManager
的用法示例。
在下文中一共展示了DataManager.TaskAddNewTask方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TaskToDB
private void TaskToDB()
{
if (!IfTaskGreedChanged())
return;
DataManager dm = new DataManager();
int col = 4;
int rows = taskDataGridView.Rows.Count;
string[] read = new string[4];
for (int i = 0; i < rows - 1; i++)
{
for (int j = 0; j < col; j++)
{
read[j] = taskDataGridView.Rows[i].Cells[j + 1].Value.ToString();
}
for (int j = 0; j < col; j++)
{
if (j == 2)
continue; // description might be null
if (read[j] == null)
return;
}
int ans = dm.TaskAddNewTask(Convert.ToInt32(read[0]), Convert.ToInt32(read[1]), read[2],
Convert.ToInt32(read[3]));
if (ans == -1)
MessageBox.Show("Error while creating new task");
}
}
示例2: Taskadd_new_taskTest
public void Taskadd_new_taskTest()
{
DataManager target = new DataManager(); // TODO: Initialize to an appropriate value
// int ID = 0; // TODO: Initialize to an appropriate value
int Task_Owner = 1; // TODO: Initialize to an appropriate value
int Story_ID = 3; // TODO: Initialize to an appropriate value
string Description = " "; // TODO: Initialize to an appropriate value
int Priority = 2; // TODO: Initialize to an appropriate value
int expected = 0; // TODO: Initialize to an appropriate value
int actual;
actual = target.TaskAddNewTask(Story_ID, Priority, Description, Task_Owner);
Assert.AreEqual(expected, actual);
//Assert.Inconclusive("Verify the correctness of this test method.");
}
示例3: TaskToDB
private void TaskToDB()
{
if (!IfTaskGreedChanged())
return;
DataManager dm = new DataManager();
MathManager mm = new MathManager();
//int col = 4;
//int rows = taskDataGridView.Rows.Count;
//int col;
int rows;
if (Convert.ToInt32(updatedTaskIndexes.Count.ToString()) == 0) // no changes were found, there fore no need to save any data
return;
//string[] read = new string[4];
for(int i = 0; i < Convert.ToInt32(updatedTaskIndexes.Count.ToString()); i++)
{
rows = updatedTaskIndexes.ElementAt(i).getRow();
int task_ID = Convert.ToInt32(taskDataGridView.Rows[rows].Cells[1].Value.ToString());
if (mm.isTask_Id_Exist(task_ID) >= 0)
{ // task already exist, therefore we need only to update
int storyId = Convert.ToInt32(taskDataGridView.Rows[rows].Cells[0].Value.ToString());
if (mm.isTask_Story_IDValid(storyId) >= 0)
{
int ans = dm.TaskSetTaskStoryID(task_ID, storyId);
}
else
{
MessageBox.Show("Invalid Story id at line:" + (rows + 1));
updatedTaskIndexes.RemoveAt(i);
return;
}
int priority = Convert.ToInt32(taskDataGridView.Rows[rows].Cells[2].Value.ToString());
if (mm.isTask_PriorityValid(priority) >= 0)
{
dm.TaskSetTaskPriority(task_ID, priority);
}
else
{
MessageBox.Show("Invalid Priority value at line:" + (rows + 1));
updatedTaskIndexes.RemoveAt(i);
return;
}
string descriptions = taskDataGridView.Rows[rows].Cells[5].Value.ToString();
dm.TaskSetTaskDescription(task_ID, descriptions);
int ownerId = Convert.ToInt32(taskDataGridView.Rows[rows].Cells[3].Value.ToString());
if (mm.isTask_Ovner_IdValid(ownerId) >= 0)
{
dm.TaskSetTaskOwner(task_ID, ownerId);
}
else
{
MessageBox.Show("Invalid Owner Id at line:" + (rows + 1));
updatedTaskIndexes.RemoveAt(i);
return;
}
}
else
{
int storyId = Convert.ToInt32(taskDataGridView.Rows[rows].Cells[0].Value.ToString());
int priority = Convert.ToInt32(taskDataGridView.Rows[rows].Cells[2].Value.ToString());
string descriptions = taskDataGridView.Rows[rows].Cells[5].Value.ToString();
int ownerId = Convert.ToInt32(taskDataGridView.Rows[rows].Cells[3].Value.ToString());
int ans = dm.TaskAddNewTask(storyId, priority, descriptions,
ownerId);
MessageBox.Show("Added");
if (ans == -1)
{
MessageBox.Show("Error while creating new task");
updatedTaskIndexes.RemoveAt(i);
return;
}
}
}
int size = Convert.ToInt32(updatedTaskIndexes.Count.ToString());
for (int i = 0; i < size; i++)
{
updatedTaskIndexes.RemoveAt(0);
}
}