Ejemplo n.º 1
0
        public void GenerateProductButtons()
        {
            Controls.Clear();

            int topDistance  = 10;
            int leftDistance = 10;

            for (int i = 0; i < products.Count; i++)
            {
                Button productButton = new Button();
                productButton.Parent    = this;
                productButton.Name      = products.ElementAt(i).Name + "Button";
                productButton.Text      = products.ElementAt(i).Name;
                productButton.ForeColor = Color.Red;
                productButton.Top       = topDistance;
                productButton.Left      = leftDistance;
                if (i % 5 == 0 && i != 0)
                {
                    topDistance       += 100;
                    leftDistance       = 10;
                    productButton.Top  = topDistance;
                    productButton.Left = leftDistance;
                }
                leftDistance      += 100;
                productButton.Size = new Size(80, 60);

                productButton.Click += ProductButton_Click;
            }

            DrawGenerateReceiptButton();
        }
Ejemplo n.º 2
0
        public static void updateLuotThuoc(int ID, int soLuongThem)
        {
            if (currentLuotKhamID == -1)
            {
                return;
            }
            LuotThuoc lt    = LuotThuocDAO.getLuotThuoc(ID);
            int       index = -1;

            for (int i = 0; i < listLuotThuoc.Count; i++)
            {
                if (listLuotThuoc.ElementAt(i).ID == ID)
                {
                    index = i;
                }
            }
            if (index == -1 || lt == null)
            {
                return;
            }
            lt.SoLuong += soLuongThem;
            lt.ChiPhi  += soLuongThem * ThuocDAO.getThuoc(lt.Thuoc).DonGia;
            listLuotThuoc.ElementAt(index).soluong2 = (int)lt.SoLuong;
            listLuotThuoc.ElementAt(index).chiphi2  = (double)lt.ChiPhi;
            LuotThuocDAO.updateLuotThuoc(ID, lt);
        }
