示例#1
0
 public string GetStoryName(int story_id)
 {
     using (ProjectDBEntities db_entity = new ProjectDBEntities())
     {
         Storys s = db_entity.Storys.FirstOrDefault(sid => sid.story_id == story_id);
         return(s.name);
     }
 }
示例#2
0
        private void cmbStories_SelectedIndexChanged(object sender, EventArgs e)
        {
            string currStory = cmbStories.SelectedItem.ToString();

            cStry = currStory;
            using (ProjectDBEntities db_entitiy = new ProjectDBEntities())
            {
                Storys cStory = db_entitiy.Storys.FirstOrDefault(s => s.name == currStory);
                txtCurrStoryDesc.Text = cStory.description;
                lblCurrStoryDate.Text = cStory.startingDate.Value.ToShortDateString() + " -Deadline [" + cStory.deadline.ToString() + " Gün]- " + cStory.endingDate.Value.ToShortDateString();
            }
            tasks_fetch();
        }
示例#3
0
 void StoryDetails()
 {
     using (ProjectDBEntities db_entity = new ProjectDBEntities())
     {
         string currStory = cmbStories.SelectedItem.ToString();
         if (currStory != null)
         {
             Storys story = db_entity.Storys.FirstOrDefault(w => w.name == currStory);
             txtStoryName.Text        = story.name;
             txtStoryDescription.Text = story.description;
             txtStoryDeadline.Text    = story.deadline.ToString();
             lblDateNow.Text          = story.startingDate.Value.ToShortDateString() + "-" + story.endingDate.Value.ToShortDateString();
         }
     }
 }
示例#4
0
 private void btnNewTask_Click(object sender, EventArgs e)
 {
     using (ProjectDBEntities db_entity = new ProjectDBEntities())
     {
         if (currType == type.New)
         {
             string  currStory  = cmbStories.SelectedItem.ToString();
             string  currWorker = cmbWorkers.SelectedItem.ToString();
             Storys  story      = db_entity.Storys.FirstOrDefault(s => s.name == currStory);
             Workers worker     = db_entity.Workers.FirstOrDefault(w => w.name == currWorker);
             Tasks   tsk        = new Tasks();
             Task    task       = new Task(story.story_id, txtTaskName.Text, txtTaskDetails.Text, dtTaskDate.Value.Date, Convert.ToInt16(txtTaskDeadline.Text), worker.worker_id);
             tsk.story_id       = task.GetStory();
             tsk.worker_id      = task.GetWorker();
             tsk.taskName       = task.GetTaskName();
             tsk.details        = task.GetDetails();
             tsk.commitmentDate = task.GetCommitmentDate();
             tsk.endingDate     = task.GetEndingDate();
             tsk.deadline       = task.GetDeadline();
             tsk.state          = task.GetTaskState();
             db_entity.Tasks.Add(tsk);
             CreateTaskPanel(task);
         }
         else
         {
             Tasks task = db_entity.Tasks.FirstOrDefault(t => t.taskName == currControl.Name);
             if (currType == type.Edit)
             {
                 task.taskName       = txtTaskName.Text;
                 task.details        = txtTaskDetails.Text;
                 task.deadline       = Convert.ToInt16(txtTaskDeadline.Text);
                 task.commitmentDate = dtTaskDate.Value.Date;
                 task.endingDate     = task.commitmentDate.Value.AddDays(task.deadline.Value);
                 Workers w = db_entity.Workers.FirstOrDefault(v => v.name == cmbWorkers.SelectedItem.ToString());
                 task.worker_id = w.worker_id;
             }
             if (currType == type.Delete)
             {
                 db_entity.Tasks.Remove(task);
             }
         }
         db_entity.SaveChanges();
         MessageBox.Show("İşlem Başarıyla Gerçekleşti.");
         ResetTaskGroupBox();
         Storys_Fetch();
     }
 }
示例#5
0
        void TaskDetails(string taskName)
        {
            using (ProjectDBEntities db_entity = new ProjectDBEntities())
            {
                Tasks currTask = db_entity.Tasks.FirstOrDefault(w => w.taskName == taskName);

                txtTaskName.Text     = currTask.taskName;
                txtTaskDetails.Text  = currTask.details;
                txtTaskDeadline.Text = currTask.deadline.ToString();

                Storys  story  = db_entity.Storys.FirstOrDefault(s => s.story_id == currTask.story_id);
                Workers worker = db_entity.Workers.FirstOrDefault(w => w.worker_id == currTask.worker_id);

                cmbWorkers.Text  = worker.name;
                lblStoryAdi.Text = "Story : " + story.name;
                dtTaskDate.Value = currTask.commitmentDate.Value.Date;
            }
        }
示例#6
0
 private void btnCreateStory_Click(object sender, EventArgs e)
 {
     using (ProjectDBEntities db_entity = new ProjectDBEntities())
     {
         if (currType == type.New)
         {
             Story st = new Story(txtStoryName.Text, txtStoryDescription.Text, int.Parse(txtStoryDeadline.Text));
             st.EditEndingDate(st.GetStartingDate(), st.GetDeadline());
             Storys st_db = new Storys();
             st_db.name         = st.GetName();
             st_db.description  = st.GetDescription();
             st_db.startingDate = st.GetStartingDate();
             st_db.endingDate   = st.GetEndingDate();
             st_db.state        = st.GetState();
             st_db.deadline     = st.GetDeadline();
             db_entity.Storys.Add(st_db);
         }
         else
         {
             string currStory = cmbStories.SelectedItem.ToString();
             Storys story     = db_entity.Storys.FirstOrDefault(w => w.name == currStory);
             if (currType == type.Edit && currStory != null)
             {
                 lblDateNow.Text   = story.startingDate.ToString();
                 story.name        = txtStoryName.Text;
                 story.description = txtStoryDescription.Text;
                 story.deadline    = Convert.ToInt16(txtStoryDeadline.Text);
                 story.endingDate  = story.startingDate.Value.AddDays(story.deadline.Value);
             }
             if (currType == type.Delete && currStory != null)
             {
                 db_entity.Storys.Remove(story);
             }
         }
         db_entity.SaveChanges();
         MessageBox.Show("İşlem Başarıyla Gerçekleşti.");
         ResetStoryGroupBox();
         Storys_Fetch();
     }
 }