protected void Confirmar_Click(object sender, ImageClickEventArgs e) { try { Int64 ncodigo_pedid = 0; Seguridad conex = new Seguridad(); Int64 tercero; tercero = conex.tercero(Session["user"].ToString()); String pedido; pedido = conex.pedido(); ncodigo_pedid = Convert.ToInt64(pedido) + 1; DataTable datos = new DataTable(); string comando = "insert into tbl_pedidos (ncodigo_pedid,ncod_ubic_pedid,ncod_terce_pedid,ffecha_pedid,ccod_conce_pedid,ccod_estad_pedid,nneto_pedid,nimpuesto_pedid,ndescuento_pedid,ntotal_pedid,cobservacion_pedid) values " + "('" + ncodigo_pedid + "','0','" + tercero.ToString() + "','" + DateTime.Now.ToString() + "','PD','AC',0,0,0,0,'')"; datos = conex.conexion(comando); for (int i = 0; i < Carro.Rows.Count; i++) { string comando2 = "exec proc_detalles_movimientos " + ncodigo_pedid + ",'PD'," + Carro.Rows[i]["Codigo"].ToString() + ", 0 ,'" + DateTime.Now.ToString() + "'," + Carro.Rows[i]["Cantidad"].ToString()+ ", " + Carro.Rows[i]["Precio"].ToString() + ", 0 , 0 ,'agregar'"; datos = conex.conexion(comando2); } Lbpedido.Text = "Pedido Numero: " + ncodigo_pedid.ToString(); Confirmar.Visible = false; Cancelar.Visible = false; } catch { Lbpedido.Text = "Error Creando Pedido"; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //Esto ocurre solo la primera vez que se carga tu página string user = "", pass = ""; bool rta = false; if (Session["user"] != null) user = Session["user"].ToString(); else user = ""; if (Session["pass"] != null) pass = Session["pass"].ToString(); else pass = ""; Seguridad login = new Seguridad(); rta = login.login(user, pass); if (rta) { if (Session["datos"] != null) { Carro = Session["datos"] as DataTable; DT_Carro.DataSourceID = null; DT_Carro.DataSource = Carro; DT_Carro.DataBind(); } if (Session["ctd"] != null) { Master.LbCantiad = Session["ctd"].ToString(); } } else { Response.Redirect("Error.aspx"); } } else { if (!string.IsNullOrEmpty(Session["user"].ToString()) || !string.IsNullOrEmpty(Session["pass"].ToString()))//si se salio y quiere volver con el boto atras { if (Session["datos"] != null) { Carro = Session["datos"] as DataTable; DT_Carro.DataSourceID = null; DT_Carro.DataSource = Carro; DT_Carro.DataBind(); } if (Session["ctd"] != null) { Master.LbCantiad = Session["ctd"].ToString(); } } else { Response.Redirect("Error.aspx"); } } }
protected void Page_Load(object sender, EventArgs e) { string user = "", pass = ""; bool rta = false; if (Session["user"] != null) user = Session["user"].ToString(); else user = ""; if (Session["pass"] != null) pass = Session["pass"].ToString(); else pass = ""; Seguridad login = new Seguridad(); rta = login.login(user,pass); if (rta) { } else { Response.Redirect("Error.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { //Esto ocurre solo la primera vez que se carga tu página string user = "", pass = ""; bool rta = false; if (Session["user"] != null) user = Session["user"].ToString(); else user = ""; if (Session["pass"] != null) pass = Session["pass"].ToString(); else pass = ""; Seguridad login = new Seguridad(); rta = login.login(user, pass); if (rta) { SqlConnection myConnection; SqlDataAdapter myCommand; String Base = "Data Source= .\\SQLEXPRESS;Initial Catalog=Boromir;Integrated Security=True"; myConnection = new SqlConnection(Base); string consulta = "select ncodigo_produ Codigo, cnombre_produ Producto,nprecio_venta_produ Precio, nimpuesto_produ IVA,(nprecio_venta_produ + (nprecio_venta_produ * nimpuesto_produ / 100)) Total from tbl_productos"; string flt = "", obj = "", scr = ""; if (Request.QueryString["Flt"] != null) flt = Request.QueryString["Flt"]; if (Request.QueryString["Obj"] != null) { obj = Request.QueryString["Obj"]; switch (obj) { case "marca": consulta = consulta + " where ccod_marca_produ = '" + flt + "'"; break; case "categ": consulta = consulta + " where ccod_categ_produ = '" + flt + "'"; break; } } if (Request.QueryString["scr"] != null) { scr = Request.QueryString["scr"]; if (string.IsNullOrEmpty(scr)) consulta = "select ncodigo_produ Codigo, cnombre_produ Producto from tbl_productos"; else consulta = consulta + " where cnombre_produ like '%" + scr.Trim() + "%'"; } myCommand = new SqlDataAdapter(consulta, myConnection); DataSet ds = new DataSet(); myCommand.Fill(ds); Dt_productos.DataSourceID = null; Dt_productos.DataSource = ds; Dt_productos.DataBind(); } else { Response.Redirect("Error.aspx"); } } else { if (string.IsNullOrEmpty(Session["user"].ToString()) || string.IsNullOrEmpty(Session["pass"].ToString())) Response.Redirect("Error.aspx"); } }