예제 #1
0
        public bool CheckDuplicateZoneArea(area mArea)
        {
            var  checkDuplicateArea = _entities.areas.FirstOrDefault(a => a.area_name == mArea.area_name && a.region_id == mArea.region_id && a.area_id != mArea.area_id);
            bool return_type        = checkDuplicateArea == null ? false : true;

            return(return_type);
        }
예제 #2
0
 public border(location startPoint, location endPoint, area upperArea, area lowerArea)
 {
     this.startPoint = startPoint;
     this.endPoint   = endPoint;
     this.upperArea  = upperArea;
     this.lowerArea  = lowerArea;
 }
예제 #3
0
        private void RefreshCustomerListByPage(int page)
        {
            area _area = SelectedArea;

            if (_isSearchedPerformed)
            {
                if (_searchText != "")
                {
                    _PagingCollection = CustomerService.GetPaginatedQuickSearchedCustomerListByPage(_searchText, page, _area.AREA_NAME);
                }
                else
                {
                    _PagingCollection = CustomerService.GetPaginatedCustomerListByPage(page, _area.AREA_NAME);
                }
            }
            else
            {
                _PagingCollection = CustomerService.GetPaginatedCustomerListByPage(page, _area.AREA_NAME);
            }

            CustomerList = _PagingCollection.Collection;
            PagingList   = _PagingCollection.PagesList;

            CustomerListView.ItemsSource = CustomerList;
            CustomerListView.Items.Refresh();

            PagingListView.ItemsSource = PagingList;
            PagingListView.Items.Refresh();
        }
예제 #4
0
        public async Task <IHttpActionResult> Putarea(int id, area area)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != area.id)
            {
                return(BadRequest());
            }

            db.Entry(area).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!areaExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #5
0
        public void BatchDeleteTest()
        {
            area v1 = new area();
            area v2 = new area();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                context.Set <area>().Add(v1);
                context.Set <area>().Add(v2);
                context.SaveChanges();
            }

            PartialViewResult rv = (PartialViewResult)_controller.BatchDelete(new string[] { v1.ID.ToString(), v2.ID.ToString() });

            Assert.IsInstanceOfType(rv.Model, typeof(areaBatchVM));

            areaBatchVM vm = rv.Model as areaBatchVM;

            vm.Ids = new string[] { v1.ID.ToString(), v2.ID.ToString() };
            _controller.DoBatchDelete(vm, null);

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                Assert.AreEqual(context.Set <area>().Count(), 0);
            }
        }
예제 #6
0
        public void DeleteTest()
        {
            area v = new area();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                context.Set <area>().Add(v);
                context.SaveChanges();
            }

            PartialViewResult rv = (PartialViewResult)_controller.Delete(v.ID.ToString());

            Assert.IsInstanceOfType(rv.Model, typeof(areaVM));

            areaVM vm = rv.Model as areaVM;

            v         = new area();
            v.ID      = vm.Entity.ID;
            vm.Entity = v;
            _controller.Delete(v.ID.ToString(), null);

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                Assert.AreEqual(context.Set <area>().Count(), 0);
            }
        }
예제 #7
0
        public void EditTest()
        {
            area v = new area();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                context.Set <area>().Add(v);
                context.SaveChanges();
            }

            PartialViewResult rv = (PartialViewResult)_controller.Edit(v.ID.ToString());

            Assert.IsInstanceOfType(rv.Model, typeof(areaVM));

            areaVM vm = rv.Model as areaVM;

            v    = new area();
            v.ID = vm.Entity.ID;

            vm.Entity = v;
            vm.FC     = new Dictionary <string, object>();

            _controller.Edit(vm);

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                var data = context.Set <area>().FirstOrDefault();

                Assert.AreEqual(data.UpdateBy, "user");
                Assert.IsTrue(DateTime.Now.Subtract(data.UpdateTime.Value).Seconds < 10);
            }
        }
예제 #8
0
        void seed_filling(ref Sensor_data[,] pixel, int x, int y, int label, ref area area_size)
        {
            pixel[y, x].area_label = label;
            area_size.size++;
            if (area_size.max_x < x)
            {
                area_size.max_x = x;
            }

            if (area_size.max_y < y)
            {
                area_size.max_y = y;
            }

            if (area_size.min_x > x)
            {
                area_size.min_x = x;
            }

            if (area_size.min_y > y)
            {
                area_size.min_y = y;
            }

            for (int i = 0; i < 8; i++)
            {
                if (dirY[i] + y >= 0 && dirY[i] + y < Form1.r && dirX[i] + x >= 0 && dirX[i] + x < Form1.c && pixel[dirY[i] + y, dirX[i] + x].area_label == 1)
                {
                    pixel[dirY[i] + y, dirX[i] + x].area_label = label;
                    seed_filling(ref pixel, dirX[i] + x, dirY[i] + y, label, ref area_size);
                }
            }
        }
