Beispiel #1
0
    public string GetControlHtml(string controlLocation,string username, string userid)
    {
        // Create instance of the page control
        Page page = new Page();

        // Create instance of the user control
        UserControl userControl = (UserControl)page.LoadControl(controlLocation);

        //Disabled ViewState- If required
        //userControl.EnableViewState = false;

        //Form control is mandatory on page control to process User Controls
        HtmlForm form = new HtmlForm();

        //Add user control to the form
        form.Controls.Add(userControl);

        //Add form to the page
        page.Controls.Add(form);

        //Write the control Html to text writer
        StringWriter textWriter = new StringWriter();

        //execute page on server
        HttpContext.Current.Server.Execute(page, textWriter, false);

        // Clean up code and return html
           // string html = Regex.Replace(textWriter.ToString(), "(.*(\r|\n|\r\n))*.*<div id=.{1}wrapperAjax.{1} />", "", RegexOptions.IgnoreCase);

        string html = textWriter.ToString().Replace("userName", username).Replace("userid", userid).Replace("(.*(\r|\n|\r\n))*.*<div id=.{1}wrapperAjax.{1} />","");

        return html;
    }
 protected void btnExcel_Click(object sender, EventArgs e)
 {
     try
     {
         ChangeControlsToValue(gvDeposits);
        // gvDeposits.Columns[13].Visible = false;
         Response.ClearContent();
         Response.AddHeader("content-disposition", "attachment; filename=AgentDeposits.xls");
         Response.ContentType = "application/excel";
         StringWriter sWriter = new StringWriter();
         HtmlTextWriter hTextWriter = new HtmlTextWriter(sWriter);
         HtmlForm hForm = new HtmlForm();
         gvDeposits.Parent.Controls.Add(hForm);
         hForm.Attributes["runat"] = "server";
         hForm.Controls.Add(gvDeposits);
         hForm.RenderControl(hTextWriter);
         StringBuilder sBuilder = new StringBuilder();
         sBuilder.Append("<html xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns=\"http://www.w3.org/TR/REC-html40\"> <head><meta http-equiv=\"Content-Type\" content=\"text/html;charset=windows-1252\"><!--[if gte mso 9]><xml><x:ExcelWorkbook><x:ExcelWorksheets><x:ExcelWorksheet><x:Name>ExportToExcel</x:Name><x:WorksheetOptions><x:Panes></x:Panes></x:WorksheetOptions></x:ExcelWorksheet></x:ExcelWorksheets></x:ExcelWorkbook></xml><![endif]--></head> <body>");
         sBuilder.Append(sWriter + "</body></html>");
         Response.Write(sBuilder.ToString());
         Response.End();
         //gvDeposits.Columns[13].Visible = true;
     }
     catch (Exception ex)
     {
         //lblMsg.InnerHtml = ex.Message;
         throw ex;
     }
 }
    protected void Button3_Click(object sender, EventArgs e)
    {
        string fileName = "export.xls";

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        System.IO.StringWriter sw = new System.IO.StringWriter(sb);
        HtmlTextWriter htw = new HtmlTextWriter(sw);

        Page page = new Page();
        HtmlForm form = new HtmlForm();

        // Deshabilitar la validación de eventos, sólo asp.net 2
        page.EnableEventValidation = false;

        // Realiza las inicializaciones de la instancia de la clase Page que requieran los diseñadores RAD.
        page.DesignerInitialize();

        page.Controls.Add(form);

        form.Controls.Add(GridView1);

        page.RenderControl(htw);

        Response.Clear();
        Response.Buffer = true;
        Response.ContentType = "application/vnd.ms-excel";
        Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
        Response.Charset = "UTF-8";
        Response.ContentEncoding = System.Text.Encoding.Default;
        Response.Write(sb.ToString());
        Response.End();
    }
Beispiel #4
0
 public static void PrintWebControl(Control ctrl, string Script)
 {
     StringWriter stringWrite = new StringWriter();
     System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
     if (ctrl is WebControl)
     {
         Unit w = new Unit(100, UnitType.Percentage); ((WebControl)ctrl).Width = w;
     }
     Page pg = new Page();
     pg.EnableEventValidation = false;
     if (Script != string.Empty)
     {
         pg.ClientScript.RegisterStartupScript(pg.GetType(), "PrintJavaScript", Script);
     }
     HtmlForm frm = new HtmlForm();
     pg.Controls.Add(frm);
     frm.Attributes.Add("runat", "server");
     frm.Controls.Add(ctrl);
     pg.DesignerInitialize();
     pg.RenderControl(htmlWrite);
     string strHTML = stringWrite.ToString();
     HttpContext.Current.Response.Clear();
     HttpContext.Current.Response.Write(strHTML);
     HttpContext.Current.Response.Write("<script>window.print();</script>");
     HttpContext.Current.Response.End();
 }
 protected void BtnDownloadAttendanceAsExcel_Click(object sender, EventArgs e)
 {
     if (int.Parse(DDLSemester.SelectedValue.ToString()) % 2 == 0)
         LblSemesterType.Text = "EVEN SEMESTER";
     else
         LblSemesterType.Text = "ODD SEMESTER";
     LblDepartment.Text = Session["Department"].ToString();
     LblFromDate.Text = TxtBxFromDate.Text;
     LblToDate.Text = TxtBxToDate.Text;
     LblSection.Text = DDLSection.SelectedItem.Text;
     LblSemester.Text = DDLSemester.SelectedItem.Text;
     string name = DDLSection.SelectedItem.ToString().Replace("   ", "") + ".xls";
     HtmlForm form = new HtmlForm();
     string attachment = "attachment; filename=" + name;
     Response.ClearContent();
     Response.AddHeader("content-disposition", attachment);
     Response.ContentType = "application/ms-excel";
     StringWriter stw = new StringWriter();
     HtmlTextWriter htextw = new HtmlTextWriter(stw);
     form.Controls.Add(ListHeader);
     form.Controls.Add(GridView1);
     this.Controls.Add(form);
     form.RenderControl(htextw);
     Response.Write(stw.ToString());
     Response.End();
 }
 /// <summary>
 /// 创建浮点型校验控件
 /// </summary>
 /// <param name="fForm">表单对象</param>
 /// <param name="fControl">绑定的控件 </param>
 public static void CreateDoubleValidator(HtmlForm fForm, Control fControl)
 {
     RegularExpressionValidator validator = new RegularExpressionValidator();
     validator.ValidationExpression = "^[0-9]+(.[0-9]{1,16})?$";
     validator.ErrorMessage = "格式必须为数值";
     validator.ControlToValidate = fControl.ID;
     //validator.EnableViewState = false;
     fForm.Controls.AddAt(fForm.Controls.IndexOf(fControl) + 1, validator);
 }
 /// <summary>
 /// 创建比较校验控件
 /// </summary>
 /// <param name="fForm">表单对象</param>
 /// <param name="fControl1"></param>
 /// <param name="fControl2"></param>
 /// <param name="fErrorMessage">提示信息</param>
 public static void CreateCompareValidator(HtmlForm fForm, Control fControl1, Control fControl2, string fErrorMessage)
 {
     CompareValidator validator = new CompareValidator();
     validator.ErrorMessage = fErrorMessage;
     validator.ControlToCompare = fControl1.ID;
     validator.ControlToValidate = fControl2.ID;
     //validator.EnableViewState = false;
     validator.ValueToCompare = "=";
     fForm.Controls.AddAt(fForm.Controls.IndexOf(fControl2) + 1, validator);
 }
        public void CanCreateFromHtmlElementTest()
        {
            const string Html = "<form name='Test'></form>";

            var page = new HtmlPageStub(Html);

            var element = new HtmlForm(page, ((IHtmlPage)page).Node);

            Action action = () => new DefaultHtmlElementFinder<HtmlForm>(element);

            action.ShouldNotThrow();
        }
 /// <summary>
 /// 创建浮点型范围校验控件
 /// </summary>
 /// <param name="fForm">表单对象</param>
 /// <param name="fControl">绑定的控件</param>
 /// <param name="fMaxValue">最大值</param>
 /// <param name="fMinValue">最小值</param>
 public static void CreateDoubleRangeValidator(HtmlForm fForm, Control fControl, double fMaxValue, double fMinValue)
 {
     RangeValidator Validator = new RangeValidator();
     Validator.Type = ValidationDataType.Double;
     Validator.MaximumValue = fMaxValue.ToString();
     Validator.MinimumValue = fMinValue.ToString();
     Validator.ErrorMessage = "超出范围";
     //Validator.EnableViewState = false;
     Validator.ControlToValidate = fControl.ID;
     Validator.Text = "请输入正确的值";
     fForm.Controls.AddAt(fForm.Controls.IndexOf(fControl) + 1, Validator);
 }
 protected void ExportDupes(object sender, EventArgs e)
 {
     Response.Clear();
     Response.AddHeader("content-disposition", "attachment; filename=Duplicates.xls");
     Response.Charset = "";
     Response.ContentType = "application/vnd.xls";
     StringWriter stringWrite = new StringWriter();
     HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
     HtmlForm newForm = new HtmlForm();
     this.Controls.Add(newForm);
     newForm.Controls.Add(gvDupes);
     newForm.RenderControl(htmlWrite);
     Response.Write(stringWrite.ToString());
     Response.End();
     this.Dispose();
 }
    protected void btnExport_Click(object sender, EventArgs e)
    {
        Security s=  Session["sec"] as Security;
        if (s==null)
        {
            Response.Redirect("error.aspx");
        }
        string jsid = s.getUserCode();
        dbModule dm = new dbModule();
        string kcbh = KCDDL.SelectedValue;
        int syid= Convert.ToInt32(SYDDL.SelectedValue);
        DataTable dt = dm.getSyqdqk( kcbh ,syid,jsid );
        GridView1.DataSource = dt;
        GridView1.DataBind();
        GridView1.Caption = KCDDL.SelectedItem.Text + "---" + SYDDL.SelectedItem.Text + "签到情况";
        string fileName = "export.xls";

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        System.IO.StringWriter sw = new System.IO.StringWriter(sb);
        HtmlTextWriter htw = new HtmlTextWriter(sw);

        Page page = new Page();
        HtmlForm form = new HtmlForm();

        // Deshabilitar la validación de eventos, sólo asp.net 2
        page.EnableEventValidation = false;

        // Realiza las inicializaciones de la instancia de la clase Page que requieran los diseñadores RAD.
        page.DesignerInitialize();

        page.Controls.Add(form);

        form.Controls.Add(GridView1);

        page.RenderControl(htw);

        Response.Clear();
        Response.Buffer = true;
        Response.ContentType = "application/vnd.ms-excel";
        Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
        Response.Charset = "UTF-8";
        Response.ContentEncoding = System.Text.Encoding.Default;
        Response.Write(sb.ToString());
        Response.End();
    }
    protected void btnExportar_Command(object sender, CommandEventArgs e)
    {
        if (e.CommandName == "Exportar")
            {
                  if (GridView1.Rows.Count > 0 && GridView1.Visible == true ){
                //try{
                    lblMsj.Text = "";
                    StringBuilder sb = new StringBuilder();
                    StringWriter sw = new StringWriter(sb);
                    HtmlTextWriter htw = new HtmlTextWriter(sw);

                    Page page = new Page();
                    HtmlForm form = new HtmlForm();

                    GridView1.EnableViewState = false;
                    // Deshabilitar la validación de eventos, sólo asp.net 2
                    page.EnableEventValidation = false;
                    // Realiza las inicializaciones de la instancia de la clase Page que requieran los diseñadores RAD.
                    page.DesignerInitialize();
                    page.Controls.Add(form);
                    form.Controls.Add(GridView1);
                    page.RenderControl(htw);
                    Response.Clear();
                    Response.Buffer = true;
                    Response.ContentType = "application/vnd.ms-excel";
                    Response.AddHeader("Content-Disposition", "attachment;filename=Evaluaciones.xls");
                    Response.Charset = "UTF-8";
                    Response.ContentEncoding = Encoding.Default;
                    Response.Write(sb.ToString());
                    Response.End();
                  }
             else
             {
                 //lblMsj.Text = "la tabla no contiene datos para exportar...";
             }
                //}
                //catch (Exception ex)
                //{
                //    EventLogger ev = new EventLogger();
                //    ev.Save("Seguimiento, export excel ", ex);
                //}
        }
    }
 protected void btnExportWarning_Click(object sender, EventArgs e)
 {
     Response.Clear();
     Response.AddHeader("content-disposition", "attachment; filename=NotFound.xls");
     Response.Charset = "";
     Response.ContentType = "application/vnd.xls";
     DataTable dtNotFound = CareerCruisingWeb.CCLib.Common.DataAccess.GetDataTable("Select oldUserName, newUserName from Port_UsernameReplaceGroup where PortfolioID is null");
     StringWriter stringWrite = new StringWriter();
     HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
     HtmlForm newForm = new HtmlForm();
     this.Controls.Add(newForm);
     gvWarnings.DataSource = dtNotFound;
     gvWarnings.DataBind();
     newForm.Controls.Add(gvWarnings);
     newForm.RenderControl(htmlWrite);
     Response.Write(stringWrite.ToString());
     Response.End();
     this.Dispose();
 }
Beispiel #14
0
 protected void Btn_ClickExport(object sender, EventArgs e)
 {
     if (((DataTable)Session["WorkingPIDs"]).Rows.Count > 0)
     {
         DataTable dtTemp = (DataTable)Session["WorkingPIDs"];
         System.Text.StringBuilder sbPIDs = new System.Text.StringBuilder();
         sbPIDs.Append("(0");
         for (int c = 0; c < dtTemp.Rows.Count; c++)
             sbPIDs.Append("," + dtTemp.Rows[c][0]);
         sbPIDs.Append(")");
         System.Text.StringBuilder sbExportSQL = new System.Text.StringBuilder();
         sbExportSQL.Append("SELECT  p.PortfolioID,UserName ,[PassWord] ,FirstName, LastName, GradeNumber, GenderID, Active,SchoolID,");
         sbExportSQL.Append("LastLogin,s.Percentage,EmailAddress,Address1 ,City ,StateProv, CreateDate,TransferSchoolId ,TransferUserName ,Transferdate,");
         sbExportSQL.Append("SchoolUserName ,SchoolPassword FROM dbo.Portfolio p");
         sbExportSQL.Append(" JOIN PCSStatus s on p.PortfolioID=s.PortfolioID where p.PortfolioID in " + sbPIDs.ToString());
         if (hidSort.Value.Length > 0)
         {
             sbExportSQL.Append(" order by " + hidSort.Value);
             if (!(hidSort.Value == "LastName"))
                 sbExportSQL.Append(" , LastName");
         }
         else
             sbExportSQL.Append(" order by Username, LastName, FirstName ");
         DataTable dtExport = DataAccess.GetDataTable(sbExportSQL.ToString());
         gvExport.DataSource = dtExport;
         gvExport.DataBind();
         // Export the data table
         Response.Clear();
         Response.AddHeader("content-disposition", "attachment; filename=Export.xls");
         Response.Charset = "";
         Response.ContentType = "application/vnd.xls";
         StringWriter stringWrite = new StringWriter();
         HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
         HtmlForm newForm = new HtmlForm();
         this.Controls.Add(newForm);
         newForm.Controls.Add(gvExport);
         newForm.RenderControl(htmlWrite);
         Response.Write(stringWrite.ToString());
         Response.End();
         this.Dispose();
     }
 }
Beispiel #15
0
 protected void Btn_ClickExport(object sender, EventArgs e)
 {
     if (((DataTable)Session["WorkingPIDs"]).Rows.Count > 0)
     {
         DataTable dtTemp = (DataTable)Session["WorkingPIDs"];
         System.Text.StringBuilder sbPIDs = new System.Text.StringBuilder();
         sbPIDs.Append("(0");
         for (int c = 0; c < dtTemp.Rows.Count; c++)
             sbPIDs.Append("," + dtTemp.Rows[c][0]);
         sbPIDs.Append(")");
         System.Text.StringBuilder sbExportSQL = new System.Text.StringBuilder();
         sbExportSQL.Append("Select [ID],CourseName,CourseCredit, CourseTerm, CourseType, CourseCategory, CourseNumber, SchoolID,");
         sbExportSQL.Append("CourseDesc, Okay9, Okay10, Okay11, Okay12 FROM PortfolioCourse ");
         sbExportSQL.Append(" where [ID] in " + sbPIDs.ToString());
         if (hidSort.Value.Length > 0)
         {
             sbExportSQL.Append(" order by " + hidSort.Value);
             if (!(hidSort.Value == "CourseName"))
                 sbExportSQL.Append(" , CourseName");
         }
         else
             sbExportSQL.Append(" order by CourseName");
         DataTable dtExport = DataAccess.GetDataTable(sbExportSQL.ToString());
         gvExport.DataSource = dtExport;
         gvExport.DataBind();
         // Export the data table
         Response.Clear();
         Response.AddHeader("content-disposition", "attachment; filename=Export.xls");
         Response.Charset = "";
         Response.ContentType = "application/vnd.xls";
         StringWriter stringWrite = new StringWriter();
         HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
         HtmlForm newForm = new HtmlForm();
         this.Controls.Add(newForm);
         newForm.Controls.Add(gvExport);
         newForm.RenderControl(htmlWrite);
         Response.Write(stringWrite.ToString());
         Response.End();
         this.Dispose();
     }
 }
Beispiel #16
0
    public static void LoadDataFromCookie(string currPageName,HtmlForm frmCurrForm )
    {
        if (HttpContext.Current.Request.Cookies[currPageName]!=null)
            {
                string searchFields = HttpContext.Current.Request.Cookies[currPageName].Value;

                if (searchFields.Trim()!="")
                {
                    Array arrFlds = searchFields.Split(',');

                    if (arrFlds.Length>0)
                    {
                        for(int cntr=0;cntr<arrFlds.Length;cntr++)
                        {
                            Array arrFldsWithValue = arrFlds.GetValue(cntr).ToString().Split(':');

                            if (arrFldsWithValue.Length>0)
                            {
                                if (arrFldsWithValue.GetValue(0).ToString().StartsWith("txt"))
                                {
                                    //*- text box
                                    ((TextBox) frmCurrForm.FindControl(arrFldsWithValue.GetValue(0).ToString())).Text=(arrFldsWithValue.GetValue(1)==null)? "":arrFldsWithValue.GetValue(1).ToString().Trim();

                                }
                                else if ((arrFldsWithValue.GetValue(0).ToString().StartsWith("dbl"))||
                                    (arrFldsWithValue.GetValue(0).ToString().StartsWith("ddl"))||
                                    (arrFldsWithValue.GetValue(0).ToString().StartsWith("lst")))
                                {
                                    // list box
                                    ((DropDownList)frmCurrForm.FindControl(arrFldsWithValue.GetValue(0).ToString())).SelectedValue	= (arrFldsWithValue.GetValue(1)==null)? "":arrFldsWithValue.GetValue(1).ToString().Trim();
                                    //(arrFldsWithValue.GetValue(0).ToString())).SelectedValue = (arrFldsWithValue.GetValue(1)==null)? "":arrFldsWithValue.GetValue(0).ToString();
                                }
                            }
                        }
                    }
                }
            }
    }
    public static void GenerateExcel(GridView gridViewExcel, string header, string filename, System.Web.UI.Page page)
    {
        HtmlForm form = new HtmlForm();
        form.Attributes["runat"] = "server";

        HtmlGenericControl ctrl = new HtmlGenericControl("h1");
        ctrl.InnerHtml = "<center>"+header+"</center>";

        page.Response.ClearContent();
        page.Response.AddHeader("content-disposition",
            "attachment;filename="+filename+".xls");
        page.Response.ContentType = "applicatio/excel";
        StringWriter sw = new StringWriter(); ;
        HtmlTextWriter htm = new HtmlTextWriter(sw);

        form.Controls.Add(ctrl);
        form.Controls.Add(gridViewExcel);
        page.Controls.Add(form);

        page.Form.RenderControl(htm);
        page.Response.Write(sw.ToString());
        page.Response.End();
    }
