private void SearchProfileParameters1L()
 {
     star1Info       = ucProfileSearch.star1Info;
     ObjStar1Dfup    = new Star1Details();
     ObjStar1Dfup.Id = null;
     foreach (Star1stLevelInfo lines in ucProfileSearch.star1Info)
     {
         ObjStar1Dfup.ProfileName = lines.Level1;
         ObjStar1Dfup.Pcc         = lines.Pccid;
         try
         {
             if (lines.Type == "A" && Regex.IsMatch(lines.Text, "^DK[A-Z]{3}[0-9]{3}$", RegexOptions.IgnoreCase))
             {
                 ObjStar1Dfup.CustomerDk = lines.Text.Substring(2);
             }
             if (lines.Type == "A" && Regex.IsMatch(lines.Text, "^5CONTACTO-", RegexOptions.IgnoreCase))
             {
                 ObjStar1Dfup.ContactCompany = lines.Text.Substring(10);
             }
             if (lines.Type == "N" && Regex.IsMatch(lines.Text, "^5PASSWORD*", RegexOptions.IgnoreCase))
             {
                 ObjStar1Dfup.Password = lines.Text.Substring(10);
             }
         }
         catch (Exception e)
         {
             MessageBox.Show(e.ToString(), @"Error");
         }
     }
 }
        public void AddStar1Details(Star1Details objS1Details, string connectionName)
        {
            Database  db       = DatabaseFactory.CreateDatabase(connectionName);
            DbCommand dbcomand = db.GetStoredProcCommand(Resources.SetStar1Details.SP_SetStar1Details);

            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_ProfileName, DbType.String, objS1Details.ProfileName);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_CustomerDK, DbType.String, objS1Details.CustomerDk);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_PCC, DbType.String, objS1Details.Pcc);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_CompanyName, DbType.String, objS1Details.CompanyName);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_Telephone, DbType.String, objS1Details.Phone);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_Ext, DbType.String, objS1Details.Ext);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_TravelPolicies, DbType.String, objS1Details.TravelPolicies);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_SocialReason, DbType.String, objS1Details.SocialReason);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_Street, DbType.String, objS1Details.Street);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_OutsideNumber, DbType.String, objS1Details.OutsideNumber);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_InternalNumber, DbType.String, objS1Details.InternalNumber);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_Colony, DbType.String, objS1Details.Colony);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_Municipality, DbType.String, objS1Details.Municipality);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_PostalCode, DbType.String, objS1Details.PostalCode);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_City, DbType.String, objS1Details.City);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_State, DbType.String, objS1Details.State);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_RFC, DbType.String, objS1Details.Rfc);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_CreditCard, DbType.String, objS1Details.CreditCard);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_ExpiratioDate, DbType.String, objS1Details.ExpirationDate);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_ContactCompany, DbType.String, objS1Details.ContactCompany);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_Email, DbType.String, objS1Details.Email);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_Comments, DbType.String, objS1Details.Comments);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_CreatedBy, DbType.String, objS1Details.CreatedBy);
            db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_Password, DbType.String, objS1Details.Password);
            //db.AddInParameter(dbcomand, Resources.SetStar1Details.PARAM_ExtraData, DbType.String, extraData);

            db.ExecuteNonQuery(dbcomand);
        }
        private Star1Details Getprofile1Level(String pcc, string level1)
        {
            var s1 = new Star1Details();
            var fd = new FieldsDynamicsBL();

            listFields          = fd.GetStar1Details(pcc, level1);
            s1.ProfileName      = GetDynamicProperties("ProfileName");
            s1.Pcc              = GetDynamicProperties("PCC");
            s1.CustomerDk       = GetDynamicProperties("CustomerDK");
            s1.CompanyName      = GetDynamicProperties("CompanyName");
            s1.Phone            = GetDynamicProperties("Telephone");
            s1.Ext              = GetDynamicProperties("Ext");
            s1.TravelPolicies   = GetDynamicProperties("TravelPolicies");
            s1.SocialReason     = GetDynamicProperties("SocialReason");
            s1.Street           = GetDynamicProperties("Street");
            s1.OutsideNumber    = GetDynamicProperties("OutsideNumber");
            s1.InternalNumber   = GetDynamicProperties("InternalNumber");
            s1.Colony           = GetDynamicProperties("Colony");
            s1.Municipality     = GetDynamicProperties("Municipality");
            s1.PostalCode       = GetDynamicProperties("PostalCode");
            s1.City             = GetDynamicProperties("City");
            s1.State            = GetDynamicProperties("State");
            s1.Rfc              = GetDynamicProperties("RFC");
            s1.CreditCard       = GetDynamicProperties("CreditCard");
            s1.CVV1             = GetDynamicProperties("CVV1");
            s1.ExpirationDate   = GetDynamicProperties("ExpirationDate");
            s1.ContactCompany   = GetDynamicProperties("ContactCompany");
            s1.Email            = GetDynamicProperties("Email");
            s1.Comments         = GetDynamicProperties("Comments");
            s1.CreatedBy        = GetDynamicProperties("CreatedBy");
            s1.Password         = GetDynamicProperties("Password");
            s1.Id               = GetDynamicProperties("Id");
            s1.Osi              = GetDynamicProperties("Osi");
            s1.Remarks          = GetDynamicProperties("Remarks");
            s1.AlternativeEmail = GetDynamicProperties("AlternativeEmail");
            s1.SabreFormats     = GetDynamicProperties("SabreFormats");
            s1.CreditCard2      = GetDynamicProperties("CreditCard2");
            s1.CVV2             = GetDynamicProperties("CVV2");
            s1.ExpirationDate2  = GetDynamicProperties("ExpirationDate2");
            s1.CreditCard3      = GetDynamicProperties("CreditCard3");
            s1.CVV3             = GetDynamicProperties("CVV3");
            s1.ExpirationDate3  = GetDynamicProperties("ExpirationDate3");
            s1.CreditCard4      = GetDynamicProperties("CreditCard4");
            s1.ExpirationDate4  = GetDynamicProperties("ExpirationDate4");
            s1.CreditCard5      = GetDynamicProperties("CreditCard5");
            s1.ExpirationDate5  = GetDynamicProperties("ExpirationDate5");
            s1.SyncStatus       = GetDynamicProperties("SyncStatus");
            return(s1);
        }
