private void btnOK_Click(object sender, System.EventArgs e)
        {
            InputResponse = this.txtInput.Text;
            Parameter pass = ParameterBL.GetParameterValue("PasswordProfilesDelete");

            if (InputResponse.Equals(pass.Values))
            {
                if (!string.IsNullOrEmpty(firstStarName) && string.IsNullOrEmpty(secondStarName))
                {
                    DialogResult result = MessageBox.Show(string.Format("¿DESEAS BORRAR LA ESTRELLA DE PRIMER NIVEL {0}?", firstStarName), Resources.Constants.MYCTS, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (result.Equals(DialogResult.Yes))
                    {
                        Delete1stLevelBL.Delete1stLevel(pcc, firstStarName);
                        //Active1stLevelBL.Active1stLevel(pcc, firstStarName);
                        SetProfileChangesBL.SetProfile(Login.PCC, Login.Agent, firstStarName, string.Empty, DateTime.Now);
                        CatAllStarsBL.ListAllStars.Clear();
                        LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_WELCOME_PROFILES);
                    }
                }
                else if (!string.IsNullOrEmpty(firstStarName) && !string.IsNullOrEmpty(secondStarName))
                {
                    DialogResult result = MessageBox.Show(string.Format("¿DESEAS BORRAR LA ESTRELLA DE SEGUNDO NIVEL {0}?", secondStarName), Resources.Constants.MYCTS, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (result.Equals(DialogResult.Yes))
                    {
                        Delete2ndLevelBL.Delete2ndLevel(secondStarName);
                        //Active2ndLevelBL.Active2ndLevel(pcc, firstStarName, secondStarName);
                        SetProfileChangesBL.SetProfile(Login.PCC, Login.Agent, firstStarName, secondStarName, DateTime.Now);
                        bool noSecondStar             = true;
                        List <CatAllStars> Star2Count = CatAllStarsBL.GetAll2ndStarDetailed_Profile(ucProfileSearch.star1Info[0].Pccid, ucProfileSearch.star1Info[0].Level1, Login.OrgId);
                        if (Star2Count != null)
                        {
                            foreach (CatAllStars item in Star2Count)
                            {
                                if (item.Active)
                                {
                                    noSecondStar = false;
                                    break;
                                }
                            }
                        }
                        if (noSecondStar)
                        {
                            Update1stLevelBL.Update1stLevel(pcc, firstStarName, string.Empty, 2);
                        }
                        LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_WELCOME_PROFILES);
                    }
                }
            }
            else
            {
                MessageBox.Show(Resources.Profiles.Constants.PASSWORD_ERROR, Resources.Constants.MYCTS, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            this.Close();
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Renombra el nombre de la estrella
 /// </summary>
 private void RenameProfile()
 {
     if (this.Parameters != null)
     {
         if (this.Parameters.Length.Equals(2))
         {
             DialogResult result = MessageBox.Show(Resources.Profiles.Constants.SAVE_CHANGES, Resources.Constants.MYCTS, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
             if (result.Equals(DialogResult.Yes))
             {
                 Update1stLevelBL.Update1stLevel(this.Parameters[0], this.Parameters[1], txtStar1name.Text, 0);
                 SetProfileChangesBL.SetProfile(Login.PCC, Login.Agent, this.Parameters[1], string.Empty, DateTime.Now);
                 CatAllStarsBL.ListAllStars.Clear();
                 ucProfileSearch.star1Info.Clear();
                 ucProfileSearch.star1Info    = Star1stLevelInfoBL.GetStar1stLevelInfo(this.Parameters[0], txtStar1name.Text);
                 frmProfiles._ucProfileSearch = null;
                 LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_PROFILE_INFO_DISPLAY);
             }
             else
             {
                 frmProfiles._ucProfileSearch = null;
                 LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_WELCOME_PROFILES);
             }
         }
         else if (this.Parameters.Length.Equals(3))
         {
             DialogResult result = MessageBox.Show(Resources.Profiles.Constants.SAVE_CHANGES, Resources.Constants.MYCTS, MessageBoxButtons.YesNo, MessageBoxIcon.Information);
             if (result.Equals(DialogResult.Yes))
             {
                 //Update2ndLevelBL.Update2ndLevel(this.Parameters[0], this.Parameters[1], this.Parameters[2], txtStar2Name.Text);
                 SetProfileChangesBL.SetProfile(Login.PCC, Login.Agent, this.Parameters[1], this.Parameters[2], DateTime.Now);
                 CatAllStarsBL.ListAllStars.Clear();
                 ucProfileSearch.star1Info.Clear();
                 ucProfileSearch.star2Info.Clear();
                 ucProfileSearch.star1Info    = Star1stLevelInfoBL.GetStar1stLevelInfo(this.Parameters[0], this.Parameters[1]);
                 ucProfileSearch.star2Info    = Star2ndLevelInfoBL.GetStar2ndLevelInfo(this.Parameters[0], this.Parameters[1], txtStar2Name.Text);
                 frmProfiles._ucProfileSearch = null;
                 LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_PROFILE_INFO_DISPLAY);
             }
             else
             {
                 frmProfiles._ucProfileSearch = null;
                 LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_WELCOME_PROFILES);
             }
         }
     }
 }
        /// <summary>
        /// Crea el perfil de primer nivel
        /// </summary>
        private void ContinueCreatingProfile()
        {
            //string send = "*S";
            //string sabreAnswer = string.Empty;
            string textValue = string.Empty;

            //using (CommandsAPI objCommand = new CommandsAPI())
            //{
            //    sabreAnswer = objCommand.SendReceive(send, 0, 0);
            //}


            //int col = 0;
            //int row = 0;
            //CommandsQik.searchResponse(sabreAnswer, ".", ref row, ref col);
            //if (row > 0)
            //{
            //    CommandsQik.CopyResponse(sabreAnswer, ref pcc, 1, 1, 4);
            //}

            if (string.IsNullOrEmpty(this.Parameters[0]))
            {
                pcc = Login.PCC;
            }
            else
            {
                pcc = this.Parameters[0];
            }


            //SetStarsLevel2BL.AddStarslevel2(pcc, ProfileNameFirstLevel, ProfileNameSecondLevel, true, );

            if (!string.IsNullOrEmpty(txtStreetAndNumber.Text))
            {
                textValue = string.Format("DIRECCIÓN PERSONAL: {0}, {1}, {2}, {3}, {4}",
                                          txtStreetAndNumber.Text,
                                          txtColony.Text,
                                          txtCP.Text,
                                          txtState.Text,
                                          txtCity.Text);
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, textValue, ref ucCreateProfileSecondLevel.profileList);
            }

            if (!string.IsNullOrEmpty(txtNames.Text) && string.IsNullOrEmpty(txtLastName.Text))
            {
                textValue = string.Format("NOMBRE COMPLETO: {0} {1} {2} {3}",
                                          txtNames.Text,
                                          txtNames2.Text,
                                          txtLastName.Text,
                                          txtLastName2.Text);
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, textValue, ref ucCreateProfileSecondLevel.profileList);
            }

            if (!string.IsNullOrEmpty(txtOcupation.Text))
            {
                textValue = string.Format("OCUPACIÓN: {0}",
                                          txtOcupation.Text);
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, textValue, ref ucCreateProfileSecondLevel.profileList);
            }


            if (!string.IsNullOrEmpty(txtSeat.Text))
            {
                textValue = string.Format("PREFERENCIA DE ASIENTO: {0}",
                                          txtSeat.Text);
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, textValue, ref ucCreateProfileSecondLevel.profileList);
            }


            if (!string.IsNullOrEmpty(txtFamiliarName1.Text))
            {
                textValue = string.Format("FAMILIAR : {0} {1} {2}",
                                          txtFamiliarName1.Text,
                                          (!string.IsNullOrEmpty(txtFamiliarLastname1.Text)? txtFamiliarLastname1.Text : FamiliarLastName),
                                          txtPassengerType1.Text);
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, textValue, ref ucCreateProfileSecondLevel.profileList);
            }

            if (!string.IsNullOrEmpty(txtFamiliarName2.Text))
            {
                textValue = string.Format("FAMILIAR : {0} {1} {2}",
                                          txtFamiliarName2.Text,
                                          (!string.IsNullOrEmpty(txtFamiliarLastname2.Text) ? txtFamiliarLastname2.Text : FamiliarLastName),
                                          txtPassengerType2.Text);
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, textValue, ref ucCreateProfileSecondLevel.profileList);
            }

            if (!string.IsNullOrEmpty(txtFamiliarName3.Text))
            {
                textValue = string.Format("FAMILIAR : {0} {1} {2}",
                                          txtFamiliarName3.Text,
                                          (!string.IsNullOrEmpty(txtFamiliarLastname3.Text) ? txtFamiliarLastname3.Text : FamiliarLastName),
                                          txtPassengerType3.Text);
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, textValue, ref ucCreateProfileSecondLevel.profileList);
            }

            if (!string.IsNullOrEmpty(txtFamiliarName4.Text))
            {
                textValue = string.Format("FAMILIAR : {0} {1} {2}",
                                          txtFamiliarName4.Text,
                                          (!string.IsNullOrEmpty(txtFamiliarLastName4.Text) ? txtFamiliarLastName4.Text : FamiliarLastName),
                                          txtPassengerType4.Text);
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, textValue, ref ucCreateProfileSecondLevel.profileList);
            }

            if (!string.IsNullOrEmpty(txtFamiliarName5.Text))
            {
                textValue = string.Format("FAMILIAR : {0} {1} {2}",
                                          txtFamiliarName5.Text,
                                          (!string.IsNullOrEmpty(txtFamiliarLastName5.Text) ? txtFamiliarLastName5.Text : FamiliarLastName),
                                          txtPassengerType5.Text);
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, textValue, ref ucCreateProfileSecondLevel.profileList);
            }

            if (!string.IsNullOrEmpty(txtComment1.Text))
            {
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, txtComment1.Text, ref ucCreateProfileSecondLevel.profileList);
            }

            if (!string.IsNullOrEmpty(txtComment2.Text))
            {
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, txtComment2.Text, ref ucCreateProfileSecondLevel.profileList);
            }

            if (!string.IsNullOrEmpty(txtComment3.Text))
            {
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, txtComment3.Text, ref ucCreateProfileSecondLevel.profileList);
            }

            if (!string.IsNullOrEmpty(txtCreditCardNumber.Text))
            {
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, string.Format("TARJETA DE CREDITO PARA AUTO/HOTEL: {0}{1} {2}-{3} {4}", txtCreditCardCode.Text, txtCreditCardNumber.Text, txtCCVigencyMonth.Text, txtCCVigencyYear.Text, txtCCLastName.Text), ref ucCreateProfileSecondLevel.profileList);
            }

            if (!string.IsNullOrEmpty(txtHotelNumber1.Text))
            {
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, string.Format("PREFERENCIA HOTEL: {0}{1}", txtHotelCode1.Text, txtHotelNumber1.Text), ref ucCreateProfileSecondLevel.profileList);
            }

            if (!string.IsNullOrEmpty(txtHotelNumber2.Text))
            {
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, string.Format("PREFERENCIA HOTEL: {0}{1}", txtHotelCode2.Text, txtHotelNumber2.Text), ref ucCreateProfileSecondLevel.profileList);
            }

            if (!string.IsNullOrEmpty(txtCarAgencyNumber1.Text))
            {
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, string.Format("PREFERENCIA ARRENDADORA: {0}{1}", txtCarAgencyCode1.Text, txtCarAgencyNumber1.Text), ref ucCreateProfileSecondLevel.profileList);
            }

            if (!string.IsNullOrEmpty(txtCarAgencyNumber2.Text))
            {
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, string.Format("PREFERENCIA ARRENDADORA: {0}{1}", txtCarAgencyCode2.Text, txtCarAgencyNumber2.Text), ref ucCreateProfileSecondLevel.profileList);
            }
            DateTime date = DateTime.Now;

            foreach (ListItem Content in ucCreateProfileSecondLevel.profileList)
            {
                SetStarsLevel2InfoBL.AddStarsLevel2Info(pcc, ProfileNameFirstLevel, ProfileNameSecondLevel, Content.Value, Content.Text, date, false);
            }
            Update1stLevelBL.Update1stLevel(pcc, ProfileNameFirstLevel, string.Empty, 1);
            ucProfileSearch.star1Info    = Star1stLevelInfoBL.GetStar1stLevelInfo(pcc, ProfileNameFirstLevel);
            ucProfileSearch.star2Info    = Star2ndLevelInfoBL.GetStar2ndLevelInfo(pcc, ProfileNameFirstLevel, ProfileNameSecondLevel);
            frmProfiles._ucProfileSearch = null;

            frmProfiles frm = this.ParentForm as frmProfiles;

            frm.Width  = frm.MinWidth;
            frm.Height = frm.MinHeight;
            frm.CenterForm();
            frm.IsMinSize = true;

            CatAllStarsBL.ListAllStars.Clear();

            LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_PROFILE_INFO_DISPLAY);
        }