Ejemplo n.º 3
0
        private void pingSelOnceButton_Click(object sender, EventArgs e)
        {
            string ip = IpFix(ipList.ElementAt(addressBox.SelectedIndex));

            pingChart.Series.Clear();
            pingChart.Series.Add(ip);
            ping(ip, 1);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 运算开始(Parallel+Lock)
        /// </summary>
        public void Process()
        {
            object obj = new object();

            Action[] processitems = new Action[_tasks.Count];
            for (int i = 0; i < _tasks.Count; i++)
            {
                processitems[i] = _tasks.ElementAt(i).Process;
            }
            Parallel.Invoke(processitems);
        }
Ejemplo n.º 5
0
        private void btnCommentCrudEdit_Click(object sender, EventArgs e)
        {
            int           commentIndex = dgvCommentTable.CurrentCell.RowIndex;
            CommentEntity comment      = AllComments.ElementAt(commentIndex);
            CRUD_Comment  crudComment  = new CRUD_Comment(comment);

            crudComment.ShowDialog();

            if (crudComment.DialogResult == DialogResult.OK)
            {
                dgvCommentTable.InvalidateRow(commentIndex);
            }
        }
Ejemplo n.º 6
0
 public void Start()
 {
     foreach (EffectStep step in Steps)
     {
         step.InitializeStep();
     }
     _running     = true;
     _currentStep = 0;
     if (Steps.Count > 0)
     {
         Steps.ElementAt(0).Run();
     }
 }
Ejemplo n.º 7
0
        public BindingList <Orden> listarOrdenes()
        {
            BindingList <Orden> lista = new BindingList <Orden>();
            String          cadena    = "server=50.62.209.188;" + "user=fpaz; password=123456; database=LP2;" + "port=3306";
            MySqlConnection conn      = new MySqlConnection(cadena);

            conn.Open();
            MySqlCommand comando = new MySqlCommand();

            comando.CommandText = "SELECT * FROM ORDEN";
            comando.Connection  = conn;

            MesaDA             mesaDA   = new MesaDA();
            BindingList <Mesa> lstMesas = new BindingList <Mesa>();

            lstMesas = mesaDA.listarMesas();

            OrdenMenuDetalleDA detalleDA = new OrdenMenuDetalleDA();
            BindingList <Orden_Menu_Detalle> lstDetalle = new BindingList <Orden_Menu_Detalle>();

            lstDetalle = detalleDA.listarDetalleDeOrden();

            MySqlDataReader reader = comando.ExecuteReader();

            while (reader.Read())
            {
                Orden o = new Orden();
                o.Id = reader.GetInt32(0);
                int idMesa = reader.GetInt32(1);
                for (int i = 0; i < lstMesas.Count(); i++)
                {
                    if (lstMesas.ElementAt(i).Id == o.Id)
                    {
                        o.Mesa = lstMesas.ElementAt(i);
                        break;
                    }
                }
                for (int i = 0; i < lstDetalle.Count(); i++)
                {
                    if (lstDetalle.ElementAt(i).IdOrden == o.Id)
                    {
                        o.DetalleOrden.Add(lstDetalle.ElementAt(i));
                    }
                }
                o.Hora_orden = reader.GetDateTime(2);
                o.PreioTotal = reader.GetDouble(3);
                lista.Add(o);
            }
            conn.Close();
            return(lista);
        }
Ejemplo n.º 8
0
        public BindingList <Orden_Menu_Detalle> listarDetalleDeOrden()
        {
            BindingList <Orden_Menu_Detalle> lista = new BindingList <Orden_Menu_Detalle>();
            String          cadena = "server=50.62.209.188;" + "user=fpaz; password=123456; database=LP2;" + "port=3306";
            MySqlConnection conn   = new MySqlConnection(cadena);

            conn.Open();
            MySqlCommand comando = new MySqlCommand();

            comando.CommandText = "SELECT * FROM ORDEN_MENU_DETALLE";
            comando.Connection  = conn;

            MySqlDataReader reader = comando.ExecuteReader();

            EntradaDA             entradaDA   = new EntradaDA();
            BindingList <Entrada> lstEntradas = new BindingList <Entrada>();

            lstEntradas = entradaDA.listarEntradas();

            PlatoFondoDA             platoFondoDA   = new PlatoFondoDA();
            BindingList <PlatoFondo> lstPlatosFondo = new BindingList <PlatoFondo>();

            lstPlatosFondo = platoFondoDA.listarPlatoFondo();

            while (reader.Read())
            {
                Orden_Menu_Detalle detalle = new Orden_Menu_Detalle();
                detalle.Id      = reader.GetInt32(0);
                detalle.IdOrden = reader.GetInt32(1);
                for (int i = 0; i < lstEntradas.Count(); i++)
                {
                    if (lstEntradas.ElementAt(i).Id == reader.GetInt32(2))
                    {
                        detalle.Entrada = lstEntradas.ElementAt(i);
                        break;
                    }
                }
                for (int i = 0; i < lstPlatosFondo.Count(); i++)
                {
                    if (lstPlatosFondo.ElementAt(i).Id == reader.GetInt32(3))
                    {
                        detalle.PlatoFondo = lstPlatosFondo.ElementAt(i);
                        break;
                    }
                }
                lista.Add(detalle);
            }
            conn.Close();
            return(lista);
        }
Ejemplo n.º 9
0
        private void btnPlaceEdit_Click(object sender, EventArgs e)
        {
            int         placeIndex = dgvPlaceTable.CurrentCell.RowIndex;
            PlaceEntity place      = AllPlaces.ElementAt(placeIndex);
            CRUD_Place  crudPlace  = new CRUD_Place(place);

            crudPlace.editing = true;
            crudPlace.ShowDialog();

            if (crudPlace.DialogResult == DialogResult.OK)
            {
                dgvPlaceTable.InvalidateRow(placeIndex);
            }
        }
Ejemplo n.º 10
0
        private void btnUserEdit_Click(object sender, EventArgs e)
        {
            int        userIndex = dgvUserTable.CurrentCell.RowIndex;
            UserEntity user      = AllUsers.ElementAt(userIndex);

            CRUD_User crudUser = new CRUD_User(user);

            crudUser.editing = true;
            crudUser.ShowDialog();

            if (crudUser.DialogResult == DialogResult.OK)
            {
                dgvUserTable.InvalidateRow(userIndex);
            }
        }
Ejemplo n.º 11
0
        private void btnInfoEdit_Click(object sender, EventArgs e)
        {
            int        infoIndex = dgvInfoTable.CurrentCell.RowIndex;
            InfoEntity info      = AllInfos.ElementAt(infoIndex);

            CRUD_Information crudInfo = new CRUD_Information(info, login.Id);

            crudInfo.editing = true;
            crudInfo.ShowDialog();

            if (crudInfo.DialogResult == DialogResult.OK)
            {
                dgvInfoTable.InvalidateRow(infoIndex);
            }
        }
Ejemplo n.º 12
0
        private void btnCategoryEdit_Click(object sender, EventArgs e)
        {
            int            catIndex = dgvCategoryTable.CurrentCell.RowIndex;
            CategoryEntity cat      = AllCategories.ElementAt(catIndex);

            CRUD_Category crudCat = new CRUD_Category(cat);

            crudCat.editing = true;
            crudCat.ShowDialog();

            if (crudCat.DialogResult == DialogResult.OK)
            {
                dgvCategoryTable.InvalidateRow(catIndex);
            }
        }
Ejemplo n.º 13
0
        private void btnUTCrudEdit_Click(object sender, EventArgs e)
        {
            int            userTypeIndex = dgvUTTable.CurrentCell.RowIndex;
            UserTypeEntity userType      = AllUserTypes.ElementAt(userTypeIndex);

            CRUD_UserType crudUserType = new CRUD_UserType(userType);

            crudUserType.editing = true;
            crudUserType.ShowDialog();

            if (crudUserType.DialogResult == DialogResult.OK)
            {
                dgvUTTable.InvalidateRow(userTypeIndex);
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// delete item(s)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Delete_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure to delete the record?", "Dialog", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                LeaveDetailsService service = new LeaveDetailsService();
                for (int i = 0; i < RequestHistory.Rows.Count;)
                {
                    if (Convert.ToBoolean(RequestHistory.Rows[i].Cells[0].Value) == true)
                    {
                        LeaveDetails detail = new LeaveDetails();
                        detail = detailsBindingList.ElementAt(i);
                        detailsBindingList.RemoveAt(i);
                        service.RemoveDetails(detail);
                    }
                    else
                    {
                        i++;
                    }
                }
                RequestHistory.DataSource = null;
                allDetails.Clear();
                detailsBindingList.Clear();
                AssignDatatoList();
                AddLeavingsAttributetoList(allDetails);
                BindVactionDetails();
                nCurrent    = 0;
                pageCurrent = 0;
                InitPagingList();
                MessageBox.Show("Submit Successfully !");
            }
        }
Ejemplo n.º 15
0
        // starts the game and creates 3 random question
        private void startToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Random randomGenerator;

            int      index;
            Question tmpQuestion;

            randomGenerator = new Random();
            gameQuestions   = new List <Question>();

            int i = 0;

            //generates the 3 questions
            while (i < 3)
            {
                index       = randomGenerator.Next(0, questonlist.Count);
                tmpQuestion = questonlist.ElementAt(index);
                //checks to see if the tmpquestion is already in the question list
                if (!gameQuestions.Contains(tmpQuestion))
                {
                    gameQuestions.Add(tmpQuestion);
                    i++;
                }
            }
            newGame = new Game(gameQuestions);
            newGame.Show();
        }