Ejemplo n.º 4
0
        public static void AddStars1Details(Star1Details s1Details)
        {
            var objSetStar1DetailsDAL = new SetStar1DetailsDAL();

            try
            {
                try
                {
                    objSetStar1DetailsDAL.AddStar1Details(s1Details, CommonENT.MYCTSDBPROFILES_CONNECTION);
                }
                catch (Exception ex)
                {
                    new EventsManager.EventsManager(ex, EventsManager.EventsManager.OrigenError.BaseDeDatos);
                    objSetStar1DetailsDAL.AddStar1Details(s1Details, CommonENT.MYCTSDBPROFILESBACKUP_CONNECTION);
                }
            }
            catch { }
        }
Ejemplo n.º 5
0
        public static void UpdateStar1Details(Star1Details objStar1Details)
        {
            var objUpdateStar1Details = new UpdateStar1DetailsDAL();

            try
            {
                try
                {
                    objUpdateStar1Details.UpdateS1Details(objStar1Details, CommonENT.MYCTSDBPROFILES_CONNECTION);
                }
                catch (Exception ex)
                {
                    new EventsManager.EventsManager(ex, EventsManager.EventsManager.OrigenError.BaseDeDatos);
                    objUpdateStar1Details.UpdateS1Details(objStar1Details, CommonENT.MYCTSDBPROFILESBACKUP_CONNECTION);
                }
            }
            catch
            {
            }
        }
