public override string ToString() { string pathDelimiter = PathInfo.PathDelimiter; string result = string.Empty; if (LabID == 0) { return(result); } else { result += LabID.ToString(); } if (LabLocationID == 0) { return(result); } else { result += pathDelimiter + LabLocationID.ToString(); } return(result); }
public string[] ToArray(string statsBasedOn) { List <string> list = new List <string> { ResourceID.ToString(), ProcessTechID.ToString(), LabID.ToString(), ResourceName, ProcessTechName }; switch (statsBasedOn) { case "charged": list.AddRange(Activities.Select(x => x.ChargeDuration.ToString("#0.000")).ToArray()); break; case "scheduled": list.AddRange(Activities.Select(x => x.SchedDuration.ToString("#0.000")).ToArray()); break; case "actual": list.AddRange(Activities.Select(x => x.ActDuration.ToString("#0.000")).ToArray()); break; } list.Add(GetTotal(statsBasedOn).ToString("#0.000")); return(list.ToArray()); }
public override string ToString() { string pathDelimiter = PathDelimiter; string result = string.Empty; if (BuildingID == 0 && ResourceID == 0) { return(result); } else { result += BuildingID.ToString(); } if (LabID == 0 && ResourceID == 0) { return(result); } else { result += pathDelimiter + LabID.ToString(); } if (ProcessTechID == 0 && ResourceID == 0) { return(result); } else { result += pathDelimiter + ProcessTechID.ToString(); } if (ResourceID == 0) { return(result); } else { result += pathDelimiter + ResourceID.ToString(); } return(result); }
public string[] ListAllLabs() { var rad = new string[] { LabID.ToString(), Namn, Course.Name }; return(rad); }
private void button1_Click(object sender, EventArgs e) { // Проверим, что всё, что нужно, введено if (textBox1.Text == "") { MessageBox.Show("Введите фамилию пользователя", "Ошибка"); return; } if (textBox2.Text == "") { MessageBox.Show("Введите имя пользователя", "Ошибка"); return; } if (status == 1) { if (textBox5.Text == "") { MessageBox.Show("Введите или сгенерируйте пароль", "Ошибка"); return; } if (textBox4.Text == "") { MessageBox.Show("Введите подтверждение пароля", "Ошибка"); return; } } if (textBox6.Text == "") { MessageBox.Show("Введите логин пользователя", "Ошибка"); return; } int LabID; switch (status) { case 1: LabID = LabsID.Where(x => x.Value == comboBox1.SelectedItem.ToString()).FirstOrDefault().Key; List <string> Answer = ServerCommunication.Send_Get_Msg_To_Server("users.add", "name " + textBox2.Text + "\nsecond_name " + textBox3.Text + "\nsurname " + textBox1.Text + "\nlogin " + textBox6.Text + "\npassword " + textBox5.Text + "\nconfirm " + textBox4.Text + "\npermissions 1" + "\njob " + textBox7.Text + "\nlaboratory_id " + LabID.ToString()); if (Answer[1] == "User added") { FormAnswer = true; Close(); } else { MessageBox.Show(Answer[1], "Ошибка добавления пользователя"); } break; case 2: string Params = ""; if (textBox1.Text != OldInfo.Surname) { Params += textBox1.Text != "" ? "\nsurname " + textBox1.Text : "\nsurname {CLEAR}"; } if (textBox2.Text != OldInfo.Name) { Params += textBox2.Text != "" ? "\nname " + textBox2.Text : "\nname {CLEAR}"; } if (textBox3.Text != OldInfo.SecondName) { Params += textBox3.Text != "" ? "\nsecond_name " + textBox3.Text : "\nsecond_name {CLEAR}"; } if (comboBox1.SelectedItem.ToString() != OldInfo.Lab) { LabID = LabsID.Where(x => x.Value == comboBox1.SelectedItem.ToString()).FirstOrDefault().Key; Params += "\nlaboratory_id " + LabID.ToString(); } if (textBox7.Text != OldInfo.Job) { Params += textBox7.Text != "" ? "\njob " + textBox7.Text : "\njob {CLEAR}"; } if (Params == "") { FormAnswer = true; Close(); return; } Params += "\nlogin " + textBox6.Text; List <string> AnswerEdit = ServerCommunication.Send_Get_Msg_To_Server("users.update", Params); if (AnswerEdit[1] == "User information updated") { FormAnswer = true; Close(); } else { MessageBox.Show(AnswerEdit[1], "Ошибка добавления пользователя"); } break; } }