예제 #9
0
        public List <area> GetArea(string id)
        {
            string sql = "";

            if (string.IsNullOrEmpty(id))
            {
                sql = "SELECT DISTINCT CODEID,CODENAME FROM AREA WHERE PARENTID=100000 AND SFDY = '1'";
            }
            else
            {
                sql = "SELECT DISTINCT CODEID,CODENAME FROM AREA WHERE SFDY = '1' AND PARENTID = " + id + "";
            }
            System.Data.DataTable mytable = AppUtility.Engine.EngineConfig.CommandFactory.CreateCommand().ExecuteDataTable(sql);
            List <area>           list    = new List <area>();

            if (mytable.Rows.Count > 0)
            {
                for (int i = 0; i < mytable.Rows.Count; i++)
                {
                    area Area = new area();
                    Area.code     = mytable.Rows[i]["CodeID"].ToString();
                    Area.codeName = mytable.Rows[i]["CODENAME"].ToString();
                    list.Add(Area);
                }
            }
            return(list);
        }
예제 #10
0
        public void AddArea(ref OperationResult pobjOperationResult, areaDto pobjDtoEntity, List <string> ClientSession)
        {
            //mon.IsActive = true;
            string NewId = "(No generado)";

            try
            {
                SigesoftEntitiesModel dbContext = new SigesoftEntitiesModel();
                area objEntity = areaAssembler.ToEntity(pobjDtoEntity);

                objEntity.d_InsertDate   = DateTime.Now;
                objEntity.i_InsertUserId = Int32.Parse(ClientSession[2]);
                objEntity.i_IsDeleted    = 0;
                // Autogeneramos el Pk de la tabla
                int intNodeId = int.Parse(ClientSession[0]);
                NewId = Common.Utils.GetNewId(intNodeId, Utils.GetNextSecuentialId(intNodeId, 11), "OA");;
                objEntity.v_AreaId = NewId;

                dbContext.AddToarea(objEntity);
                dbContext.SaveChanges();

                pobjOperationResult.Success = 1;
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "ÁREA", "v_AreaId=" + NewId.ToString(), Success.Ok, null);
                return;
            }
            catch (Exception ex)
            {
                pobjOperationResult.Success          = 0;
                pobjOperationResult.ExceptionMessage = Common.Utils.ExceptionFormatter(ex);
                // Llenar entidad Log
                LogBL.SaveLog(ClientSession[0], ClientSession[1], ClientSession[2], LogEventType.CREACION, "ÁREA", "v_AreaId=" + NewId.ToString(), Success.Failed, pobjOperationResult.ExceptionMessage);
                return;
            }
        }
예제 #11
0
        public async Task <IActionResult> Edit(string id, [Bind("ID_area,Nombre_area")] area area)
        {
            if (id != area.ID_area)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(area);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!areaExists(area.ID_area))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(area));
        }
예제 #12
0
 public void SubmitForm()
 {
     try
     {
         string       keyValue     = ctx.Request["keyValue"];
         HttpRequest  request      = HttpContext.Current.Request;
         Stream       stream       = request.InputStream;
         StreamReader streamReader = new StreamReader(stream);
         string       json         = string.Empty;
         json = streamReader.ReadToEnd();
         json = HttpUtility.UrlDecode(json);
         string[] area       = json.Split('&');
         area     areaEntity = new area();
         areaEntity.parentid = Convert.ToInt32(area[0].Split('=')[1]);
         areaEntity.fullname = area[1].Split('=')[1];
         areaEntity.layers   = Convert.ToInt32(area[2].Split('=')[1]);
         areaEntity.encode   = area[3].Split('=')[1];
         areaEntity.id       = Convert.ToInt32(areaEntity.encode);
         IdalCommon.IareaEx.SubmitForm(areaEntity, keyValue);
         Success("操作成功!");
     }
     catch (Exception)
     {
         Error("操作失败!");
     }
 }
