예제 #1
0
        private void SendData()
        {
            for (int i = 0; i < 10; i++)
            {
                string lbName;
                var    listboxData = new ListBox();

                var      container = Master.FindControl("Body");
                string[] input     = new string[10];

                for (int i2 = 0; i2 <= 2; i2++) //--Var
                {
                    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] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        }
                        break;

                    case 1:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = DateTime.Today.ToString();
                        }
                        else
                        {
                            input[i2] = (((TextBox)txtBox).Text.ToString());
                        }
                        break;

                    case 2:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = DateTime.Today.ToString();
                        }
                        else
                        {
                            input[i2] = (((TextBox)txtBox).Text.ToString());
                        }
                        break;
                    }
                }

                UserCode LoginUser = (UserCode)Session["authenticatedUser"];
                UserCode user      = GetCurrentUser(LoginUser.ID);

                DateTime dt      = DateTime.Now;
                string   dateNow = dt.ToString("yyyy-MM-dd");

                _business.AddProject(new ProjectCode(0, input[0], Convert.ToDateTime(input[1]), Convert.ToDateTime(input[2]), user.ID, Convert.ToDateTime(dateNow), Convert.ToDateTime(dateNow))); //--Var

                lbName      = "lbEdit" + i.ToString() + "0";
                listboxData = container.FindControl(lbName) as ListBox;

                if (listboxData.SelectedIndex.ToString().Count() != 0)
                {
                    foreach (ListItem l in listboxData.Items)
                    {
                        if (l.Selected == true)
                        {
                            ProjectCode Project = _business.GetProjects(sortingPar).Last();             //--Var
                            _business.AddCRAToProject(Convert.ToInt32(l.Value.ToString()), Project.ID); //--Var
                        }
                    }
                }

                lbName      = "lbEdit" + i.ToString() + "1";
                listboxData = container.FindControl(lbName) as ListBox;

                if (listboxData.SelectedIndex.ToString().Count() != 0)
                {
                    foreach (ListItem l in listboxData.Items)
                    {
                        if (l.Selected == true)
                        {
                            ProjectCode Project = _business.GetProjects(sortingPar).Last();                //--Var
                            _business.AddDoctorToProject(Convert.ToInt32(l.Value.ToString()), Project.ID); //--Var
                        }
                    }
                }

                lbName      = "lbEdit" + i.ToString() + "2";
                listboxData = container.FindControl(lbName) as ListBox;

                if (listboxData.SelectedIndex.ToString().Count() != 0)
                {
                    foreach (ListItem l in listboxData.Items)
                    {
                        if (l.Selected == true)
                        {
                            ProjectCode Project = _business.GetProjects(sortingPar).Last();                  //--Var
                            _business.AddHospitalToProject(Convert.ToInt32(l.Value.ToString()), Project.ID); //--Var
                        }
                    }
                }

                lbName      = "lbEdit" + i.ToString() + "3";
                listboxData = container.FindControl(lbName) as ListBox;

                if (listboxData.SelectedIndex.ToString().Count() != 0)
                {
                    foreach (ListItem l in listboxData.Items)
                    {
                        if (l.Selected == true)
                        {
                            ProjectCode Project = _business.GetProjects(sortingPar).Last();                        //--Var
                            _business.AddProjectManagerToProject(Convert.ToInt32(l.Value.ToString()), Project.ID); //--Var
                        }
                    }
                }

track1:
                continue;
            }
        }