Beispiel #18
0
      private void Page_Load(object sender, EventArgs e)
      {
          HtmlForm form1 = (HtmlForm)(HtmlForm)this.FindControl("Form1");

          this.GHTTestBegin(form1);
          this.GHTSubTestBegin("GHTSubTest1");
          try
          {
              this.Session.Clear();
              this.GHTSubTestAddResult((string)(this.Session["variable1"]));
          }
          catch (Exception exception6)
          {
              // ProjectData.SetProjectError(exception6);
              Exception exception1 = exception6;
              this.GHTSubTestUnexpectedExceptionCaught(exception1);
              // ProjectData.ClearProjectError();
          }
          this.GHTSubTestEnd();
          this.GHTSubTestBegin("GHTSubTest2");
          try
          {
              this.Session["variable1"] = "var1";
              this.GHTSubTestAddResult((string)(this.Session["variable1"]));
          }
          catch (Exception exception7)
          {
              // ProjectData.SetProjectError(exception7);
              Exception exception2 = exception7;
              this.GHTSubTestUnexpectedExceptionCaught(exception2);
              // ProjectData.ClearProjectError();
          }
          this.GHTSubTestEnd();
          this.GHTSubTestBegin("GHTSubTest3");
          try
          {
              this.Session["variable1"] = "changed var1";
              this.GHTSubTestAddResult((string)(this.Session["variable1"]));
          }
          catch (Exception exception8)
          {
              // ProjectData.SetProjectError(exception8);
              Exception exception3 = exception8;
              this.GHTSubTestUnexpectedExceptionCaught(exception3);
              // ProjectData.ClearProjectError();
          }
          this.GHTSubTestEnd();
          this.GHTSubTestBegin("GHTSubTest4");
          try
          {
              this.Session["variable1"] = null;
              this.GHTSubTestAddResult((string)(this.Session["variable1"]));
          }
          catch (Exception exception9)
          {
              // ProjectData.SetProjectError(exception9);
              Exception exception4 = exception9;
              this.GHTSubTestUnexpectedExceptionCaught(exception4);
              // ProjectData.ClearProjectError();
          }
          this.GHTSubTestEnd();
          this.GHTSubTestBegin("GHTSubTest5");
          try
          {
              this.GHTSubTestAddResult((string)(this.Session[0]));
              this.GHTSubTestAddResult(this.Session.Count.ToString());
          }
          catch (Exception exception10)
          {
              // ProjectData.SetProjectError(exception10);
              Exception exception5 = exception10;
              this.GHTSubTestUnexpectedExceptionCaught(exception5);
              // ProjectData.ClearProjectError();
          }
          this.GHTSubTestEnd();
          this.GHTTestEnd();
      }
 internal virtual string GetAdaptiveErrorMessage(HttpContext context, bool dontShowSensitiveInfo)
 {
     this.GetHtmlErrorMessage(dontShowSensitiveInfo);
     context.Response.UseAdaptiveError = true;
     try
     {
         Page page = new ErrorFormatterPage {
             EnableViewState = false
         };
         HtmlForm child = new HtmlForm();
         page.Controls.Add(child);
         IParserAccessor accessor = child;
         Label           label    = this.CreateLabelFromText(System.Web.SR.GetString("Error_Formatter_ASPNET_Error", new object[] { HttpRuntime.AppDomainAppVirtualPath }));
         label.ForeColor = Color.Red;
         label.Font.Bold = true;
         label.Font.Size = FontUnit.Large;
         accessor.AddParsedSubObject(label);
         accessor.AddParsedSubObject(this.CreateBreakLiteral());
         label             = this.CreateLabelFromText(this.ErrorTitle);
         label.ForeColor   = Color.Maroon;
         label.Font.Bold   = true;
         label.Font.Italic = true;
         accessor.AddParsedSubObject(label);
         accessor.AddParsedSubObject(this.CreateBreakLiteral());
         accessor.AddParsedSubObject(this.CreateLabelFromText(System.Web.SR.GetString("Error_Formatter_Description") + " " + this.Description));
         accessor.AddParsedSubObject(this.CreateBreakLiteral());
         string miscSectionTitle = this.MiscSectionTitle;
         if (!string.IsNullOrEmpty(miscSectionTitle))
         {
             accessor.AddParsedSubObject(this.CreateLabelFromText(miscSectionTitle));
             accessor.AddParsedSubObject(this.CreateBreakLiteral());
         }
         StringCollection adaptiveMiscContent = this.AdaptiveMiscContent;
         if ((adaptiveMiscContent != null) && (adaptiveMiscContent.Count > 0))
         {
             foreach (string str2 in adaptiveMiscContent)
             {
                 accessor.AddParsedSubObject(this.CreateLabelFromText(str2));
                 accessor.AddParsedSubObject(this.CreateBreakLiteral());
             }
         }
         string displayPath = this.GetDisplayPath();
         if (!string.IsNullOrEmpty(displayPath))
         {
             string text = System.Web.SR.GetString("Error_Formatter_Source_File") + " " + displayPath;
             accessor.AddParsedSubObject(this.CreateLabelFromText(text));
             accessor.AddParsedSubObject(this.CreateBreakLiteral());
             text = System.Web.SR.GetString("Error_Formatter_Line") + " " + this.SourceFileLineNumber;
             accessor.AddParsedSubObject(this.CreateLabelFromText(text));
             accessor.AddParsedSubObject(this.CreateBreakLiteral());
         }
         StringCollection adaptiveStackTrace = this.AdaptiveStackTrace;
         if ((adaptiveStackTrace != null) && (adaptiveStackTrace.Count > 0))
         {
             foreach (string str5 in adaptiveStackTrace)
             {
                 accessor.AddParsedSubObject(this.CreateLabelFromText(str5));
                 accessor.AddParsedSubObject(this.CreateBreakLiteral());
             }
         }
         StringWriter writer  = new StringWriter(CultureInfo.CurrentCulture);
         TextWriter   writer2 = context.Response.SwitchWriter(writer);
         page.ProcessRequest(context);
         context.Response.SwitchWriter(writer2);
         return(writer.ToString());
     }
     catch
     {
         return(this.GetStaticErrorMessage(context));
     }
 }
Beispiel #20
0
 protected virtual void BuildFooter(HtmlForm form)
 {
     form.Controls.Add(new Footer());
 }
Beispiel #21
0
        private void Bangding()
        {
            HtmlForm FrmNewDocument = (HtmlForm)this.Page.FindControl("DisplayStyle");

            SqlDataReader dr;             //存放人物的数据

            UDS.Components.DocumentFlow df = new UDS.Components.DocumentFlow();
            df.GetStyleDescription(StyleID, out dr);

            Table tt = new Table();

            tt.HorizontalAlign = HorizontalAlign.Center;
            tt.Width           = Unit.Percentage(100);
            tt.Style.Add("left", "0px");
            tt.Style.Add("top", "0px");
            tt.CssClass    = "GbText";
            tt.BorderWidth = 1;

            AddRow(tt, "表单示例", "../../../Images/treetopbg.jpg");

            while (dr.Read())
            {
                TextBox txt = new TextBox();

                txt.ID = "txt" + dr["Field_Name"].ToString();
                if (dr["MultiLine"].ToString() != "False")
                {
                    txt.TextMode = TextBoxMode.MultiLine;
                }
                txt.Height   = Int32.Parse(dr["Height"].ToString());
                txt.Width    = Int32.Parse(dr["Width"].ToString());
                txt.CssClass = "Input3";


                TableRow  tr = new TableRow();
                TableCell tl = new TableCell();
                TableCell tc = new TableCell();
                TableCell ta = new TableCell();

                Literal lt = new Literal();

                ta.VerticalAlign = VerticalAlign.Top;
                ta.Width         = Unit.Percentage(5);
                lt.Text          = dr["Example"].ToString();

                tc.Controls.Add(txt);
                tc.Controls.Add(lt);
                tc.Width = Unit.Percentage(80);

                tl.Text  = dr["Field_Description"].ToString() + ":";
                tl.Width = Unit.Percentage(15);

                if (dr["MultiLine"].ToString() != "False")
                {
                    tl.VerticalAlign = VerticalAlign.Top;
                }
                else
                {
                    tl.VerticalAlign = VerticalAlign.Middle;
                }
                tl.HorizontalAlign = HorizontalAlign.Right;

                tr.Cells.Add(ta);
                tr.Cells.Add(tl);
                tr.Cells.Add(tc);
                tt.Rows.Add(tr);

                tc = null;
                tl = null;
                tr = null;
            }
            dr.Close();
            dr = null;

            AddAttachControl(tt);
            AddRow(tt, "<a href='#' onclick='history.back();'>返回</a>", "");

            FrmNewDocument.Controls.Add(tt);
        }
    /*
    public override void VerifyRenderingInServerForm(Control control)
    {
    }
     * */
    private void export2Excel(String sFilename)
    {
        Response.Clear();
        Response.Buffer = true;
        Response.AddHeader("content-disposition", string.Format("attachment;filename={0}.xls", sFilename));
        Response.Charset = "UTF-8";
        Response.ContentType = "application/vnd.ms-excel";
        System.IO.StringWriter stringWrite = new System.IO.StringWriter();
        System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
        //bind lại gv
        GridParent.AllowPaging = false;
        napGridParent();

        HtmlForm frm = new HtmlForm();
        GridParent.Parent.Controls.Add(frm);
        frm.Attributes["runat"] = "server";
        frm.Controls.Add(GridParent);
        frm.RenderControl(htmlWrite);

        Response.Write("<table cellSpacing='0' cellPadding='0' width='100%' align='center' border='1'");
        Response.Write(stringWrite.ToString());
        Response.Write("</table>");
        Response.End();
    }
Beispiel #23
0
        /// <summary>导出Excel</summary>
        /// <param name="gv"></param>
        /// <param name="filename"></param>
        /// <param name="max"></param>
        /// <param name="encoding"></param>
        public static void ExportExcel(GridView gv, String filename, Int32 max, Encoding encoding)
        {
            //var Request = HttpContext.Current.Request;
            //var Response = HttpContext.Current.Response;

            //去掉所有列的排序
            foreach (DataControlField item in gv.Columns)
            {
                if (item is DataControlField)
                {
                    (item as DataControlField).SortExpression = null;
                }
            }
            if (max > 0)
            {
                gv.PageSize = max;
            }
            gv.DataBind();

            // 新建页面
            var page = new Page();
            var form = new HtmlForm();

            page.EnableEventValidation = false;
            page.Controls.Add(form);
            form.Controls.Add(gv);

            Response.Clear();
            Response.Buffer          = true;
            Response.Charset         = encoding.WebName;
            Response.ContentEncoding = encoding;

            /*
             * 按照RFC2231的定义, 多语言编码的Content-Disposition应该这么定义:
             * Content-Disposition: attachment; filename*="utf8''%e6%94%b6%e6%ac%be%e7%ae%a1%e7%90%86.xls"
             * filename后面的等号之前要加 *
             * filename的值用单引号分成三段,分别是字符集(utf8)、语言(空)和urlencode过的文件名。
             * 最好加上双引号,否则文件名中空格后面的部分在Firefox中显示不出来
             */
            var cd = String.Format("attachment;filename=\"{0}\"", filename);

            if (Request.UserAgent.Contains("MSIE"))
            {
                cd = String.Format("attachment;filename=\"{0}\"", HttpUtility.UrlEncode(filename, encoding));
            }
            else if (Request.UserAgent.Contains("Firefox"))
            {
                cd = String.Format("attachment;filename*=\"{0}''{1}\"", encoding.WebName, HttpUtility.UrlEncode(filename, encoding));
            }

            Response.AppendHeader("Content-Disposition", cd);
            Response.ContentType = "application/ms-excel";

            var sw  = new StringWriter();
            var htw = new HtmlTextWriter(sw);

            page.RenderControl(htw);

            var html = sw.ToString();

            //if (html.StartsWith("<div>")) html = html.SubString("<div>".Length);
            //if (html.EndsWith("</div>")) html = html.SubString(0, html.Length - "</div>".Length);

            html = String.Format("<meta http-equiv=\"content-type\" content=\"application/ms-excel; charset={0}\"/>", encoding.WebName) + Environment.NewLine + html;

            Response.Output.Write(html);

            //var wd = new WebDownload(html, encoding);
            //wd.Mode = WebDownload.DispositionMode.Attachment;
            //wd.Render();

            Response.Flush();
            Response.End();
        }
Beispiel #24
0
        protected override void OnInit(EventArgs e)
        {
            // Init
            PlaceHolder       plc = null;
            ControlCollection col = Controls;

            // Set template directory
            if (_templateDir == null && ConfigurationSettings.AppSettings["TemplateDir"] != null)
            {
                _templateDir = ConfigurationSettings.AppSettings["TemplateDir"];
            }

            // Get the template control
            if (_templateFilename == null)
            {
                _templateFilename = ConfigurationSettings.AppSettings["DefaultTemplate"];
            }
            BasePageControl pageControl = (BasePageControl)LoadControl(ResolveUrl(_templateDir + _templateFilename));

            // Add the pagecontrol on top of the control collection of the page
            pageControl.ID = "p";
            col.AddAt(0, pageControl);

            // Get the Content placeholder
            plc = pageControl.Content;
            if (plc != null)
            {
                // Iterate through the controls in the page to find the form control.
                foreach (Control control in col)
                {
                    if (control is HtmlForm)
                    {
                        // We've found the form control. Now move all child controls into the placeholder.
                        HtmlForm formControl = (HtmlForm)control;
                        while (formControl.Controls.Count > 0)
                        {
                            // Updated 10/04/2008: Support UpdatePanel by Kien
                            if (formControl.Controls[0] is UpdatePanel)
                            {
                                UpdatePanel updatepanel = new UpdatePanel();
                                UpdatePanel oldPanel    = (UpdatePanel)formControl.Controls[0];
                                while (oldPanel.ContentTemplateContainer.Controls.Count > 0)
                                {
                                    updatepanel.ContentTemplateContainer.Controls.Add(
                                        oldPanel.ContentTemplateContainer.Controls[0]);
                                }
                                plc.Controls.Add(updatepanel);
                                formControl.Controls.RemoveAt(0);
                            }
                            else
                            {
                                plc.Controls.Add(formControl.Controls[0]);
                            }
                        }
                    }
                }
                // throw away all controls in the page, except the page control
                while (col.Count > 1)
                {
                    col.Remove(col[1]);
                }
            }
            base.OnInit(e);
        }
        public static void List2Excel <T>(HttpResponseBase responsePage, IList <T> lista, String Titulo, String nombre, List <ReportColumnHeader> columnsNames, DataTable dt = null)
        {
            var filename = nombre + ".xls";

            DataTable DataTablelista;

            if (dt != null)
            {
                DataTablelista = dt;
            }
            else
            {
                DataTablelista = CollectionHelper.ConvertTo(lista);
            }

            List <DataColumn> lstIndexremoves = new List <DataColumn>();

            for (int i = 0; i < DataTablelista.Columns.Count; i++)
            {
                DataColumn         col     = DataTablelista.Columns[i];
                ReportColumnHeader mcolumn = columnsNames.Find(x => x.BindField == col.ColumnName);

                if (mcolumn == null)
                {
                    lstIndexremoves.Add(col);
                }
                else
                {
                    DataTablelista.Columns[i].ColumnName = mcolumn.HeaderName;
                }
            }

            for (int i = 0; i < lstIndexremoves.Count; i++)
            {
                DataTablelista.Columns.Remove(lstIndexremoves[i]);
            }


            var dgGrid = new DataGrid();

            dgGrid.GridLines             = GridLines.Both;
            dgGrid.DataSource            = DataTablelista;
            dgGrid.HeaderStyle.BackColor = System.Drawing.ColorTranslator.FromHtml("#333333");
            dgGrid.HeaderStyle.ForeColor = System.Drawing.Color.White;
            dgGrid.DataBind();

            var sb   = new StringBuilder();
            var Page = new Page();

            var SW  = new StringWriter(sb);
            var htw = new HtmlTextWriter(SW);

            var inicio = "<div> " +
                         "<table border=0 cellpadding=0 cellspacing=0>" +
                         "<tr>" +
                         "<td colspan=10 align=center><h1>Consulta de " + Titulo + "</h1></td>" +
                         "</tr>" +
                         "<tr>" +
                         "<td colspan=1 align=left style='font-weight:bold'>Fecha de generación:</td>" +
                         "<td colspan=2 align=left>" + DateTime.Now.ToLongDateString() + "</td>" +
                         "</tr>" +
                         "</table>" +
                         "</div>";

            htw.Write(inicio);

            var form = new HtmlForm();

            responsePage.ContentType = "application/vnd.ms-excel";
            responsePage.AddHeader("Content-Disposition", "attachment;filename=" + filename);
            responsePage.Charset         = string.Empty;
            responsePage.ContentEncoding = Encoding.Default;
            dgGrid.EnableViewState       = false;
            Page.EnableEventValidation   = false;
            Page.DesignerInitialize();
            Page.Controls.Add(form);
            form.Controls.Add(dgGrid);
            Page.RenderControl(htw);
            responsePage.Clear();
            responsePage.Buffer = true;
            responsePage.Write(sb.ToString());
            responsePage.End();
        }
Beispiel #26
0
    private void Page_Init()
    {
        // Load Page Properties
        HtmlMeta myDescription = new HtmlMeta();

        myDescription.Name    = "Description";
        myDescription.Content = myMasterPageIndex.MasterPage_Description;
        this.Header.Controls.Add(myDescription);

        // Add CSS for Advanced window
        string[] CssFiles =
        {
            "~/App_Themes/NexusCore/Editor.css",
        };

        foreach (string CssFile in CssFiles)
        {
            HtmlLink cssEditor_Link = new HtmlLink();
            cssEditor_Link.Href = CssFile;
            cssEditor_Link.Attributes.Add("type", "text/css");
            cssEditor_Link.Attributes.Add("rel", "stylesheet");
            Header.Controls.Add(cssEditor_Link);
        }


        // Add Script File for Advanced window
        string[] Scripts =
        {
        };

        foreach (string myScript in Scripts)
        {
            string MapPath = Request.ApplicationPath;

            if (MapPath.EndsWith("/"))
            {
                MapPath = MapPath.Remove(MapPath.Length - 1) + myScript;
            }
            else
            {
                MapPath = MapPath + myScript;
            }

            HtmlGenericControl scriptTag = new HtmlGenericControl("script");
            scriptTag.Attributes.Add("type", "text/javascript");
            scriptTag.Attributes.Add("src", MapPath);
            Header.Controls.Add(scriptTag);
        }

        // Add Script Manager
        RadScriptManager myScriptMgr = new RadScriptManager();

        myScriptMgr.ID = "RadScriptManager1";

        HtmlForm myForm = (HtmlForm)Page.Master.FindControl("Form_NexusCore");

        myForm.Controls.Add(myScriptMgr);

        // Add PlaceHolder
        PlaceHolder myPlaceHolder = new PlaceHolder();

        myPlaceHolder.ID = "PlaceHolder_AdvancedMode";

        #region Add Control Manager Windows
        // Create CodeBlock
        RadScriptBlock myCodeBlock = new RadScriptBlock();

        // Create Script Tag
        HtmlGenericControl myCodeBlock_ScriptTag = new HtmlGenericControl("Script");
        myCodeBlock_ScriptTag.Attributes.Add("type", "text/javascript");
        myCodeBlock_ScriptTag.InnerHtml = Nexus.Core.Phrases.PhraseMgr.Get_Phrase_Value("NexusCore_PageEditor_PoPWindow");
        myCodeBlock.Controls.Add(myCodeBlock_ScriptTag);

        // Create Window Manager
        RadWindowManager myWindowManager = new RadWindowManager();
        myWindowManager.ID = "RadWindowManager_ControlManager";

        // Create RadWindow
        RadWindow myRadWindow = new RadWindow();
        myRadWindow.ID                    = "RadWindow_ControlManager";
        myRadWindow.Title                 = "User Control Manager";
        myRadWindow.ReloadOnShow          = true;
        myRadWindow.ShowContentDuringLoad = false;
        myRadWindow.Modal                 = true;
        myRadWindow.Animation             = WindowAnimation.Fade;
        myRadWindow.AutoSize              = true;
        myRadWindow.Behaviors             = WindowBehaviors.Close;
        myRadWindow.InitialBehaviors      = WindowBehaviors.Resize;
        //myRadWindow.DestroyOnClose = true;
        myRadWindow.KeepInScreenBounds = true;
        myRadWindow.VisibleStatusbar   = false;

        myWindowManager.Windows.Add(myRadWindow);

        // Create AjaxManager
        RadAjaxManager myRadAjaxManager = new RadAjaxManager();
        myRadAjaxManager.ID           = "RadAjaxManager_ControlManger";
        myRadAjaxManager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager_AjaxRequest);

        // Add to Place Holder
        myPlaceHolder.Controls.Add(myCodeBlock);
        myPlaceHolder.Controls.Add(myWindowManager);
        myPlaceHolder.Controls.Add(myRadAjaxManager);

        #endregion

        #region Add Warp Controls and Dock Layout

        // Remove inline Controls
        HtmlGenericControl myContentDiv = (HtmlGenericControl)Page.Master.FindControl("pageWrapContainer");
        Page.Master.Controls.Remove(myContentDiv);

        // Create Hidden Update_Panel
        UpdatePanel myUpdatePanel_Docks = new UpdatePanel();
        myUpdatePanel_Docks.ID = "UpdatePanel_Docks";

        // Create myRadAjaxManager Postback Trigger
        PostBackTrigger RadAjaxTrigger = new PostBackTrigger();
        RadAjaxTrigger.ControlID = myRadAjaxManager.ID;
        myUpdatePanel_Docks.Triggers.Add(RadAjaxTrigger);

        // Add inLine Controls back
        myPlaceHolder.Controls.Add(myUpdatePanel_Docks);

        //myUpdatePanel_DockLayout.ContentTemplateContainer.Controls.Add(myDockLayout);

        myPlaceHolder.Controls.Add(myContentDiv);
        myForm.Controls.Add(myPlaceHolder);

        #endregion

        // Load MasterPage Control
        MasterPageMgr myMasterPageMgr = new MasterPageMgr();
        myMasterPageMgr.Load_MasterPageControls_Advanced(this.Page, myMasterPageIndex.MasterPageIndexID);
    }
Beispiel #27
0
 public Hidden(HtmlForm parentForm, string name, string value) : base(parentForm, name, value)
 {
 }
