public List<Ranks> RanksSort(List<Ranks> ranks)
        {
            long count = ranks.Count;

            for (int i = 0; i < count - 1; i++)
                for (int j = 0; j < count - 1 - i; j++)
                {
                    if (ranks[j].Solved < ranks[j + 1].Solved)
                    {
                        long t = ranks[j].Position;
                        ranks[j].Position = ranks[j + 1].Position;
                        ranks[j + 1].Position = t;
                        Ranks rk = ranks[j];
                        ranks[j] = ranks[j + 1];
                        ranks[j + 1] = rk;
                    }
                    else if (ranks[j].Solved != 0 && ranks[j + 1].Solved != 0 && ranks[j].Solved == ranks[j + 1].Solved)
                    if(ranks[j].LastTimeOfAc > ranks[j + 1].LastTimeOfAc)
                    {
                        long t = ranks[j].Position;
                        ranks[j].Position = ranks[j + 1].Position;
                        ranks[j + 1].Position = t;
                        Ranks rk = ranks[j];
                        ranks[j] = ranks[j + 1];
                        ranks[j + 1] = rk;
                    }
                }

            return ranks;
        }
        public List<IFeedItem> ReadIFeedItems(Uri uri)
        {
            var feedItems = new List<Data.IFeedItem>();
            SyndicationFeed syndicationFeed;
            using (var xmlReader = XmlReader.Create(uri.AbsoluteUri))
            {
                syndicationFeed = SyndicationFeed.Load(xmlReader);
                xmlReader.Close();
            }

            foreach (var item in syndicationFeed.Items)
            {
                var feedItem = new FeedItem();
                var id = Guid.NewGuid();
                feedItem.Id = Guid.TryParse(item.Id, out id) ? new Guid(item.Id) : id;
                feedItem.Title = item.Title.Text;
                feedItem.Mp3Url = item.Links[0].Uri;
                feedItem.PublishDate = item.PublishDate.DateTime;

                feedItems.Add(feedItem);
            }

            var ret = new List<IFeedItem>();
            feedItems.ForEach(x => ret.Add(new FeedItem() { Id = x.Id, Mp3Url = x.Mp3Url, PublishDate = x.PublishDate, Title = x.Title }));
            return ret;
        }
Esempio n. 3
0
        public static void actualizarSectoresEdificio(edificio edificio, List<sector> sectores)
        {
            try {
                admEntities db = Datos.getDB();
                var s = db.edificios_sectores.Where(x => x.dir_edificio == edificio.direccion).ToList();

                foreach (var sectB in s)
                {
                    db.edificios_sectores.Remove(sectB);
                }

                foreach (sector sect in sectores)
                {
                    edificios_sectores es = new edificios_sectores();
                    es.dir_edificio = edificio.direccion;
                    es.id_sector = sect.idsector;
                    db.edificios_sectores.Add(es);
                }
                db.SaveChanges();
            }
            catch (Exception e)
            {
                string str = e.InnerException == null ? e.Message : e.InnerException.Message;
                Logger.Log.write(str);
                throw e;
            }
        }
 /// <summary>
 /// Validates the field values of this object. Override this method to enable
 /// validation of field values.
 /// </summary>
 /// <param name="validationResults">The validation results, add additional results to this list.</param>
 protected override void ValidateFields(List<IFieldValidationResult> validationResults)
 {
     if (string.IsNullOrWhiteSpace(Name))
     {
         validationResults.Add(FieldValidationResult.CreateError(NameProperty, "Name of room is required"));
     }
 }
