Esempio n. 1
0
        private void initGrid(DateTime start, DateTime end, string var_cliente)
        {
            this.Session[this._nameSessionData] = Documents_Trans.get_Docn_TransAdonis(start, end, var_cliente).Tables[0];
            this.gvDocTrans.DataSource          = (DataTable)this.Session[this._nameSessionData];
            this.gvDocTrans.DataBind();

            //this.Session[this._nameSessionData] = (object)Documents_Trans.get_Docn_TransAdonis(start, end,var_cliente);
            //this.gvDocTrans.DataSourceID = this.odsConsult.ID;
            //this.gvDocTrans.DataBind();
            //MergeRows(gvDocTrans, 2);
        }
Esempio n. 2
0
        protected void ibExportDoc_Click(object sender, ImageClickEventArgs e)
        {
            DataTable dt = null;

            try
            {
                DateTime fechaini = Convert.ToDateTime(txtDateStart.Text);
                DateTime fechafin = Convert.ToDateTime(txtDateEnd.Text);
                dt = Documents_Trans.get_Docn_TransAdonis(fechaini, fechafin, "-1", "2").Tables[0];
                if (dt.Rows.Count > 0)
                {
                    DateTime _fecStart = Convert.ToDateTime((txtDateStart.Text.Equals(string.Empty)) ? "01/01/1900" : txtDateStart.Text);
                    DateTime _fecEnd   = Convert.ToDateTime((txtDateEnd.Text.Equals(string.Empty)) ? "01/01/1900" : txtDateEnd.Text);

                    DataSet   _interf = Adonis.Get_Comercial_Interface(_fecStart, _fecEnd);
                    DataTable dtinter = _interf.Tables[0];

                    DataRow[] foundRows = dtinter.Select("", "");

                    System.Text.StringBuilder str = new System.Text.StringBuilder();

                    for (int i = 0; i <= foundRows.GetUpperBound(0); i++)
                    {
                        str.Append(foundRows[i][0].ToString() + "\r\n");
                    }

                    Response.Clear();
                    Response.Buffer      = true;
                    Response.ContentType = "text/plain";
                    Response.AddHeader("Content-Disposition", "attachment;filename=InterComerAdonis.txt");
                    Response.Charset         = "UTF-8";
                    Response.ContentEncoding = System.Text.Encoding.Default;

                    System.IO.StringWriter       tw = new System.IO.StringWriter();
                    System.Web.UI.HtmlTextWriter hw = new System.Web.UI.HtmlTextWriter(tw);

                    Response.Write(str.ToString());
                    Response.End();
                }
                else
                {
                    msnMessage.LoadMessage("No hay datos para exportar", UserControl.ucMessage.MessageType.Error);
                }
            }
            catch (Exception exc)
            {
                msnMessage.LoadMessage(exc.Message, UserControl.ucMessage.MessageType.Error);
                dt = null;
            }
        }