Beispiel #28
0
        protected void ButtonExportarPdf_Click(object sender, EventArgs e)
        {
            AcuseFolio objAcuseOpinionFolio;

            strTipoArrendamiento = Request.QueryString["TipoArrto"];
            int  intFolio;
            bool ConversionOK; //esta nos dice si es un número válido

            try
            {
                StringBuilder  sb  = new StringBuilder();
                StringWriter   sw  = new StringWriter(sb);
                HtmlTextWriter htw = new HtmlTextWriter(sw);

                Page     page = new Page();
                HtmlForm form = new HtmlForm();
                page.EnableEventValidation = false;
                page.DesignerInitialize();
                form = this.form1;
                form.FindControl("ButtonExportarPdf").Visible = false;
                page.Controls.Add(form);
                page.RenderControl(htw);

                //string strCabecero ="<!DOCTYPE html> <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/><title></title><meta charset='utf-8' /></head><body>";
                string strCabecero = "<!DOCTYPE html> <html xmlns='http://www.w3.org/1999/xhtml'> <head runat='server'> <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/> <title></title> <link href='https://framework-gb.cdn.gob.mx/assets/styles/main.css' rel='stylesheet'/> <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,600,300' rel='stylesheet' type='text/css'/> <link href='https://framework-gb.cdn.gob.mx/favicon.ico' rel='shortcut icon'/> <style> @media print { #ZonaNoImrpimible {display:none;} } nav,aside  { display: none; } .auto-style1 { height: 119px; } </style> <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js'></script> </head> <body>";
                string strPie      = "</body> </html>";


                string strBotonExportar = "<asp:Button ID=\"ButtonExportarPdf\" runat=\"server\" CssClass=\"btn btn-default\" OnClick=\"ButtonExportarPdf_Click\" Text=\"Exportar a PDF\" ToolTip=\"Exportar a PDF.\" />";
                string strBotonImprimir = "<input type=\"button\" id=\"ButtonImprimir\" value=\"Imprimir\" onclick=\"javascript: window.print()\" class=\"btn\" />";
                string strBrakePage     = "page-break-before: always;";



                string strCuerpoOriginal  = sb.ToString();
                string strPaginaConCuerpo = strCabecero + strCuerpoOriginal + strPie;
                //string strCuerpoFormateado = especialesHTML(strPaginaConCuerpo).Replace(strImagenLogoIndaabinHtml, strImagenLogoIndaabinFisica).Replace(strImagenEscudoNacionalHtml, strImagenEscudoNacionalFisica).Replace(strBotonImprimir, "").Replace(strBotonExportar, "").Replace(strBrakePage, "");
                string strCuerpoFormateado = especialesHTML(strPaginaConCuerpo);

                //poner la url del nuevo logo si pasa del 1 de diciembre de 2018
                ConversionOK = int.TryParse(Request.QueryString["IdFolio"].ToString(), out intFolio);
                if (ConversionOK)
                {
                    objAcuseOpinionFolio = new NGConceptoRespValor().ObtenerAcuseSolicitudOpinionConInmueble(intFolio, strTipoArrendamiento);

                    string fecha = objAcuseOpinionFolio.FechaAutorizacion.ToString();

                    string[] nuevafecha = fecha.Split('/');

                    string[] ano = nuevafecha[2].Split(' ');

                    string dia = nuevafecha[0];

                    string mes = nuevafecha[1];

                    string year = ano[0];

                    strCuerpoFormateado = strCuerpoFormateado.Replace("src=\"http://sistemas.indaabin.gob.mx/ImagenesComunes/INDAABIN_01.jpg\"", "src=\"https://sistemas.indaabin.gob.mx/ImagenesComunes/SHCP-INDAABINREDUCIDO.PNG");

                    strCuerpoFormateado = strCuerpoFormateado.Replace("url(http://sistemas.indaabin.gob.mx/ImagenesComunes/aguila.png);", "url(https://sistemas.indaabin.gob.mx/ImagenesComunes/nuevoescudo.png);");

                    strCuerpoFormateado = strCuerpoFormateado.Replace("background-position: center;", "background-position: left;");

                    strCuerpoFormateado = strCuerpoFormateado.Replace("##font##", "font-family: Montserrat;");

                    strCuerpoFormateado = strCuerpoFormateado.Replace("##Viejo##", "display:none;");

                    //if (Convert.ToInt32(year) >= 2018)
                    //{
                    //    if (Convert.ToInt32(mes) >= 12)
                    //    {
                    //        if (Convert.ToInt32(dia) >= 1)
                    //        {

                    //            strCuerpoFormateado = strCuerpoFormateado.Replace("src=\"http://sistemas.indaabin.gob.mx/ImagenesComunes/INDAABIN_01.jpg\"", "src=\"https://sistemas.indaabin.gob.mx/ImagenesComunes/SHCP-INDAABINREDUCIDO.PNG");

                    //            strCuerpoFormateado = strCuerpoFormateado.Replace("url(http://sistemas.indaabin.gob.mx/ImagenesComunes/aguila.png);", "url(https://sistemas.indaabin.gob.mx/ImagenesComunes/nuevoescudo.png);");

                    //            strCuerpoFormateado = strCuerpoFormateado.Replace("background-position: center;", "background-position: left;");

                    //            strCuerpoFormateado = strCuerpoFormateado.Replace("##font##", "font-family: Montserrat;");

                    //            strCuerpoFormateado = strCuerpoFormateado.Replace("##Viejo##", "display:none;");
                    //        }
                    //        else
                    //        {
                    //            strCuerpoFormateado = strCuerpoFormateado.Replace("##Nuevo##", "display:none;");
                    //        }
                    //    }
                    //    else
                    //    {
                    //        strCuerpoFormateado = strCuerpoFormateado.Replace("##Nuevo##", "display:none;");
                    //    }
                    //}
                    //else
                    //{
                    //    strCuerpoFormateado = strCuerpoFormateado.Replace("##Nuevo##", "display:none;");
                    //}
                }



                ExportHTML exportar = new ExportHTML();
                exportar.CanPrint = true;

                //RCA 10/18/2017
                exportar.GenerarPDF(strCuerpoFormateado);
                //exportar.GenerarPDF(strCuerpoFormateado, Server.MapPath("~"));
            }
            catch (Exception ex)
            {
                Msj = "Ha ocurrido un error al exportar a PDF. Contacta al área de sistemas.";
                this.LabelInfo.Text = "<div class='alert alert-danger'><strong> Error </strong>" + Msj + "</div>";
                MostrarMensajeJavaScript(Msj);

                BitacoraExcepcion BitacoraExcepcionAplictivo = new BitacoraExcepcion
                {
                    CadenaconexionBD = System.Configuration.ConfigurationManager.ConnectionStrings["cnArrendamientoInmueble"].ConnectionString,
                    Aplicacion       = "ContratosArrto",
                    Modulo           = MethodInfo.GetCurrentMethod().DeclaringType.ToString() + ".aspx",
                    Funcion          = MethodBase.GetCurrentMethod().Name + "()",
                    DescExcepcion    = ex.InnerException == null ? ex.Message : ex.InnerException.Message,
                    Usr = ((SSO)Session["Contexto"]).UserName.ToString()
                };
                BitacoraExcepcionAplictivo.RegistrarBitacoraExcepcion();
                BitacoraExcepcionAplictivo = null;
            }
        }
        private void Page_Load(object sender, System.EventArgs e)
        {
            HtmlForm frm = (HtmlForm)FindControl("Form1");

            GHTTestBegin(frm);

            // Call twice with the same instance should provide the same result.
            this.GHTSubTestBegin("Two calls by the same object.");
            try
            {
                bool     flag1;
                ListItem item1 = new ListItem("Text", "Value");
                if (item1.GetHashCode() == item1.GetHashCode())
                {
                    flag1 = true;
                }
                else
                {
                    flag1 = false;
                }
                this.GHTSubTestAddResult(flag1.ToString());
            }
            catch (Exception exception5)
            {
                this.GHTSubTestUnexpectedExceptionCaught(exception5);
            }
            this.GHTSubTestEnd();

            // Equal items (value equality, and not ref equality) should provide the same hashcode.
            this.GHTSubTestBegin("Equal items ");
            try
            {
                bool     flag2;
                ListItem item2 = new ListItem("Text", "Value");
                ListItem item3 = new ListItem("Text", "Value");
                if (item2.GetHashCode() == item3.GetHashCode())
                {
                    flag2 = true;
                }
                else
                {
                    flag2 = false;
                }
                this.GHTSubTestAddResult(flag2.ToString());
            }
            catch (Exception exception6)
            {
                this.GHTSubTestUnexpectedExceptionCaught(exception6);
            }
            this.GHTSubTestEnd();

            // Not equal items (different text) should provide the diffrent hashcode.
            this.GHTSubTestBegin("Not equal items ");
            try
            {
                bool     flag3;
                ListItem item4 = new ListItem("Text1", "Value");
                ListItem item5 = new ListItem("Text2", "Value");
                if (item4.GetHashCode() == item5.GetHashCode())
                {
                    flag3 = true;
                }
                else
                {
                    flag3 = false;
                }
                this.GHTSubTestAddResult(flag3.ToString());
            }
            catch (Exception exception7)
            {
                // ProjectData.SetProjectError(exception7);
                Exception exception3 = exception7;
                this.GHTSubTestUnexpectedExceptionCaught(exception3);
                // ProjectData.ClearProjectError();
            }
            this.GHTSubTestEnd();

            // Not equal items (different value) should provide the diffrent hashcode.
            this.GHTSubTestBegin("Not equal items ");
            try
            {
                bool     flag4;
                ListItem item6 = new ListItem("Text", "Value1");
                ListItem item7 = new ListItem("Text", "Value2");
                if (item6.GetHashCode() == item7.GetHashCode())
                {
                    flag4 = true;
                }
                else
                {
                    flag4 = false;
                }
                this.GHTSubTestAddResult(flag4.ToString());
            }
            catch (Exception exception8)
            {
                // ProjectData.SetProjectError(exception8);
                Exception exception4 = exception8;
                this.GHTSubTestUnexpectedExceptionCaught(exception4);
                // ProjectData.ClearProjectError();
            }
            this.GHTSubTestEnd();
            this.GHTTestEnd();
        }
    protected void BtnDownloadAttendanceAsExcel_Click(object sender, EventArgs e)
    {
        BtnGetAttendance_Click(sender, e);
        LblSectionGroup1.Text = LblSectionGroup.Text;
        LblSectionGroup2.Text = DDLSectionGroup.SelectedItem.ToString();
        LblFromDate.Text = TxtBxFromDate.Text;
        LblToDate.Text = TxtBxToDate.Text;
        LblSubjectName.Text = DDLSubjects.SelectedItem.Text;
        sql = "SELECT FacultyName from Faculty WHERE FacultyID='" + int.Parse(Session["FacultyID"].ToString()) + "'";
        c = new Connect(sql);
        LblFacultyName.Text = c.ds.Tables[0].Rows[0]["FacultyName"].ToString();
        string name = DDLSectionGroup.SelectedItem.ToString().Replace("   ", "") + ".xls";
        HtmlForm form = new HtmlForm();
        string attachment = "attachment; filename=" + name;
        Response.ClearContent();
        Response.Buffer = true;
        Response.AddHeader("content-disposition", attachment);
        Response.ContentType = "application/ms-excel";
        StringWriter stw = new StringWriter();
        HtmlTextWriter htextw = new HtmlTextWriter(stw);
        form.Controls.Add(ListHeader);
        if (GridView1.Visible == true)
            form.Controls.Add(GridView1);
        if (GridView2.Visible == true)
        {
            foreach (GridViewRow row in GridView2.Rows)
            {
                foreach (TableCell cell in row.Cells)
                {
                    if (row.RowIndex % 2 == 0)
                    {
                        cell.BackColor = GridView1.AlternatingRowStyle.BackColor;
                    }
                    else
                    {
                        cell.BackColor = GridView1.RowStyle.BackColor;
                    }
                    cell.CssClass = "textmode";
                    List<Control> controls = new List<Control>();

                    //Add controls to be removed to Generic List
                    foreach (Control control in cell.Controls)
                    {
                        controls.Add(control);
                    }

                    //Loop through the controls to be removed and replace then with Literal
                    foreach (Control control in controls)
                    {

                        switch (control.GetType().Name)
                        {
                            case "Label":
                                cell.Controls.Add(new Literal { Text = (control as Label).Text });
                                break;
                            case "TextBox":
                                cell.Controls.Add(new Literal { Text = (control as TextBox).Text });
                                break;
                            case "LinkButton":
                                cell.Controls.Add(new Literal { Text = (control as LinkButton).Text });
                                break;
                            case "CheckBox":
                                cell.Controls.Add(new Literal { Text = (control as CheckBox).Text });
                                break;
                            case "RadioButton":
                                cell.Controls.Add(new Literal { Text = (control as RadioButton).Text });
                                break;
                        }
                        cell.Controls.Remove(control);
                    }
                }
            }
            form.Controls.Add(GridView2);
        } this.Controls.Add(form);
        form.RenderControl(htextw);
        Response.Write(stw.ToString());
        Response.End();
    }
Beispiel #31
0
 public Hidden(HtmlForm parentForm, string name, string value) : base(parentForm, name, value)
 {
 }
Beispiel #32
0
 public static HttpContent CreateHttpContent(HtmlForm form)
 {
     return(new FormUrlEncodedContent(form.InputElements.Select(x => new KeyValuePair <string, string>(x.Name, x.Value)).ToArray()));
 }
		HtmlForm BuildAuthorForm(){

			HtmlForm form = new HtmlForm(){Name="Author", Action="api/Author/save?cayita=true"};

			form.Id="form-edit";

			form.AddHtmlHiddenField( (field)=>{
				field.AddHtmlTextInput((input)=>{
				input.Name="Id";
				});
			});

			form.AddHtmlField( (field)=>{
				field.Label.InnerHtml="Name";
				field.AddHtmlTextInput((input)=>{
				input.Required=true;
				input.Name="Name";
				input.Placeholder="Author's name";
				});
			});

			form.AddHtmlField( (field)=>{
				field.Label.InnerHtml="City";
				field.AddHtmlTextInput((input)=>{
				input.Required=true;
				input.Name="City";
				input.Placeholder="city";
				});
			});

			form.AddHtmlField( (field)=>{
				field.Label.InnerHtml="Comments";
				field.AddHtmlTextInput((input)=>{
					input.Name="Comments";
				});
			});



			form.AddHtmlField( (field)=>{
				field.Label.InnerHtml="Active";
				field.AddHtmlCheckboxInput((input)=>{
					input.Name="Active";
				});
			});


			form.AddActionButton( new HtmlButton(){
				Type="submit", Text="Save", Class="button-save btn btn-primary",
				Name="Author"
			});
			form.AddActionButton( new HtmlButton(){Text="Cancel", Class="button-cancel btn", Name="Author"});

			return form;
		}
Beispiel #34
0
      private void Page_Load(object sender, EventArgs e)
      {
          HtmlForm form1 = (HtmlForm)(HtmlForm)this.FindControl("Form1");

          this.GHTTestBegin(form1);
          this.GHTSubTestBegin("GHTSubTest1");
          try
          {
              this.GHTSubTestAddResult(this.Session.CodePage.ToString());
          }
          catch (Exception exception6)
          {
              // ProjectData.SetProjectError(exception6);
              Exception exception1 = exception6;
              this.GHTSubTestUnexpectedExceptionCaught(exception1);
              // ProjectData.ClearProjectError();
          }
          this.GHTSubTestEnd();
          this.GHTSubTestBegin("GHTSubTest2");
          try
          {
              this.Session.CodePage = 0x7b;
              this.GHTSubTestAddResult(this.Session.CodePage.ToString());
              this.GHTSubTestExpectedExceptionNotCaught("ArgumentException");
          }
#if NET_2_0
          catch (NotSupportedException exception7)
          {
              // ProjectData.SetProjectError(exception7);
              NotSupportedException exception2 = exception7;
              this.GHTSubTestExpectedExceptionCaught(exception2);
              // ProjectData.ClearProjectError();
          }
#endif
          catch (ArgumentException exception7)
          {
              // ProjectData.SetProjectError(exception7);
              ArgumentException exception2 = exception7;
              this.GHTSubTestExpectedExceptionCaught(exception2);
              // ProjectData.ClearProjectError();
          }

          catch (Exception exception8)
          {
              // ProjectData.SetProjectError(exception8);
              Exception exception3 = exception8;
              this.GHTSubTestUnexpectedExceptionCaught(exception3);
              // ProjectData.ClearProjectError();
          }
          this.GHTSubTestEnd();
          this.GHTSubTestBegin("GHTSubTest4");
          try
          {
              this.Session.CodePage = -125;
              this.GHTSubTestAddResult(this.Session.CodePage.ToString());
              this.GHTSubTestExpectedExceptionNotCaught("ArgumentException");
          }
          catch (ArgumentException exception9)
          {
              // ProjectData.SetProjectError(exception9);
              ArgumentException exception4 = exception9;
              this.GHTSubTestExpectedExceptionCaught(exception4);
              // ProjectData.ClearProjectError();
          }
          catch (Exception exception10)
          {
              // ProjectData.SetProjectError(exception10);
              Exception exception5 = exception10;
              this.GHTSubTestUnexpectedExceptionCaught(exception5);
              // ProjectData.ClearProjectError();
          }
          this.GHTSubTestEnd();
          this.GHTTestEnd();
      }
Beispiel #35
0
    /// <summary>
    /// Imprime um controle de uma página, com script
    /// <summary>
    public static void ImprimirControle(Control ctl, string script)
    {
        try
        {
            if (ctl != null)
            {
                StringWriter stringWrite = new StringWriter();
                HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);

                if (ctl is WebControl)
                {
                    Unit w = new Unit(100, UnitType.Percentage);
                    ((WebControl)ctl).Width = w;
                }

                Page pg = new Page();
                pg.EnableEventValidation = false;

                if (script != string.Empty)
                {
                    pg.ClientScript.RegisterStartupScript(pg.GetType(), string.Empty, script);
                }

                HtmlForm frm = new HtmlForm();
                pg.Controls.Add(frm);

                frm.Attributes.Add("runat", "server");
                frm.Controls.Add(ctl);

                pg.DesignerInitialize();
                pg.RenderControl(htmlWrite);

                string strHTML = stringWrite.ToString();
                HttpContext.Current.Response.Clear();
                HttpContext.Current.Response.ContentEncoding = Encoding.UTF8;
                HttpContext.Current.Response.Write(strHTML);

                string print = "<script type=\"text/javascript\" language=\"javascript\">window.print();</script>";
                HttpContext.Current.Response.Write(print);
                HttpContext.Current.Response.End();
                HttpContext.Current.Response.Flush();
            }
        }
        catch { }
    }
Beispiel #36
0
        protected override void OnInit(EventArgs e)
        {
            // The GeneralPage loads it's own content. No need for the PageEngine to do that.
            base.ShouldLoadContent = false;
            // Init the PageEngine.
            base.OnInit(e);
            // Build page.
            ControlCollection col = this.Controls;

            this._currentSite = base.RootNode.Site;
            if (this._currentSite.DefaultTemplate != null &&
                this._currentSite.DefaultPlaceholder != null &&
                this._currentSite.DefaultPlaceholder != String.Empty)
            {
                // Load the template
                this.TemplateControl = (BaseTemplate)this.LoadControl(UrlHelper.GetApplicationPath()
                                                                      + this._currentSite.DefaultTemplate.Path);
                // Register css
                string css = UrlHelper.GetApplicationPath()
                             + this._currentSite.DefaultTemplate.BasePath
                             + "/Css/" + this._currentSite.DefaultTemplate.Css;
                RegisterStylesheet("maincss", css);

                if (this._title != null)
                {
                    this.TemplateControl.Title = this._title;
                }

                // Add the pagecontrol on top of the control collection of the page
                this.TemplateControl.ID = "p";
                col.AddAt(0, this.TemplateControl);

                // Get the Content placeholder
                this._contentPlaceHolder = this.TemplateControl.FindControl(this._currentSite.DefaultPlaceholder) as PlaceHolder;
                if (this._contentPlaceHolder != null)
                {
                    // Iterate through the controls in the page to find the form control.
                    foreach (Control control in col)
                    {
                        if (control is HtmlForm)
                        {
                            // We've found the form control. Now move all child controls into the placeholder.
                            HtmlForm formControl = (HtmlForm)control;
                            while (formControl.Controls.Count > 0)
                            {
                                this._contentPlaceHolder.Controls.Add(formControl.Controls[0]);
                            }
                        }
                    }
                    // throw away all controls in the page, except the page control
                    while (col.Count > 1)
                    {
                        col.Remove(col[1]);
                    }
                }
            }
            else
            {
                // The default template and placeholders are not correctly configured.
                throw new Exception("Unable to display page because the default template is not configured.");
            }
        }