Esempio n. 5
0
        public void StatC5CX(List<DwNumber> numbers, string dbName)
        {
            string[] dmNames = new string[] { "Peroid", "He" };
            string[] numberTypes = new string[] { "A2", "A3", "A4", "A6", "A7", "A8" };
            DwC5CXSpanBiz spanBiz = new DwC5CXSpanBiz(dbName);

            foreach (var numberType in numberTypes)
            {
                Dictionary<string, Dictionary<string, int>> lastSpanDict = new Dictionary<string, Dictionary<string, int>>(16);
                List<DwC5CXSpan> c5cxSpans = new List<DwC5CXSpan>(numbers.Count * 20);
                string newNumberType = numberType.Replace("A", "C");
                string tableName = string.Format("{0}{1}", "C5", newNumberType);
                spanBiz.DataAccessor.TableName = ConfigHelper.GetDwSpanTableName(tableName);
                long lastP = spanBiz.DataAccessor.SelectLatestPeroid(string.Empty);

                foreach (DwNumber number in numbers)
                {
                    var cxNumbers = NumberCache.Instance.GetC5CXNumbers(number.C5, newNumberType);
                    var c5cxSpanList = this.GetC5CXSpanList(lastSpanDict, cxNumbers, number, dmNames);
                    if (number.P > lastP)
                        c5cxSpans.AddRange(c5cxSpanList);
                }
                spanBiz.DataAccessor.Insert(c5cxSpans, SqlInsertMethod.SqlBulkCopy);

                Console.WriteLine("{0} {1} Finished", dbName, tableName);
            }

            Console.WriteLine("{0} {1} Finished", dbName, "ALL C5CX Span");
        }
Esempio n. 6
0
 public static List<Staff> getAllStaff()
 {
     List<Staff> StaffsList = new List<Staff>();
     //Connect to SQL Server
     SqlConnection conn = new SqlConnection("Data Source=(local); Database=WebDevelopmentDB; Integrated Security=SSPI");
     //Select all columns for a given StaffID as well as their password hash
     SqlCommand cmd = new SqlCommand("SELECT dbo.Staff.GivenName, dbo.Staff.Surname, dbo.Staff.Email, dbo.Staff.PhoneNumber1, dbo.Staff.PhoneNumber2, dbo.Staff.Role, dbo.Accounts.PassHash FROM dbo.Staff INNER JOIN dbo.Accounts ON dbo.Staff.StaffID = dbo.Accounts.AccID)", conn);
     SqlDataReader rdr = cmd.ExecuteReader();
     while (rdr.Read()) {
         StaffsList.Add(new Staff{
         GivenName = rdr[0].ToString(),
         Surname = rdr[1].ToString(),
         Address = rdr[2].ToString(),
         Email = rdr[3].ToString(),
         Phone1 = rdr[4].ToString(),
         Phone2 = rdr[5].ToString(),
         Role = rdr[6].ToString(),
         PassHash = rdr[7].ToString()});
     }
     //Close the reader and the SQL connection
     if (rdr != null) {
         rdr.Close();
     }
     conn.Close();
     return StaffsList;
 }
 /// <summary>
 /// Validates the field values of this object. Override this method to enable
 /// validation of field values.
 /// </summary>
 /// <param name="validationResults">The validation results, add additional results to this list.</param>
 protected override void ValidateFields(List<IFieldValidationResult> validationResults)
 {
     if (string.IsNullOrWhiteSpace(ApiKey))
     {
         validationResults.Add(FieldValidationResult.CreateError(ApiKeyProperty, "Api key is required"));
     }
 }
Esempio n. 8
0
        public static List<UserProfile> GetFarFromOneRelations(Guid userId)
        {
            // On cherche nos relations. On cherche les relations de nos relations => récursif
            List<UserProfile> listUserRelations = GetRelations(userId);

            List<UserProfile> listLoggedUserRelation = GetRelations((Guid)(Membership.GetUser(System.Web.HttpContext.Current.User.Identity.Name, false).ProviderUserKey));

            List<UserProfile> listFarFromOneRelations = new List<UserProfile>();

            // We search all the directly connected users to the actual logged user relations
            foreach (UserProfile userRelation in listUserRelations)
            {
                listFarFromOneRelations.AddRange(GetRelations((Guid)(Membership.GetUser(userRelation.UserName, false).ProviderUserKey)));
            }

            UserProfile actualUser = UserProfile.GetUserProfile(System.Web.HttpContext.Current.User.Identity.Name);
            while(listFarFromOneRelations.Contains(actualUser))
            {
                // We delete all the occurences of the actual user
                listFarFromOneRelations.Remove(actualUser);
            }

            // On supprime les utilisateurs qui sont déjà directement connectés avec l'utilisateur
            foreach (UserProfile user in listLoggedUserRelation)
            {
                if (listFarFromOneRelations.Contains(user))
                {
                    listFarFromOneRelations.Remove(user);
                }
            }

            return listFarFromOneRelations;
        }
        public static IRepository<Book> Create()
        {
            var listOfBooks = new List<Book>();
            for (int i = 0; i < 20; i++)
            {
                listOfBooks.Add(new Book
                {
                    Id = i,
                    Title = "Book " + i,
                    Description = "Description" + i,
                    Author = new Author
                    {
                        FirstName = "FirstName " + i,
                        LastName = "LastName " + i
                    }
                });
            }

            var repository = new Mock<IRepository<Book>>();
            repository.Setup(r => r.All()).Returns(listOfBooks.AsQueryable());
            repository.Setup(r => r.Add(It.IsAny<Book>())).Callback<Book>(b =>
            {
                b.Id = 1;
            });
            repository.Setup(r => r.SaveChanges()).Verifiable();

            return repository.Object;
        }