Ejemplo n.º 6
0
        public Star1Details GetStar1Details(string pcc, string profileName)
        {
            var listStar1Details = new Star1Details();
            var objStar1Details  = new GetStar1DetailsDAL();

            try
            {
                try
                {
                    listStar1Details = objStar1Details.ObjGetStar1Details(pcc, profileName, CommonENT.MYCTSDBPROFILES_CONNECTION);
                }
                catch (Exception ex)
                {
                    new EventsManager.EventsManager(ex, EventsManager.EventsManager.OrigenError.BaseDeDatos);
                    listStar1Details = objStar1Details.ObjGetStar1Details(pcc, profileName, CommonENT.MYCTSDBPROFILESBACKUP_CONNECTION);
                }
            }
            catch { }
            return(listStar1Details);
        }
Ejemplo n.º 7
0
        public Star1Details ObjGetStar1Details(string pcc, string profileName, string connectionName)
        {
            Database  db        = DatabaseFactory.CreateDatabase(connectionName);
            DbCommand dbCommand = db.GetStoredProcCommand(Resources.GetStar1DetailsResources.SP_GetStar1Details);

            db.AddInParameter(dbCommand, Resources.GetStar1DetailsResources.PARAM_PCC, DbType.String, pcc);
            db.AddInParameter(dbCommand, Resources.GetStar1DetailsResources.PARAM_ProfileName, DbType.String, profileName);
            var item = new Star1Details();

            using (IDataReader dr = db.ExecuteReader(dbCommand))
            {
                int _id             = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_Id);
                int _city           = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_City);
                int _colony         = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_Colony);
                int _comments       = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_Comments);
                int _companyName    = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_CompanyName);
                int _contactCompany = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_ContactCompany);
                int _createdBy      = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_CreatedBy);
                int _creditCard     = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_CreditCard);
                int _customerDK     = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_CustomerDK);
                int _email          = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_Email);
                int _expiratioDate  = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_ExpiratioDate);
                int _ext            = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_Ext);
                //int _extraData = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_ExtraData);
                int _internalNumber = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_InternalNumber);
                int _municipality   = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_Municipality);
                int _0utsideNumber  = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_OutsideNumber);
                int _password       = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_Password);
                int _pcc            = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_PCC);
                int _postalCode     = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_PostalCode);
                int _profileName    = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_ProfileName);
                int _rfc            = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_RFC);
                int _socialReason   = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_SocialReason);
                int _state          = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_State);
                int _street         = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_Street);
                int _phone          = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_Telephone);
                int _travelPolicies = dr.GetOrdinal(Resources.GetStar1DetailsResources.PARAM_TravelPolicies);

                while (dr.Read())
                {
                    item.Id             = (dr[_id] == DBNull.Value) ? Types.StringNullValue : dr.GetInt32(_id).ToString();
                    item.City           = (dr[_city] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_city);
                    item.Colony         = (dr[_colony] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_colony);
                    item.Comments       = (dr[_comments] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_comments);
                    item.CompanyName    = (dr[_companyName] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_companyName);
                    item.ContactCompany = (dr[_contactCompany] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_contactCompany);
                    item.CreatedBy      = (dr[_createdBy] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_createdBy);
                    item.CreditCard     = (dr[_creditCard] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_creditCard);
                    item.CustomerDk     = (dr[_customerDK] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_customerDK);
                    item.Email          = (dr[_email] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_email);
                    item.ExpirationDate = (dr[_expiratioDate] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_expiratioDate);
                    item.Ext            = (dr[_ext] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_ext);
                    item.InternalNumber = (dr[_internalNumber] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_internalNumber);
                    item.Municipality   = (dr[_municipality] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_municipality);
                    item.OutsideNumber  = (dr[_0utsideNumber] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_0utsideNumber);
                    item.Password       = (dr[_password] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_password);
                    item.Pcc            = (dr[_pcc] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_pcc);
                    item.PostalCode     = (dr[_postalCode] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_postalCode);
                    item.ProfileName    = (dr[_profileName] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_profileName);
                    item.Rfc            = (dr[_rfc] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_rfc);
                    item.SocialReason   = (dr[_socialReason] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_socialReason);
                    item.State          = (dr[_state] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_state);
                    item.Street         = (dr[_street] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_street);
                    item.Phone          = (dr[_phone] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_phone);
                    item.TravelPolicies = (dr[_travelPolicies] == DBNull.Value) ? Types.StringNullValue : dr.GetString(_travelPolicies);
                }
            }

            return(item);
        }
        /// <summary>
        /// Carga informacion de perfil elegido por el usuario
        /// </summary>
        private void SetProfileInfo()
        {
            int indexProfile = 0;

            if (listViewProfiles.SelectedIndices.Count > 0)
            {
                indexProfile = listViewProfiles.SelectedIndices[0];
            }

            var objGetStar1DetailsBL = new GetStar1DetailsBL();

            // Swhichea entre el obtener el perfil en el esquema anterior y el nuevo
            if (StarsList[indexProfile].Level.Equals(Resources.Profiles.Constants.STAR_LEVEL_ONE))
            {
                if (StarsList[indexProfile].IsNew)
                {
                    _objStar1Details = Getprofile1Level(StarsList[indexProfile].PccId, StarsList[indexProfile].StarName);
                    star1Info        = objProfilesMethods.FormatSabreProfile1L(_objStar1Details);
                    AccessProfile(star1Info[0].Level1);
                }
                else
                {
                    star1Info = Star1stLevelInfoBL.GetStar1stLevelInfo(StarsList[indexProfile].PccId, StarsList[indexProfile].StarName);

                    DialogResult result = MessageBox.Show("Para usar este perfil es necesario actualizarlo al nuevo módulo de perfiles \n¿Desea continuar?",
                                                          @"Actualizacion de perfil", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                    if (result == DialogResult.Yes)
                    {
                        isMessageUpdateShow = true;
                        newFormat           = true;
                        if (AccessProfile(star1Info[0].Level1))
                        {
                            var uProfiles = new frmUpdateProfiles(this.ParentForm, "First");
                            uProfiles.ShowDialog();
                        }

                        return;
                    }
                }
            }

            else if (StarsList[indexProfile].Level.Equals(Resources.Profiles.Constants.STAR_LEVEL_TWO))
            {
                _objStar1Details = Getprofile1Level(StarsList[indexProfile].PccId, StarsList[indexProfile].Star1Ref);
                star1Info        = objProfilesMethods.FormatSabreProfile1L(_objStar1Details);



                if (StarsList[indexProfile].IsNew)
                {
                    _star2D = Getprofile2Level(StarsList[indexProfile].PccId, StarsList[indexProfile].Star1Ref, StarsList[indexProfile].StarName, StarsList[indexProfile].DK);
                    //_star2D = Getprofile2Level(StarsList[indexProfile].Email, StarsList[indexProfile].DK);
                    ObjStar2Details = _star2D;
                    star2Info       = objProfilesMethods.FormatSabreProfile2L(_star2D);
                    AccessProfile(star2Info[0].Level2);
                }
                else
                {
                    if (!GetStar1stLevelByStar2LevelBL.GetStar1stLevelByStar2Level(StarsList[indexProfile].Star1Ref, StarsList[indexProfile].PccId))
                    {
                        MessageBox.Show("No es posible actualizar este perfil ya que el perfil de primer nivel al que pertenece " + StarsList[indexProfile].Star1Ref + " aún no está actualizado", "No es posible Actualizar", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                    else
                    {
                        star2Info = Star2ndLevelInfoBL.GetStar2ndLevelInfo(StarsList[indexProfile].PccId, StarsList[indexProfile].Star1Ref, StarsList[indexProfile].StarName);

                        DialogResult result = MessageBox.Show("Para usar este perfil es necesario actualizarlo al nuevo módulo de perfiles \n¿Desea continuar?",
                                                              @"Actualizacion de perfil", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                        if (result == DialogResult.Yes)
                        {
                            newFormat           = true;
                            isMessageUpdateShow = true;
                            if (AccessProfile(star2Info[0].Level2))
                            {
                                var frm = this.ParentForm as frmProfiles;
                                newFormat = true;
                                var fe = new frmUpdateProfiles(this.ParentForm, "Second");
                                fe.ShowDialog();
                            }
                            return;
                        }
                    }
                }
            }
        }