Beispiel #37
0
        private void ExportToExcel(string nameReport, List <InformeProduccionM> lista, string Area, string Maquina, string fInicio)
        {
            HttpResponse   response     = Response;
            StringWriter   sw           = new StringWriter();
            HtmlTextWriter htw          = new HtmlTextWriter(sw);
            Page           pageToRender = new Page();
            HtmlForm       form         = new HtmlForm();
            Label          la           = new Label();

            string Titulo = "<div align='center'>Informe SobreImpresión<br/>";

            if (Area != "")
            {
                Titulo += "Area : " + Area;
            }
            if (Maquina != "")
            {
                Titulo += " Maquina : " + Maquina;
            }
            if (fInicio != "")
            {
                Titulo += " Fecha : " + fInicio;
            }
            la.Text = Titulo + "</div><br />";

            form.Controls.Add(la);

            #region ConversionListaGrilla
            int contado = 0;
            int TotalRotCantPlan = 0; int TotalRotCantPlanSobre = 0; int TotalRotCantProdSobre = 0; int TotalRotCantDifSobre = 0; double RotPorceCantDifSobre = 0; int TotalRotCantPlanBajo = 0; int TotalRotCantProdBajo = 0; int TotalRotCantDifBajo = 0; double RotPorceCantDifBajo = 0;
            int TotalPlaCantPlan = 0; int TotalPlaCantPlanSobre = 0; int TotalPlaCantProdSobre = 0; int TotalPlaCantDifSobre = 0; double PlaPorceCantDifSobre = 0; int TotalPlaCantPlanBajo = 0; int TotalPlaCantProdBajo = 0; int TotalPlaCantDifbajo = 0; double PlaPorceCantDifBajo = 0;
            foreach (string maquinasProd in lista.Select(o => o.Maquina).Distinct())
            {
                GridView gv = new GridView();
                gv.DataSource = lista.Where(o => o.Maquina == maquinasProd);
                gv.DataBind();
                gv.HeaderStyle.BackColor = System.Drawing.Color.Blue;
                gv.HeaderStyle.ForeColor = System.Drawing.Color.White;

                gv.HeaderRow.Cells[0].Text = "Maquina";
                gv.HeaderRow.Cells[1].Text = "OT";
                gv.HeaderRow.Cells[2].Text = "NombreOT";
                gv.HeaderRow.Cells[3].Text = "Pliego";
                gv.HeaderRow.Cells[4].Text = "Cant. Planificado";
                gv.HeaderRow.Cells[5].Text = "Cant. Producida";
                gv.HeaderRow.Cells[6].Text = "Dif.";
                gv.HeaderRow.Cells[7].Text = "% ";
                //if (Session["Usuario"].ToString().Trim() == "apaillaqueo" || Session["Usuario"].ToString().Trim() == "mandrade")
                //{
                //    gv.HeaderRow.Cells[8].Visible = false;
                //    gv.HeaderRow.Cells[10].Visible = false;
                //}
                //else
                //{
                gv.HeaderRow.Cells[8].Text  = "Control Wip";
                gv.HeaderRow.Cells[10].Text = "Operador";
                //}
                //gv.HeaderRow.Cells[8].Text = "Control Wip";
                gv.HeaderRow.Cells[9].Text    = "Papeles";
                gv.HeaderRow.Cells[9].Visible = false;
                //gv.HeaderRow.Cells[10].Text = "Operador";
                gv.HeaderRow.Cells[11].Visible = false;
                gv.HeaderRow.Cells[12].Visible = false;
                gv.HeaderRow.Cells[13].Visible = false;
                gv.HeaderRow.Cells[14].Visible = false;
                gv.HeaderRow.Cells[15].Visible = false;
                gv.HeaderRow.Cells[16].Visible = false;
                gv.HeaderRow.Cells[17].Visible = false;
                gv.HeaderRow.Cells[18].Visible = false;
                gv.HeaderRow.Cells[19].Visible = false;
                gv.HeaderRow.Cells[20].Visible = false;
                int CantPlanSobre    = 0;
                int CantProdSobre    = 0;
                int CantPlanBajo     = 0;
                int CantProdBajo     = 0;
                int TotalPlanificado = 0;

                for (int contador = 0; contador < gv.Rows.Count; contador++)
                {
                    GridViewRow row = gv.Rows[contador];
                    //if (Session["Usuario"].ToString().Trim() == "apaillaqueo" || Session["Usuario"].ToString().Trim() == "mandrade")
                    //{
                    //    row.Cells[8].Visible = false;
                    //    row.Cells[10].Visible = false;
                    //}
                    //else
                    //{
                    row.Cells[8].Text  = row.Cells[11].Text;
                    row.Cells[10].Text = row.Cells[9].Text;
                    //}
                    //row.Cells[8].Text = row.Cells[11].Text;
                    //row.Cells[10].Text = row.Cells[9].Text;
                    row.Cells[9].Visible = false;
                    row.Cells[9].Text    = row.Cells[18].Text;
                    string Maquinagv = row.Cells[7].Text;
                    row.Cells[7].Text     = row.Cells[4].Text + "%";
                    row.Cells[6].Text     = row.Cells[17].Text;
                    row.Cells[5].Text     = row.Cells[13].Text;
                    row.Cells[4].Text     = row.Cells[3].Text;
                    row.Cells[3].Text     = row.Cells[2].Text;
                    row.Cells[2].Text     = row.Cells[1].Text;
                    row.Cells[1].Text     = row.Cells[0].Text;
                    row.Cells[0].Text     = Maquinagv;
                    row.Cells[11].Visible = false;
                    row.Cells[12].Visible = false;
                    row.Cells[13].Visible = false;
                    row.Cells[14].Visible = false;
                    row.Cells[15].Visible = false;
                    row.Cells[16].Visible = false;
                    row.Cells[17].Visible = false;
                    row.Cells[18].Visible = false;
                    row.Cells[19].Visible = false;
                    row.Cells[20].Visible = false;
                    TotalPlanificado     += Convert.ToInt32(row.Cells[4].Text);
                    if (Convert.ToInt32(row.Cells[5].Text) >= Convert.ToInt32(row.Cells[4].Text))
                    {
                        CantPlanSobre += Convert.ToInt32(row.Cells[4].Text);
                        CantProdSobre += Convert.ToInt32(row.Cells[5].Text);
                        if (row.Cells[20].Text == "Rotativas")
                        {
                            TotalRotCantPlan      += Convert.ToInt32(row.Cells[4].Text);
                            TotalRotCantPlanSobre += Convert.ToInt32(row.Cells[4].Text);
                            TotalRotCantProdSobre += Convert.ToInt32(row.Cells[5].Text);
                        }
                        else
                        {
                            TotalPlaCantPlan      += Convert.ToInt32(row.Cells[4].Text);
                            TotalPlaCantPlanSobre += Convert.ToInt32(row.Cells[4].Text);
                            TotalPlaCantProdSobre += Convert.ToInt32(row.Cells[5].Text);
                        }
                    }
                    else
                    {
                        if (row.Cells[20].Text == "Rotativas")
                        {
                            TotalRotCantPlan     += Convert.ToInt32(row.Cells[4].Text);
                            CantPlanBajo         += Convert.ToInt32(row.Cells[4].Text);
                            TotalRotCantPlanBajo += Convert.ToInt32(row.Cells[4].Text);
                            CantProdBajo         += Convert.ToInt32(row.Cells[5].Text);
                            TotalRotCantProdBajo += Convert.ToInt32(row.Cells[5].Text);
                        }
                        else
                        {
                            TotalPlaCantPlan     += Convert.ToInt32(row.Cells[4].Text);
                            CantPlanBajo         += Convert.ToInt32(row.Cells[4].Text);
                            TotalPlaCantPlanBajo += Convert.ToInt32(row.Cells[4].Text);
                            CantProdBajo         += Convert.ToInt32(row.Cells[5].Text);
                            TotalPlaCantProdBajo += Convert.ToInt32(row.Cells[5].Text);
                        }
                    }
                }
                string CantidadDif = (CantProdSobre - CantPlanSobre).ToString();
                string PorcenProd  = (Convert.ToDouble(Convert.ToDouble(CantidadDif) / Convert.ToDouble(CantPlanSobre)) * 100).ToString("N2") + "%";

                Label  TablaMaquinaTotal = new Label();
                string Negativo          = "";
                if (CantPlanBajo > 0)
                {
                    string CantidadDifNeg = (CantProdBajo - CantPlanBajo).ToString();
                    string PorcenProdNeg  = (Convert.ToDouble(Convert.ToDouble(CantidadDifNeg) / Convert.ToDouble(CantPlanBajo)) * 100).ToString("N2") + "%";
                    Negativo = "<tr><td colspan ='6'></td><td style='border:1px solid black;'>Cant. Plan. Bajo</td>" +
                               "<td style='border:1px solid black;'>" + CantPlanBajo.ToString() + "</td></tr><tr>" +
                               "<td colspan ='6'></td><td style='border:1px solid black;'>Cant. Prod. Bajo</td>" +
                               "<td style='border:1px solid black;'>" + CantProdBajo.ToString() + "</td></tr><tr>" +
                               "<td colspan ='6'></td><td style='border:1px solid black;'>Diferencia Bajo</td>" +
                               "<td style='border:1px solid black;'>" + CantidadDifNeg + "</td></tr><tr>" +
                               "<td colspan ='6'></td><td style='border:1px solid black;'>% Bajo</td>" +
                               "<td style='border:1px solid black;'>" + PorcenProdNeg + "</td></tr>";
                }
                TablaMaquinaTotal.Text = "<br/><div align='right'><table><tr>" +
                                         "<td colspan ='6'></td><td  style='border:1px solid black;'>Total Cant. Plan.</td>" +
                                         "<td style='border:1px solid black;'>" + TotalPlanificado.ToString() + "</div></td></tr><tr>" +
                                         "<td colspan ='6'></td><td  style='border:1px solid black;'>Cant. Plan. Sobre</td>" +
                                         "<td style='border:1px solid black;'>" + CantPlanSobre.ToString() + "</div></td></tr><tr>" +
                                         "<td colspan ='6'></td><td style='border:1px solid black;'>Cant. Prod. Sobre</td>" +
                                         "<td style='border:1px solid black;'>" + CantProdSobre.ToString() + "</td></tr><tr>" +
                                         "<td colspan ='6'></td><td style='border:1px solid black;'>Diferencia Sobre</td>" +
                                         "<td style='border:1px solid black;'>" + CantidadDif + "</td></tr><tr>" +
                                         "<td colspan ='6'></td><td style='border:1px solid black;'>% Sobre</td>" +
                                         "<td style='border:1px solid black;'>" + PorcenProd.Replace("NaN", "0") + "</td></tr>" + Negativo + "</table></div>";

                Label Maquina1 = new Label();
                if (contado == 0)
                {
                    Maquina1.Text = "<div align='left'>" + maquinasProd + " </div><br/>";
                }
                else
                {
                    Maquina1.Text = "<br/><div align='left'>" + maquinasProd + " </div><br/>";
                }
                form.Controls.Add(Maquina1);
                form.Controls.Add(gv);
                form.Controls.Add(TablaMaquinaTotal);
                contado++;
            }
            #endregion

            Label TablaMaquinaRot = new Label();
            TotalRotCantDifSobre = (TotalRotCantProdSobre - TotalRotCantPlanSobre);
            RotPorceCantDifSobre = Convert.ToDouble(Convert.ToDouble(TotalRotCantDifSobre) / Convert.ToDouble(TotalRotCantPlanSobre)) * 100;
            TotalRotCantDifBajo  = (TotalRotCantPlanBajo - TotalRotCantProdBajo);

            string RotNegativoBajo = "";
            if (TotalRotCantDifBajo > 0)
            {
                RotPorceCantDifBajo = Convert.ToDouble(Convert.ToDouble(TotalRotCantDifBajo) / Convert.ToDouble(TotalRotCantPlanBajo)) * 100;
                RotNegativoBajo     = "<tr><td colspan ='6'></td><td  style='border:1px solid black;'>Cant. Plan. Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + TotalRotCantPlanBajo.ToString() + "</td></tr><tr>" +
                                      "<td colspan ='6'></td><td  style='border:1px solid black;'>Cant. Prod. Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + TotalRotCantProdBajo.ToString() + "</td></tr><tr>" +
                                      "<td colspan ='6'></td><td  style='border:1px solid black;'>Diferencia Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + TotalRotCantDifBajo.ToString() + "</td></tr><tr>" +
                                      "<td colspan ='6'></td><td  style='border:1px solid black;'>% Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + RotPorceCantDifBajo.ToString() + "%</td></tr>";
            }
            TablaMaquinaRot.Text = "<br/><br/><br/><div align='right'><table><tr>" +
                                   "<td colspan ='6'></td><td  style='border:1px solid black;'colspan ='2'>Rotativa</td></tr><tr>" +
                                   "<td colspan ='6'></td><td  style='border:1px solid black;'>Total Cant. Plan.</td>" +
                                   "<td style='border:1px solid black;'>" + TotalRotCantPlan.ToString() + "</td></tr><tr>" +
                                   "<td colspan ='6'></td><td  style='border:1px solid black;'>Cant. Plan. Sobre</td>" +
                                   "<td style='border:1px solid black;'>" + TotalRotCantPlanSobre.ToString() + "</td></tr><tr>" +
                                   "<td colspan ='6'></td><td style='border:1px solid black;'>Cant. Prod. Sobre</td>" +
                                   "<td style='border:1px solid black;'>" + TotalRotCantProdSobre.ToString() + "</td></tr><tr>" +
                                   "<td colspan ='6'></td><td style='border:1px solid black;'>Diferencia Sobre</td>" +
                                   "<td style='border:1px solid black;'>" + TotalRotCantDifSobre + "</td></tr><tr>" +
                                   "<td colspan ='6'></td><td style='border:1px solid black;'>% Sobre</td>" +
                                   "<td style='border:1px solid black;'>" + RotPorceCantDifSobre.ToString("N2").Replace("NaN", "0") + "%</td></tr>" +
                                   RotNegativoBajo + "</table></div>";

            form.Controls.Add(TablaMaquinaRot);

            Label TablaMaquinaPla = new Label();
            TotalPlaCantDifSobre = (TotalPlaCantProdSobre - TotalPlaCantPlanSobre);
            TotalPlaCantDifbajo  = (TotalPlaCantPlanBajo - TotalPlaCantProdBajo);
            PlaPorceCantDifSobre = Convert.ToDouble(Convert.ToDouble(TotalPlaCantDifSobre) / Convert.ToDouble(TotalPlaCantPlanSobre)) * 100;

            string PlaNegativoBajo = "";
            if (TotalPlaCantDifbajo > 0)
            {
                PlaPorceCantDifBajo = Convert.ToDouble(Convert.ToDouble(TotalPlaCantDifbajo) / Convert.ToDouble(TotalPlaCantPlanBajo)) * 100;
                PlaNegativoBajo     = "<tr><td colspan ='6'></td><td  style='border:1px solid black;'>Cant. Plan. Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + TotalPlaCantPlanBajo.ToString() + "</td></tr><tr>" +
                                      "<td colspan ='6'></td><td  style='border:1px solid black;'>Cant. Prod. Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + TotalPlaCantProdBajo.ToString() + "</td></tr><tr>" +
                                      "<td colspan ='6'></td><td  style='border:1px solid black;'>Diferencia Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + TotalPlaCantDifbajo.ToString() + "</td></tr><tr>" +
                                      "<td colspan ='6'></td><td  style='border:1px solid black;'>% Bajo</td>" +
                                      "<td style='border:1px solid black;'>" + PlaPorceCantDifBajo.ToString() + "%</td></tr>";
            }
            TablaMaquinaPla.Text = "<br/><div align='right'><table><tr>" +
                                   "<td colspan ='6'></td><td  style='border:1px solid black;' colspan ='2'>Plana</td></tr><tr>" +
                                   "<td colspan ='6'></td><td  style='border:1px solid black;'>Total Cant. Plan.</td>" + // colspan ='2'
                                   "<td style='border:1px solid black;'>" + TotalPlaCantPlan.ToString() + "</td></tr><tr>" +
                                   "<td colspan ='6'></td><td  style='border:1px solid black;'>Cant. Plan. Sobre</td>" + // colspan ='2'
                                   "<td style='border:1px solid black;'>" + TotalPlaCantPlanSobre.ToString() + "</div></td></tr><tr>" +
                                   "<td colspan ='6'></td><td style='border:1px solid black;'>Cant. Prod. Sobre</td>" +
                                   "<td style='border:1px solid black;'>" + TotalPlaCantProdSobre.ToString() + "</td></tr><tr>" +
                                   "<td colspan ='6'></td><td style='border:1px solid black;'>Diferencia Sobre</td>" +
                                   "<td style='border:1px solid black;'>" + TotalPlaCantDifSobre + "</td></tr><tr>" +
                                   "<td colspan ='6'></td><td style='border:1px solid black;'>% Sobre</td>" +
                                   "<td style='border:1px solid black;'>" + PlaPorceCantDifSobre.ToString("N2") + "%</td></tr>" +
                                   PlaNegativoBajo + "</table></div>";

            form.Controls.Add(TablaMaquinaPla);

            pageToRender.Controls.Add(form);
            response.Clear();
            response.Buffer      = true;
            response.ContentType = "application/vnd.ms-excel";
            response.AddHeader("Content-Disposition", "attachment;filename=" + nameReport + ".xls");
            response.Charset         = "UTF-8";
            response.ContentEncoding = Encoding.Default;
            pageToRender.RenderControl(htw);


            response.Write(sw.ToString());
            response.End();
        }
Beispiel #38
0
        private void Page_Load(object sender, EventArgs e)
        {
            HtmlForm form1 = (HtmlForm)this.FindControl("Form1");

            this.GHTTestBegin(form1);
            base.GHTActiveSubTest = this.GHTSubTest1;
            try
            {
                this.DataGrid1.DataSource = GHDataSources.DSDataTable();
                ButtonColumn column2 = new ButtonColumn();
                ButtonColumn column3 = new ButtonColumn();
                ButtonColumn column1 = new ButtonColumn();
                column2.DataTextField        = "ID";
                column3.DataTextField        = "Name";
                column1.DataTextField        = "Company";
                column2.DataTextFormatString = "";
                column3.DataTextFormatString = "(format str)";
                column1.DataTextFormatString = "{0:c5}";
                this.DataGrid1.Columns.Add(column2);
                this.DataGrid1.Columns.Add(column3);
                this.DataGrid1.Columns.Add(column1);
                this.DataGrid1.DataBind();
                this.GHTSubTestAddResult(column2.DataTextFormatString);
                this.GHTSubTestAddResult(column3.DataTextFormatString);
                this.GHTSubTestAddResult(column1.DataTextFormatString);
            }
            catch (Exception exception5)
            {
                // ProjectData.SetProjectError(exception5);
                Exception exception1 = exception5;
                this.GHTSubTestUnexpectedExceptionCaught(exception1);
                // ProjectData.ClearProjectError();
            }
            base.GHTActiveSubTest = this.Ghtsubtest2;
            try
            {
                this.DataGrid2.DataSource = GHDataSources.DSDataTable();
                ButtonColumn column4 = new ButtonColumn();
                ButtonColumn column5 = new ButtonColumn();
                ButtonColumn column6 = new ButtonColumn();
                column4.DataTextField        = "ID";
                column5.DataTextField        = "ID";
                column6.DataTextField        = "ID";
                column4.DataTextFormatString = "";
                column5.DataTextFormatString = "(format str)";
                column6.DataTextFormatString = "{0:c5}";
                this.DataGrid2.Columns.Add(column4);
                this.DataGrid2.Columns.Add(column5);
                this.DataGrid2.Columns.Add(column6);
                this.DataGrid2.DataBind();
                this.GHTSubTestAddResult(column4.DataTextFormatString);
                this.GHTSubTestAddResult(column5.DataTextFormatString);
                this.GHTSubTestAddResult(column6.DataTextFormatString);
            }
            catch (Exception exception6)
            {
                // ProjectData.SetProjectError(exception6);
                Exception exception2 = exception6;
                this.GHTSubTestUnexpectedExceptionCaught(exception2);
                // ProjectData.ClearProjectError();
            }
            base.GHTActiveSubTest = this.Ghtsubtest3;
            try
            {
                this.DataGrid3.DataSource = GHDataSources.DSDataTable();
                this.DataGrid3.DataBind();
                this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid3.Columns[0]).DataTextFormatString);
                this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid3.Columns[1]).DataTextFormatString);
                this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid3.Columns[2]).DataTextFormatString);
            }
            catch (Exception exception7)
            {
                // ProjectData.SetProjectError(exception7);
                Exception exception3 = exception7;
                this.GHTSubTestUnexpectedExceptionCaught(exception3);
                // ProjectData.ClearProjectError();
            }
            base.GHTActiveSubTest = this.Ghtsubtest4;
            try
            {
                this.DataGrid4.DataSource = GHDataSources.DSDataTable();
                this.DataGrid4.DataBind();
                this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid4.Columns[0]).DataTextFormatString);
                this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid4.Columns[1]).DataTextFormatString);
                this.GHTSubTestAddResult(((ButtonColumn)this.DataGrid4.Columns[2]).DataTextFormatString);
            }
            catch (Exception exception8)
            {
                // ProjectData.SetProjectError(exception8);
                Exception exception4 = exception8;
                this.GHTSubTestUnexpectedExceptionCaught(exception4);
                // ProjectData.ClearProjectError();
            }
            this.GHTTestEnd();
        }
 internal ImageControl(HtmlForm Form, IHtmlNode Node) : base(Form, Node)
 {
 }