Esempio n. 10
0
        private void btnCobrar_Click(object sender, EventArgs e)
        {
            List<CatalogoDeudores.DetalleDeuda> detalles = new List<CatalogoDeudores.DetalleDeuda>();

            foreach (DataGridViewRow r in dgvLista.Rows)
            {
                if (r.Cells["Seleccion"].Value != null)
                {
                    CatalogoDeudores.DetalleDeuda d = ((CatalogoDeudores.DetalleDeuda)r.DataBoundItem);
                    Business.ControladorExpensas.registrarPago(d);
                    detalles.Add(d);
                }
            }

            if (detalles.Count > 0)
            {
                if (MessageBox.Show("Desea imprimir comprobante?", "Sistema", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    unidad u = (unidad)cmbUnidad.SelectedItem;
                    titular t = u.titular;

                    System.Diagnostics.Process.Start(Business.ControladorExpensas.emitirRecibo(Properties.Resources.qr, detalles, u, t));
                }
            }

            cmbUnidad_SelectedIndexChanged(sender, e);
            lblImporte.Text = lblRecargo.Text = lblTotalAPagar.Text = "0,00";
        }
Esempio n. 11
0
        public void Deserialise(Reader In)
        {
            Bookings = new List<Booking>(In.ReadInt32());
            for (int x = 0; x < Bookings.Capacity; x++)
                Bookings.Add(DataModel.DeserialiseExternal<Booking>(In));

            Departments = new List<Department>(In.ReadInt32());
            for (int x = 0; x < Departments.Capacity; x++)
                Departments.Add(DataModel.DeserialiseExternal<Department>(In));

            Periods = new List<TimeSlot>(In.ReadInt32());
            for (int x = 0; x < Periods.Capacity; x++)
                Periods.Add(DataModel.DeserialiseExternal<TimeSlot>(In));

            Rooms = new List<Room>(In.ReadInt32());
            for (int x = 0; x < Rooms.Capacity; x++)
                Rooms.Add(DataModel.DeserialiseExternal<Room>(In));

            Users = new List<User>(In.ReadInt32());
            for (int x = 0; x < Users.Capacity; x++)
                Users.Add(DataModel.DeserialiseExternal<User>(In));

            Subjects = new List<Subject>(In.ReadInt32());
            for (int x = 0; x < Subjects.Capacity; x++)
                Subjects.Add(DataModel.DeserialiseExternal<Subject>(In));

            Classes = new List<Class>(In.ReadInt32());
            for (int x = 0; x < Classes.Capacity; x++)
                Classes.Add(DataModel.DeserialiseExternal<Class>(In));
        }
Esempio n. 12
0
        public static void C5CX(string name, string type, int length, string output)
        {
            List<DmDPC> srcNumbers = null;
            if (length > 5)
            {
                srcNumbers = NumberCache.Instance.GetNumberList(type);
            }
            else
            {
                srcNumbers = NumberCache.Instance.GetNumberList("C5");
            }

            DmC5CXBiz biz = new DmC5CXBiz(name);
            List<DmC5CX> entities = new List<DmC5CX>(srcNumbers.Count * 56);
            foreach (var srcNumber in srcNumbers)
            {
                string number = srcNumber.Number.Replace(' ', ',');
                var cxNumbers = new Combinations<int>(number.ToList(), length > 5 ? 5 : length);
                foreach (var cxNumber in cxNumbers)
                {
                    string cx = NumberCache.Instance.GetNumberId(length > 5 ? "C5" : type, cxNumber.Format("D2", ","));
                    DmC5CX entity = new DmC5CX();
                    entity.C5 = (length > 5) ? cx : srcNumber.Id;
                    entity.CX = (length > 5) ? srcNumber.Id : cx;
                    entity.C5Number = (length > 5) ? cx.ToString(2, " ") : srcNumber.Number;
                    entity.CXNumber = (length > 5) ? srcNumber.Number : cx.ToString(2, " ");
                    entity.NumberType = type;
                    entities.Add(entity);
                }
            }

            //biz.DataAccessor.Truncate();
            biz.DataAccessor.Insert(entities, SqlInsertMethod.SqlBulkCopy);
        }
Esempio n. 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            List<recommandation> listR = new List<recommandation>();

            if (User.Identity.IsAuthenticated)
            {
                userName = User.Identity.Name;

                //on recupere le parametre "del" pour voir si il y a un message à effacer
                if (Request.Params["del"] != null && Convert.ToInt16(Request.Params["del"]) != 0)
                {
                    //RecommandationService.deleteRecommandation(Convert.ToInt16(Request.Params["del"]),2);
                    not.Text = "Recommandation effacée";
                }

                listR = RecomendationService.getRecommandations((Guid)Membership.GetUser(userName, false).ProviderUserKey);
                if (listR.Count > 0)
                {
                    //o utilise le template pour les messages envoyés
                    rpt.DataSource = RecomendationService.RecommandationToRecommandationPlus(listR);
                    rpt.DataBind();
                }
                else
                {
                    errorMessage("Aucune recommandation à afficher");
                }

            }
            else
            {
                errorMessage("Erreur");
            }
        }
