示例#1
0
        public static string Insert(DateTime dateEntry, string receiptType, string serie, string sequent, decimal iva, string status, int idEmployee, int idProvider, DataTable dtDetails)
        {
            EntryData DEntry = new EntryData();

            DEntry.DateEntry   = dateEntry;
            DEntry.ReceiptType = receiptType;
            DEntry.Serie       = serie;
            DEntry.Sequent     = sequent;
            DEntry.Iva         = iva;
            DEntry.Status      = status;
            DEntry.IdEmployee  = idEmployee;
            DEntry.IdProvider  = idProvider;

            List <EntryDetailData> entryDetails = new List <EntryDetailData>();

            foreach (DataRow row in dtDetails.Rows)
            {
                EntryDetailData detail = new EntryDetailData();
                detail.IdItem       = Convert.ToInt32(row["id_articulo"].ToString());
                detail.PriceBuy     = Convert.ToDecimal(row["precio_compra"].ToString());
                detail.PriceSale    = Convert.ToDecimal(row["precio_venta"].ToString());
                detail.StockIni     = Convert.ToInt32(row["stock_inicial"].ToString());
                detail.StockCurrent = Convert.ToInt32(row["stock_inicial"].ToString());
                detail.Fecha        = Convert.ToDateTime(row["fecha_produccion"].ToString());
                entryDetails.Add(detail);
            }
            return(DEntry.Insert(DEntry, entryDetails));
        }
示例#2
0
        private void cmdReturnToList_Click(object sender, EventArgs e)
        {
            if (lstSkip.SelectedItems.Count == 1)
            {
                var entry = SkipData[lstSkip.SelectedIndices[0]];
                entry.nrCrt = 1;

                entry.dateReturn = DateTime.Now;
                RestoreToList(entry);
                AddEntryToFile(entry, true);
                EntryData.Insert(0, entry);
                EntryData[0].nrCrt = 0;

                foreach (TruckInfo ti in EntryData)
                {
                    lstTruckOrder.Items[ti.nrCrt].SubItems[0].Text = (++ti.nrCrt).ToString();
                }

                using (FixedObjectFileStream stream = new FixedObjectFileStream(skipFile, FileMode.Open, FileAccess.ReadWrite)) {
                    stream.RemoveAt(lstSkip.SelectedIndices[0]);

                    if (SkipData != null)
                    {
                        foreach (TruckInfo ti in SkipData.Skip(lstSkip.SelectedIndices[0] + 1))
                        {
                            lstSkip.Items[--ti.nrCrt].SubItems[0].Text = ti.nrCrt.ToString();
                        }
                    }
                }

                if (SkipData != null)
                {
                    SkipData.RemoveAt(lstSkip.SelectedIndices[0]);
                }
                if (lstSkip != null)
                {
                    lstSkip.Items.Remove(lstSkip.SelectedItems[0]);
                }

                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("EntryData"));
                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SkipData"));
            }
        }