Ejemplo n.º 16
0
 private void UsunBtn_Click(object sender, RoutedEventArgs e)
 {
     if (UmowaL.Count > 0)
     {
         using (var ctx = new BazyDanychContext())
         {
             Umowa tmp = new Umowa {
                 ID = UmowaL.ElementAt <Umowa>(UmowaList.SelectedIndex).ID
             };
             ctx.Spotkanie.Attach(tmp);
             ctx.Spotkanie.Remove(tmp);
             ctx.SaveChanges();
         }
     }
     InitTabs();
 }
Ejemplo n.º 17
0
 private void loadpanel()
 {
     try
     {
         lstEs   = new BindingList <cxc_EstadoCobro_Info>(estadoCobroBus.Get_List_EstadoCobro());
         lstSucu = new BindingList <tb_Sucursal_Info>(sucuBus.Get_List_Sucursal(param.IdEmpresa));
         lstEs.Insert(0, new cxc_EstadoCobro_Info()
         {
             IdEstadoCobro = "", Descripcion = "Todos"
         });
         cmbSucursal.Properties.DataSource = lstSucu;
         lstTipoDoc = new BindingList <cxc_cobro_tipo_Info>(cobroTipoBus.Get_List_Cobro_Tipo("S"));
         lstTipoDoc.Insert(0, new cxc_cobro_tipo_Info()
         {
             IdCobro_tipo = "", tc_descripcion = "Todos"
         });
         cmbEstadoCobro.Properties.DataSource = lstEs;
         dtHasta.EditValue = param.Fecha_Transac;
         dtDesde.EditValue = Convert.ToDateTime(dtHasta.EditValue).AddDays(-30);
         cmbTipoDoc.Properties.DataSource = lstTipoDoc;
         cmbEstadoCobro.EditValue         = lstEs.ElementAt(3).IdEstadoCobro;
         cmbTipoDoc.EditValue             = lstTipoDoc.ElementAt(0).IdCobro_tipo;
         cmbSucursal.EditValue            = lstSucu.ElementAt(0).IdSucursal;
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
     }
 }