Esempio n. 14
0
 private void Span(List<DwNumber> numbers)
 {
     string[] dxs = { "D1", "D2", "D3", "D4", "D5" };
     var spanDict = new Dictionary<int, int>(11);
     StreamWriter sw = new StreamWriter(@"d:\c1span.txt", false, Encoding.UTF8);
     foreach (var number in numbers)
     {
         foreach (var dx in dxs)
         {
             int spans = number.Seq - 1;
             int dxValue = ConvertHelper.GetInt32(number[dx].ToString());
             if (spanDict.ContainsKey(dxValue))
             {
                 spans = number.Seq - spanDict[dxValue] - 1;
                 spanDict[dxValue] = number.Seq;
             }
             else
             {
                 spanDict.Add(dxValue, -1);
             }
             sw.WriteLine("{0},{1},{2}", number.P, dxValue, spans);
         }
     }
     sw.Close();
 }
Esempio n. 15
0
        public static List<ExpensasEdificio> getAllExpensas(List<edificio> edificios, DateTime periodo, DateTime vto1, DateTime vto2)
        {
            try
            {
                List<ExpensasEdificio> expensas = new List<ExpensasEdificio>();
                admEntities db = Datos.getDB();

                //var edificios = db.edificio.ToList();
                int MaxNroFactura = 0;
                List<string> nroFactura = db.Database.SqlQuery<String>(@"select nro_factura from expensas").ToList();
                foreach (var s in nroFactura)
                {
                    int temp = int.Parse(s);
                    if (temp > MaxNroFactura)
                        MaxNroFactura = temp;
                }

                int correlativo = MaxNroFactura + 1;

                DateTime asd = DateTime.Parse("1 /" + periodo.Month + "/" + periodo.Year);
                List<expensas> expensasExistentes = db.expensas.Where(x => x.fecha == asd).ToList();

                foreach (var e in edificios)
                {
                    expensas.Add(getExpensasEdificio(e, periodo, vto1, vto2, ref correlativo, db, expensasExistentes));
                }
                return expensas;
            }
            catch (Exception e)
            {
                Logger.Log.write(e.InnerException == null ? e.Message : e.InnerException.Message);
                throw e;
            }
        }
 public CategorySettingsForm(List<Category> categories, List<IFeed> allFeeds)
 {
     InitializeComponent();
     this.Categories = categories;
     this.AllFeeds = allFeeds;
     IsCategoriesChanged = false;
 }