예제 #13
0
 public area_parentId(area r)
 {
     this.id       = r.id;
     this.fullname = r.fullname;
     this.layers   = r.layers;
     this.encode   = r.encode;
     this.parentid = r.parentid;
 }
예제 #14
0
 public void Post(area ar)
 {
     if (ModelState.IsValid)
     {
         myEntity.areas.Add(ar);
         myEntity.SaveChanges();
     }
 }
예제 #15
0
        private void addarea(area are)
        {
            MysqlTOOLS mt  = new MysqlTOOLS();
            string     sql = $"INSERT into area (area_name,area_city,area_province) VALUES('{are.name}','{are.city}','{are.province}')";

            //Button2.Text = sql;
            mt.sqlToExec(sql);
        }
예제 #16
0
        //-------------FUNCIONES DE CONSULTAR
        public static int Get_Area()
        {
            GrupoLiEntities contexto = new GrupoLiEntities();
            var             consulta = new area();
            int             id       = contexto.area.Max(x => x.id_area);

            return(id);
        }
예제 #17
0
        public ActionResult DeleteConfirmed(int id)
        {
            area area = db.area.Find(id);

            db.area.Remove(area);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #18
0
 protected void dgArea_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
 {
     if (e.NewSelectedIndex > -1)
     {
         area ob = aBLL.GetById(Convert.ToInt32(dgArea.DataKeys[e.NewSelectedIndex].Value));
         FillText(ob);
     }
 }
예제 #19
0
 public ActionResult Edit([Bind(Include = "idarea,nombre,cordinador")] area area)
 {
     if (ModelState.IsValid)
     {
         AreaBLL.Update(area);
         return(RedirectToAction("Index"));
     }
     return(View(area));
 }
예제 #20
0
 public static AreaDTO ConvertDalToDto(area are)
 {
     return(new AreaDTO()
     {
         id = are.id,
         corporation_code = are.corporation_code,
         ring_or_area = are.ring_or_area,
     });
 }
예제 #21
0
        protected void EditarRegistro(object sender, EventArgs e)
        {
            int IdSucursal = Mgr_Sucursal.Set_IdSucursalDDl(ObjUsuario, ddlSucursalEdit);

            int id_area_padre = 0;

            if (!chkAreaEdit.Checked || ddlAreasEdit.SelectedValue == string.Empty)
            {
                strNivel = 1;
            }
            else
            {
                id_area_padre = Convert.ToInt32(ddlAreasEdit.SelectedValue);

                List <area> ListaArea = new List <area>();
                ListaArea = Mgr_Area.Get_Area(0, Convert.ToInt32(ddlAreasEdit.SelectedValue), "");

                foreach (var item in ListaArea)
                {
                    strNivel = Convert.ToInt32(item.nivel.ToString());
                }

                if (strNivel == 3)
                {
                    strNivel = 4;
                }
                if (strNivel == 2)
                {
                    strNivel = 3;
                }
                if (strNivel == 1)
                {
                    strNivel = 2;
                }
            }

            GrupoLiEntities contexto = new GrupoLiEntities();
            int             idArea   = Convert.ToInt32(hdfAreaID.Value);
            area            Edit     = contexto.area.SingleOrDefault(b => b.id_area == idArea);

            if (Edit != null)
            {
                Edit.nombre        = txtNombreEdit.Text;
                Edit.id_sucursal   = IdSucursal;
                Edit.id_area_padre = id_area_padre;
                Edit.nivel         = strNivel;
                Edit.tipo          = ddlTipoAreaEdit.SelectedValue;
            }
            ObjUsuario.Error = CRUD.Edit_Fila(contexto);

            Modal.CerrarModal("editModal", "EditModalScript", this);

            Modal.MostrarAlertaEdit(phAlerta, divAlerta, lbAlerta, ObjUsuario.Error, txtBuscar);

            LlenarGridView();
            CargarListas();
        }
예제 #22
0
 public ActionResult Edit([Bind(Include = "id,descripcion")] area area)
 {
     if (ModelState.IsValid)
     {
         db.Entry(area).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(area));
 }
예제 #23
0
        public static void ReadAreas(accounts acc, String usrHash)
        {
            if (Service.IService != null)
            {
                getAreasResponse areaResponse = null;

                try
                {
                    //faz a leitura das areas
                    areaResponse = Service.IService.getAreas(new getAreasRequest(usrHash));
                }
                catch
                {
                    areaResponse = null;
                }

                if (areaResponse != null)
                {   //leitura feita corretamente
                    area docRecent = new area();
                    docRecent.active = true;
                    docRecent.edit   = true;
                    docRecent.nome   = "Arquivos recentes";
                    docRecent.id     = DOC_RECENT_ID;
                    Addin.Areas.Add(docRecent);

                    area[] areas = areaResponse.@return;

                    if (areas != null && areas.Length > 0)
                    {
                        var condition = areas.Where(a => a.nome != null && !String.IsNullOrEmpty(a.nome.TrimStart().TrimEnd()) && a.active);
                        if (condition != null)
                        {
                            Addin.Areas.AddRange(condition);

                            for (Int32 i = 0; i < Addin.Areas.Count; i++)
                            {   //coloca a area privada na MY_ACCOUNT_POS da array
                                if (Addin.Areas[i].id == MY_ACCOUNT_ID && i != MY_ACCOUNT_POS)
                                {
                                    area aux = Addin.Areas[MY_ACCOUNT_POS];
                                    Addin.Areas[MY_ACCOUNT_POS] = Addin.Areas[i];
                                    Addin.Areas[i] = aux;
                                }
                            }

                            area trash = new area();
                            trash.active = true;
                            trash.edit   = true;
                            trash.nome   = "Lixeira";
                            trash.id     = TRASH_ID;
                            Addin.Areas.Add(trash);
                        }
                    }
                }
            }
        }
예제 #24
0
        public HttpResponseMessage Post([FromBody] Models.area mArea)
        {
            try
            {
                if (string.IsNullOrEmpty(mArea.area_name))
                {
                    var formatter = RequestFormat.JsonFormaterString();
                    return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                        output = "error", msg = "Area Name is Empty"
                    }, formatter));
                }



                if (_areaRepository.CheckDuplicateZoneArea(mArea))
                {
                    var formatter = RequestFormat.JsonFormaterString();
                    return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                        output = "error", msg = "Same Area and Zone Already Exists! "
                    }, formatter));
                }
                else
                {
                    area insertArea = new area
                    {
                        area_name    = mArea.area_name,
                        area_code    = mArea.area_code,
                        region_id    = mArea.region_id,
                        is_active    = mArea.is_active,
                        created_by   = mArea.created_by,
                        created_date = DateTime.Now,
                        updated_by   = mArea.updated_by,
                        updated_date = DateTime.Now
                    };



                    _areaRepository.AddArea(insertArea);


                    var formatter = RequestFormat.JsonFormaterString();
                    return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                        output = "success", msg = "Area saved successfully"
                    }, formatter));
                }
            }
            catch (Exception ex)
            {
                var formatter = RequestFormat.JsonFormaterString();
                return(Request.CreateResponse(HttpStatusCode.OK, new Confirmation {
                    output = "error", msg = ex.ToString()
                }, formatter));
            }
        }
