示例#1
0
        public List<RPCFan> RetrieveFirstObject(WorkbookPart wbPart, Sheet theSheet)
        {
            string abc = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
            WorksheetPart wsPart =
                (WorksheetPart)(wbPart.GetPartById(theSheet.Id));
            Cell theCell = wsPart.Worksheet.Descendants<Cell>().
              Where(c => c != null).FirstOrDefault();
            string first = FindCellInnerValue(wbPart, theCell);
            var letra = first.Substring(0, 1);
            int numeros = int.Parse(first.Substring(1));
            int i = abc.IndexOf(letra);
            List<RPCFan> retorno = new List<RPCFan>();
            int countFans = 0;
            int numeroscopy = numeros;
            while (theCell != null)
            {
                string newRef = abc[i].ToString() + (numeroscopy++ + 1).ToString();
                theCell = wsPart.Worksheet.Descendants<Cell>().
              Where(c => c.CellReference == newRef).FirstOrDefault();
                countFans++;
            }
            for (int ii = 0; ii < (countFans - 1); ii++)
            {
                string newRef;
                i = abc.IndexOf(letra);
                theCell = new Cell();
                var fan = new RPCFan();
                List<string> data = new List<string>();
                while (theCell != null)
                {
                    newRef = abc[i++].ToString() + (numeros + 1).ToString();
                    theCell = wsPart.Worksheet.Descendants<Cell>().
                  Where(c => c.CellReference == newRef).FirstOrDefault();
                    var value = FindCellInnerValue(wbPart, theCell, false);
                    data.Add(value);
                    //i++;
                }
                fan.YaEntro = false;
                fan.LastCell = abc[i-2].ToString() + (numeros + 1).ToString();
                fan.ID = data[0];
                fan.Nombre = data[1];
                fan.CardNum = data[2];
                fan.DNI = data[3];
                fan.Ingreso = data[4];
                if (data[5]!="0")
                    fan.YaEntro = true;

                retorno.Add(fan);
                numeros++;
            }

            return retorno;
        }
示例#2
0
        private void MarkCell(RPCFan myfan)
        {
            WorksheetPart wsPart =
              (WorksheetPart)(wbPart.GetPartById(theSheet.Id));
            Cell theCellular = wsPart.Worksheet.Descendants<Cell>().
              Where(c => c.CellReference == myfan.LastCell).FirstOrDefault();
            theCellular.CellValue = new CellValue("X");
            theCellular.DataType =
                new EnumValue<CellValues>(CellValues.String);

            // Save
            wsPart.Worksheet.Save();
        }
示例#3
0
 private void button1_Click(object sender, EventArgs e)
 {
     txtDNI.Text = ultimo.DNI;
      txtIngreso.Text = ultimo.Ingreso;
      txtNom.Text = ultimo.Nombre;
      txtRPC.Text = ultimo.CardNum;
      ultimo = new RPCFan();
      this.Focus();
 }
示例#4
0
        private void Ingreso_KeyPress(object sender, KeyPressEventArgs e)
        {
            try
            {
                if (e.KeyChar >= 48 && e.KeyChar <= 57)
                {
                    cardPrimaryKey += e.KeyChar;
                    if (cardPrimaryKey.Length == 10)
                    {
                        Clean();

                        txtInfo.Text = "";

                        RPCFan myfan = rpc.KeyPressLengthAlert(cardPrimaryKey, firstCell,entered);
                        if (myfan == null)
                            txtInfo.Text = "La tarjeta no tiene ingresos asignados!";
                        else if (myfan.ID == null)
                            txtInfo.Text = "Esta tarjeta ya fue ingresada!";
                        else
                        {
                            this.ultimo = myfan;
                            txtDNI.Text = myfan.DNI;
                            txtIngreso.Text = myfan.Ingreso;
                            txtNom.Text = myfan.Nombre;
                            txtRPC.Text = myfan.CardNum;
                        }

                        cardPrimaryKey = "";
                    }
                }
                else if (e.KeyChar == (char)Keys.Enter)
                {

                    e.Handled = true;

                }
            }
            catch (Exception)
            {
            }
        }