Esempio n. 17
0
        // GET: Matching
        public ActionResult Index()
        {
            //Check if user is logged in
            if (!PageAuthorization.Authorize()) return RedirectToAction("Login", "Users");

            //User user = new User();
            //user.Id = 72;
            var user = (User)Session["logged_in_user_obj"];

            var client = new SMARestClient("MeetUpService.svc");
            var meetupContent = client.Get<List<MeetUp>>("meetups/").ToList();
            List<MeetUp> received = new List<MeetUp>();
            List<MeetUp> sent = new List<MeetUp>();

            foreach (var item in meetupContent)
            {
                if (item.Guide.Id == user.Id)
                {
                    received.Add(item);
                }
            }

            foreach (var item in meetupContent)
            {
                if (item.Traveler.Id == user.Id)
                {
                    sent.Add(item);
                }
            }

            ViewBag.ReceivedRequest = received;
            ViewBag.SentRequest= sent;
            return View();
        }
        public static Game Build()
        {
            var hidingSpots = new List<HidingSpot>();

            var rnd = new Random();
            var indexOfHidingSpot = rnd.Next(9);

            for (var idx = 0; idx < 9; idx++)
            {
                hidingSpots.Add(new HidingSpot
                {
                    Id = idx,
                    HasBeenChecked = false,
                    HasTreasure = idx == indexOfHidingSpot
                });
            }

            _game = new Game
            {
                Id = 1,
                TurnsRemaining = 3,
                HidingSpots = hidingSpots
            };

            return _game;
        }
Esempio n. 19
0
 public static List<Class> getClasses(string student)
 {
     List<Class> classList = new List<Class>();
     //Connect to SQL Server
     SqlConnection conn = new SqlConnection("Data Source=PANDORASBOX\\PANDORASBOX; Database=WebDevelopmentDB; Integrated Security=SSPI");
     conn.Open();
     ClassRoster roster = new ClassRoster(int.Parse(student));
     //Select all columns for a given StaffID as well as their password hash
     for (int i = 0; i <= roster.Roster.GetLength(0); i++) {
         SqlCommand cmd = new SqlCommand("SELECT ClassCode, Day, Time, Semester, TutorID FROM dbo.ClassList WHERE (ClassCode = " + roster.Roster[i, 0] + ")", conn);
         SqlDataReader rdr = cmd.ExecuteReader();
         while (rdr.Read()) {
             classList.Add(new Class {
                 ClassCode = rdr[0].ToString(),
                 Day = rdr[1].ToString(),
                 Time = rdr[2].ToString(),
                 Semester = rdr[3].ToString(),
                 TutorID = rdr[4].ToString()
             });
         }
         //Close the reader and the SQL connection
         if (rdr != null) {
             rdr.Close();
         }
         conn.Close();
     }
     return classList;
 }
Esempio n. 20
0
 public int Them(BOXuLyKho item, List<BOXuLyKhoChiTiet> lsArray, Transit mTransit)
 {
     ThemMoi(item, lsArray, mTransit);
     frmXuLyKho.AddObject(item.XuLyKho);
     frmXuLyKho.Commit();
     return item.XuLyKho.ChinhKhoID;
 }
        /// <summary>
        /// Devuelve las personas.
        /// </summary>
        /// <returns>Las personas.</returns>
        public static List<Persona> GetPersonasAsList()
        {
            _dataServer.IniciarTransaccion();

            try
            {
                List<Persona> result = new List<Persona>();
                const string Query = "SELECT Id, Nombre, Apellido FROM PERSONAS";
                SqlDataReader dataReader = _dataServer.GetDataReader(Query);

                while (dataReader.Read())
                {
                    Persona persona = new Persona
                                          {
                                              Id = (int) dataReader["Id"],
                                              Nombre = (string) dataReader["Nombre"],
                                              Apellido = (string) dataReader["Apellido"]
                                          };
                    result.Add(persona);
                }

                dataReader.Close();
                return result;
            }
            finally
            {
                _dataServer.TerminarTrasaccion();
            }
        }
