コード例 #1
0
        /*
        Metodo que inserta un nuevo grupo
        */
        protected void AddGroup_Click(object sender, EventArgs e)
        {
            string value = ValueGroup.Text;
            if (value != "")
            {
                EquipmentService equipmentService = new EquipmentService();

                String user = Context.User.Identity.Name;
                AuditDataFromWeb audit = new AuditDataFromWeb();
                audit.Reason = "N/A";
                audit.StationIP = General.getIp(this.Page);
                audit.UserName = user;

                CUDView crud = equipmentService.insertEquipmentGroup(value, audit);

                if (crud.insert == false)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not insert the Value')", true);
                }
                else
                {
                    ValueGroup.Text = "";
                    filEquipmentGroupTable();
                    upModalSuccess.Update();
                }
            }
        }
コード例 #2
0
        protected void AddGroup_Click(object sender, EventArgs e)
        {
            string value = ValueGroup.Text;
            if (value != "")
            {
                EquipmentService equipmentService = new EquipmentService();
                CUDView crud =  equipmentService.insertEquipmentGroup(value);

                if (crud.insert == false)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not insert the Value')", true);
                }
                else
                {
                    ValueGroup.Text = "";
                    filEquipmentGroupTable();
                    upModalSuccess.Update();
                }
            }
        }
コード例 #3
0
        protected void addBrand_Click(object sender, EventArgs e)
        {
            string value = valueBrand.Text;
            if (value != "")
            {
                EquipmentService equipmentService = new EquipmentService();
                CUDView crud = equipmentService.insertBrand(value);

                if (crud.insert == false)
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not insert the Value')", true);
                }
                else
                {
                    valueBrand.Text = "";
                    fillBrandGroupTable();
                    updateBrandModal.Update();
                }

            }
        }
コード例 #4
0
        /*
        Metodo que se utiliza para guardar un nuevo equipo
        */
        private void saveAuxiliar()
        {
            //Se verifica que se haya completado el grupo y el brand
            if (EquipmentGroupText.SelectedItem != null & BrandText.SelectedItem != null)
            {
                //Se verifica que los demas campos esten completos
                if (EquipmentGroupText.SelectedItem.Value != "" & BrandText.SelectedItem.Value != ""
                    & HMIAddressText.Text != "" & EquipmentIdText.Text != "" &
                    LocationText.Text != "" & ModelText.Text != "" & PLCAddressText.Text != "")
                {
                    //Se crea el servicio
                    EquipmentService equipmentService = new EquipmentService();
                    EquipmentInsertView insertView = new EquipmentInsertView();
                    //Se llenan los datos
                    insertView.BrandId = Int32.Parse(BrandText.SelectedItem.Value);
                    insertView.GroupId = Int32.Parse(EquipmentGroupText.SelectedItem.Value);
                    insertView.HMIAddress = HMIAddressText.Text;
                    insertView.Id = EquipmentIdText.Text;
                    insertView.Location = LocationText.Text;
                    insertView.Model = ModelText.Text;
                    insertView.PLCAddress = PLCAddressText.Text;
                    insertView.PLCLink = ethernetLink.Items[0].Selected;
                    insertView.Status = EquipmentEnable.Items[0].Selected;
                    //Se llenan los datos para la auditoria
                    String user = Context.User.Identity.Name;
                    AuditDataFromWeb audit = new AuditDataFromWeb();
                    audit.Reason = "N/A";
                    audit.StationIP = General.getIp(this.Page);
                    audit.UserName = user;
                    //Se realiza la insercion
                    CUDView crud = equipmentService.insertEquipment(insertView, audit);

                    if (crud.insert == false)
                    {
                        if (crud.errorMessage == "errHMIPLC")
                        {
                            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('The IP address of the PLC or HMI is already assigned.')", true);
                        }
                        else
                        {
                            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not insert the Equipment')", true);
                        }
                    }
                    else
                    {
                        clearFields1();
                        fillEquipmentTable();
                    }

                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true);
                }

            }
            else
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true);
            }
        }
コード例 #5
0
 /*
 Metodo que se utiliza para llenar la tabla de Equipos
 */
 private void fillEquipmentTable()
 {
     EquipmentService equipmentService = new EquipmentService();
     List<EquipmentView> equipmentData = equipmentService.getEquipments();
     GridView3.DataSource = equipmentData;
     GridView3.PageIndex = 0;
     GridView3.DataBind();
 }
コード例 #6
0
 /*
  Metodo que llena la tabla de EquipmentBrand de la tabla de EquipmentGroup
 */
 private void fillBrandGroupTable()
 {
     EquipmentService equipmentService = new EquipmentService();
     List<BrandView> brands = equipmentService.getEquipmentBrand();
     GridView2.DataSource = brands;
     GridView2.DataBind();
 }