예제 #25
0
        public async Task <IActionResult> Create([Bind("ID_area,Nombre_area")] area area)
        {
            if (ModelState.IsValid)
            {
                _context.Add(area);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(area));
        }
        public ActionResult Create([Bind(Include = "codigoArea,nombreArea")] area area)
        {
            if (ModelState.IsValid)
            {
                db.area.Add(area);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(area));
        }
예제 #27
0
        public ActionResult Create([Bind(Include = "id,descripcion")] area area)
        {
            if (ModelState.IsValid)
            {
                db.area.Add(area);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(area));
        }
예제 #28
0
        public async Task <IHttpActionResult> Getarea(int id)
        {
            area area = await db.area.FindAsync(id);

            if (area == null)
            {
                return(NotFound());
            }

            return(Ok(area));
        }
예제 #29
0
        private Guid AddArea()
        {
            area v = new area();

            using (var context = new DataContext(_seed, DBTypeEnum.Memory))
            {
                context.Set <area>().Add(v);
                context.SaveChanges();
            }
            return(v.ID);
        }
예제 #30
0
        /// <summary>
        /// 构造函数,单纯显示树形
        /// </summary>
        /// <param name="currentNode">当前区域</param>
        public AreaTree(area currentNode)//单纯显示树形
        {
            this.area = currentNode;

            List <area> allNodes = IareaEx.getEntityList().Where(p => Convert.ToInt32(p.parentid) == currentNode.id).ToList(); //获取属于这个节点的子节点

            foreach (area a in allNodes)                                                                                       //遍历当前节点下的所有子节点
            {
                AreaTree tn = new AreaTree(a);
                this.children.Add(tn);//递归创建子节点
            }
        }