Esempio n. 22
0
 /// <summary>
 /// Создание карточки с фиксированными параметрами.
 /// </summary>
 public Card()
 {
     this.Name = "Ivan";
     this.SynCode = 100500;
     this.Id = 1;
     this.ContactsList = new List<Contact>();
 }
Esempio n. 23
0
        public static void StorePageLinks(CmsPage page) {
            var redirects = new List<RedirectEntity>();

            PopulatePageList(redirects, page);

            ThreadPool.QueueUserWorkItem(callback => AddPageLinksToDatabase(redirects));
        }
Esempio n. 24
0
 public IEnumerable<User> GetAllUsers()
 {
     var friends = this.UserRepository.GetAllUsers().ToList();
     var userFriends = new List<User>();
     friends.ForEach(f => f.ParseUserFriend(ref userFriends));
     return userFriends;
 }
        public Feed ReadFeed(Uri uri)
        {
            Feed feed = null;
            var feedItems = new List<FeedItem>();
            Category category = null;

            SyndicationFeed syndicationFeed;
            using (var xmlReader = XmlReader.Create(uri.AbsoluteUri))
            {
                syndicationFeed = SyndicationFeed.Load(xmlReader);
                xmlReader.Close();
            }

            if (syndicationFeed == null) return null;
            foreach (var item in syndicationFeed.Items)
            {
                var feedItem = new FeedItem();
                Guid id;

                feedItem.Id = Guid.TryParse(item.Id, out id) ? id : new Guid();
                feedItem.Title = item.Title.Text;
                feedItem.Mp3Url = item.Links.Count > 1 ? item.Links[1].Uri : item.Links[0].Uri;
                feedItem.PublishDate = item.PublishDate.DateTime;
                feedItem.Description = StripHTML(item.Summary.Text);
                feedItem.IsUsed = false;
                feedItems.Add(feedItem);
            }

            var items = new List<Data.IFeedItem>();
            feedItems.ForEach(x => items.Add(x));
            feed = new Feed(Guid.NewGuid(), syndicationFeed.Title.Text, items, uri, category,0);

            return feed;
        }
Esempio n. 26
0
 public IEnumerable<Movie> GetUserMovies(int userId)
 {
     var movies = this.UserRepository.GetUserMovies(userId).ToList();
     var userMovies = new List<Movie>();
     movies.ForEach(m => m.ParseMovies(ref userMovies));
     return userMovies;
 }
        public Publications Get(int id)
        {
            var list = context.Web.Lists.GetByTitle(Title);
            var query = new CamlQuery() { ViewXml = "<View><Query><Where><Eq><FieldRef Name='ID' /><Value Type='Integer'>" + id + "</Value></Eq></Where></Query><RowLimit>1</RowLimit></View>" };
            var items = list.GetItems(query);
            context.Load(items);
            context.ExecuteQuery();

            if (items.Count > 0)
            {
                string[] lines = items[0]["_x0422__x044d__x0433__x0438_"].ToString().Split(',');

                var tags = new List<Tag>();

                foreach (var line in lines)
                {
                    tags.Add(mapTag(line));
                }

                return new Publications()
                {
                    Title = items[0]["Title"].ToString(),
                    Article = items[0]["_x0421__x0442__x0430__x0442__x04"].ToString(),
                    PublicationDate = ((DateTime)items[0]["_x0414__x0430__x0442__x0430__x00"]).AddDays(1),
                    Source = items[0]["_x0418__x0441__x0442__x043e__x04"].ToString(),
                    Subtitle = items[0]["_x041f__x043e__x0434__x0437__x04"].ToString(),
                    Tags = tags
                };
            }
            else
            {
                return null;
            }
        }
        public static void Main()
        {
            var tupacDisciplines = new List<Discipline>
            {
                new Discipline(DisciplineName.Music, 10, 10),
                new Discipline(DisciplineName.History, 8, 8)
            };

            var studentsFromClassA = new List<Student>
            {
                new Student("Marshall", "Mathers"),
                new Student("Earl", "Simmons"),
                new Student("Mary", "Blige")
            };

            var studentsFromClassB = new List<Student>
            {
                new Student("William", "Roberts"),
                new Student("Dwayne", "Carter"),
                new Student("Kimberly", "Jones")
            };

            var teachers = new List<Teacher> 
            {
                new Teacher("Tupac", "Shakur", tupacDisciplines)
            };

            var classA = new SchoolClass(teachers, studentsFromClassA);
            var classB = new SchoolClass(teachers, studentsFromClassB);

            var school = new School(new List<SchoolClass> { classA, classB });

            Console.WriteLine(school);
        }
