示例#1
0
        private void sbrAltaPedido()
        {
            try
            {
                cPedidosVenta.CabVenta cabven = (cPedidosVenta.CabVenta)bS1.Current;
                int vId = cabven.fncAlta();
                if (vId == 0)
                {
                    MessageBox.Show("No se ha podido dar de Alta el Pedido");
                    return;
                }

                sbrActuDatos();

                bS1.MoveLast();
                //bS1.Add(cabven);
                //bS1.MoveLast();
                txCodCli.Focus();
                btDel.Visible = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("No se ha podido dar de Alta el Pedido :'" + ex.Message + "'");
                bS1.CancelEdit();
            }
        }
示例#2
0
        private void sbrProcesoPedCli()
        {
            if (cParamXml.ActPedCli == "False")
            {
                return;
            }

            tiProces.Enabled = false;
            lbMen.Text       = "Procesando Pedidos de Cliente";
            Application.DoEvents();
            DataTable dt = new DataTable();

            string vNumSerie = SQLDataAccess.GenTraeNumSerie(cParamXml.NSerPedCli, false, cParamXml.strConec);

            string vSql = cConstantes.SQL_CabPed_Dbf;

            vSql = vSql.Replace("[?vbCr]", cConstantes.vbCtr.ToString());
            vSql = vSql.Replace("[?vbLf]", cConstantes.vbLF.ToString());
            vSql = vSql.Replace("[?NumPed]", vNumSerie);

            try
            {
                dt = SQLDataAccess.TraeDBF(vSql, cUtil.DBFConec(cParamXml.strOleDBConecDbf));
                cPedidosVenta.CabVenta oCabPed = new cPedidosVenta.CabVenta();
                cPedidosVenta.LinVenta oLinPed = new cPedidosVenta.LinVenta();
                string vNumPed = "";
                string vErr    = "";
                foreach (DataRow dr in dt.Rows)
                {
                    vNumPed = dr["nnumped"].ToString();

                    if (oCabPed.fncAlta(dr))
                    {
                        string vSql2 = cConstantes.SQL_LinPed_Dbf;
                        vSql2 = vSql2.Replace("[?vbCr]", cConstantes.vbCtr.ToString());
                        vSql2 = vSql2.Replace("[?vbLf]", cConstantes.vbLF.ToString());
                        vSql2 = vSql2.Replace("[?NumPed]", vNumPed);
                        DataTable dt2 = SQLDataAccess.TraeDBF(vSql2, cUtil.DBFConec(cParamXml.strOleDBConecDbf));
                        foreach (DataRow dr2 in dt2.Rows)
                        {
                            //DataRow dr2 = dt2.Rows[0];
                            if (!oLinPed.fncAltaLin(dr2))
                            {
                                vErr         = oLinPed.Error;
                                lbError.Text = vErr;
                                Application.DoEvents();
                                Thread.Sleep(5000);
                            }
                        }
                    }
                    else
                    {
                        vErr         = oCabPed.Error;
                        lbError.Text = vErr;
                        Application.DoEvents();
                        Thread.Sleep(5000);
                    }
                    SQLDataAccess.GenSetNumSerie(cParamXml.NSerPedCli, vNumPed, cParamXml.strConec);
                }
            }
            catch (Exception ex)
            {
                lbError.Text = DateTime.Now.ToLongDateString() + "-- " + ex.Message;
            }


            lbMen.Text = "";
            Application.DoEvents();
            tiProces.Enabled = true;
        }