Ejemplo n.º 18
0
        private void Login(string userName, string pass)
        {
            BindingList <Rol> roles = new BindingList <Rol>();

            try
            {
                user  = svc.Login(userName, pass);
                roles = rolManager.GetUserRoles(user.UserID);
            }
            catch (System.Exception excep)
            {
                MessageBox.Show(excep.Message);
            }

            if (roles.Count > 1)
            {
                comboRoles.DataSource    = roles;
                comboRoles.DisplayMember = "Nombre";
                comboRoles.SelectedIndex = 0;
                panelRoles.Show();
            }
            else
            {
                if (roles.Count < 1)
                {
                    throw new Exception("El usuario no tiene roles asignados, contacte a un administrativo!");
                }
                Rol rol = (Rol)roles.ElementAt(0);
                user.RoleID = rol.ID;
                user.Perfil = rol.Perfil;
                svc.SetUserFunctionalities(user);
                user.DetallesPersona = detallesManager.getDetalles(user.UserID);
                iniciar_sesion();
            }
        }
Ejemplo n.º 19
0
 // Random Group
 private void button10_Click(object sender, EventArgs e)
 {
     if (Topic.Count != 0)
     {
         foreach (var items in tm)
         {
             foreach (var item in items.Value)
             {
                 Std.Add(item);
             }
             items.Value.Clear();
         }
         int    ratio = Std.Count / Topic.Count;
         Random rand  = new Random();
         foreach (var items in tm)
         {
             for (int i = 0; i < ratio; i++)
             {
                 int index = rand.Next() % Std.Count;
                 items.Value.Add(Std.ElementAt(index));
                 Std.RemoveAt(index);
             }
         }
     }
 }
Ejemplo n.º 20
0
 private void KlientRemove_Click(object sender, RoutedEventArgs e)
 {
     if (KlientL.Count > 0)
     {
         using (var ctx = new BazyDanychContext())
         {
             Klient tmp = new Klient {
                 ID = KlientL.ElementAt <Klient>(KlientList.SelectedIndex).ID
             };
             ctx.Osoba.Attach(tmp);
             ctx.Osoba.Remove(tmp);
             ctx.SaveChanges();
         }
     }
     InitTabs();
 }