Esempio n. 29
0
        /// <summary>
        /// Inserta en la tabla FUNCIONALIDAD_ROL las funcionalidades seleccionadas que se van a usar en un rol.
        /// </summary>
        /// <param name="rolId"></param>
        /// <param name="funcionalidades"></param>
        public static void Insertar(Int32 rolId, List<Int32> funcionalidades)
        {
            using (var con = DataAccess.GetConnection())
            {
                var delete = new SqlCommand(SP_DELETE, con);
                delete.CommandType = CommandType.StoredProcedure;
                delete.Parameters.Add("@idrol", SqlDbType.Int).Value = rolId;

                SqlCommand insert = null;

                con.Open();
                using (var trans = con.BeginTransaction())
                {
                    //En 1 sola transaccion , borro todas los registros viejos e inserto los seleccionados.
                    //Borron y cuenta nueva.
                    delete.Transaction = trans;
                    delete.ExecuteNonQuery();

                    foreach (var id in funcionalidades)
                    {
                        //aca probe reusando la variable y modificando solo el valor del parametro.
                        //no quiso andar asi que lo martilleamos y listo.
                        insert = new SqlCommand(SP_INSERT, con, trans);
                        insert.CommandType = CommandType.StoredProcedure;
                        insert.Parameters.Add("@id_rol", SqlDbType.Int).Value = rolId;
                        insert.Parameters.Add("@id_funcionalidad", SqlDbType.Int).Value = id;

                        insert.ExecuteNonQuery();
                    }
                    trans.Commit();
                }
                con.Close();
            }
        }
        public static void Import11x5()
        {
            List<NumberType> numberTypes = NumberTypeBiz.Instance.GetAll().Where(x => x.RuleType.Contains("11X5")).ToList();
            string[] number1 = new string[] { "DaXiao", "DanShuang", "ZiHe", "Lu012" };
            string[] number2 = new string[] { "DaXiao", "DanShuang", "ZiHe", "Lu012", "He", "HeWei", "Ji", "JiWei", "KuaDu", "DaXiaoBi", "ZiHeBi", "DanShuangBi", "Lu012Bi" };
            string[] number3 = new string[] { "DaXiao", "DanShuang", "ZiHe", "Lu012", "He", "HeWei", "Ji", "JiWei", "KuaDu", "AC", "DaXiaoBi", "ZiHeBi", "DanShuangBi", "Lu012Bi" };

            foreach (var numberType in numberTypes)
            {
                if (numberType.Code.StartsWith("A")) continue;

                Data.Biz.D11X5.DmDPCBiz biz = new Data.Biz.D11X5.DmDPCBiz("jiangx11x5", numberType.Code.GetDmTableSuffix());
                List<DimensionNumberType> ntds = new List<DimensionNumberType>();
                if (numberType.Length == 1)
                    ntds = biz.DataAccessor.SelectNumberTypeDimGroupBy(number1, numberType.Code);
                else if (numberType.Length == 2)
                    ntds = biz.DataAccessor.SelectNumberTypeDimGroupBy(number2, numberType.Code);
                else
                    ntds = biz.DataAccessor.SelectNumberTypeDimGroupBy(number3, numberType.Code);

                foreach (var ntd in ntds)
                {
                    ntd.NumberType = numberType.Code;
                    ntd.RuleType = numberType.RuleType;
                    ntd.Amount = ntd.Nums * numberType.Amount;
                    ntd.Probability = (ntd.Nums * 1.0) * numberType.Probability;
                }
                DimensionNumberTypeBiz.Instance.DataAccessor.Insert(ntds, SqlInsertMethod.SqlBulkCopy);
            }
        }