Beispiel #40
0
        private void Page_Load(Object sender, EventArgs e)
        {
            // If the Language has not been set the user has a expired
            // session or does not come from the main page
            if (String.IsNullOrEmpty(WebSession.LanguageCode))
            {
                Response.Redirect("/");
                return;
            }

            if (IsPostBack == false)
            {
                InitPage();
            }

            Logger.Debug("Game.Page_Load. Page load starts. Session ID {0}, IsPostBack {1}", Session.SessionID,
                         IsPostBack);

            HtmlForm form = (HtmlForm)Master.FindControl("main_form");

            form.DefaultButton = answer_button.UniqueID;

            translations          = new TranslationsWeb();
            translations.Language = WebSession.LanguageCode;

            string answer = Request.QueryString ["answer"];

            if (IsPostBack == false && string.IsNullOrEmpty(answer) == false)
            {
                ProcessAnswer(answer);
            }

            if (WebSession.GameState == null)
            {
                Logger.Debug("Game.Page_Load creating new session");
                session                     = new gbrainy.Core.Main.GameSession(translations);
                session.GameManager         = CreateManager();
                session.PlayList.Difficulty = gbrainy.Core.Main.GameDifficulty.Medium;
                session.PlayList.GameType   = gbrainy.Core.Main.GameSession.Types.LogicPuzzles |
                                              gbrainy.Core.Main.GameSession.Types.Calculation |
                                              gbrainy.Core.Main.GameSession.Types.VerbalAnalogies;

                session.New();
                WebSession.GameState = session;
                Global.TotalGamesSessions++;

                _game = GetNextGame();
                UpdateGame();

                // If the first time that loads this does not have a session
                // send the user to the home page
                //Logger.Debug ("New Session, redirecting to Default.aspx");
                //Response.Redirect ("Default.aspx");
            }
            else if (WebSession.GameState != null && WebSession.GameState.Status == GameSession.SessionStatus.Finished)
            {
                // Finished game
                image = new GameImage(null);
                game_image.ImageUrl     = CreateImage(WebSession);
                answer_button.Enabled   = false;
                answer_textbox.Text     = string.Empty;
                answer_textbox.Enabled  = false;
                nextgame_link.Enabled   = false;
                endgames_button.Enabled = false;
                UpdateGame();
            }
            else
            {
                session = WebSession.GameState;

                if (_game == null)
                {
                    _game = WebSession.GameState.CurrentGame;
                }

                UpdateGame();
            }


            if (IsPostBack == false)
            {
                SetText();
            }

            if (IsPostBack == true)
            {
                Logger.Debug("Game.Page_Load. Ignoring postback");
                return;
            }

            Logger.Debug("Game.Page_Load. Page load completed");
        }
Beispiel #41
0
        /// <summary>
        /// 导出数据函数
        /// </summary>
        /// <param name="FileType">导出文件MIME类型</param>
        /// <param name="FileName">导出文件的名称</param>
        /// this.Export(GV_List, "application/ms-excel", "ShiftProd.xls");
        /// this.Export(GV_List, "application/ms-word", "ShiftProd.doc");
        protected void Export(String FileType, String FileName)
        {
            int maxResult = 5000;

            this.AllowPaging  = false;
            this.AllowSorting = false;
            if (this.FindPager().RecordCount > this.FindPager().PageSize)
            {
                if (this.FindPager().RecordCount > maxResult)
                {
                    this.FindPager().PageSize = maxResult;
                }
                else
                {
                    this.FindPager().PageSize = this.FindPager().RecordCount;
                }
            }

            this.Execute();

            System.Globalization.CultureInfo cultureInfo = new System.Globalization.CultureInfo("ZH-CN", true);
            StringBuilder  sb  = new StringBuilder();
            StringWriter   sw  = new StringWriter(cultureInfo);
            HtmlTextWriter htw = new HtmlTextWriter(sw);

            System.Web.UI.Control parent = this.Parent;

            MethodInfo   getResponseMethodInfo = this.Parent.GetType().GetMethod("GetResponse");
            HttpResponse Response         = (HttpResponse)getResponseMethodInfo.Invoke(this.Parent, null);
            MethodInfo   renderMethodInfo = this.Parent.GetType().GetMethod("Render");


            Page     page = new Page();
            HtmlForm form = new HtmlForm();

            this.EnableViewState = false;

            // Deshabilitar la validación de eventos, sólo asp.net 2
            page.EnableEventValidation = false;

            // Realiza las inicializaciones de la instancia de la clase Page que requieran los diseñadores RAD.
            page.DesignerInitialize();

            page.Controls.Add(form);

            form.Controls.Add(this);

            page.RenderControl(htw);

            Response.Clear();
            Response.Buffer = true;

            //Response.ContentType = "application/vnd.ms-excel";
            //Response.AddHeader("Content-Disposition", "attachment;filename=data.xls");
            Response.AppendHeader("Content-Disposition", "attachment;filename="
                                  + HttpUtility.UrlEncode(FileName, System.Text.Encoding.UTF8));

            //设置输出流HttpMiME类型(导出文件格式)
            Response.ContentType = FileType;
            Response.Write("<meta http-equiv=Content-Type content=\"text/html; charset=GB2312\">");
            //Response.Charset = "UTF-8";
            //设定输出字符集
            Response.Charset = "GB2312";
            //Response.ContentEncoding = Encoding.Default;
            //Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("GB2312");

            string content = sw.ToString();

            content = renderMethodInfo.Invoke(parent, new object[] { content }) as string;

            Response.Write(content);


            Response.Flush();
            Response.End();

            this.AllowPaging  = true;
            this.AllowSorting = true;
            //this.PageSize = 10;
            //this.Execute();
        }
Beispiel #42
0
    public static void Export(string fileName, GridView gv, string css)
    {
        string style = @"<style> TD { mso-number-format:\@; } </style>";

        HttpContext.Current.Response.Clear();
        HttpContext.Current.Response.AddHeader("content-disposition", string.Format("attachment; filename={0}", fileName));
        HttpContext.Current.Response.ContentType = "application/ms-excel";

        HtmlForm frm = new HtmlForm();

        gv.Parent.Controls.Add(frm);// .Parent.Controls.Add(frm);

        frm.Attributes["runat"] = "server";
        frm.Controls.Add(gv);

        using (StringWriter sw = new StringWriter())
        {
            using (HtmlTextWriter htw = new HtmlTextWriter(sw))
            {
                //  Create a form to contain the grid
                Table table = new Table();
                table.BorderStyle = BorderStyle.Solid;
                table.GridLines   = gv.GridLines;


                //  add the header row to the table

                if (gv.HeaderRow != null)
                {
                    GridViewExportUtil.PrepareControlForExport(gv.HeaderRow);
                    //gv.HeaderRow.BackColor = System.Drawing.Color.SkyBlue;

                    for (int iCol = 0; iCol < gv.HeaderRow.Cells.Count; iCol++)
                    {
                        gv.HeaderRow.Cells[iCol].BackColor = System.Drawing.Color.SkyBlue;
                    }

                    for (int iCol = gv.Columns.Count - 1; iCol >= 0; iCol--)
                    {
                        if (gv.Columns[iCol].Visible == false)
                        {
                            gv.HeaderRow.Cells.RemoveAt(iCol);
                        }
                    }
                    table.Rows.Add(gv.HeaderRow);
                }

                //  add each of the data rows to the table
                foreach (GridViewRow row in gv.Rows)
                {
                    GridViewExportUtil.PrepareControlForExport(row);

                    for (int iCol = gv.Columns.Count - 1; iCol >= 0; iCol--)
                    {
                        if (gv.Columns[iCol].Visible == false)
                        {
                            row.Cells.RemoveAt(iCol);
                        }
                    }
                    table.Rows.Add(row);
                }

                //  add the footer row to the table
                if (gv.FooterRow != null)
                {
                    GridViewExportUtil.PrepareControlForExport(gv.FooterRow);
                    table.Rows.Add(gv.FooterRow);
                }
                //  render the table into the htmlwriter
                table.RenderControl(htw);

                //  render the htmlwriter into the response
                HttpContext.Current.Response.Write(style);
                HttpContext.Current.Response.Write(css);
                HttpContext.Current.Response.Write(sw.ToString());
                HttpContext.Current.Response.End();
            }
        }
    }
 private void exportToExcel(string nameReport, GridView fuente)
 {
     HttpResponse response = Response;
     StringWriter sw = new StringWriter();
     HtmlTextWriter htw = new HtmlTextWriter(sw);
     Page pageToRender = new Page();
     HtmlForm form = new HtmlForm();
     form.Controls.Add(fuente);
     pageToRender.Controls.Add(form);
     response.Clear();
     response.Buffer = true;
     response.ContentType = "application/vnd.ms-excel";
     response.AddHeader("Content-Disposition", "attachment;filename=" + nameReport);
     response.Charset = "UTF-8";
     response.ContentEncoding = Encoding.Default;
     pageToRender.RenderControl(htw);
     response.Write(sw.ToString());
     response.End();
 }