コード例 #7
0
        /*
        Metodo que llena el dropdown list de EquipmetBrand
        */
        private void fillBrandGroup()
        {
            EquipmentService equipmentService = new EquipmentService();
            List<BrandView> brands = equipmentService.getEquipmentBrand();
            BrandText.DataSource = brands;
            BrandText.DataBind();

            ListItem l = new ListItem("", "", true);
            l.Selected = true;
            BrandText.Items.Insert(0, l);
        }
コード例 #8
0
 /*
 Metodo que llena la tabla de EquipmentGroup de la tabla de EquipmentGroup
 */
 private void filEquipmentGroupTable()
 {
     EquipmentService equipmentService = new EquipmentService();
     List<EquipmentGroupView> groups = equipmentService.getEquipmentGroup();
     GridView1.DataSource = groups;
     GridView1.DataBind();
 }
コード例 #9
0
 /*
 Metodo que se invoca cuando se presiona el botón de búsqueda, carga la lista de equipos con el filtro de búsqueda
 */
 protected void searchButton_Click(object sender, ImageClickEventArgs e)
 {
     EquipmentService equipmentService = new EquipmentService();
     List<EquipmentView> equipmentData = equipmentService.searchEquipment(searchText.Text);
     GridView3.DataSource = equipmentData;
     GridView3.DataBind();
 }
コード例 #10
0
        private void updateAuxiliar()
        {
            if (HttpContext.Current.Session["EquipmentId"] != null)
            {
                if (HMIAddressText.Text != "" & PLCAddressText.Text != "" & LocationText.Text != "")
                {
                    string confirmValue = Request.Form["confirm_value"];
                    if (confirmValue == "Yes")
                    {
                        EquipmentService equipmentService = new EquipmentService();
                        EquipmentUpdateView equipment = new EquipmentUpdateView();

                        equipment.HMIAddress = HMIAddressText.Text;
                        equipment.Location = LocationText.Text;
                        equipment.PLCAddress = PLCAddressText.Text;
                        equipment.PLCLink = ethernetLink.Items[0].Selected;
                        equipment.Status = EquipmentEnable.Items[0].Selected;
                        equipment.Id = EquipmentIdText.Text;

                        CUDView crud = equipmentService.updateEquipment(equipment);

                        if (crud.update == false)
                        {
                            this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the Equipment')", true);
                        }

                        clearFields1();
                        fillEquipmentTable();
                    }
                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true);
                }
            }
        }
コード例 #11
0
        private void saveAuxiliar()
        {
            if (EquipmentGroupText.SelectedItem != null & BrandText.SelectedItem != null)
            {
                if (EquipmentGroupText.SelectedItem.Value != "" & BrandText.SelectedItem.Value != "" &
                    EquipmentSubIdText.Text != "" & HMIAddressText.Text != "" & EquipmentIdText.Text != "" &
                    LocationText.Text != "" & ModelText.Text != "" & PLCAddressText.Text != ""){

                    int n;
                    bool isNumeric = int.TryParse(EquipmentSubIdText.Text, out n);

                    if (isNumeric)
                    {
                        string confirmValue = Request.Form["confirm_value"];
                        if (confirmValue == "Yes")
                        {
                            EquipmentService equipmentService = new EquipmentService();
                            EquipmentInsertView insertView = new EquipmentInsertView();

                            insertView.BrandId = Int32.Parse(BrandText.SelectedItem.Value);

                           // insertView.GroupConsecutive = Int32.Parse(EquipmentSubIdText.Text);

                            insertView.GroupId = Int32.Parse(EquipmentGroupText.SelectedItem.Value);
                            insertView.HMIAddress = HMIAddressText.Text;
                            insertView.Id = EquipmentIdText.Text;
                            insertView.Location = LocationText.Text;
                            insertView.Model = ModelText.Text;
                            insertView.PLCAddress = PLCAddressText.Text;
                            insertView.PLCLink = ethernetLink.Items[0].Selected;
                            insertView.Status = EquipmentEnable.Items[0].Selected;

                            CUDView crud = equipmentService.insertEquipment(insertView);

                            if (crud.insert == false)
                            {
                                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not insert the Equipment')", true);
                            }
                            else
                            {
                                clearFields1();
                                fillEquipmentTable();
                            }
                        }
                    }
                    else
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Equipment Sub Id must be numeric.')", true);
                    }

                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true);
                }

            }
            else
            {
                this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true);
            }
        }
コード例 #12
0
        protected void UpdateGroup_Click(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["EquipmentGroupId"] != null) {

                string value = ValueGroup.Text;
                if (value != "")
                {
                    EquipmentService equipmentService = new EquipmentService();
                    EquipmentGroupView groupView = new EquipmentGroupView();

                    groupView.EquipmentGroupId = Int32.Parse(HttpContext.Current.Session["EquipmentGroupId"].ToString());
                    groupView.EquipmentGroupName = value;

                    CUDView crud = equipmentService.UpdateEquipmentGroup(groupView);

                    if (crud.update == false)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the Value')", true);
                    }
                    else
                    {
                        ValueGroup.Text = "";
                        filEquipmentGroupTable();
                        upModalSuccess.Update();
                    }
                }
            }
        }
