Beispiel #1
0
        private void SendData()
        {
            for (int i = 0; i < 10; i++)
            {
                var      container = Master.FindControl("Body");
                string[] input     = new string[6]; //--Var

                for (int i2 = 0; i2 <= 5; 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] = "";
                        }
                        else
                        {
                            input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        }

                        break;

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

                    case 3:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = "";
                        }
                        else
                        {
                            input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        }
                        break;

                    case 4:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = "";
                        }
                        else
                        {
                            input[i2] = _business.BeginUpperCase((((TextBox)txtBox).Text.ToString()));
                        }
                        break;

                    case 5:
                        if (String.IsNullOrWhiteSpace(((TextBox)txtBox).Text.ToString()))
                        {
                            input[i2] = "";
                        }
                        else
                        {
                            if (_business.IsValidPhone(((TextBox)txtBox).Text.ToString()))
                            {
                                input[i2] = (((TextBox)txtBox).Text.ToString());
                            }
                            else
                            {
                                //error---------------------------------------
                                input[i2] = "error invalid phone";
                            }
                        }
                        break;
                    }
                }

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

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

                _business.AddHospital(new HospitalCode(0, input[0], input[1], input[2], input[3], input[4], input[5], user.ID, Convert.ToDateTime(dateNow), Convert.ToDateTime(dateNow))); //--Var
track1:
                continue;
            }
        }