Beispiel #44
0
    //�Public�Methods�(2)�

    public static void IncludeFileInputAttribute(this HtmlForm instance)
    {
        instance.Attributes.Add("enctype", "multipart/form-data");
    }
        protected void ibExcel_Click(object sender, ImageClickEventArgs e)
        {
            int PesoTotalOrig = 0;
            int BobCProyect   = 0;
            int BobSProyect   = 0;
            //DateTime f1 = new DateTime();
            string f1 = "";
            string f2 = "";

            if (txtFechaInicio.Text != "")
            {
                string   fechaI = txtFechaInicio.Text;
                string[] str    = fechaI.Split('/');
                string   dia    = str[0];
                string   mes    = str[1];
                string   año    = str[2];
                año = año.Substring(0, 4);

                //string fechaInicio = mes + "/" + dia + "/" + año;

                f1 = año + "-" + mes + "-" + dia;//Convert.ToDateTime(fechaInicio);
                //txtCliente.Text = mes + "/" + dia + "/" + año;
                string   fechaT = txtFechaTermino.Text;
                string[] str2   = fechaT.Split('/');
                string   dia2   = str2[0];
                string   mes2   = str2[1];
                string   año2   = str2[2];
                año = año.Substring(0, 4);

                f2            = mes2 + "/" + dia2 + "/" + año2;
                PesoTotalOrig = controlbob.PesoOriginalTB(f1, f2);
            }
            else
            {
                f1 = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd");
                f2 = DateTime.Now.ToString("yyyy-MM-dd");
            }
            List <Bobina_Excel> lista = controlbob.ListBobina_WarRom(f1, f2);

            List <Bobina_Excel> listaDimen = lista.Where(o => o.Maquina == "Dimensionadora").ToList();
            List <Bobina_Excel> listaM600  = lista.Where(o => o.Maquina == "M600").ToList();
            List <Bobina_Excel> listaLitho = lista.Where(o => o.Maquina == "Lithoman").ToList();
            List <Bobina_Excel> listaWeb1  = lista.Where(o => o.Maquina == "WEB 1").ToList();

            Bobina_Excel bob1 = new Bobina_Excel();
            Bobina_Excel bob2 = new Bobina_Excel();
            Bobina_Excel bob3 = new Bobina_Excel();
            Bobina_Excel bob4 = new Bobina_Excel();
            Bobina_Excel bob5 = new Bobina_Excel();

            GridView wControl = new GridView();

            wControl.DataSource = listaLitho;
            wControl.DataBind();
            wControl.HeaderStyle.BackColor = System.Drawing.Color.Blue;
            wControl.HeaderStyle.ForeColor = System.Drawing.Color.White;

            GridView GridM600 = new GridView();

            GridM600.DataSource = listaM600;
            GridM600.DataBind();
            GridM600.HeaderStyle.BackColor = System.Drawing.Color.Blue;
            GridM600.HeaderStyle.ForeColor = System.Drawing.Color.White;

            GridView GridDimen = new GridView();

            GridDimen.DataSource = listaDimen;
            GridDimen.DataBind();
            GridDimen.HeaderStyle.BackColor = System.Drawing.Color.Blue;
            GridDimen.HeaderStyle.ForeColor = System.Drawing.Color.White;

            GridView GridWeb1 = new GridView();

            GridWeb1.DataSource = listaWeb1;
            GridWeb1.DataBind();
            GridWeb1.HeaderStyle.BackColor = System.Drawing.Color.Blue;
            GridWeb1.HeaderStyle.ForeColor = System.Drawing.Color.White;
            //Inicio del Excel

            if (wControl.Rows.Count > 0)
            {
                wControl.HeaderRow.Cells[0].Text     = "Código Bobina";
                wControl.HeaderRow.Cells[1].Visible  = false;
                wControl.HeaderRow.Cells[2].Text     = "Nombre Papel";
                wControl.HeaderRow.Cells[3].Text     = "Gramaje";
                wControl.HeaderRow.Cells[4].Text     = "Peso Bobina";
                wControl.HeaderRow.Cells[5].Text     = "Estado Bobina";
                wControl.HeaderRow.Cells[6].Text     = "Origen Daño";
                wControl.HeaderRow.Cells[7].Text     = "Causa Daño";
                wControl.HeaderRow.Cells[8].Text     = "Kilos Escarpe";
                wControl.HeaderRow.Cells[9].Text     = "% Perdida";
                wControl.HeaderRow.Cells[10].Visible = false;
                wControl.HeaderRow.Cells[11].Visible = false;
                wControl.HeaderRow.Cells[12].Visible = false;
                wControl.HeaderRow.Cells[13].Visible = false;
                wControl.HeaderRow.Cells[14].Visible = false;
                wControl.HeaderRow.Cells[15].Visible = false;
                wControl.HeaderRow.Cells[16].Visible = false;
                wControl.HeaderRow.Cells[17].Visible = false;
                wControl.HeaderRow.Cells[18].Visible = false;
            }

            if (GridM600.Rows.Count > 0)
            {
                GridM600.HeaderRow.Cells[0].Text     = "Código Bobina";
                GridM600.HeaderRow.Cells[1].Visible  = false;
                GridM600.HeaderRow.Cells[2].Text     = "Nombre Papel";
                GridM600.HeaderRow.Cells[3].Text     = "Gramaje";
                GridM600.HeaderRow.Cells[4].Text     = "Peso Bobina";
                GridM600.HeaderRow.Cells[5].Text     = "Estado Bobina";
                GridM600.HeaderRow.Cells[6].Text     = "Origen Daño";
                GridM600.HeaderRow.Cells[7].Text     = "Causa Daño";
                GridM600.HeaderRow.Cells[8].Text     = "Kilos Escarpe";
                GridM600.HeaderRow.Cells[9].Text     = "% Perdida";
                GridM600.HeaderRow.Cells[10].Visible = false;
                GridM600.HeaderRow.Cells[11].Visible = false;
                GridM600.HeaderRow.Cells[12].Visible = false;
                GridM600.HeaderRow.Cells[13].Visible = false;
                GridM600.HeaderRow.Cells[14].Visible = false;
                GridM600.HeaderRow.Cells[15].Visible = false;
                GridM600.HeaderRow.Cells[16].Visible = false;
                GridM600.HeaderRow.Cells[17].Visible = false;
                GridM600.HeaderRow.Cells[18].Visible = false;
            }

            if (GridDimen.Rows.Count > 0)
            {
                GridDimen.HeaderRow.Cells[0].Text     = "Código Bobina";
                GridDimen.HeaderRow.Cells[1].Visible  = false;
                GridDimen.HeaderRow.Cells[2].Text     = "Nombre Papel";
                GridDimen.HeaderRow.Cells[3].Text     = "Gramaje";
                GridDimen.HeaderRow.Cells[4].Text     = "Peso Bobina";
                GridDimen.HeaderRow.Cells[5].Text     = "Estado Bobina";
                GridDimen.HeaderRow.Cells[6].Text     = "Origen Daño";
                GridDimen.HeaderRow.Cells[7].Text     = "Causa Daño";
                GridDimen.HeaderRow.Cells[8].Text     = "Kilos Escarpe";
                GridDimen.HeaderRow.Cells[9].Text     = "% Perdida";
                GridDimen.HeaderRow.Cells[10].Visible = false;
                GridDimen.HeaderRow.Cells[11].Visible = false;
                GridDimen.HeaderRow.Cells[12].Visible = false;
                GridDimen.HeaderRow.Cells[13].Visible = false;
                GridDimen.HeaderRow.Cells[14].Visible = false;
                GridDimen.HeaderRow.Cells[15].Visible = false;
                GridDimen.HeaderRow.Cells[16].Visible = false;
                GridDimen.HeaderRow.Cells[17].Visible = false;
                GridDimen.HeaderRow.Cells[18].Visible = false;
            }

            if (GridWeb1.Rows.Count > 0)
            {
                GridWeb1.HeaderRow.Cells[0].Text     = "Código Bobina";
                GridWeb1.HeaderRow.Cells[1].Visible  = false;
                GridWeb1.HeaderRow.Cells[2].Text     = "Nombre Papel";
                GridWeb1.HeaderRow.Cells[3].Text     = "Gramaje";
                GridWeb1.HeaderRow.Cells[4].Text     = "Peso Bobina";
                GridWeb1.HeaderRow.Cells[5].Text     = "Estado Bobina";
                GridWeb1.HeaderRow.Cells[6].Text     = "Origen Daño";
                GridWeb1.HeaderRow.Cells[7].Text     = "Causa Daño";
                GridWeb1.HeaderRow.Cells[8].Text     = "Kilos Escarpe";
                GridWeb1.HeaderRow.Cells[9].Text     = "% Perdida";
                GridWeb1.HeaderRow.Cells[10].Visible = false;
                GridWeb1.HeaderRow.Cells[11].Visible = false;
                GridWeb1.HeaderRow.Cells[12].Visible = false;
                GridWeb1.HeaderRow.Cells[13].Visible = false;
                GridWeb1.HeaderRow.Cells[14].Visible = false;
                GridWeb1.HeaderRow.Cells[15].Visible = false;
                GridWeb1.HeaderRow.Cells[16].Visible = false;
                GridWeb1.HeaderRow.Cells[17].Visible = false;
                GridWeb1.HeaderRow.Cells[18].Visible = false;
            }

            int count = 0;

            for (int contador = 0; contador < wControl.Rows.Count; contador++)
            {
                GridViewRow row = wControl.Rows[contador];
                row.Cells[1].Visible  = false;
                row.Cells[10].Visible = false;
                row.Cells[11].Visible = false;
                row.Cells[12].Visible = false;
                row.Cells[13].Visible = false;
                row.Cells[14].Visible = false;
                row.Cells[15].Visible = false;
                row.Cells[16].Visible = false;
                row.Cells[17].Visible = false;
                row.Cells[18].Visible = false;
                bob1.BBuenas          = row.Cells[11].Text;
                bob1.BMalas           = row.Cells[12].Text;
                bob1.BMalas_QG        = row.Cells[10].Text;
                bob1.Maquina          = row.Cells[13].Text; //total de Peso
                bob1.NombreOT         = row.Cells[14].Text; //Total de escarpe
                bob1.CProyecto        = row.Cells[15].Text;
                bob1.SProyecto        = row.Cells[16].Text;
                bob1.ProCProyec       = row.Cells[17].Text;
                bob1.ProSProyec       = row.Cells[18].Text;

                double PromedioBuenas = ((Convert.ToDouble(bob1.BMalas) * 100) / Convert.ToDouble(bob1.BBuenas));
                PromedioBuenas = Math.Round(PromedioBuenas);
                bob1.OT        = PromedioBuenas.ToString("N0") + "%";

                double PromedioMalas = ((Convert.ToDouble(bob1.BMalas_QG) * 100) / Convert.ToDouble(bob1.BBuenas));
                PromedioMalas      = Math.Round(PromedioMalas);
                bob1.Peso_Original = PromedioMalas.ToString("N0") + "%";

                double PromedioEscarpe = ((Convert.ToDouble(bob1.NombreOT)) / Convert.ToDouble(bob1.BBuenas));
                bob1.Pesos_Conos = PromedioEscarpe.ToString("N0");

                double escarpe = ((Convert.ToDouble(bob1.NombreOT) * 100) / Convert.ToDouble(bob1.Maquina));
                bob1.Pesos_Envoltura = escarpe.ToString("N1") + "%";



                if (count == 0)
                {
                    if (bob5.BBuenas != null)
                    {
                        bob5.BBuenas   = (Convert.ToDouble(bob1.BBuenas.ToString()) + Convert.ToDouble(bob5.BBuenas.ToString())).ToString();
                        bob5.BMalas    = (Convert.ToDouble(bob1.BMalas.ToString()) + Convert.ToDouble(bob5.BMalas.ToString())).ToString();
                        bob5.BMalas_QG = (Convert.ToDouble(bob1.BMalas_QG.ToString()) + Convert.ToDouble(bob5.BMalas_QG.ToString())).ToString();
                        bob5.Maquina   = (Convert.ToDouble(bob1.Maquina.ToString()) + Convert.ToDouble(bob5.Maquina.ToString())).ToString();
                        bob5.NombreOT  = (Convert.ToDouble(bob1.NombreOT.ToString()) + Convert.ToDouble(bob5.NombreOT.ToString())).ToString();

                        count = count + 1;
                    }
                    else
                    {
                        bob5.BBuenas   = Convert.ToDouble(bob1.BBuenas.ToString()).ToString();
                        bob5.BMalas    = Convert.ToDouble(bob1.BMalas.ToString()).ToString();
                        bob5.BMalas_QG = Convert.ToDouble(bob1.BMalas_QG.ToString()).ToString();
                        bob5.Maquina   = Convert.ToDouble(bob1.Maquina.ToString()).ToString();
                        bob5.NombreOT  = Convert.ToDouble(bob1.NombreOT.ToString()).ToString();
                        BobCProyect    = Convert.ToInt32(bob1.CProyecto);
                        BobSProyect    = Convert.ToInt32(bob1.SProyecto);

                        bob5.ProCProyec = bob1.ProCProyec;
                        bob5.ProSProyec = bob1.ProSProyec;
                        count           = count + 1;
                    }
                }
                double PesoOriginal = Convert.ToDouble(row.Cells[4].Text);
                if (row.Cells[4].Text.Length > 3)
                {
                    string po2 = PesoOriginal.ToString("N0").Replace(",", ".");
                    row.Cells[4].Text = po2;
                }
                else
                {
                    string po2 = PesoOriginal.ToString("N0");
                    row.Cells[4].Text = po2;
                }
            }
            count = 0;
            for (int contador = 0; contador < GridM600.Rows.Count; contador++)
            {
                GridViewRow row = GridM600.Rows[contador];
                row.Cells[1].Visible  = false;
                row.Cells[10].Visible = false;
                row.Cells[11].Visible = false;
                row.Cells[12].Visible = false;
                row.Cells[13].Visible = false;
                row.Cells[14].Visible = false;
                row.Cells[15].Visible = false;
                row.Cells[16].Visible = false;
                row.Cells[17].Visible = false;
                row.Cells[18].Visible = false;
                bob2.BBuenas          = row.Cells[11].Text;
                bob2.BMalas           = row.Cells[12].Text;
                bob2.BMalas_QG        = row.Cells[10].Text;
                bob2.Maquina          = row.Cells[13].Text;
                bob2.NombreOT         = row.Cells[14].Text;

                double PromedioBuenas = ((Convert.ToDouble(bob2.BMalas) * 100) / Convert.ToDouble(bob2.BBuenas));
                PromedioBuenas = Math.Round(PromedioBuenas);
                bob2.OT        = PromedioBuenas.ToString("N0") + "%";

                double PromedioMalas = ((Convert.ToDouble(bob2.BMalas_QG) * 100) / Convert.ToDouble(bob2.BBuenas));
                PromedioMalas      = Math.Round(PromedioMalas);
                bob2.Peso_Original = PromedioMalas.ToString("N0") + "%";

                double PromedioEscarpe = ((Convert.ToDouble(bob2.NombreOT)) / Convert.ToDouble(bob2.BBuenas));
                bob2.Pesos_Conos = PromedioEscarpe.ToString("N0");

                double escarpe = ((Convert.ToDouble(bob2.NombreOT) * 100) / Convert.ToDouble(bob2.Maquina));
                bob2.Pesos_Envoltura = escarpe.ToString("N1") + "%";

                if (count == 0)
                {
                    if (bob5.BBuenas != null)
                    {
                        bob5.BBuenas   = (Convert.ToDouble(bob2.BBuenas.ToString()) + Convert.ToDouble(bob5.BBuenas.ToString())).ToString();
                        bob5.BMalas    = (Convert.ToDouble(bob2.BMalas.ToString()) + Convert.ToDouble(bob5.BMalas.ToString())).ToString();
                        bob5.BMalas_QG = (Convert.ToDouble(bob2.BMalas_QG.ToString()) + Convert.ToDouble(bob5.BMalas_QG.ToString())).ToString();
                        bob5.Maquina   = (Convert.ToDouble(bob2.Maquina.ToString()) + Convert.ToDouble(bob5.Maquina.ToString())).ToString();
                        bob5.NombreOT  = (Convert.ToDouble(bob2.NombreOT.ToString()) + Convert.ToDouble(bob5.NombreOT.ToString())).ToString();

                        count = count + 1;
                    }
                    else
                    {
                        bob5.BBuenas   = Convert.ToDouble(bob2.BBuenas.ToString()).ToString();
                        bob5.BMalas    = Convert.ToDouble(bob2.BMalas.ToString()).ToString();
                        bob5.BMalas_QG = Convert.ToDouble(bob2.BMalas_QG.ToString()).ToString();
                        bob5.Maquina   = Convert.ToDouble(bob2.Maquina.ToString()).ToString();
                        bob5.NombreOT  = Convert.ToDouble(bob2.NombreOT.ToString()).ToString();

                        count = count + 1;
                    }
                }

                double PesoOriginal = Convert.ToDouble(row.Cells[4].Text);
                if (row.Cells[4].Text.Length > 3)
                {
                    string po2 = PesoOriginal.ToString("N0").Replace(",", ".");
                    row.Cells[4].Text = po2;
                }
                else
                {
                    string po2 = PesoOriginal.ToString("N0");
                    row.Cells[4].Text = po2;
                }
            }
            count = 0;
            for (int contador = 0; contador < GridDimen.Rows.Count; contador++)
            {
                GridViewRow row = GridDimen.Rows[contador];
                row.Cells[1].Visible  = false;
                row.Cells[10].Visible = false;
                row.Cells[11].Visible = false;
                row.Cells[12].Visible = false;
                row.Cells[13].Visible = false;
                row.Cells[14].Visible = false;
                row.Cells[15].Visible = false;
                row.Cells[16].Visible = false;
                row.Cells[17].Visible = false;
                row.Cells[18].Visible = false;
                bob3.BBuenas          = row.Cells[11].Text;
                bob3.BMalas           = row.Cells[12].Text;
                bob3.BMalas_QG        = row.Cells[10].Text;
                bob3.Maquina          = row.Cells[13].Text;
                bob3.NombreOT         = row.Cells[14].Text;

                double PromedioBuenas = ((Convert.ToDouble(bob3.BMalas) * 100) / Convert.ToDouble(bob3.BBuenas));
                PromedioBuenas = Math.Round(PromedioBuenas);
                bob3.OT        = PromedioBuenas.ToString("N0") + "%";

                double PromedioMalas = ((Convert.ToDouble(bob3.BMalas_QG) * 100) / Convert.ToDouble(bob3.BBuenas));
                PromedioMalas      = Math.Round(PromedioMalas);
                bob3.Peso_Original = PromedioMalas.ToString("N0") + "%";

                double PromedioEscarpe = ((Convert.ToDouble(bob3.NombreOT)) / Convert.ToDouble(bob3.BBuenas));
                bob3.Pesos_Conos = PromedioEscarpe.ToString("N0");

                double escarpe = ((Convert.ToDouble(bob3.NombreOT) * 100) / Convert.ToDouble(bob3.Maquina));
                bob3.Pesos_Envoltura = escarpe.ToString("N1") + "%";

                if (count == 0)
                {
                    if (bob5.BBuenas != null)
                    {
                        bob5.BBuenas   = (Convert.ToDouble(bob3.BBuenas.ToString()) + Convert.ToDouble(bob5.BBuenas.ToString())).ToString();
                        bob5.BMalas    = (Convert.ToDouble(bob3.BMalas.ToString()) + Convert.ToDouble(bob5.BMalas.ToString())).ToString();
                        bob5.BMalas_QG = (Convert.ToDouble(bob3.BMalas_QG.ToString()) + Convert.ToDouble(bob5.BMalas_QG.ToString())).ToString();
                        bob5.Maquina   = (Convert.ToDouble(bob3.Maquina.ToString()) + Convert.ToDouble(bob5.Maquina.ToString())).ToString();
                        bob5.NombreOT  = (Convert.ToDouble(bob3.NombreOT.ToString()) + Convert.ToDouble(bob5.NombreOT.ToString())).ToString();

                        count = count + 1;
                    }
                    else
                    {
                        bob5.BBuenas   = Convert.ToDouble(bob3.BBuenas.ToString()).ToString();
                        bob5.BMalas    = Convert.ToDouble(bob3.BMalas.ToString()).ToString();
                        bob5.BMalas_QG = Convert.ToDouble(bob3.BMalas_QG.ToString()).ToString();
                        bob5.Maquina   = Convert.ToDouble(bob3.Maquina.ToString()).ToString();
                        bob5.NombreOT  = Convert.ToDouble(bob3.NombreOT.ToString()).ToString();

                        count = count + 1;
                    }
                }

                double PesoOriginal = Convert.ToDouble(row.Cells[4].Text);
                if (row.Cells[4].Text.Length > 3)
                {
                    string po2 = PesoOriginal.ToString("N0").Replace(",", ".");
                    row.Cells[4].Text = po2;
                }
                else
                {
                    string po2 = PesoOriginal.ToString("N0");
                    row.Cells[4].Text = po2;
                }
            }
            count = 0;
            for (int contador = 0; contador < GridWeb1.Rows.Count; contador++)
            {
                GridViewRow row = GridWeb1.Rows[contador];
                row.Cells[1].Visible  = false;
                row.Cells[10].Visible = false;
                row.Cells[11].Visible = false;
                row.Cells[12].Visible = false;
                row.Cells[13].Visible = false;
                row.Cells[14].Visible = false;
                row.Cells[15].Visible = false;
                row.Cells[16].Visible = false;
                row.Cells[17].Visible = false;
                row.Cells[18].Visible = false;
                bob4.BBuenas          = row.Cells[11].Text;
                bob4.BMalas           = row.Cells[12].Text;
                bob4.BMalas_QG        = row.Cells[10].Text;
                bob4.Maquina          = row.Cells[13].Text;
                bob4.NombreOT         = row.Cells[14].Text;

                double PromedioBuenas = ((Convert.ToDouble(bob4.BMalas) * 100) / Convert.ToDouble(bob4.BBuenas));
                PromedioBuenas = Math.Round(PromedioBuenas);
                bob4.OT        = PromedioBuenas.ToString("N0") + "%";

                double PromedioMalas = ((Convert.ToDouble(bob4.BMalas_QG) * 100) / Convert.ToDouble(bob4.BBuenas));
                PromedioMalas      = Math.Round(PromedioMalas);
                bob4.Peso_Original = PromedioMalas.ToString("N0") + "%";

                double PromedioEscarpe = ((Convert.ToDouble(bob4.NombreOT)) / Convert.ToDouble(bob4.BBuenas));
                bob4.Pesos_Conos = PromedioEscarpe.ToString("N0");

                double escarpe = ((Convert.ToDouble(bob4.NombreOT) * 100) / Convert.ToDouble(bob4.Maquina));
                bob4.Pesos_Envoltura = escarpe.ToString("N1") + "%";

                if (count == 0)
                {
                    if (bob5.BBuenas != null)
                    {
                        bob5.BBuenas   = (Convert.ToDouble(bob4.BBuenas.ToString()) + Convert.ToDouble(bob5.BBuenas.ToString())).ToString();
                        bob5.BMalas    = (Convert.ToDouble(bob4.BMalas.ToString()) + Convert.ToDouble(bob5.BMalas.ToString())).ToString();
                        bob5.BMalas_QG = (Convert.ToDouble(bob4.BMalas_QG.ToString()) + Convert.ToDouble(bob5.BMalas_QG.ToString())).ToString();
                        bob5.Maquina   = (Convert.ToDouble(bob4.Maquina.ToString()) + Convert.ToDouble(bob5.Maquina.ToString())).ToString();
                        bob5.NombreOT  = (Convert.ToDouble(bob4.NombreOT.ToString()) + Convert.ToDouble(bob5.NombreOT.ToString())).ToString();

                        count = count + 1;
                    }
                    else
                    {
                        bob5.BBuenas   = Convert.ToDouble(bob4.BBuenas.ToString()).ToString();
                        bob5.BMalas    = Convert.ToDouble(bob4.BMalas.ToString()).ToString();
                        bob5.BMalas_QG = Convert.ToDouble(bob4.BMalas_QG.ToString()).ToString();
                        bob5.Maquina   = Convert.ToDouble(bob4.Maquina.ToString()).ToString();
                        bob5.NombreOT  = Convert.ToDouble(bob4.NombreOT.ToString()).ToString();
                        count          = count + 1;
                    }
                }

                double PesoOriginal = Convert.ToDouble(row.Cells[4].Text);
                if (row.Cells[4].Text.Length > 3)
                {
                    string po2 = PesoOriginal.ToString("N0").Replace(",", ".");
                    row.Cells[4].Text = po2;
                }
                else
                {
                    string po2 = PesoOriginal.ToString("N0");
                    row.Cells[4].Text = po2;
                }
            }
            count = 0;
            HttpResponse   response     = Response;
            StringWriter   sw           = new StringWriter();
            HtmlTextWriter htw          = new HtmlTextWriter(sw);
            Page           pageToRender = new Page();
            HtmlForm       form         = new HtmlForm();
            Label          la           = new Label();
            string         FechaTitulo;

            if (txtFechaInicio.Text == "")
            {
                FechaTitulo = DateTime.Now.AddDays(-1).ToShortDateString();
            }
            else
            {
                FechaTitulo = txtFechaInicio.Text;
            }
            string Titulo = "<div align='center'>Reporte Desperdicio Papel <br/>Dia: " + txtFechaInicio.Text + " Desde:00:00 Hasta 23:59:59 </div><br />";

            la.Text = Titulo;
            form.Controls.Add(la);
            if (wControl.Rows.Count > 0)
            {
                Label Maquina1 = new Label();
                Maquina1.Text = "<div>Lithoman </div><br/>";
                form.Controls.Add(Maquina1);
                form.Controls.Add(wControl);
                Label TaTotLitho = new Label();
                TaTotLitho.Text = "<br/><div align='right'><table><tr>" +
                                  "<td colspan ='6'></td><td  style='border:1px solid black;' colspan ='2'>Total Bobinas Consumidas</td>" +
                                  "<td style='border:1px solid black;'>" + bob1.BBuenas.ToString() + "</div></td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Bobinas Buenas</td>" +
                                  "<td style='border:1px solid black;'>" + bob1.BMalas.ToString() + "</td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Bobinas Malas</td>" +
                                  "<td style='border:1px solid black;'>" + bob1.BMalas_QG.ToString() + "</td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Peso Bobina</td>" +
                                  "<td style='border:1px solid black;'>" + bob1.Maquina.ToString() + "</td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Escarpe Bobina</td>" +
                                  "<td style='border:1px solid black;'>" + bob1.NombreOT.ToString() + "</td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Bobina Buenas</td>" +
                                  "<td style='border:1px solid black;'>" + bob1.OT.ToString() + "</td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Bobina Malas</td>" +
                                  "<td style='border:1px solid black;'>" + bob1.Peso_Original.ToString() + "</td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio escalpe por bobina - kg</td>" +
                                  "<td style='border:1px solid black;'>" + bob1.Pesos_Conos.ToString() + "</td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Escarpe</td>" +
                                  "<td style='border:1px solid black;'>" + bob1.Pesos_Envoltura.ToString() + "</td></tr></table></div>";
                form.Controls.Add(TaTotLitho);
            }

            if (GridM600.Rows.Count > 0)
            {
                Label Maquina2 = new Label();
                Maquina2.Text = "<br/><div align='left'>M600 </div><br/>";
                form.Controls.Add(Maquina2);
                form.Controls.Add(GridM600);
                Label TaTotM600 = new Label();
                TaTotM600.Text = "<br/><div align='right'><table><tr>" +
                                 "<td colspan ='6'></td><td  style='border:1px solid black;' colspan ='2'>Total Bobinas Consumidas</td>" +
                                 "<td style='border:1px solid black;'>" + bob2.BBuenas.ToString() + "</div></td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Bobinas Buenas</td>" +
                                 "<td style='border:1px solid black;'>" + bob2.BMalas.ToString() + "</td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Bobinas Malas</td>" +
                                 "<td style='border:1px solid black;'>" + bob2.BMalas_QG.ToString() + "</td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Peso Bobina</td>" +
                                 "<td style='border:1px solid black;'>" + bob2.Maquina.ToString() + "</td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Escarpe Bobina</td>" +
                                 "<td style='border:1px solid black;'>" + bob2.NombreOT.ToString() + "</td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Bobina Buenas</td>" +
                                 "<td style='border:1px solid black;'>" + bob2.OT.ToString() + "</td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Bobina Malas</td>" +
                                 "<td style='border:1px solid black;'>" + bob2.Peso_Original.ToString() + "</td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio escalpe por bobina - kg</td>" +
                                 "<td style='border:1px solid black;'>" + bob2.Pesos_Conos.ToString() + "</td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Escarpe</td>" +
                                 "<td style='border:1px solid black;'>" + bob2.Pesos_Envoltura.ToString() + "</td></tr></table></div>";
                form.Controls.Add(TaTotM600);
            }

            if (GridDimen.Rows.Count > 0)
            {
                Label Maquina3 = new Label();
                Maquina3.Text = "<br/><div align='left'>Dimensionadora </div><br/>";
                form.Controls.Add(Maquina3);
                form.Controls.Add(GridDimen);
                Label TaTotDimen = new Label();
                TaTotDimen.Text = "<br/><div align='right'><table><tr>" +
                                  "<td colspan ='6'></td><td  style='border:1px solid black;' colspan ='2'>Total Bobinas Consumidas</td>" +
                                  "<td style='border:1px solid black;'>" + bob3.BBuenas.ToString() + "</div></td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Bobinas Buenas</td>" +
                                  "<td style='border:1px solid black;'>" + bob3.BMalas.ToString() + "</td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Bobinas Malas</td>" +
                                  "<td style='border:1px solid black;'>" + bob3.BMalas_QG.ToString() + "</td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Peso Bobina</td>" +
                                  "<td style='border:1px solid black;'>" + bob3.Maquina.ToString() + "</td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Escarpe Bobina</td>" +
                                  "<td style='border:1px solid black;'>" + bob3.NombreOT.ToString() + "</td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Bobina Buenas</td>" +
                                  "<td style='border:1px solid black;'>" + bob3.OT.ToString() + "</td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Bobina Malas</td>" +
                                  "<td style='border:1px solid black;'>" + bob3.Peso_Original.ToString() + "</td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio escalpe por bobina - kg</td>" +
                                  "<td style='border:1px solid black;'>" + bob3.Pesos_Conos.ToString() + "</td></tr><tr>" +
                                  "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Escarpe</td>" +
                                  "<td style='border:1px solid black;'>" + bob3.Pesos_Envoltura.ToString() + "</td></tr></table></div>";
                form.Controls.Add(TaTotDimen);
            }

            if (GridWeb1.Rows.Count > 0)
            {
                Label Maquina4 = new Label();
                Maquina4.Text = "<br/><div align='left'>Web 1 </div><br/>";
                form.Controls.Add(Maquina4);
                form.Controls.Add(GridWeb1);
                Label TaTotWeb1 = new Label();
                TaTotWeb1.Text = "<br/><div align='right'><table><tr>" +
                                 "<td colspan ='6'></td><td  style='border:1px solid black;' colspan ='2'>Total Bobinas Consumidas</td>" +
                                 "<td style='border:1px solid black;'>" + bob4.BBuenas.ToString() + "</div></td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Bobinas Buenas</td>" +
                                 "<td style='border:1px solid black;'>" + bob4.BMalas.ToString() + "</td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Bobinas Malas</td>" +
                                 "<td style='border:1px solid black;'>" + bob4.BMalas_QG.ToString() + "</td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Peso Bobina</td>" +
                                 "<td style='border:1px solid black;'>" + bob4.Maquina.ToString() + "</td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Escarpe Bobina</td>" +
                                 "<td style='border:1px solid black;'>" + bob4.NombreOT.ToString() + "</td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Bobina Buenas</td>" +
                                 "<td style='border:1px solid black;'>" + bob4.OT.ToString() + "</td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Bobina Malas</td>" +
                                 "<td style='border:1px solid black;'>" + bob4.Peso_Original.ToString() + "</td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio escalpe por bobina - kg</td>" +
                                 "<td style='border:1px solid black;'>" + bob4.Pesos_Conos.ToString() + "</td></tr><tr>" +
                                 "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Escarpe</td>" +
                                 "<td style='border:1px solid black;'>" + bob4.Pesos_Envoltura.ToString() + "</td></tr></table></div>";
                form.Controls.Add(TaTotWeb1);
            }
            if (bob5.BBuenas.ToString() != null)
            {
                double PromedioBuenas = ((Convert.ToDouble(bob5.BMalas) * 100) / Convert.ToDouble(bob5.BBuenas));
                PromedioBuenas = Math.Round(PromedioBuenas);
                bob5.OT        = PromedioBuenas.ToString("N0") + "%";

                double PromedioMalas = ((Convert.ToDouble(bob5.BMalas_QG) * 100) / Convert.ToDouble(bob5.BBuenas));
                PromedioMalas      = Math.Round(PromedioMalas);
                bob5.Peso_Original = PromedioMalas.ToString("N0") + "%";

                double PromedioEscarpe = ((Convert.ToDouble(bob5.NombreOT)) / Convert.ToDouble(bob5.BBuenas));
                bob5.Pesos_Conos = PromedioEscarpe.ToString("N0");

                double escarpe = ((Convert.ToDouble(bob5.NombreOT) * 100) / Convert.ToDouble(PesoTotalOrig));//bob5.Maquina));
                bob5.Pesos_Envoltura = escarpe.ToString("N1") + "%";


                Label TaTotGeneral = new Label();
                TaTotGeneral.Text = "<br/><div align='right'><table><tr>" +
                                    "<td colspan ='6'></td><td  style='border:1px solid black;' colspan ='3'>General</td>" +
                                    "</tr><tr>" +
                                    "<td colspan ='6'></td><td  style='border:1px solid black;' colspan ='2'>Total Bobinas Consumidas</td>" +
                                    "<td style='border:1px solid black;'>" + bob5.BBuenas.ToString() + "</div></td></tr><tr>" +
                                    "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Bobinas Buenas</td>" +
                                    "<td style='border:1px solid black;'>" + bob5.BMalas.ToString() + "</td></tr><tr>" +
                                    "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Bobinas Malas</td>" +
                                    "<td style='border:1px solid black;'>" + bob5.BMalas_QG.ToString() + "</td></tr><tr>" +
                                    "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Peso Bobina</td>" +
                                    "<td style='border:1px solid black;'>" + PesoTotalOrig.ToString("N0").Replace(",", ".") + "</td></tr><tr>" +
                                    "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Escarpe Bobina</td>" +
                                    "<td style='border:1px solid black;'>" + bob5.NombreOT.ToString() + "</td></tr><tr>" +
                                    "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Bobina Buenas</td>" +
                                    "<td style='border:1px solid black;'>" + bob5.OT.ToString() + "</td></tr><tr>" +
                                    "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Bobina Malas</td>" +
                                    "<td style='border:1px solid black;'>" + bob5.Peso_Original.ToString() + "</td></tr><tr>" +
                                    "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio escalpe por bobina - kg</td>" +
                                    "<td style='border:1px solid black;'>" + bob5.Pesos_Conos.ToString() + "</td></tr><tr>" +
                                    "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Promedio Escarpe</td>" +
                                    "<td style='border:1px solid black;'>" + bob5.Pesos_Envoltura.ToString() + "</td></tr><tr>" +
                                    "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Bobina Proyecto</td>" +
                                    "<td style='border:1px solid black;'>" + BobCProyect.ToString("N0").Replace(",", ".") + "</td></tr><tr>" +
                                    "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total Bobina Sin Proyecto</td>" +
                                    "<td style='border:1px solid black;'>" + BobSProyect.ToString("N0").Replace(",", ".") + "</td></tr><tr>" +
                                    "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total % Con Proyecto</td>" +
                                    "<td style='border:1px solid black;'>" + bob5.ProCProyec.ToString() + "</td></tr><tr>" +
                                    "<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Total % Sin Proyecto</td>" +
                                    "<td style='border:1px solid black;'>" + bob5.ProSProyec.ToString() + "</td></tr></table></div>";
                //"<td colspan ='6'></td><td style='border:1px solid black;' colspan ='2'>Peso Total Bobi</td>" +
                //"<td style='border:1px solid black;'>" + PesoTotalOrig.ToString("N0").Replace(",", ".") + "</td></tr></table></div>";
                form.Controls.Add(TaTotGeneral);
            }

            //Label TotalEscalpe = new Label();
            //TotalEscalpe.Text = "<br/><div align='center'>"+PesoTotalOrig.ToString("N0").Replace(",",".")+"</div><br/>";
            //form.Controls.Add(TotalEscalpe);
            pageToRender.Controls.Add(form);
            response.Clear();
            response.Buffer      = true;
            response.ContentType = "application/vnd.ms-excel";
            string fecha;

            if (txtFechaInicio.Text == "")
            {
                fecha = DateTime.Now.AddDays(-1).ToShortDateString();
            }
            else
            {
                fecha = txtFechaInicio.Text;
            }
            response.AddHeader("Content-Disposition", "attachment;filename=Reporte Desperdicio Papel" + fecha + ".xls");
            response.Charset         = "UTF-8";
            response.ContentEncoding = Encoding.Default;
            pageToRender.RenderControl(htw);
            response.Write(sw.ToString());
            response.End();


            //fin del excel
        }
		HtmlForm BuildUserForm(){

			HtmlForm form = new HtmlForm(){Name="User", Action="api/User/save?cayita=true"};

			form.Id="form-edit";

			form.AddHtmlHiddenField( (field)=>{
				field.AddHtmlTextInput((input)=>{
				input.Name="Id";
				});
			});

			form.AddHtmlField( (field)=>{
				field.Label.InnerHtml="Name";
				field.AddHtmlTextInput((input)=>{
				input.Required=true;
				input.Name="Name";
				input.Placeholder="User's name";
				});
			});

			form.AddHtmlField( (field)=>{
				field.Label.InnerHtml="City";
				field.AddHtmlTextInput((input)=>{
				input.Required=true;
				input.Name="City";
				input.Placeholder="city";
				});
			});

			form.AddHtmlField( (field)=>{
				field.Label.InnerHtml="Address";
				field.AddHtmlTextInput((input)=>{
					input.Name="Address";
				});
			});

			form.AddHtmlField( (field)=>{
				field.Label.InnerHtml="Birthday";
				field.AddHtmlTextInput((input)=>{
					input.Name="DoB";
					input.Type="date";
					input.Required=true;
				});
			});

			form.AddHtmlField( (field)=>{
				field.Label.InnerHtml="E-Mail";
				field.AddHtmlTextInput((input)=>{
				input.Required=true;
				input.Name="Email";
				input.Placeholder="e-mail";
				input.Type="email";
				input.Attributes["data-validation-email-message"]="no valid e-mail";
				});
			});

			form.AddHtmlField( (field)=>{
				field.Label.InnerHtml="Rating";
				field.AddHtmlTextInput((input)=>{
				input.Required=true;
				input.Name="Rating";
				input.Placeholder="User's rating";
				});
			});


			form.AddHtmlField( (field)=>{
				field.Label.InnerHtml="Level";
				field.AddHtmlRadioInput((input)=>{
					input.Name="Level";
					input.Inline=true;
					input.Value="A";
					input.Label="A";
				});

				field.AddHtmlRadioInput((input)=>{
					input.Name="Level";
					input.Inline=true;
					input.Value="B";
					input.Label="B";
				});

				field.AddHtmlRadioInput((input)=>{
					input.Name="Level";
					input.Inline=true;
					input.Value="C";
					input.Label="C";
				});
			});

			form.AddHtmlField( (field)=>{
				field.Label.InnerHtml="Active";
				field.AddHtmlCheckboxInput((input)=>{
					input.Name="IsActive";
				});
			});

			form.AddActionButton(b=>{
				b.ButtonType=ButtonType.Submit;
				b.Text="Save";
				b.Class="button-save btn btn-primary";
				b.Name="User";
			});

			form.AddActionButton(b=>{
				b.Text="Cancel";
				b.ButtonType=ButtonType.Reset;
				b.Class="button-cancel btn";
				b.Name="User";
			});

			return form;
		}
    protected void Button3_Click(object sender, EventArgs e)
    {
        string xn = xnDDL.SelectedValue;
        string xq = xqDDL.SelectedValue;
        string z = zDDL.SelectedValue;
        string sysid = sysDDL.SelectedValue;
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["syxkConn"].ConnectionString);
        string sql = "select symc,jsxm,syxingq,syks,id from v_ywcsyjhb where syxn='" + xn + "' and syxq=" + xq + " and syz=" + z + " and sysid= " + sysid + "order by syxn,syxq,syz,syxingq,syks";
        SqlDataAdapter ada = new SqlDataAdapter(sql, conn);
        DataTable dt = new DataTable();
        ada.Fill(dt);
        Table1.Caption = xn + "年——" + xqDDL.SelectedItem.Text + "——" + zDDL.SelectedItem.Text + "——" + sysDDL.SelectedItem.Text + "实验安排表";

        for (int i = 1; i <= 7; i++)
        {
            for (int j = 1; j <= 7; j++)
            {

                TableCell tc = Table1.FindControl("TableCell" + i.ToString() + j.ToString()) as TableCell;
                if (tc == null)
                {
                }
                else
                {

                    //tc.Text = @"<a href=eadm_syjh_bg.aspx?&ap=1&syxingq=" + j.ToString() + @"&syks=" + i.ToString() + @">安排实验</a>";
                    tc.Text = " ";
                }
            }
        }

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            string symc = dt.Rows[i]["symc"].ToString();
            string jsxm = dt.Rows[i]["jsxm"].ToString();
            string syjhid = dt.Rows[i]["id"].ToString();
            int syxingq = Convert.ToInt32(dt.Rows[i]["syxingq"]);
            int syks = Convert.ToInt32(dt.Rows[i]["syks"]);
            TableCell tc = Table1.FindControl("TableCell" + syks.ToString() + syxingq.ToString()) as TableCell;
            if (tc == null)
            {
            }
            else
            {
                //tc.Text = symc + "(" + jsxm + @")<br><a href=eadm_syjh_bg.aspx?ap=2&syjhid=" + syjhid + @">取消实验</a>";
                tc.Text = symc + "(" + jsxm + ")";
            }

        }

        string fileName =  "export.xls";

        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        System.IO.StringWriter sw = new System.IO.StringWriter(sb);
        HtmlTextWriter htw = new HtmlTextWriter(sw);

        Page page = new Page();
        HtmlForm form = new HtmlForm();

        // Deshabilitar la validación de eventos, sólo asp.net 2
        page.EnableEventValidation = false;

        // Realiza las inicializaciones de la instancia de la clase Page que requieran los diseñadores RAD.
        page.DesignerInitialize();

        page.Controls.Add(form);

        form.Controls.Add(Table1);

        page.RenderControl(htw);

        Response.Clear();
        Response.Buffer = true;
        Response.ContentType = "application/vnd.ms-excel";
        Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
        Response.Charset = "UTF-8";
        Response.ContentEncoding = System.Text.Encoding.Default;
        Response.Write(sb.ToString());
        Response.End();
    }
