Exemplo n.º 1
0
 public ProjectSelect(int GroupId, GroupDetails parent)
 {
     InitializeComponent();
     this.MinimumSize = new Size(this.Width, this.Height);
     id  = GroupId;
     par = parent;
     Refresh();
 }
Exemplo n.º 2
0
 public EvaluationSelect(int GroupId, GroupDetails parent)
 {
     InitializeComponent();
     EDDatePicker.MaxDate = DateTime.Now;
     EDDatePicker.Value   = EDDatePicker.MaxDate;
     this.MinimumSize     = new Size(this.Width, this.Height);
     id           = GroupId;
     par          = parent;
     OMError.Text = "";
     Refresh();
 }
Exemplo n.º 3
0
 private void SelectButton_Click(object sender, EventArgs e)
 {
     try
     {
         if (RegCombBox.Text == "\0")
         {
             MessageBox.Show("Box cannot be empty.");
             return;
         }
         if (flag == 0)
         {
             String ids = "-1";
             int    GId = 0;
             foreach (int x in SId)
             {
                 ids = ids + ", " + x.ToString();
             }
             String cmd    = "SELECT GroupId, StudentId FROM GroupStudent WHERE GroupId = (Select GroupId FROM GroupStudent JOIN Student ON StudentId = Id WHERE RegistrationNo = '" + RegCombBox.SelectedItem.ToString() + "' AND Status = (SELECT Id FROM Lookup WHERE Category = 'STATUS' AND Value = 'Active')) AND StudentID IN (" + ids + ")";
             var    reader = DatabaseConnection.getInstance().getData(cmd);
             while (reader.Read())
             {
                 SId.Remove((int)reader.GetValue(1));
                 GId = (int)reader.GetValue(0);
             }
             ids = "-1";
             foreach (int x in SId)
             {
                 ids = ids + ", " + x.ToString();
             }
             cmd = "UPDATE GroupStudent SET Status = (SELECT Id FROM Lookup WHERE Category = 'STATUS' AND Value = 'InActive') WHERE StudentId IN (Select Id from Student JOIN GroupStudent ON Id = StudentId WHERE Id IN (" + ids + "))";
             DatabaseConnection.getInstance().exectuteQuery(cmd);
             foreach (int x in SId)
             {
                 cmd = String.Format("Insert INTO GroupStudent(GroupId, StudentId, Status, AssignmentDate) values('{0}', '{1}', (SELECT Id FROM Lookup WHERE Category = 'STATUS' AND Value = 'Active'), GETDATE())", GId, x);
                 DatabaseConnection.getInstance().exectuteQuery(cmd);
             }
             Parent.Refresh();
             MessageBox.Show("Students added.");
             this.Close();
         }
         else if (flag == 1)
         {
             int    flag2 = 0;
             String data  = "";
             foreach (char x in RegCombBox.SelectedItem.ToString())
             {
                 if (flag2 <= 1 && x == ' ')
                 {
                     flag2++;
                 }
                 else if (x == '\0')
                 {
                     break;
                 }
                 else if (flag2 == 2)
                 {
                     data = data + x;
                 }
             }
             string cmd    = "SELECT GroupProject.GroupId FROM (Student JOIN GroupStudent ON Student.Id = StudentId) JOIN GroupProject ON GroupStudent.GroupId = GroupProject.GroupId WHERE ProjectId = " + Id.ToString() + " AND RegistrationNo = '" + data + "' AND Status = (SELECT Id FROM Lookup WHERE Category = 'STATUS' AND Value = 'Active')";
             var    reader = DatabaseConnection.getInstance().getData(cmd);
             while (reader.Read())
             {
                 GroupDetails gd = new GroupDetails((int)reader.GetValue(0));
                 this.Close();
                 gd.Show();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }