コード例 #1
0
        public ActionResult Create(REGION region)
        {
            if (ModelState.IsValid)
            {
                db.REGIONS.AddObject(region);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(region);
        }
コード例 #2
0
 public ActionResult Edit(REGION region)
 {
     if (ModelState.IsValid)
     {
         db.REGIONS.Attach(region);
         db.ObjectStateManager.ChangeObjectState(region, EntityState.Modified);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(region);
 }
コード例 #3
0
ファイル: Node.cs プロジェクト: nguyenhaidang94/GameMario
        /// <summary>
        /// constructor
        /// </summary>
        public Node(int parentNodeId, REGION region, Box boundaryBox)
        {
            _Tl = null;
            _Tr = null;
            _Bl = null;
            _Br = null;

            _Region = region;
            _NodeId = parentNodeId * 10 + (int)_Region;
            _ListObject = new List<TileObject>();
            //node root
            if (parentNodeId == 0)
                _BoundaryBox = boundaryBox;
            else
            {
                switch (_Region)
                {
                    case REGION.TOP_LEFT:
                        _BoundaryBox = new Box(
                            boundaryBox.X - boundaryBox.Width/4,
                            boundaryBox.Y + boundaryBox.Height/4,
                            boundaryBox.Width/2,
                            boundaryBox.Height/2
                            );
                        break;
                    case REGION.TOP_RIGHT:
                        _BoundaryBox = new Box(
                            boundaryBox.X + boundaryBox.Width / 4,
                            boundaryBox.Y + boundaryBox.Height / 4,
                            boundaryBox.Width / 2,
                            boundaryBox.Height / 2
                            );
                        break;
                    case REGION.BOT_LEFT:
                        _BoundaryBox = new Box(
                            boundaryBox.X - boundaryBox.Width / 4,
                            boundaryBox.Y - boundaryBox.Height / 4,
                            boundaryBox.Width / 2,
                            boundaryBox.Height / 2
                            );
                        break;
                    case REGION.BOT_RIGHT:
                        _BoundaryBox = new Box(
                            boundaryBox.X + boundaryBox.Width / 4,
                            boundaryBox.Y - boundaryBox.Height / 4,
                            boundaryBox.Width / 2,
                            boundaryBox.Height / 2
                            );
                        break;
                }
            }
        }
コード例 #4
0
ファイル: FrmSomDelegue.cs プロジェクト: romainbezard/GSBCR
        private void btnConsulterNvRapRegion_Click(object sender, EventArgs e)
        {
            List <RAPPORT_VISITE>   lesRapports     = Manager.ChargerRapportByRegionDuPraticien(matricule);
            frmConsultRapportRegion consulteRapport = new frmConsultRapportRegion(lesRapports);
            List <RAPPORT_VISITE>   lrv             = new List <RAPPORT_VISITE>();
            REGION r = Manager.ChargerRegionMatricule(matricule);

            lrv = Manager.ChargerRapportRegionDelegue(r.REG_CODE);

            frmConsultRapportRegion f = new frmConsultRapportRegion(lrv);

            Hide();
            f.ShowDialog();
            Show();
        }
コード例 #5
0
        public static REGION FindByMatricule(string matricule)
        {
            REGION r = new REGION();

            using (var context = new GSB_VisiteEntities())
            {
                var req = from reg in context.REGIONs
                          join t in context.TRAVAILLERs
                          on reg.REG_CODE equals t.REG_CODE
                          where t.VIS_MATRICULE == matricule
                          select reg;
                r = req.SingleOrDefault <REGION>();
            }
            return(r);
        }
コード例 #6
0
ファイル: RegionForm.cs プロジェクト: mdgiles/TraceOffice
        private void BindFocusedRow(GridView view, int focusedRowHandle)
        {
            object row = view.GetRow(focusedRowHandle);

            if (row != null && row.GetType() != typeof(DevExpress.Data.NotLoadedObject))
            {
                ReadonlyThreadSafeProxyForObjectFromAnotherThread proxy = (ReadonlyThreadSafeProxyForObjectFromAnotherThread)view.GetRow(focusedRowHandle);
                REGION record = (REGION)proxy.OriginalRow;
                BindingSource.DataSource = _context.REGION.Where(c => c.CODE == record.CODE);
            }
            else
            {
                ClearBindings();
            }
        }
コード例 #7
0
        /// <summary>
        /// recherche une région par son nom
        /// </summary>
        /// <param name="Lib"></param>
        /// <returns>REGION</returns>
        public REGION FindByLib(string Lib)
        {
            REGION reglib = null;

            using (var context = new GSB_VisiteEntities())
            {
                //désactiver le chargement différé
                context.Configuration.LazyLoadingEnabled = false;
                var req = from r in context.REGIONs
                          where r.REG_NOM == Lib
                          select r;
                reglib = req.SingleOrDefault <REGION>();
            }
            return(reglib);
        }
コード例 #8
0
ファイル: RegionDAO.cs プロジェクト: BraviMathieu/GSBCR
        public static REGION FindById(string code)
        {
            //A faire : rechercher une région par son nom
            REGION reg = null;

            using (var context = new GSB_VisiteEntities())
            {
                //context.Configuration.LazyLoadingEnabled = false;
                var req = from r in context.REGION
                          where r.REG_CODE == code
                          select r;
                reg = req.SingleOrDefault <REGION>();
            }
            return(reg);
        }
コード例 #9
0
        private void button1_Click(object sender, EventArgs e)
        {
            VISITEUR vs = new VISITEUR();

            vs = (VISITEUR)cbxVisiteur.SelectedItem;
            REGION r = new REGION();

            r = (REGION)cbxReg.SelectedItem;
            TRAVAILLER t = new TRAVAILLER();

            t.VIS_MATRICULE = vs.VIS_MATRICULE;
            t.JJMMAA        = DateTime.Today;
            t.REG_CODE      = r.REG_CODE;
            t.TRA_ROLE      = "Délégué";
            Manager.CreateTravailler(t);
        }
コード例 #10
0
ファイル: RegionDAO.cs プロジェクト: Light-123/GSBCR-C-
        public static REGION FindById(string code)
        {
            //A faire : rechercher une région par son nom
            REGION reg = null;

            using (var context = new GSB_VisiteEntities())
            {
                //désactiver le chargement différé
                //context.Configuration.LazyLoadingEnabled = false;
                var req = from m in context.REGION.Include("LeSecteur")
                          where m.REG_CODE == code
                          select m;
                reg = req.SingleOrDefault <REGION>();
            }
            return(reg);
        }
コード例 #11
0
        /// <summary>
        /// Recherche une région par son code
        /// </summary>
        /// <param name="code"></param>
        /// <returns></returns>
        public REGION FindById(string code)
        {
            // Recherche une region par son code
            REGION reg = null;

            using (var context = new GSB_visite_groupe1Entities())
            {
                //désactiver le chargement différé
                //context.Configuration.LazyLoadingEnabled = false;
                var req = from r in context.REGION
                          where r.REG_CODE == code
                          select r;
                reg = req.SingleOrDefault <REGION>();
            }
            return(reg);
        }
コード例 #12
0
ファイル: RegionController.cs プロジェクト: Munder90/Trueque
        public ActionResult Edit([Bind(Include = "REGION1,SOCIEDAD")] REGION rEGION)
        {
            int pagina_id = 951;//ID EN BASE DE DATOS

            FnCommon.ObtenerConfPage(db, pagina_id, User.Identity.Name, this.ControllerContext.Controller, 950);
            string spras_id = ViewBag.spras_id;

            ViewBag.SOCIEDAD = new SelectList(db.SOCIEDADs.Where(t => t.ACTIVO).ToList(), "BUKRS", "BUKRS", rEGION.SOCIEDAD);
            if (ModelState.IsValid)
            {
                db.Entry(rEGION).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }
            return(View(rEGION));
        }
コード例 #13
0
ファイル: RegionForm.cs プロジェクト: mdgiles/TraceOffice
 void SetBindings()
 {
     if (BindingSource.Current == null)
     {
         ClearBindings();
     }
     else
     {
         _selectedRecord = ((REGION)BindingSource.Current);
         LoadAndBindSupplierRegion();
         SetReadOnly(false);
         SetReadOnlyKeyFields(true);
         BarButtonItemDelete.Enabled = true;
         BarButtonItemSave.Enabled   = true;
     }
     ErrorProvider.Clear();
 }
コード例 #14
0
ファイル: RegionForm.cs プロジェクト: mdgiles/TraceOffice
 private void BarButtonItemNew_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     _ignoreLeaveRow = true;                   //so that when the grid row changes it doesn't try to save again
     if (SaveRecord(true))
     {
         //For some reason when there is no existing record in the binding source the Add method does not
         //trigger the CurrentChanged event, but AddNew does so use that instead
         _selectedRecord = (REGION)BindingSource.AddNew();
         //With the instant feedback data source, the new row is not immediately added to the grid, so move
         //the focused row to the filter row just so that no other existing row is visually highlighted
         GridViewLookup.FocusedRowHandle = DevExpress.Data.BaseListSourceDataController.FilterRow;
         SetReadOnlyKeyFields(false);
         TextEditCode.Focus();
         SetReadOnly(false);
     }
     ErrorProvider.Clear();
     _ignoreLeaveRow = false;
 }
コード例 #15
0
        public void Update(int Id, int REGIONId, string NOMBRE)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioCOMUNA repositorio = new RepositorioCOMUNA(context);
                    COMUNA            _COMUNA     = repositorio.GetById(Id);
                    if (Equals(_COMUNA, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado COMUNA con Id =", Id.ToString()));
                    }

                    RepositorioREGION _repositorioREGION = new RepositorioREGION(context);
                    REGION            _objREGION         = _repositorioREGION.GetById(REGIONId);
                    if (Equals(_objREGION, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado REGION con Id =", REGIONId.ToString()));
                    }

                    //properties

                    if (!string.IsNullOrEmpty(NOMBRE))
                    {
                        _COMUNA.NOMBRE = NOMBRE;
                    }

                    //parents

                    _COMUNA.REGION = _objREGION;

                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
コード例 #16
0
        public int Add(int ID, string NOMBRE)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioREGION repositorio = new RepositorioREGION(context);

                    if (repositorio.GetByFilter(ID, true).Any())
                    {
                        throw new Exception("Ya existe una región con este ID");
                    }

                    REGION _REGION = null;
                    if (repositorio.GetByFilter(ID, false).Any())
                    {
                        _REGION        = repositorio.GetByFilter(ID, false).First();
                        _REGION.NOMBRE = NOMBRE;
                        _REGION.ACTIVO = true;
                    }
                    else
                    {
                        _REGION        = new Modelo.REGION();
                        _REGION.ID     = ID;
                        _REGION.NOMBRE = NOMBRE;
                        _REGION.ACTIVO = true;
                        context.AddObject("REGION", _REGION);
                    }

                    context.SaveChanges();

                    return(_REGION.ID);
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
コード例 #17
0
ファイル: RegionController.cs プロジェクト: Munder90/Trueque
        // GET: Region/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            REGION rEGION = db.REGIONs.Find(id);

            if (rEGION == null)
            {
                return(HttpNotFound());
            }
            int pagina_id = 952;//ID EN BASE DE DATOS

            FnCommon.ObtenerConfPage(db, pagina_id, User.Identity.Name, this.ControllerContext.Controller, 950);
            string spras_id = ViewBag.spras_id;

            ViewBag.SOCIEDAD = new SelectList(db.SOCIEDADs.Where(t => t.ACTIVO).ToList(), "BUKRS", "BUKRS", rEGION.SOCIEDAD);
            return(View(rEGION));
        }
コード例 #18
0
 /// <summary>
 /// Trae el registro de Region como objeto Region
 /// </summary>
 /// <param name="region">id de la region a filtrar</param>
 /// <returns></returns>
 public RegionBEL traerRegion(int region)
 {
     try
     {
         REGION cliDalc = (from tmpCliente in ConexionBLL.getConexion().REGION
                           where tmpCliente.ID_REGION == region
                           select tmpCliente).FirstOrDefault();
         if (cliDalc != null)
         {
             RegionBEL cliente = new RegionBEL();
             cliente.IdRegion = (int)cliDalc.ID_REGION;
             cliente.Nombre   = cliDalc.NOMBRE;
             return(cliente);
         }
         return(null);
     }
     catch
     {
         return(null);
     }
 }
コード例 #19
0
        public string ActualizarRegion(string nombre, int id, int pais)
        {
            try
            {
                REGION    region    = new REGION();
                RegionDAL regionDAL = new RegionDAL();

                if (nombre.Trim().Length > 1)
                {
                    if (id > 0)
                    {
                        if (pais > 0)
                        {
                            region.ID = id;
                            region.FECHA_ULTIMO_UPDATE = DateTime.Now;
                            region.PAIS_ID             = pais;
                            region.NOMBRE = nombre;
                            return(regionDAL.ActualizarRegion(region));
                        }
                        else
                        {
                            return("Seleccione un pais");
                        }
                    }
                    else
                    {
                        return("Seleccione un registro de la tabla");
                    }
                }
                else
                {
                    return("El nombre debe tener al menos 2 caracteres");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #20
0
        public int Add(int REGIONId, string NOMBRE)
        {
            Init();
            try
            {
                using (LQCEEntities context = new LQCEEntities())
                {
                    RepositorioREGION _repositorioREGION = new RepositorioREGION(context);
                    REGION            _objREGION         = _repositorioREGION.GetById(REGIONId);
                    if (Equals(_objREGION, null))
                    {
                        throw new Exception(String.Concat("No se ha encontrado REGION con Id =", REGIONId.ToString()));
                    }

                    COMUNA _COMUNA = new COMUNA();

                    //properties

                    _COMUNA.NOMBRE = NOMBRE;
                    _COMUNA.ACTIVO = true;

                    //parents

                    _COMUNA.REGION = _objREGION;

                    context.AddObject("COMUNA", _COMUNA);
                    context.SaveChanges();

                    return(_COMUNA.ID);
                }
            }
            catch (Exception ex)
            {
                ISException.RegisterExcepcion(ex);
                Error = ex.Message;
                throw ex;
            }
        }
コード例 #21
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     if (db.REGION.Count() == 0)
     {
         REGION region = new REGION();
         region.NOMBREREGION = "Región por defecto";
         db.REGION.Add(region);
         db.SaveChanges();
     }
     if (db.TARIFAENVIO.Count() == 0)
     {
         TARIFAENVIO tarifaInicial = new TARIFAENVIO();
         tarifaInicial.NOMBRETARIFA = "Sin Tarifa - 0";
         tarifaInicial.VALORTARIFA  = 0;
         tarifaInicial.IDREGION     = 1;
         db.TARIFAENVIO.Add(tarifaInicial);
         db.SaveChanges();
     }
     if (db.USUARIO.Count() == 0)
     {
         USUARIO usuarioInicial = new USUARIO();
         usuarioInicial.USERNAME       = "******";
         usuarioInicial.PRIMERNOMBRE   = "Visitante";
         usuarioInicial.PRIMERAPELLIDO = "Ventas Web";
         usuarioInicial.DIRECCION      = "Ventas Web";
         usuarioInicial.CIUDAD         = "Ciudad Visitante";
         usuarioInicial.PROVINCIA      = "Provincia Visitante";
         usuarioInicial.TELEFONO       = "telefono";
         usuarioInicial.PAIS           = "Pais Visitante";
         usuarioInicial.EMAIL          = "*****@*****.**";
         db.USUARIO.Add(usuarioInicial);
         db.SaveChanges();
     }
 }
コード例 #22
0
        public void Session_Start()
        {
            //inicializa las cookies
            carrito     = new HttpCookie("CarritoCompra");
            cantCarrito = new HttpCookie("CantidadCarrito");
            //obtener cookie "CarritoCompra" de la request
            HttpCookie ckRequest = Request.Cookies["CarritoCompra"];

            //si la cookie de la request es nula, añadir nueva
            if (ckRequest == null)
            {
                id = 1;
                if (db.CARRITOCOMPRA.Count() != 0)
                {
                    id = db.CARRITOCOMPRA.Max(p => p.IDCARRITO) + 1;
                }
                //se llena cookie con la información
                carrito.Value   = id.ToString();
                carrito.Expires = DateTime.Now.AddYears(1);
                Response.Cookies.Set(carrito);
                cantCarrito.Value   = "0";
                cantCarrito.Expires = DateTime.Now.AddYears(1);
                Response.Cookies.Set(cantCarrito);
                CARRITOCOMPRA aux = new CARRITOCOMPRA();
                aux.IDCARRITO     = id;
                aux.IDTARIFAENVIO = 1;
                aux.IDUSUARIO     = 1;
                aux.USUARIO       = db.USUARIO.Find(1);
                aux.TARIFAENVIO   = db.TARIFAENVIO.Find(1);
                if (aux.TARIFAENVIO == null)
                {
                    if (db.REGION.Count() == 0)
                    {
                        REGION region = new REGION();
                        region.NOMBREREGION = "Región por defecto";
                        db.REGION.Add(region);
                        db.SaveChanges();
                    }
                    if (db.TARIFAENVIO.Count() == 0)
                    {
                        TARIFAENVIO tarifaInicial = new TARIFAENVIO();
                        tarifaInicial.NOMBRETARIFA = "Sin Tarifa - 0";
                        tarifaInicial.VALORTARIFA  = 0;
                        tarifaInicial.IDREGION     = 1;
                        db.TARIFAENVIO.Add(tarifaInicial);
                        db.SaveChanges();
                    }
                    aux.TARIFAENVIO = db.TARIFAENVIO.Find(1);
                }
                if (aux.USUARIO == null)
                {
                    USUARIO usuarioInicial = new USUARIO();
                    usuarioInicial.USERNAME       = "******";
                    usuarioInicial.PRIMERNOMBRE   = "Visitante";
                    usuarioInicial.PRIMERAPELLIDO = "Ventas Web";
                    usuarioInicial.DIRECCION      = "Ventas Web";
                    usuarioInicial.CIUDAD         = "Ciudad Visitante";
                    usuarioInicial.PROVINCIA      = "Provincia Visitante";
                    usuarioInicial.TELEFONO       = "telefono";
                    usuarioInicial.PAIS           = "Pais Visitante";
                    usuarioInicial.EMAIL          = "*****@*****.**";
                    db.USUARIO.Add(usuarioInicial);
                    db.SaveChanges();
                    aux.USUARIO = db.USUARIO.Find(1);
                }
                //carro.IDCARRITO = id;
                db.CARRITOCOMPRA.Add(aux);
                db.SaveChanges();
            }
            else
            {
                //obtener el valor de cookie en un auxiliar
                id = decimal.Parse(ckRequest.Value);
                //intentar obtener el carrito de compra con el valor de cookie
                CARRITOCOMPRA verificarCarrito = db.CARRITOCOMPRA.Find(id);

                //validar (caso 1: es válida)
                if (verificarCarrito != null && verificarCarrito.IDCARRITO == id)
                {
                    Response.Cookies["CarritoCompra"].Value   = ckRequest.Value;
                    Response.Cookies["CarritoCompra"].Expires = DateTime.Now.AddYears(1);
                }
                //sin embargo, (Caso 2: no es válida)
                else
                {
                    //añade a la base un registro vacío de carrito (genera id en base)
                    //obtiene el id del ultimo carrito registrado (se guarda en id
                    id = 1;
                    if (db.CARRITOCOMPRA.Count() != 0)
                    {
                        id = db.CARRITOCOMPRA.Max(p => p.IDCARRITO) + 1;
                    }
                    //se llena cookie con la información
                    Response.Cookies["CarritoCompra"].Value   = id.ToString();
                    Response.Cookies["CarritoCompra"].Expires = DateTime.Now.AddYears(1);
                    Response.Cookies["CantidadCarrito"].Value = "0";
                    CARRITOCOMPRA aux = new CARRITOCOMPRA();
                    aux.IDTARIFAENVIO = 1;
                    aux.IDUSUARIO     = 1;
                    aux.USUARIO       = db.USUARIO.Find(1);
                    aux.TARIFAENVIO   = db.TARIFAENVIO.Find(1);
                    if (aux.TARIFAENVIO == null)
                    {
                        if (db.REGION.Count() == 0)
                        {
                            REGION region = new REGION();
                            region.NOMBREREGION = "Región por defecto";
                            db.REGION.Add(region);
                            db.SaveChanges();
                        }
                        if (db.TARIFAENVIO.Count() == 0)
                        {
                            TARIFAENVIO tarifaInicial = new TARIFAENVIO();
                            tarifaInicial.NOMBRETARIFA = "Sin Tarifa - 0";
                            tarifaInicial.VALORTARIFA  = 0;
                            tarifaInicial.IDREGION     = 1;
                            db.TARIFAENVIO.Add(tarifaInicial);
                            db.SaveChanges();
                        }
                        aux.TARIFAENVIO = db.TARIFAENVIO.Find(1);
                    }
                    if (aux.USUARIO == null)
                    {
                        USUARIO usuarioInicial = new USUARIO();
                        usuarioInicial.USERNAME       = "******";
                        usuarioInicial.PRIMERNOMBRE   = "Visitante";
                        usuarioInicial.PRIMERAPELLIDO = "Ventas Web";
                        usuarioInicial.DIRECCION      = "Ventas Web";
                        usuarioInicial.CIUDAD         = "Ciudad Visitante";
                        usuarioInicial.PROVINCIA      = "Provincia Visitante";
                        usuarioInicial.TELEFONO       = "telefono";
                        usuarioInicial.PAIS           = "Pais Visitante";
                        usuarioInicial.EMAIL          = "*****@*****.**";
                        db.USUARIO.Add(usuarioInicial);
                        db.SaveChanges();
                        aux.USUARIO = db.USUARIO.Find(1);
                    }
                    //carro.IDCARRITO = id;
                    db.CARRITOCOMPRA.Add(aux);
                    db.SaveChanges();
                }
            }
        }
コード例 #23
0
        /*
        ====================================================================
        Check if there is a selectable unit for current player on x,y
        The currently selected unit is not counted as selectable. (though
        a primary unit on the same tile may be selected if it's not
        the current unit)
        ====================================================================
        */
        public static Unit engine_get_select_unit(int x, int y, REGION region)
        {
            if (x < 0 || y < 0 || x >= Engine.map.map_w || y >= Engine.map.map_h) return null;
            #if TODO_RR
            if (!Engine.map.mask[x, y].spot) return null;
            #endif

            if (region == REGION.REGION_AIR)
            {
                if (map.map[x, y].a_unit != null && map.map[x, y].a_unit.player == cur_player)
                {
                    if (cur_unit == map.map[x, y].a_unit)
                        return null;
                    else
                        return map.map[x, y].a_unit;
                }
                else
                    if (map.map[x, y].g_unit != null && map.map[x, y].g_unit.player == cur_player)
                        return map.map[x, y].g_unit;
                    else
                        return null;
            }
            else
            {
                if (map.map[x, y].g_unit != null && map.map[x, y].g_unit.player == cur_player)
                {
                    if (cur_unit == map.map[x, y].g_unit)
                        return null;
                    else
                        return map.map[x, y].g_unit;
                }
                else
                    if (map.map[x, y].a_unit != null && map.map[x, y].a_unit.player == cur_player)
                        return map.map[x, y].a_unit;
                    else
                        return null;
            }
        }
コード例 #24
0
 /*
 ====================================================================
 Get primary unit on tile.
 ====================================================================
 */
 public static Unit engine_get_prim_unit(int x, int y, REGION region)
 {
     if (x < 0 || y < 0 || x >= map.map_w || y >= map.map_h) return null;
     if (region == REGION.REGION_AIR)
     {
         if (map.map[x, y].a_unit != null)
             return map.map[x, y].a_unit;
         else
             return map.map[x, y].g_unit;
     }
     else
     {
         if (map.map[x, y].g_unit != null)
             return map.map[x, y].g_unit;
         else
             return map.map[x, y].a_unit;
     }
 }
コード例 #25
0
 public static bool engine_get_map_pos(float sx, float sy, out int mx, out int my, out REGION region)
 {
     mx = my = -1;
     region = REGION.REGION_NONE;
     int x = 0, y = 0;
     if (map.isLoaded){
         int auxWidth = Engine.map.map_w-1;
         int auxHeight = Engine.map.map_h-1;
         int width = auxWidth*Config.hex_x_offset;
         int height = -Config.hex_h*auxHeight-Config.hex_y_offset;
         if (sx>=-Config.hex_w/2 && sx<=width+Config.hex_w/2 && sy<=Config.hex_h/2 && sy>=height-Config.hex_h/2){
             x = Misc.GetWidthtPosition(sx);
             y = Misc.GetHeightPosition(sy,x);
         }
         int tile_y = (Misc.IsEven(x))?-y*Config.hex_h:-y*Config.hex_h-Config.hex_y_offset;
         if (tile_y<sy)
             region = REGION.REGION_AIR;
         else
             region = REGION.REGION_GROUND;
         mx = x;
         my = y;
         /* check range */
         if (x < 0 || y < 0 || x >= Engine.map.map_w || y >= Engine.map.map_h) return false;
         /* ok, tile exists */
         return true;
     }
     else{
         return false;
     }
 }
コード例 #26
0
 public void AddToREGION(REGION rEGION)
 {
     base.AddObject("REGION", rEGION);
 }
コード例 #27
0
ファイル: Manager.cs プロジェクト: romainbezard/GSBCR
        public static REGION ChargerRegionMatricule(string matricule)
        {
            REGION r = RegionDAO.FindByMatricule(matricule);

            return(r);
        }
コード例 #28
0
        public static bool engine_get_map_pos(float sx, float sy, out int mx, 
											  out int my, out REGION region, float yClicked)
        {
            mx = my = -1;
            region = REGION.REGION_NONE;

            if (map.isLoaded){
                for (int i=0; i<map.map_h; i++) {
                    for (int j=0; j<map.map_w; j++) {
                        if ((j * Config.hex_x_offset==sx) && (-Config.hex_h * i==sy)){
                                mx = j;
                                my = i;
                                if (-Config.hex_h * i>yClicked){
                                    region = REGION.REGION_GROUND;
                                }
                                else{
                                    region = REGION.REGION_AIR;
                                }
                                return true;
                        }
                        else if ((j * Config.hex_x_offset==sx) && (-(Config.hex_h * i) - Config.hex_y_offset==sy)){
                            mx = j;
                            my = i;
                            if (-(Config.hex_h * i) - Config.hex_y_offset>yClicked){
                                region = REGION.REGION_GROUND;
                            }
                            else{
                                region = REGION.REGION_AIR;
                            }
                            return true;
                        }
                    }
                }
                return false;
            }
            else{
                return false;
            }
        }
コード例 #29
0
        private void FrmDetailsVisiteur_Load(object sender, EventArgs e)
        {
            this.leVisiteur = VisiteurManager.loadVisiteur(laAffectation.VIS_MATRICULE);
            REGION laRegion = VisiteurManager.ChargerUneRegion(laAffectation.REG_CODE);
            List <RAPPORT_VISITE> lesRapportsConsultes = VisiteurManager.ChargerRapportVisiteurFinisEtLus(leVisiteur.VIS_MATRICULE);

            txt_Matricule.Text           = leVisiteur.VIS_MATRICULE;
            txt_Nom.Text                 = leVisiteur.VIS_NOM;
            txt_Prenom.Text              = leVisiteur.Vis_PRENOM;
            txt_Email.Text               = leVisiteur.mail;
            txt_Telephone.Text           = leVisiteur.tel;
            txt_Adresse.Text             = leVisiteur.VIS_ADRESSE;
            txt_CodePostal.Text          = leVisiteur.VIS_CP;
            txt_Ville.Text               = leVisiteur.VIS_VILLE;
            dtp_DateEmbauche.Value       = leVisiteur.VIS_DATEEMBAUCHE;
            dtp_DateEmbauche.MinDate     = leVisiteur.VIS_DATEEMBAUCHE;
            dtp_DateEmbauche.MaxDate     = leVisiteur.VIS_DATEEMBAUCHE;
            txt_SecteurCode.Text         = laRegion.LeSecteur.SEC_CODE;
            txt_SecteurLibelle.Text      = laRegion.LeSecteur.SEC_LIBELLE;
            txt_RegionCode.Text          = laRegion.REG_CODE;
            txt_Role.Text                = laAffectation.TRA_ROLE;
            dtp_DateAffectation.Value    = laAffectation.JJMMAA;
            dtp_DateAffectation.MinDate  = laAffectation.JJMMAA;
            dtp_DateAffectation.MaxDate  = laAffectation.JJMMAA;
            txt_NbRapportsConsultes.Text = lesRapportsConsultes.Count.ToString();
            if (lesRapportsConsultes.Count > 0)
            {
                this.btn_ConsulterRapports.Enabled = true;
                this.btn_ConsulterRapports.Visible = true;
            }
            else
            {
                this.btn_ConsulterRapports.Enabled = false;
                this.btn_ConsulterRapports.Visible = false;
            }


            if (!modification)
            {
                this.txt_RegionLibelle           = new System.Windows.Forms.TextBox();
                this.txt_RegionLibelle.BackColor = System.Drawing.Color.White;
                this.pnl_Region.Controls.Add(this.txt_RegionLibelle);
                this.txt_RegionLibelle.Location = new System.Drawing.Point(76, 2);
                this.txt_RegionLibelle.Name     = "txt_RegionLibelle";
                this.txt_RegionLibelle.ReadOnly = true;
                this.txt_RegionLibelle.Size     = new System.Drawing.Size(154, 20);
                this.txt_RegionLibelle.TabIndex = 13;
                this.txt_RegionLibelle.Text     = laRegion.REG_NOM;

                if (laAffectationUtilisateur.TRA_ROLE == "Responsable")
                {
                    btnModifier.Visible = true;
                    btnModifier.Enabled = true;
                }
                else
                {
                    btnModifier.Visible = false;
                    btnModifier.Enabled = false;
                }
            }
            else
            {
                ActiverModification();
            }
        }
コード例 #30
0
        //
        // GET: /Regions/Details/5

        public ViewResult Details(int id)
        {
            REGION region = db.REGIONS.Single(r => r.ID == id);

            return(View(region));
        }
コード例 #31
0
        //
        // GET: /Regions/Delete/5

        public ActionResult Delete(int id)
        {
            REGION region = db.REGIONS.Single(r => r.ID == id);

            return(View(region));
        }
コード例 #32
0
 /*
 ====================================================================
 Check if there is a target for current unit on x,y.
 ====================================================================
 */
 public static Unit engine_get_target(int x, int y, REGION region)
 {
     Unit unit;
     if (x < 0 || y < 0 || x >= map.map_w || y >= map.map_h) return null;
     if (!map.mask[x, y].spot) return null;
     if (cur_unit == null) return null;
     unit = engine_get_prim_unit(x, y, region);
     if (unit != null)
         if (cur_unit.CheckAttack(  unit, Unit.UNIT_ATTACK.UNIT_ACTIVE_ATTACK))
             return unit;
     return null;
 }
コード例 #33
0
 public static REGION CreateREGION(int id, string nOMBRE, bool aCTIVO)
 {
     REGION rEGION = new REGION();
     rEGION.ID = id;
     rEGION.NOMBRE = nOMBRE;
     rEGION.ACTIVO = aCTIVO;
     return rEGION;
 }
コード例 #34
0
 public ActionResult ADD_encargado(string nombre, string apellidos, string rut, REGION region, PROVINCIA provincia, COMUNA comuna, string direccion)
 {
     //datos.PERSONA_PROCEDURE();
     return(View());
 }