Beispiel #48
0
    private void PopulateGrid()
    {
        string Federation = "Federations: All";

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

        CIPDataAccess dal = new CIPDataAccess();
        DataSet       dsExport;

        string FederationID = string.Empty;

        try
        {
            FederationID = Session["FedId"].ToString();

            SqlParameter[] param = new SqlParameter[2];
            if (FederationID.Trim() == string.Empty)
            {
                param[0] = new SqlParameter("@FederationID", null);
            }
            else
            {
                Federation = "Federation: " + Session["FedName"].ToString();
                param[0]   = new SqlParameter("@FederationID", FederationID);
            }

            if (ddlCampYear.SelectedIndex == 0)
            {
                param[1] = new SqlParameter("@Year", null);
            }
            else
            {
                param[1] = new SqlParameter("@Year", ddlCampYear.SelectedItem.Text);
            }

            dsExport = dal.getDataset("[usp_GetViewDump]", param);

            string FileName = excelClientFile + (ddlCampYear.SelectedIndex > 0 ? ddlCampYear.SelectedItem.Text + "-" : "") + String.Format("{0:M/d/yyyy}", DateTime.Now) + ".xls";

            Response.ContentType     = "application/vnd.ms-excel";
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("windows-1255");
            Response.AddHeader("Content-Disposition", "attachment; filename=" + FileName);

            if (dsExport.Tables[0].Rows.Count == 0)
            {
                this.Controls.Remove(gvExport);
                Response.Write("No matching records found.");
                Response.End();
            }
            else
            {
                for (int i = 0; i < dsExport.Tables[0].Rows.Count; i++)
                {
                    dsExport.Tables[0].Rows[i]["Zip"] = "'" + dsExport.Tables[0].Rows[i]["Zip"];
                }

                gvExport.DataSource = dsExport;
                gvExport.DataBind();
                gvExport.Visible = true;
                hw.WriteLine("<table><tr><td><b><font size='3'>" +
                             "Campers Data Export" +
                             "</font></b></td></tr>");

                hw.WriteLine("<tr><td><font size='2'>" + Federation +
                             "</font></td></tr>");

                hw.WriteLine("<tr><td><font size='2'>" +
                             "Export Date: " + String.Format("{0:M/d/yyyy hh:mm tt}", DateTime.Now) +
                             "</font></td></tr></table>");

                HtmlForm form1 = (HtmlForm)Master.FindControl("form1");
                form1.Controls.Clear();
                form1.Controls.Add(gvExport);
                form1.RenderControl(hw);

                this.EnableViewState = false;
                Response.Write(tw.ToString());
                Response.End();
            }
        }
        catch (Exception ex)
        {
        }
    }
Beispiel #49
0
 public Checkbox(HtmlForm parentForm, string name, string value, bool isChecked) : base(parentForm, name, value)
 {
     this.isChecked = isChecked;
 }
    private void UploadAtt()
    {
        HtmlForm FrmCompose     = (HtmlForm)this.Page.FindControl("NewItem");
        Random   TempNameInt    = new Random();
        string   NewMailDirName = TempNameInt.Next(100000000).ToString();

        string SavePath = ConfigHelper.GetConfigString("AttachmentPath");

        if (string.IsNullOrEmpty(SavePath))
        {
            SavePath = "~/Attachment/";
        }
        if (!SavePath.EndsWith("/") && !SavePath.EndsWith("\\"))
        {
            SavePath += "/";
        }

        // 存放附件至提交人目录中,随机生成目录名
        SavePath += "BBS/TMP/" + NewMailDirName + "/" + Session["UserName"].ToString();
        String MapSavePath = "";

        if (SavePath.StartsWith("~"))
        {
            MapSavePath = Server.MapPath(SavePath);
        }
        else
        {
            MapSavePath = SavePath;
        }
        MapSavePath = MapSavePath.Replace("/", "\\");

        Directory.CreateDirectory(MapSavePath);
        ViewState["SavePath"] = MapSavePath;

        ArrayList upattlist = (ArrayList)ViewState["UpattList"];

        if (hif.PostedFile.FileName.Trim() != "")
        {
            string FileName = System.IO.Path.GetFileName(hif.PostedFile.FileName);
            hif.PostedFile.SaveAs(MapSavePath + "/" + FileName);

            string[]            attfile = FileName.Split('.');
            BBS_ForumAttachment att     = new BBS_ForumAttachment();
            att.Reply = 0;                    //不属于某个回复默认设置为0
            att.Name  = attfile[0];
            att.Path  = SavePath + "/" + FileName;
            if (attfile.Length > 1)
            {
                att.ExtName = attfile[attfile.Length - 1];
            }
            att.FileSize   = hif.PostedFile.ContentLength;
            att.UploadTime = DateTime.Now;

            if (upattlist == null)
            {
                upattlist = new ArrayList();
            }
            upattlist.Add(att);
        }
        ViewState["UpattList"] = upattlist;
        BindAttList();
    }
Beispiel #51
0
 private string FormIDValue(HtmlForm FormElem)
 {
     //return FormElem.UniqueID.ToString();  // Use if in a widget
     return FormElem.ID.ToString();
 }
 internal SelectControl(HtmlForm Form, IHtmlNode Node) : base(Form, Node)
 {
     Options.First().Selected = true;
 }
Beispiel #53
0
        private void ExportToSpreadsheet()
        {
            double rut;
            Int32  noperacion;
            Int32  estado_actual;
            Int16  dl_sucursal;

            if (this.txt_rut.Text.Trim() == "")
            {
                rut = 0;
            }
            else
            {
                rut = Convert.ToDouble(this.txt_rut.Text);
            }

            if (this.txt_operacion.Text.Trim() == "")
            {
                noperacion = 0;
            }
            else
            {
                noperacion = Convert.ToInt32(this.txt_operacion.Text);
            }

            if (this.dpl_estado.SelectedValue == "")
            {
                estado_actual = 0;
            }
            else
            {
                estado_actual = Convert.ToInt32(this.dpl_estado.SelectedValue);
            }

            if (this.dl_sucursal.SelectedValue == "")
            {
                dl_sucursal = 0;
            }
            else
            {
                dl_sucursal = Convert.ToInt16(this.dl_sucursal.SelectedValue);
            }

            List <Control_gestion> loperacion = new OperacionBC().getOperacionesbyCG(this.dl_producto.SelectedValue,
                                                                                     dl_sucursal,
                                                                                     Convert.ToInt16(this.dl_cliente.SelectedValue), noperacion, rut
                                                                                     , this.txt_cliente.Text.Trim(),
                                                                                     string.Format("{0:yyyyMMdd}", Convert.ToDateTime(this.txt_desde.Text.Trim())),
                                                                                     string.Format("{0:yyyyMMdd}", Convert.ToDateTime(this.txt_hasta.Text.Trim())),
                                                                                     estado_actual, (string)(Session["usrname"]), this.chk_llamada.Checked.ToString());


            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("id_solicitud"));
            dt.Columns.Add(new DataColumn("Cliente"));
            dt.Columns.Add(new DataColumn("tipo_operacion"));
            dt.Columns.Add(new DataColumn("operacion"));
            dt.Columns.Add(new DataColumn("fecha"));
            dt.Columns.Add(new DataColumn("total_gasto"));
            dt.Columns.Add(new DataColumn("rut_deudor"));
            dt.Columns.Add(new DataColumn("nombre_deudor"));
            dt.Columns.Add(new DataColumn("Cliente_nombre"));
            dt.Columns.Add(new DataColumn("ultimo_estado"));
            dt.Columns.Add(new DataColumn("total_gestion"));
            dt.Columns.Add(new DataColumn("numero_cuotas"));
            dt.Columns.Add(new DataColumn("numero_operacion"));
            dt.Columns.Add(new DataColumn("sucursal_origen"));
            dt.Columns.Add(new DataColumn("id_producto_cliente"));
            dt.Columns.Add(new DataColumn("llamada_programada"));
            dt.Columns.Add(new DataColumn("descripcion"));


            foreach (Control_gestion moperacion in loperacion)
            {
                DataRow dr = dt.NewRow();

                dr["id_solicitud"]        = moperacion.Id_solicitud.Id_solicitud;
                dr["Cliente"]             = moperacion.Id_solicitud.Cliente.Id_cliente;
                dr["Cliente_nombre"]      = moperacion.Id_solicitud.Cliente.Persona.Nombre;
                dr["operacion"]           = moperacion.Id_solicitud.Tipo_operacion.Operacion;
                dr["tipo_operacion"]      = moperacion.Id_solicitud.Tipo_operacion.Codigo;
                dr["numero_cuotas"]       = moperacion.Numero_cuotas;
                dr["numero_operacion"]    = moperacion.Numero_operacion;
                dr["sucursal_origen"]     = moperacion.Id_sucursal.Nombre;
                dr["id_producto_cliente"] = moperacion.Id_producto_cliente.Nombre;
                dr["descripcion"]         = moperacion.Id_forma_pago.Descripcion;

                if (moperacion.Rut != null)
                {
                    dr["rut_deudor"]    = moperacion.Rut.Rut;
                    dr["nombre_deudor"] = moperacion.Rut.Nombre + " " + moperacion.Rut.Apellido_paterno + " " + moperacion.Rut.Apellido_materno;
                }
                else
                {
                    dr["rut_deudor"]    = "0";
                    dr["nombre_deudor"] = "Sin Adquiriente";
                }

                dr["total_gestion"]      = moperacion.Total_gestion;
                dr["fecha"]              = string.Format("{0:dd/MM/yyyy}", moperacion.Fecha_gestion);
                dr["ultimo_estado"]      = moperacion.Id_solicitud.Estado;
                dr["llamada_programada"] = moperacion.Programacion;


                dt.Rows.Add(dr);
            }

            HttpContext context = HttpContext.Current;

            System.Text.StringBuilder    sb          = new System.Text.StringBuilder();
            System.IO.StringWriter       stringwrite = new System.IO.StringWriter(sb);
            System.Web.UI.HtmlTextWriter htmlwriter  = new System.Web.UI.HtmlTextWriter(stringwrite);


            Page     page = new Page();
            HtmlForm form = new HtmlForm();

            GridView gr = new GridView();

            gr.DataSource = dt;
            gr.DataBind();



            //HtmlTable table = new HtmlTable();
            //foreach (GridViewRow r in gr_dato.Rows)
            //{
            //    HtmlTableRow row = new HtmlTableRow();
            //    for (Int32 i = 0; i < r.Cells.Count; i++)
            //    {
            //        HtmlTableCell cell = new HtmlTableCell();
            //        cell.InnerText = r.Cells[i].Text;
            //        row.Cells.Add(cell);
            //    }
            //    table.Rows.Add(row);
            //}



            //this.gr_dato.EnableViewState = false;
            //form.Controls.Add(table);
            form.Controls.Add(gr);
            page.Controls.Add(form);
            //form.Controls.Add(this.gr_dato);
            page.RenderControl(htmlwriter);

            context.Response.Clear();
            context.Response.Buffer      = true;
            context.Response.ContentType = "application/vnd.ms-excel";
            context.Response.AppendHeader("Content-Disposition", "attachment; runat=" + "Server;" + " filename=" + "informe" + ".xls");
            context.Response.Charset         = "UTF-8";
            context.Response.ContentEncoding = System.Text.Encoding.Default;
            context.Response.Write(sb.ToString());
            context.Response.End();
        }
Beispiel #54
0
      private void Page_Load(object sender, EventArgs e)
      {
          HtmlForm form1 = (HtmlForm)(HtmlForm)this.FindControl("Form1");

          this.GHTTestBegin(form1);
          this.GHTSubTestBegin("GHTSubTest1");
          try
          {
              string      text1;
              IEnumerator enumerator1 = null;
              IEnumerator enumerator2 = null;
              this.Session.Clear();
              this.Session["v1"] = "v1";
              this.Session["v2"] = "v2";
              this.Session["v3"] = "v3";
              this.GHTSubTestAddResult(this.Session.Count.ToString());
              try
              {
                  enumerator2 = this.Session.GetEnumerator();
                  while (enumerator2.MoveNext())
                  {
                      text1 = (string)(enumerator2.Current);
                      this.GHTSubTestAddResult("Session(\"" + text1 + "\") = " + text1);
                  }
              }
              finally
              {
                  if (enumerator2 is IDisposable)
                  {
                      ((IDisposable)enumerator2).Dispose();
                  }
              }
              this.Session.Clear();
              this.GHTSubTestAddResult(this.Session.Count.ToString());
              try
              {
                  enumerator1 = this.Session.GetEnumerator();
                  while (enumerator1.MoveNext())
                  {
                      text1 = (string)(enumerator1.Current);
                      this.GHTSubTestAddResult("Session(\"" + text1 + "\") = " + text1);
                  }
              }
              finally
              {
                  if (enumerator1 is IDisposable)
                  {
                      ((IDisposable)enumerator1).Dispose();
                  }
              }
          }
          catch (Exception exception2)
          {
              // ProjectData.SetProjectError(exception2);
              Exception exception1 = exception2;
              this.GHTSubTestUnexpectedExceptionCaught(exception1);
              // ProjectData.ClearProjectError();
          }
          this.GHTSubTestEnd();
          this.GHTTestEnd();
      }