コード例 #13
0
        protected void updateBrand_Click(object sender, EventArgs e)
        {
            if (HttpContext.Current.Session["BrandGroupId"] != null)
            {

                string value = valueBrand.Text;
                if (value != "")
                {
                    EquipmentService equipmentService = new EquipmentService();
                    BrandView brandView = new BrandView();

                    brandView.BrandId = Int32.Parse(HttpContext.Current.Session["BrandGroupId"].ToString());
                    brandView.BrandName = value;

                    CUDView crud = equipmentService.updateBrand(brandView);

                    if (crud.update == false)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the Value')", true);
                    }
                    else
                    {
                        valueBrand.Text = "";
                        fillBrandGroupTable();
                        updateBrandModal.Update();
                    }
                }
            }
        }
コード例 #14
0
        /*
        Metodo que se utiliza para realizar una actualizacion
        */
        private void updateAuxiliar()
        {
            //Se verifica que se haya seleccionado un equipo
            if (HttpContext.Current.Session["EquipmentId"] != null)
            {
                //Se verifica que se hayan completado los espacios HMI, PLC y Location
                if (HMIAddressText.Text != "" & PLCAddressText.Text != "" & LocationText.Text != "")
                {
                    //Se obtienen los datos
                    EquipmentService equipmentService = new EquipmentService();
                    EquipmentUpdateView equipment = new EquipmentUpdateView();
                    equipment.HMIAddress = HMIAddressText.Text;
                    equipment.Location = LocationText.Text;
                    equipment.PLCAddress = PLCAddressText.Text;
                    equipment.PLCLink = ethernetLink.Items[0].Selected;
                    equipment.Status = EquipmentEnable.Items[0].Selected;
                    equipment.Id = EquipmentIdText.Text;
                    //Se muestra la ventana de justificacion para la actualizacion
                    String reason = Session["reason"].ToString();
                    String user = Context.User.Identity.Name;
                    //Se llenan los datos para la auditoria
                    AuditDataFromWeb audit = new AuditDataFromWeb();
                    audit.Reason = reason;
                    audit.StationIP = General.getIp(this.Page);
                    audit.UserName = user;
                    //Se realiza la actualizacion
                    CUDView crud = equipmentService.updateEquipment(equipment, audit);

                    if (crud.update == false)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the Equipment')", true);
                    }

                    clearFields1();
                    fillEquipmentTable();

                }
                else
                {
                    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Please complete all fields.')", true);
                }
            }
        }
コード例 #15
0
        /*
        Metodo que llena el dropdown list de EquipmetGroup
        */
        private void filEquipmentGroup()
        {
            EquipmentService equipmentService = new EquipmentService();
            List<EquipmentGroupView> groups = equipmentService.getEquipmentGroup();

            EquipmentGroupText.DataSource = groups;
            EquipmentGroupText.DataBind();

            ListItem l = new ListItem("", "", true);
            l.Selected = true;
            EquipmentGroupText.Items.Insert(0, l);
        }
コード例 #16
0
        /*
        Metodo para actualizar un grupo
           */
        private void updateGroupAux()
        {
            if (HttpContext.Current.Session["EquipmentGroupId"] != null)
            {
                string value = ValueGroup.Text;
                if (value != "")
                {

                    String reason = Session["reason"].ToString();
                    String user = Context.User.Identity.Name;
                    AuditDataFromWeb audit = new AuditDataFromWeb();
                    audit.Reason = reason;
                    audit.StationIP = General.getIp(this.Page);
                    audit.UserName = user;

                    EquipmentService equipmentService = new EquipmentService();
                    EquipmentGroupView groupView = new EquipmentGroupView();

                    groupView.EquipmentGroupId = Int32.Parse(HttpContext.Current.Session["EquipmentGroupId"].ToString());
                    groupView.EquipmentGroupName = value;

                    CUDView crud = equipmentService.UpdateEquipmentGroup(groupView, audit);

                    if (crud.update == false)
                    {
                        this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Could not update the Value')", true);
                    }
                    else
                    {
                        ValueGroup.Text = "";
                        filEquipmentGroupTable();
                        upModalSuccess.Update();
                    }
                    HttpContext.Current.Session["operation"] = "create";
                    showGroupModal();
                }
            }
        }
コード例 #17
0
 /*Funcion: Obtener lista de equipos
   Param:
   Return: Lista de Equipmentss
   */
 public List<EquipmentView> getEquipmentList()
 {
     EquipmentService equipment = new EquipmentService();
     return equipment.getEquipments();
 }