public void SetListBoxContent() { if (!IsPostBack) { for (int i = 0; i <= 9; i++) { List <List <string> > ListDropdownContent = _business.GetDoctorDropDownContent(); //--Var List <string> Names = new List <string>(); string lbEdit = "lbEdit" + i.ToString() + "0"; var container = Master.FindControl("Body"); var DropDownData = container.FindControl(lbEdit) as ListBox; for (int i2 = 0; i2 < ListDropdownContent.Count; i2++) { Names.Add(ListDropdownContent[i2][1]); } DropDownData.DataSource = Names; DropDownData.DataBind(); for (int i2 = 0; i2 < ListDropdownContent.Count; i2++) { DropDownData.Items[i2].Value = ListDropdownContent[i2][0]; } } } }
private void SendData() { for (int i = 0; i <= 9; i++) { string[] input = new string[6]; var container = Master.FindControl("Body"); for (int i2 = 0; i2 <= 5; i2++) { string tbName = "tbEdit" + i.ToString() + i2.ToString(); var txtBox = container.FindControl(tbName); switch (i2) { case 0: if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString())) { goto track1; } else { input[i2] = (((TextBox)txtBox).Text.ToString()); } break; case 1: input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString())); break; case 2: input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString())); break; case 3: input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString())); break; case 4: input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString())); break; case 5: input[i2] = (((TextBox)txtBox).Text.ToString()); break; } } List <List <string> > ListContentCRA = _business.GetCRADropDownContent(); List <List <string> > ListContentDoctor = _business.GetDoctorDropDownContent(); List <List <string> > ListContentSC = _business.GetStudyCoordinatorDropDownContent(); List <string> Empty = new List <string>(); Empty.Add(string.Empty); List <List <string> > ListAll = new List <List <string> >(); ListAll.Add(Empty); ListAll.Add(Empty); for (int i3 = 0; i3 < ListContentCRA.Count; i3++) { ListAll.Add(ListContentCRA[i3]); } ListAll.Add(Empty); for (int i3 = 0; i3 < ListContentDoctor.Count; i3++) { ListAll.Add(ListContentDoctor[i3]); } ListAll.Add(Empty); for (int i3 = 0; i3 < ListContentSC.Count; i3++) { ListAll.Add(ListContentSC[i3]); } UserCode LoginUser = (UserCode)Session["authenticatedUser"]; UserCode user = GetCurrentUser(LoginUser.User_ID); DateTime dt = DateTime.Now; string dateNow = dt.ToString("yyyy-MM-dd"); string ddName = "ddEdit" + i.ToString() + "0"; var dropdownData = container.FindControl(ddName) as DropDownList; string value = dropdownData.SelectedValue; string name = dropdownData.SelectedItem.Text; if (value.Contains("CR") == true) { int valueInt = Convert.ToInt16(value.Remove(0, 2)); _business.AddEvaluation(Convert.ToDateTime(input[0]), input[1], input[2], input[3], input[4], input[5], valueInt, -1, -1, user.User_ID.ToString(), dateNow, dateNow); } else if (value.Contains("DR") == true) { int valueInt = Convert.ToInt16(value.Remove(0, 2)); _business.AddEvaluation(Convert.ToDateTime(input[0]), input[1], input[2], input[3], input[4], input[5], -1, valueInt, -1, user.User_ID.ToString(), dateNow, dateNow); } else if (value.Contains("SC") == true) { int valueInt = Convert.ToInt16(value.Remove(0, 2)); _business.AddEvaluation(Convert.ToDateTime(input[0]), input[1], input[2], input[3], input[4], input[5], -1, -1, valueInt, user.User_ID.ToString(), dateNow, dateNow); } else { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alert", "alert('Make sure you have selected a valid relation.')", true); } ListContentCRA.Clear(); ListContentDoctor.Clear(); ListContentSC.Clear(); ListAll.Clear(); track1: continue; } }