示例#1
0
 private void CreateNewProfileLine()
 {
     if (this.Parameters != null)
     {
         if (this.Parameters.Length.Equals(4))
         {
             SetStarsLevel1InfoBL.AddStarslevel1Info(this.Parameters[0], this.Parameters[1], ((ListItem)(cmbLineType.SelectedItem)).Value.ToString(), txtDescription.Text, Convert.ToDateTime(this.Parameters[2]), Convert.ToBoolean(this.Parameters[3]));
             SetProfileChangesBL.SetProfile(Login.PCC, Login.Agent, this.Parameters[1], string.Empty, DateTime.Now);
             ucProfileSearch.star1Info.Clear();
             ucProfileSearch.star1Info    = Star1stLevelInfoBL.GetStar1stLevelInfo(this.Parameters[0], this.Parameters[1]);
             frmProfiles._ucProfileSearch = null;
             LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_PROFILE_INFO_DISPLAY);
         }
         else if (this.Parameters.Length.Equals(5))
         {
             SetStarsLevel2InfoBL.AddStarsLevel2Info(this.Parameters[0], this.Parameters[1], this.Parameters[2], ((ListItem)(cmbLineType.SelectedItem)).Value.ToString(), txtDescription.Text, Convert.ToDateTime(this.Parameters[3]), Convert.ToBoolean(this.Parameters[4]));
             SetProfileChangesBL.SetProfile(Login.PCC, Login.Agent, this.Parameters[1], this.Parameters[2], DateTime.Now);
             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], this.Parameters[2]);
             frmProfiles._ucProfileSearch = null;
             LoaderProfiles.AddToPanel(LoaderProfiles.Zone.Modal_Profile, this, Resources.Profiles.Constants.UC_PROFILE_INFO_DISPLAY);
         }
     }
 }
        /// <summary>
        /// Crea el perfil de primer nivel
        /// </summary>
        private void CreateProfile()
        {
            //string send = "*S";
            //string sabreAnswer = string.Empty;
            string          pcc         = string.Empty;
            string          textValue   = string.Empty;
            List <ListItem> profileList = new List <ListItem>();

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


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

            pcc = txtPCC.Text;

            if (string.IsNullOrEmpty(txtPCC.Text))
            {
                pcc = Login.PCC;
            }

            SetStarsLevel1BL.AddStarslevel1(pcc, txtProfileName.Text, false, true);

            SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_S, txtEnterpriseName.Text, ref profileList);
            SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_A, string.Concat(Resources.Profiles.Constants.COMMAND_NINE, txtPhone.Text, (!string.IsNullOrEmpty(txtExt.Text)) ? string.Concat(Resources.Profiles.Constants.COMMAND_X, txtExt.Text) : string.Empty), ref profileList);
            SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_A, string.Concat(Resources.Profiles.Constants.COMMAND_DK, txtDK.Text), ref profileList);
            SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_P, txtTravelPolicy1.Text, ref profileList);
            SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_P, txtTravelPolicy2.Text, ref profileList);
            SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_P, txtTravelPolicy3.Text, ref profileList);

            if (txtDK.Text != @"INSTOP")
            {
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_A, string.Concat(Resources.Profiles.Constants.COMMAND_FIVE_SLASH, txtSocialReason.Text), ref profileList);

                textValue = string.Format("5/{0}{1}{2},{3}",
                                          txtStreet.Text,
                                          string.Concat(Resources.Profiles.Constants.AST, txtNumberExt.Text),
                                          (!string.IsNullOrEmpty(txtNumberInt.Text)) ? string.Concat(Resources.Profiles.Constants.AST, txtNumberInt.Text) : string.Empty,
                                          txtColony.Text);
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_A, textValue, ref profileList);

                textValue = string.Format("5/{0}, {1}, {2}",
                                          txtDelorMunicipality.Text,
                                          txtCity.Text,
                                          txtState.Text);
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_A, textValue, ref profileList);
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_A, string.Concat(Resources.Profiles.Constants.COMMAND_FIVE_SLASH, txtPostalCode.Text), ref profileList);
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_A, string.Concat(Resources.Profiles.Constants.COMMAND_FIVE_SLASH, txtRFC1.Text, txtRFC2.Text, txtRFC3.Text), ref profileList);
            }


            if (!string.IsNullOrEmpty(txtCreditCardCode.Text) &&
                !string.IsNullOrEmpty(txtCreditCardNumber.Text))
            {
                textValue = (!string.IsNullOrEmpty(txtExpirationDateMonth.Text) && !string.IsNullOrEmpty(txtExpirationDateYear.Text)) ? string.Format("-{0}/{1}", txtExpirationDateMonth.Text, txtExpirationDateYear.Text) : string.Empty;
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, string.Concat(txtCreditCardCode.Text, txtCreditCardNumber.Text, textValue), ref profileList);
            }


            SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, string.Concat("CONTACTO EMPRESA:", " ", txtEnterpriseContact.Text), ref profileList);

            SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, string.Concat("EMAIL CONTACTO:", " ", txtEmailContact.Text), ref profileList);

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

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

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

            SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, string.Concat(Resources.Profiles.Constants.LABEL_PROFILE_CREATED_BY, " ", txtCreateBy.Text), ref profileList);

            if (!string.IsNullOrEmpty(txtPassword.Text))
            {
                SetCategoryValue(Resources.Profiles.Constants.LINE_TYPE_N, string.Concat(Resources.Profiles.Constants.LABEL_PASSWORD, txtPassword.Text), ref profileList);
            }
            DateTime date = DateTime.Now;

            foreach (ListItem Content in profileList)
            {
                SetStarsLevel1InfoBL.AddStarslevel1Info(pcc, txtProfileName.Text, Content.Value, Content.Text, date, false);
            }
            ucProfileSearch.star2Info.Clear();
            ucProfileSearch.star1Info    = Star1stLevelInfoBL.GetStar1stLevelInfo(pcc, txtProfileName.Text);
            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);
        }