Ejemplo n.º 21
0
        private void updateStudentDetails(int index)
        {
            if (index == -1)
            {
                deleteStudentButton.Enabled = false;
                editStudentButton.Enabled   = false;
                return;
            }
            Student student = students.ElementAt(index);

            idDisplayText.Text      = student.Id.ToString();
            nameDisplayText.Text    = student.Name;
            classDisplayText.Text   = student.Class;
            sectionDisplayText.Text = student.Section;
            contactDisplayText.Text = student.Contact;
            addressDisplayText.Text = student.Address;
        }
Ejemplo n.º 22
0
 public override void AddToTable(ShipTable table)
 {
     table.shipCameras["Total"].Value = cameras.Count;
     for (int i = 0; i < cameras.Count; i++)
     {
         table.shipCameras["Camera" + (i + 1)] = cameras.ElementAt(i).ToTable();
     }
 }
Ejemplo n.º 23
0
        private void PopulateList()
        {
            string[]     arr = new string[4];
            ListViewItem item;

            for (int i = 0; i < products.Count; i++)
            {
                if (products.ElementAt(i).Quantity < 20)
                {
                    arr[0] = products.ElementAt(i).Id.ToString();
                    arr[1] = products.ElementAt(i).Name;
                    arr[2] = products.ElementAt(i).Price.ToString("C");
                    arr[3] = products.ElementAt(i).Quantity.ToString();
                    item   = new ListViewItem(arr);
                    productListView.Items.Add(item);
                }
            }
        }
Ejemplo n.º 24
0
 private void viewToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (leaderButton.Text == "Group")
     {
         new ProfileViewFrom(leaderGroups.ElementAt(LeaderList.SelectedIndex).photo_path,
                             leaderGroups.ElementAt(LeaderList.SelectedIndex).full_name,
                             leaderGroups.ElementAt(LeaderList.SelectedIndex).position.ToString(),
                             leaderGroups.ElementAt(LeaderList.SelectedIndex).id.ToString(),
                             leaderGroups.ElementAt(LeaderList.SelectedIndex).amount.ToString()).ShowDialog();
     }
     else
     {
         new ProfileViewFrom(leader_Streams.ElementAt(LeaderList.SelectedIndex).photo_path,
                             leader_Streams.ElementAt(LeaderList.SelectedIndex).full_name,
                             leader_Streams.ElementAt(LeaderList.SelectedIndex).position.ToString(),
                             leader_Streams.ElementAt(LeaderList.SelectedIndex).id.ToString()).ShowDialog();
     }
 }
