コード例 #1
0
        private void frmUpdateProfiles_Load(object sender, EventArgs e)
        {
            var parameters = new string[4];

            frmPreloading fr = new frmPreloading(this);

            fr.Show();

            parameters[3] = "NewUpdate";

            if (_level == "First")
            {
                SearchProfileParameters1L();
                parameters[0] = ObjStar1Dfup.Pcc;
                parameters[1] = ObjStar1Dfup.ProfileName;
                parameters[2] = null;

                LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Left, this, Resources.Profiles.Constants.UC_PROFILE_INFO_DISPLAY);
                LoaderProfiles.AddToPanelWithParameters(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_FIRST_LEVEL_PROFILES, parameters);
            }

            if (_level == "Second")
            {
                SearchProfileParameters2L();
                parameters[0] = ObjStar2Dfup.Pcc;
                parameters[1] = ObjStar2Dfup.Level1;
                parameters[2] = ObjStar2Dfup.Level2;

                LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Left, this, Resources.Profiles.Constants.UC_PROFILE_INFO_DISPLAY);
                LoaderProfiles.AddToPanelWithParameters(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_SECOND_LEVEL_PROFILES, parameters);
            }
        }
        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();
        }