예제 #31
0
 public string ActualizarArea(area a)
 {
     string resultado = String.Empty;
     try
     {
         contexto.PR_ACTUALIZAR_AREA(a.area_cod, a.area_des);
         resultado = "Ok";
     }
     catch (Exception ex)
     {
         resultado = ex.Message;
     }
     return resultado;
 }
예제 #32
0
 public string ActualizarArea(area a)
 {
     string res = String.Empty;
     try
     {
         context.PR_ACTUALIZAR_AREA(a.are_cod, a.are_des);
         res = "OK";
     }
     catch (Exception ex)
     {
         res = ex.Message;
     }
     return res;
 }
예제 #33
0
 public string InsertarArea(area a)
 {
     string resultado = String.Empty;
     try
     {
         contexto.PR_INSERTAR_AREA(a.area_des);
         resultado = "Ok";
     }
     catch (Exception ex)
     {
         resultado = ex.Message;
     }
     return resultado;
 }
예제 #34
0
 public string insertaArea(area a)
 {
     string res = String.Empty;
     try
     {
         context.PR_INSERTAR_AREA(a.are_des);
         res = "OK";
     }
     catch (Exception ex)
     {
         res = ex.Message;
     }
     return res;
 }
예제 #35
0
        public area BuscarArea(int codigo)
        {
            area a = new area();
            try {
                var consulta = contexto.PR_BUSCAR_AREA(codigo);

                foreach(var area in consulta){
                    a.are_cod = area.are_cod;
                    a.are_des = area.are_des;
                }
            }
            catch (Exception) {
                throw;
            }
            return a;
        }
예제 #36
0
        public List<area> ListarAreas() {
            List<area> lista = new List<area>();

            var consulta = context.PR_LISTAR_AREA();

            foreach (var area in consulta)
            {
                area a = new area();
                a.are_cod = area.are_cod;
                a.are_des = area.are_des;

                lista.Add(a);
            }

            return lista;
        }
예제 #37
0
 public ActionResult Create(area a)
 {
     try
     {
         if (model.InsertarArea(a).Equals("Ok"))
         {
             return RedirectToAction("Index");
         }
         else
         {
             return RedirectToAction("Create");
         }
     }
     catch
     {
         return View();
     }
 }
예제 #38
0
        public ActionResult Edit(int id, area a) {
            try
            {
                area area = new area();
                area.are_cod = id;
                area.are_des = a.are_des;

                if (model.ActualizarArea(area).Equals("OK"))
                {
                    return RedirectToAction("Index");
                }
                else {
                    return RedirectToAction("Edit");
                }
            }
            catch 
            {
                return View();
            }
        }
예제 #39
0
파일: User.cs 프로젝트: nikkw/W2C
        public static void ReadAreas(accounts acc, String usrHash)
        {
            if (Service.IService != null)
            {
                getAreasResponse areaResponse = null;

                try
                {
                    //faz a leitura das areas
                    areaResponse = Service.IService.getAreas(new getAreasRequest(usrHash));
                }
                catch
                {
                    areaResponse = null;
                }

                if (areaResponse != null)
                {   //leitura feita corretamente

                    area docRecent = new area();
                    docRecent.active = true;
                    docRecent.edit = true;
                    docRecent.nome = "Arquivos recentes";
                    docRecent.id = DOC_RECENT_ID;
                    Addin.Areas.Add(docRecent);

                    area[] areas = areaResponse.@return;

                    if (areas != null && areas.Length > 0)
                    {
                        var condition = areas.Where(a => a.nome != null && !String.IsNullOrEmpty(a.nome.TrimStart().TrimEnd()) && a.active);
                        if (condition != null)
                        {
                            Addin.Areas.AddRange(condition);

                            for (Int32 i = 0; i < Addin.Areas.Count; i++)
                            {   //coloca a area privada na MY_ACCOUNT_POS da array
                                if (Addin.Areas[i].id == MY_ACCOUNT_ID && i != MY_ACCOUNT_POS)
                                {
                                    area aux = Addin.Areas[MY_ACCOUNT_POS];
                                    Addin.Areas[MY_ACCOUNT_POS] = Addin.Areas[i];
                                    Addin.Areas[i] = aux;
                                }
                            }

                            area trash = new area();
                            trash.active = true;
                            trash.edit = true;
                            trash.nome = "Lixeira";
                            trash.id = TRASH_ID;
                            Addin.Areas.Add(trash);
                        }
                    }
                }
            }
        }