Ejemplo n.º 25
0
        private void btnAddCliente_Click(object sender, EventArgs e)
        {
            if (txtRUC.Text == "")
            {
                MessageBox.Show("Debe seleccionar a un cliente", "Mensaje de advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            foreach (VisitaWS.visita v in misVisitas)
            {
                if (v.cliente.idCliente == miCliente.idCliente)
                {
                    return;
                }
            }
            VisitaWS.visita nuevaVisita = new VisitaWS.visita();
            nuevaVisita.cliente                = new VisitaWS.cliente();
            nuevaVisita.cliente.idCliente      = miCliente.idCliente;
            nuevaVisita.cliente.ruc            = miCliente.ruc;
            nuevaVisita.cliente.razonSocial    = miCliente.razonSocial;
            nuevaVisita.cliente.grupo          = miCliente.grupo;
            nuevaVisita.cliente.tipoEmpresa    = miCliente.tipoEmpresa;
            nuevaVisita.cliente.direccion      = miCliente.direccion;
            nuevaVisita.cliente.zona           = new VisitaWS.zona();
            nuevaVisita.cliente.zona.nombre    = miCliente.zona.nombre;
            nuevaVisita.empleado               = new VisitaWS.empleado();
            nuevaVisita.empleado.idEmpleado    = Program.empleado.idEmpleado;
            nuevaVisita.fechaRegistro          = DateTime.Today.AddYears(-100);
            nuevaVisita.fechaRegistroSpecified = true;
            nuevaVisita.estado = false;

            VisitaWS.visita[] visitas = new VisitaWS.visita[misVisitas.Count + 1];
            for (int cont = 0; cont < misVisitas.Count; cont++)
            {
                visitas[cont] = misVisitas.ElementAt(cont);
            }
            visitas[misVisitas.Count]         = nuevaVisita;
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = new BindingList <VisitaWS.visita>();
            misVisitas = new BindingList <VisitaWS.visita>(visitas.ToArray());
            dataGridView1.AutoGenerateColumns = false;
            dataGridView1.DataSource          = misVisitas;
            txtRUC.Text         = "";
            txtRazonSocial.Text = "";
        }
Ejemplo n.º 26
0
        public Demo()
        {
            _students              = new BindingList <Student>();
            _students.ListChanged += Students_ListChanged;
            AddStudents();
            var student = _students.ElementAt(0);

            Console.WriteLine($"Student Name: {student.FirstName} {student.LastName}");
            student.LastName = "Four";
        }
Ejemplo n.º 27
0
        private void Students_ListChanged(object sender, ListChangedEventArgs e)
        {
            if (e.PropertyDescriptor == null)
            {
                return;
            }
            var student = _students.ElementAt(e.NewIndex);

            Console.WriteLine($"Student Name: {student.FirstName} {student.LastName}");
        }
Ejemplo n.º 28
0
        void DataGridViewCellClick(object sender, DataGridViewCellEventArgs e)
        {
            ProductProperties product = productsDataList.ElementAt(dataGridView.CurrentCell.RowIndex);

            productNameTextBox.Text    = product.ProductName;
            barcodeExampleTextBox.Text = product.BarcodeExample;
            barcodeMaskTextBox.Text    = product.BarcodeMask;
            firmwareFileTextBox.Text   = product.FirmwareFile;
            nfcFileTextBox.Text        = product.NfcFile;
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Spawn a dialog to edit an existing ExposedWebsite.Website
        /// </summary>
        private void SupportedSites_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            var index = SupportedSites.IndexFromPoint(e.Location);

            if (index != ListBox.NoMatches)
            {
                var addWebsiteDialogue = new AddWebsiteDialogue(supportedSites, supportedSites.ElementAt(index));
                addWebsiteDialogue.Show();
            }
        }
Ejemplo n.º 30
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (archivos.Count == 0)
            {
                MessageBox.Show("El proyecto no tiene archivos", "Advertencia",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (dgvArchivos.SelectedRows.Count > 1)
            {
                MessageBox.Show("Solo se puede descargar un archivo a la vez", "Advertencia",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            int indxArch = dgvArchivos.CurrentCell.RowIndex;
            var result   = foldDescarga.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }
            else
            {
                String  ruta          = foldDescarga.SelectedPath + "\\";
                Archivo archDescargar = archivos.ElementAt(indxArch);

                if (archDescargar.Contenido == null)
                {
                    archDescargar.Contenido = logicaNegocio.obtenerDocumento(archDescargar.IdArchivo);
                }



                ruta = ruta + archDescargar.Nombre;
                if (File.Exists(@ruta))
                {
                    DialogResult dialogResult = MessageBox.Show("El archivo ya existe ¿Desea sobreescribirlo?", "Confirmación", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        File.WriteAllBytes(@ruta, archDescargar.Contenido);
                        MessageBox.Show("Se sobreescribio el archivo correctamente", "Información");
                        return;
                    }
                    else if (dialogResult == DialogResult.No)
                    {
                        return;
                    }
                }

                File.WriteAllBytes(@ruta, archDescargar.Contenido);
                MessageBox.Show("Se descargo el archivo correctamente", "Información");
            }
        }