Beispiel #55
0
    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        string attachment = "attachment; filename=Contacts.xls";

        Response.ClearContent();

        Response.AddHeader("content-disposition", attachment);

        Response.ContentType = "application/ms-excel";

        StringWriter sw = new StringWriter();

        HtmlTextWriter htw = new HtmlTextWriter(sw);

        HtmlForm frm = new HtmlForm();

        GridView1.Parent.Controls.Add(frm);

        frm.Attributes["runat"] = "server";

        frm.Controls.Add(GridView1);

        frm.RenderControl(htw);

        Response.Write(sw.ToString());

        Response.End();
    }
Beispiel #56
0
    private void Page_Init()
    {
        #region Page Properties
        // Load Page Properties
        HtmlMeta myKeyword = new HtmlMeta();
        myKeyword.Name    = "Keyword";
        myKeyword.Content = myPage_Loading_Info.Page_Keyword;
        Header.Controls.Add(myKeyword);

        HtmlMeta myDescription = new HtmlMeta();
        myDescription.Name    = "Description";
        myDescription.Content = myPage_Loading_Info.Page_Description;
        Header.Controls.Add(myDescription);

        // Add CSS for Editor
        string[] CssFiles =
        {
            "~/App_Themes/NexusCore/Editor.css",
            "~/App_Themes/NexusCore/TreeView.Black.css"
        };

        foreach (string CssFile in CssFiles)
        {
            HtmlLink cssEditor_Link = new HtmlLink();
            cssEditor_Link.Href = CssFile;
            cssEditor_Link.Attributes.Add("type", "text/css");
            cssEditor_Link.Attributes.Add("rel", "stylesheet");
            Header.Controls.Add(cssEditor_Link);
        }


        // Add Script File for Editor
        string[] Scripts =
        {
            "/App_AdminCP/SiteAdmin/Pages/TreeViewDock.js"
        };

        foreach (string myScript in Scripts)
        {
            string MapPath = Request.ApplicationPath;

            if (MapPath.EndsWith("/"))
            {
                MapPath = MapPath.Remove(MapPath.Length - 1) + myScript;
            }
            else
            {
                MapPath = MapPath + myScript;
            }

            HtmlGenericControl scriptTag = new HtmlGenericControl("script");
            scriptTag.Attributes.Add("type", "text/javascript");
            scriptTag.Attributes.Add("src", MapPath);
            Header.Controls.Add(scriptTag);
        }

        #endregion

        // Add Script Manager
        //ScriptManager myScriptMgr = new ScriptManager();
        RadScriptManager myScriptMgr = new RadScriptManager();
        myScriptMgr.ID = "ScriptManager_Editor";

        HtmlForm myForm = (HtmlForm)Page.Master.FindControl("Form_NexusCore");
        myForm.Controls.AddAt(0, myScriptMgr);

        // Add PlaceHolder
        PlaceHolder myPlaceHolder = new PlaceHolder();
        myPlaceHolder.ID = "PlaceHolder_DesignMode";

        #region Add Control Manager Windows
        // Create CodeBlock
        RadScriptBlock myCodeBlock = new RadScriptBlock();

        // Create Script Tag
        HtmlGenericControl myCodeBlock_ScriptTag = new HtmlGenericControl("Script");
        myCodeBlock_ScriptTag.Attributes.Add("type", "text/javascript");
        myCodeBlock_ScriptTag.InnerHtml = Nexus.Core.Phrases.PhraseMgr.Get_Phrase_Value("NexusCore_PageEditor_PoPWindow");
        myCodeBlock.Controls.Add(myCodeBlock_ScriptTag);

        // Create Window Manager
        RadWindowManager myWindowManager = new RadWindowManager();
        myWindowManager.ID = "RadWindowManager_ControlManager";

        // Create RadWindow
        RadWindow myRadWindow = new RadWindow();
        myRadWindow.ID                    = "RadWindow_ControlManager";
        myRadWindow.Title                 = "User Control Manager";
        myRadWindow.ReloadOnShow          = true;
        myRadWindow.ShowContentDuringLoad = false;
        myRadWindow.Modal                 = true;
        myRadWindow.Animation             = WindowAnimation.Fade;
        myRadWindow.AutoSize              = true;
        myRadWindow.Behaviors             = WindowBehaviors.Close;
        myRadWindow.InitialBehaviors      = WindowBehaviors.Resize;
        //myRadWindow.DestroyOnClose = true;
        myRadWindow.KeepInScreenBounds = true;
        myRadWindow.VisibleStatusbar   = false;

        myWindowManager.Windows.Add(myRadWindow);

        // Create AjaxManager
        RadAjaxManager myRadAjaxManager = new RadAjaxManager();
        myRadAjaxManager.ID           = "RadAjaxManager_ControlManger";
        myRadAjaxManager.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(RadAjaxManager_AjaxRequest);

        // Add to Place Holder
        myPlaceHolder.Controls.Add(myCodeBlock);
        myPlaceHolder.Controls.Add(myWindowManager);
        myPlaceHolder.Controls.Add(myRadAjaxManager);

        #endregion

        #region Add TreeView Toolbox

        // Div and apply with class style
        HtmlGenericControl myToolboxDiv = new HtmlGenericControl("Div");
        myToolboxDiv.Attributes.Add("Class", "nexusCore_Editor_ToolPanel");
        //myToolboxDiv.ID = "NexusCore_Editor_Toolbox";

        // TreeView Toolbox Div Panel
        HtmlGenericControl myToolbox_TopDiv = new HtmlGenericControl("Div");
        myToolbox_TopDiv.Attributes.Add("Class", "sidebartop");

        HtmlGenericControl myToolbox_BotDiv = new HtmlGenericControl("Div");
        myToolbox_BotDiv.Attributes.Add("Class", "sidebarbot");

        #region Sidebar Top

        // Tree Hidden Input used to exchange data with server: Place holder position and currentZone
        HtmlInputText _currentPlaceholderPosition = new HtmlInputText();
        _currentPlaceholderPosition.ID = "currentPlaceholderPosition";
        _currentPlaceholderPosition.Attributes.Add("style", "display: none");

        HtmlInputText _currentZoneTB = new HtmlInputText();
        _currentZoneTB.ID = "currentZoneTB";
        _currentZoneTB.Attributes.Add("style", "display: none");

        myToolbox_TopDiv.Controls.Add(_currentPlaceholderPosition);
        myToolbox_TopDiv.Controls.Add(_currentZoneTB);

        // Add TreeView Dock Script
        HtmlGenericControl myDock_ScriptTag = new HtmlGenericControl("Script");
        myDock_ScriptTag.Attributes.Add("type", "text/javascript");
        myDock_ScriptTag.InnerHtml = Nexus.Core.Phrases.PhraseMgr.Get_Phrase_Value("NexusCore_PageEditor_Dock");
        myToolbox_TopDiv.Controls.Add(myDock_ScriptTag);

        // Tree Toolbox
        RadTreeView RadTreeView_Toolbox = new RadTreeView();
        RadTreeView_Toolbox.Skin = "Black";
        RadTreeView_Toolbox.EnableEmbeddedSkins = false;
        RadTreeView_Toolbox.ID = "RadTreeView_Toolbox";
        RadTreeView_Toolbox.EnableDragAndDrop    = true;
        RadTreeView_Toolbox.ShowLineImages       = false;
        RadTreeView_Toolbox.OnClientNodeDropping = "onClientNodeDropping";
        RadTreeView_Toolbox.OnClientNodeDropped  = "onNodeDropped";
        RadTreeView_Toolbox.OnClientNodeDragging = "onNodeDragging";

        // Tree Toolbox event
        RadTreeView_Toolbox.NodeDrop += new RadTreeViewDragDropEventHandler(RadTreeView_Toolbox_NodeDrop);

        Nexus.Core.ToolBoxes.ToolBoxMgr myToolBoxMgr = new Nexus.Core.ToolBoxes.ToolBoxMgr();
        myToolBoxMgr.Load_Toolbox_Group(RadTreeView_Toolbox);

        myToolbox_TopDiv.Controls.Add(RadTreeView_Toolbox);

        #endregion

        myToolboxDiv.Controls.Add(myToolbox_TopDiv);
        myToolboxDiv.Controls.Add(myToolbox_BotDiv);
        myPlaceHolder.Controls.Add(myToolboxDiv);

        #endregion

        #region Toolbox button

        // Add Toolbox button
        HtmlGenericControl Toolbox_btnLink = new HtmlGenericControl("A");
        Toolbox_btnLink.Attributes.Add("href", "");
        Toolbox_btnLink.Attributes.Add("onclick", "initSlideLeftPanel();return false");

        HtmlGenericControl myToolbox_btnDiv = new HtmlGenericControl("Div");
        myToolbox_btnDiv.Attributes.Add("class", "nexusCore_toolsTab");
        Toolbox_btnLink.Controls.Add(myToolbox_btnDiv);

        myPlaceHolder.Controls.Add(Toolbox_btnLink);

        #endregion

        #region Add Warp Controls and Dock Layout

        // Remove inline Controls
        HtmlGenericControl myContentDiv = (HtmlGenericControl)Page.Master.FindControl("pageWrapContainer");
        Page.Master.Controls.Remove(myContentDiv);

        // Create Page Content Div
        HtmlGenericControl myEditor_Div = new HtmlGenericControl("Div");
        myEditor_Div.Attributes.Add("class", "nexusCore_Editor_MainPanel");

        // Create DockLayOut
        RadDockLayout myDockLayout = new RadDockLayout();
        myDockLayout.ID = "RadDockLayout_DesignMode";
        myDockLayout.StoreLayoutInViewState = true;

        // DockLayOut Event
        myDockLayout.LoadDockLayout += new DockLayoutEventHandler(RadDockLayout_DesignMode_LoadDockLayout);
        myDockLayout.SaveDockLayout += new DockLayoutEventHandler(RadDockLayout_DesignMode_SaveDockLayout);


        // Create Hidden Update_Panel
        UpdatePanel myUpdatePanel_Docks = new UpdatePanel();
        myUpdatePanel_Docks.ID = "UpdatePanel_Docks";

        // Create Wrap Update_Panel
        //UpdatePanel myUpdatePanel_DockLayout = new UpdatePanel();
        //myUpdatePanel_DockLayout.ID = "UpdatePanel_DockLayout";

        // Create myRadAjaxManager Postback Trigger
        PostBackTrigger RadAjaxTrigger = new PostBackTrigger();
        RadAjaxTrigger.ControlID = myRadAjaxManager.ID;
        myUpdatePanel_Docks.Triggers.Add(RadAjaxTrigger);

        // Create Tree Toolbox Trigger
        //AsyncPostBackTrigger nodeDropTrigger = new AsyncPostBackTrigger();
        PostBackTrigger nodeDropTrigger = new PostBackTrigger();
        nodeDropTrigger.ControlID = RadTreeView_Toolbox.ID;
        //nodeDropTrigger.EventName = "NodeDrop";
        myUpdatePanel_Docks.Triggers.Add(nodeDropTrigger);

        // Add inLine Controls back
        myDockLayout.Controls.Add(myContentDiv);
        myDockLayout.Controls.Add(myUpdatePanel_Docks);

        //myUpdatePanel_DockLayout.ContentTemplateContainer.Controls.Add(myDockLayout);

        myEditor_Div.Controls.Add(myDockLayout);
        myPlaceHolder.Controls.Add(myEditor_Div);
        myForm.Controls.Add(myPlaceHolder);

        #endregion

        // Load MasterPage Control
        Nexus.Core.Templates.MasterPageMgr myMasterPageMgr = new Nexus.Core.Templates.MasterPageMgr();
        myMasterPageMgr.Load_MasterPageControls_WebView(this.Page, myPage_Loading_Info.MasterPageIndexID);

        // Load Page Control
        PageEditorMgr myPageEditorMgr = new PageEditorMgr();
        myPageEditorMgr.Load_PageDocks_Design(this.Page, myPage_Loading_Info);

        // Recreate the docks in order to ensure their proper operation
        for (int i = 0; i < CurrentDockStates.Count; i++)
        {
            if (CurrentDockStates[i].Closed == false)
            {
                RadDock myDock = myPageEditorMgr.Load_PageControls_FromState(this.Page, myPage_Loading_Info, CurrentDockStates[i]);

                LinkButton Linkbtn_Delete = (LinkButton)myDock.TitlebarContainer.FindControl("Linkbtn_Delete");
                Linkbtn_Delete.Command      += new CommandEventHandler(Linkbtn_Delete_Command);
                Linkbtn_Delete.OnClientClick = string.Format("return confirm('Are you sure you want to delete {0} ?');", myDock.Title);

                string _pageindexid = Request["PageIndexID"];

                myDockLayout.Controls.Add(myDock);
                CreateSaveStateTrigger(myDock);
            }
        }
    }
Beispiel #57
0
    /// <summary>
    /// Returns the HTML markup for a control, invoking any properties on the control.
    /// </summary>
    public static string RenderControl(this HtmlHelper helper, Control control, IEnumerable<KeyValuePair<string, object>> properties)
    {
        try
        {
            if (string.IsNullOrWhiteSpace(control.ID))
            {
                control.ID = string.Format("control_{0}", Guid.NewGuid());
            }

            if (properties != null && properties.Count() > 0)
            {
                var type = control.GetType();

                foreach (KeyValuePair<string, object> prop in properties)
                {
                    var property = type.GetProperty(prop.Key);
                    property.SetValue(
                        control,
                        Convert.ChangeType(prop.Value, property.PropertyType, CultureInfo.InvariantCulture),
                        null);
                }
            }

            // To ensure all the events in the lifecycle fire (Init, Load, etc), put
            // this control into a page and run that page to get the final control markup.
            System.Web.UI.Page page = new System.Web.UI.Page();
            page.EnableViewState = false;
            HtmlForm form = new HtmlForm();
            PlaceHolder ph = new PlaceHolder();
            const string delimiterStart = "-|-|-|-|-|-|-|-|- control start -|-|-|-|-|-|-|-|-";
            const string delimiterEnd = "-|-|-|-|-|-|-|-|- control start -|-|-|-|-|-|-|-|-";
            ph.Controls.Add(new LiteralControl(delimiterStart));
            ph.Controls.Add(control);
            ph.Controls.Add(new LiteralControl(delimiterEnd));
            form.Controls.Add(ph);
            page.Controls.Add(form);

            StringWriter output = new StringWriter();
            HttpContext.Current.Server.Execute(page, output, false);
            string markup = output.ToString();

            Match m = new Regex(string.Format("{0}(.*?){1}", Regex.Escape(delimiterStart), Regex.Escape(delimiterEnd)), RegexOptions.IgnoreCase | RegexOptions.Singleline).Match(markup);
            if (m.Success)
            {
                return m.Groups[1].Value;
            }

            return string.Empty;
        }
        catch (Exception ex)
        {
            Utils.Log(string.Format("Unable to load control: {0}", control.GetType().ToString()), ex);
        }

        return HttpUtility.HtmlEncode(string.Format("ERROR - UNABLE TO LOAD CONTROL : {0}", control.GetType().ToString()));
    }
        protected override void OnInit(EventArgs e)
        {
            Controls.Add(new LiteralControl("\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.or" +
                                            "g/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xh" +
                                            "tml\" style=\"overflow: hidden\">\n"));
            HtmlHead head = new HtmlHead();

            Controls.Add(head);
            head.Controls.Add(new LiteralControl(@"
    <script type=""text/javascript"">
        function pageLoad() {
            var m = location.href.match(/(\?|&)id=(.+?)(&|$)/);
            if (!(parent && parent.window.Web) || !m) return;
            var elem = parent.window.$get(m[2]);
            if (!elem) return;
            if (typeof (FieldEditor_SetValue) !== ""undefined"")
                FieldEditor_SetValue(elem.value);
            else
                alert('The field editor does not implement ""FieldEditor_SetValue"" function.');
            if (typeof (FieldEditor_GetValue) !== ""undefined"")
                parent.window.Web.DataView.Editors[elem.id] = { 'GetValue': FieldEditor_GetValue, 'SetValue': FieldEditor_SetValue };
            else
                alert('The field editor does not implement ""FieldEditor_GetValue"" function.');
        }
    </script>
"));
            head.Controls.Add(new LiteralControl("\n    <style type=\"text/css\">\n        .ajax__htmleditor_editor_container\n        {" +
                                                 "\n            border-width:0px!important;\n        }\n\n        .ajax__htmleditor_ed" +
                                                 "itor_bottomtoolbar\n        {\n            padding-top:2px!important;\n        }\n  " +
                                                 "  </style>"));
            Controls.Add(new LiteralControl("\n<body style=\"margin: 0px; padding: 0px; background-color: #fff;\">\n"));
            HtmlForm form = new HtmlForm();

            Controls.Add(form);
            ScriptManager sm = new ScriptManager();

            sm.ScriptMode = ScriptMode.Release;
            form.Controls.Add(sm);
            string  controlName = Request.Params["control"];
            Control c           = null;

            if (!(String.IsNullOrEmpty(controlName)))
            {
                try
                {
                    c = LoadControl(String.Format("~/Controls/{0}.ascx", controlName));
                }
                catch (Exception)
                {
                }
                if (c != null)
                {
                    object[] editorAttributes = c.GetType().GetCustomAttributes(typeof(AquariumFieldEditorAttribute), true);
                    if (editorAttributes.Length == 0)
                    {
                        c = null;
                    }
                }
                else
                if (controlName == "RichEditor")
                {
                }
            }
            if (c == null)
            {
                throw new HttpException(404, String.Empty);
            }
            else
            {
                form.Controls.Add(c);
                if (!((c.GetType() == typeof(System.Web.UI.UserControl))))
                {
                    this.ClientScript.RegisterClientScriptBlock(GetType(), "ClientScripts", String.Format("function FieldEditor_GetValue(){{return $find(\'{0}\').get_content();}}\nfunction Fi" +
                                                                                                          "eldEditor_SetValue(value) {{$find(\'{0}\').set_content(value);}}", c.ClientID), true);
                }
            }
            Controls.Add(new LiteralControl("\n\n</body>\n</html>"));
            base.OnInit(e);
            EnableViewState = false;
        }
 public FormElementWithValue(HtmlForm parentForm, string name, string value) : base(parentForm, name)
 {
     this.value = value;
 }
    /// <summary>
    ///  Page Load Event Handler, call every time when the page is loaded.
    /// </summary>
    /// <param name="sender">sender object</param>
    /// <param name="e">EventArgs</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        //if the hidden field is yes that means choose ok from javascript confirm
        //so same the participants to the database
        if (HiddenSaveInformation.Value == "Y")
        {
            //reset the hidden field
            HiddenSaveInformation.Value = "N";

            //save and go to clicked url
            AddParticipants();

            //redirect to the course detail page
            string url      = Request.Url.AbsoluteUri;
            long   courseID = Convert.ToInt64(Request.QueryString[LACESConstant.QueryString.COURSE_ID]);

            //this is the hidden field redirect value, -1 means course deatil page
            //-2 means provider details page, >0 means edit participant page and this is the
            //participant id
            int val = Convert.ToInt16(HiddenRedirectUrl.Value);
            if (val == -1) //course details
            {
                //redirect to course detail page
                Response.Redirect(url.Substring(0, url.LastIndexOf("/")) + "/CourseDetails.aspx?" + LACESConstant.QueryString.COURSE_ID + "=" + courseID);
            }
            else if (val == -2) //provider details
            {
                //redirect to provider detail page
                Response.Redirect(url.Substring(0, url.LastIndexOf("/")) + "/ProviderDetails.aspx");
            }
            else if (val > 0) //edit participant, and this is the participant id
            {
                //redirect to edit participant page
                Response.Redirect(url.Substring(0, url.LastIndexOf("/")) + "/EditParticipants.aspx?" + LACESConstant.QueryString.PARTICIPANT_ID + "=" + val + "&" + LACESConstant.QueryString.COURSE_ID + "=" + courseID);
            }
        }

        //focus the default text box
        row11.Focus();

        //get the master page form tag and set default button
        HtmlForm masterHtmlForm = (HtmlForm)Master.FindControl("form1");

        masterHtmlForm.DefaultButton = btnSaveFinish.UniqueID;

        if (!IsPostBack)
        {
            //add javascript functionality to the master page provider details link
            HtmlAnchor anchorMasterProviderDetail = (HtmlAnchor)Master.FindControl("anchorProviderDetails");
            anchorMasterProviderDetail.Attributes.Add("onclick", "javascript:return CheckChange(1,-1)");

            if (Request.QueryString[LACESConstant.QueryString.COURSE_ID] != null)
            {
                try
                {
                    //get the course id from query string
                    long courseID = Convert.ToInt64(Request.QueryString[LACESConstant.QueryString.COURSE_ID]);

                    //populate ParticipantList
                    populateParticipantList(courseID);

                    //populate course information
                    populateCourseInfo();

                    //populate provider information
                    populateProviderInfo();
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }
    }