Beispiel #1
0
    protected void generateJSON_Click(object sender, EventArgs e)
    {
        DataView  view = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
        DataTable dt   = view.ToTable();

        GridView GridView2 = new GridView();

        GridView2.AllowPaging = false;
        GridView2.DataSource  = dt;
        GridView2.DataBind();

        Response.Clear();
        Response.Buffer = true;
        Response.AddHeader("content-disposition",
                           "attachment;filename=RecipesSearch.doc");
        Response.Charset     = "";
        Response.ContentType = "application/vnd.ms-word ";
        StringWriter   sw = new StringWriter();
        HtmlTextWriter hw = new HtmlTextWriter(sw);

        GridView2.RenderControl(hw);
        Response.Output.Write(sw.ToString());
        Response.Flush();
        Response.End();
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.UsageChartDataBinding();

                LoadCompany();
            }

            List <UsageItem> us = new List <UsageItem>();

            DataView dv = (DataView)SqlDataSource4.Select(System.Web.UI.DataSourceSelectArguments.Empty);

            if (dv != null)
            {
                foreach (DataRowView dr in dv)
                {
                    UsageItem v = new UsageItem();


                    v.BillDt       = dr["BillDt"].ToString();
                    v.UsageSummary = (double)dr["UsageSummary"];

                    us.Add(v);
                }

                RadChart1.DataSource                      = us;
                RadChart1.Series[0].DataYColumn           = "UsageSummary";
                RadChart1.PlotArea.XAxis.DataLabelsColumn = "BillDt";

                RadChart1.DataBind();
            }
        }
    protected void Button3_Click(object sender, EventArgs e)
    {
        DataView dv3      = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
        int      row_num1 = -1;

        for (int i = 0; i < dv3.Table.Rows.Count; i++)
        {
            if (TextBox1.Text != "" && TextBox2.Text != "" && TextBox3.Text != "" && TextBox4.Text != "")
            {
                if (TextBox1.Text.Trim().ToString() == (string)dv3.Table.Rows[i][1].ToString().Trim() &&
                    TextBox2.Text.Trim().ToString() == (string)dv3.Table.Rows[i][2].ToString().Trim() &&
                    TextBox3.Text.Trim().ToString() == (string)dv3.Table.Rows[i][3].ToString().Trim() &&
                    TextBox4.Text.Trim().ToString() == (string)dv3.Table.Rows[i][4].ToString().Trim())
                {
                    row_num1 = i;
                }
            }
        }
        int cl_id = -1;

        if (row_num1 > -1)
        {
            cl_id = (int)dv3.Table.Rows[row_num1][0];
        }
        if (cl_id > 0)
        {
            Label3.Text = "Your number is: " + cl_id.ToString();
        }
        else
        {
            Label3.Text = "Please, enter button Add. You are not in our database.";
        }
    }
Beispiel #4
0
 protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (DropDownList1.SelectedValue == "Inner")
     {
         DataView mydata = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
         GridView3.DataSource          = mydata;
         GridView3.AutoGenerateColumns = true;
         GridView3.DataBind();
     }
     else if (DropDownList1.SelectedValue == "Left")
     {
         DataView mydata = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
         GridView3.DataSource          = mydata;
         GridView3.AutoGenerateColumns = true;
         GridView3.DataBind();
     }
     else if (DropDownList1.SelectedValue == "Right")
     {
         DataView mydata = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);
         GridView3.DataSource          = mydata;
         GridView3.AutoGenerateColumns = true;
         GridView3.DataBind();
     }
     else
     {
         DataView mydata = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);
         GridView3.DataSource          = mydata;
         GridView3.AutoGenerateColumns = true;
         GridView3.DataBind();
     }
 }
Beispiel #5
0
    protected void RadGridM_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item  = e.Item as GridDataItem;
            RadGrid      gridP = item["PastDueReleaseNo"].FindControl("RadGridP") as RadGrid;
            RadGrid      grid0 = item["Day0ReleaseNo"].FindControl("RadGrid0") as RadGrid;
            RadGrid      grid1 = item["Day1ReleaseNo"].FindControl("RadGrid1") as RadGrid;
            RadGrid      grid2 = item["Day2ReleaseNo"].FindControl("RadGrid2") as RadGrid;
            RadGrid      grid3 = item["Day3ReleaseNo"].FindControl("RadGrid3") as RadGrid;
            RadGrid      grid4 = item["Day4ReleaseNo"].FindControl("RadGrid4") as RadGrid;

            SqlDataSourceP.SelectParameters[0].DefaultValue = item.GetDataKeyValue("PastDueReleaseNo").ToString();
            SqlDataSource0.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day0ReleaseNo").ToString();
            SqlDataSource1.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day1ReleaseNo").ToString();
            SqlDataSource2.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day2ReleaseNo").ToString();
            SqlDataSource3.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day3ReleaseNo").ToString();
            SqlDataSource4.SelectParameters[0].DefaultValue = item.GetDataKeyValue("Day4ReleaseNo").ToString();

            gridP.DataSource = SqlDataSourceP.Select(DataSourceSelectArguments.Empty);
            grid0.DataSource = SqlDataSource0.Select(DataSourceSelectArguments.Empty);
            grid1.DataSource = SqlDataSource1.Select(DataSourceSelectArguments.Empty);
            grid2.DataSource = SqlDataSource2.Select(DataSourceSelectArguments.Empty);
            grid3.DataSource = SqlDataSource3.Select(DataSourceSelectArguments.Empty);
            grid4.DataSource = SqlDataSource4.Select(DataSourceSelectArguments.Empty);

            gridP.DataBind();
            grid0.DataBind();
            grid1.DataBind();
            grid2.DataBind();
            grid3.DataBind();
            grid4.DataBind();
        }
    }
Beispiel #6
0
    protected void ddlDept_SelectedIndexChanged(object sender, EventArgs e)
    {
        var   mgCookie = new ManageCookie();
        users ck       = mgCookie.ReadCookies();

        if (ck != null)
        {
            var strSql = new StringBuilder();
            strSql.Append("select pj_id, pj_code, d_id, pj_name, pj_year, pj_budget, pj_complete_status, pj_category, ");
            strSql.Append(" pj_approval_status, pj_lastupdate from projects ");
            strSql.Append(" where pj_status = 'real' and pj_complete_status = N'ไม่อยู่ในเกณฑ์การประเมิน/กรอกสมบูรณ์' and ");
            strSql.Append(" d_id = " + ddlDept.SelectedValue);

            SqlDataSource4.SelectCommand = strSql.ToString();
            SqlDataSource4.DataBind();

            GridView1.DataSource = SqlDataSource4;
            GridView1.DataBind();

            var dtView = (DataView)SqlDataSource4.Select(new DataSourceSelectArguments());
            var listt  = (from t in dtView.Table.AsEnumerable()
                          group t by t.Field <string>("pj_year") into g
                          orderby g.Key
                          select new
            {
                pj_year = g.Key,
            });

            ddlProjectYear.DataSource = listt;
            ddlProjectYear.DataBind();

            ddlProjectYear.Items.Insert(0, new ListItem("[ทุกปีงบประมาณ]", String.Empty));
            ddlProjectYear.SelectedIndex = 0;
        }
    }
Beispiel #7
0
 private void check_id()
 {
     SqlDataSource4.SelectCommand = "SELECT * FROM [ticket_details]";
     System.Data.DataView dv = (System.Data.DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
     lbl.Text   = dv.Count.ToString();
     id_From_db = dv.Count + 1;
 }
    protected void btnCreate_Click2(object sender, EventArgs e)
    {
        int i = 0;

        try
        {
            DataView dv = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
            foreach (DataRowView dr in dv)
            {
                i = int.Parse(dr[0].ToString());
            }
            i++;
        }
        catch
        {
            i = 1;
        }
        Session["id"] = i;

        byte[] defimg = File.ReadAllBytes(Server.MapPath("~/") + "App_Themes/Theme1/noimg.jpg");
        Session["logo"] = defimg;

        SqlDataSource3.Insert();
        DSdelRequest.Delete();

        string ss = "Trainer Name is: " + txtTrainerName.Text + " / Email to login: "******" / Password to login: "******"mailto:" + txtEmail.Text + "&body=" + ss + "&subject=Trainer Account Successful");
    }
Beispiel #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ManageCookie mgCookie = new ManageCookie();
            users        ck       = mgCookie.ReadCookies();

            if (ck != null)
            {
                String strPJid = ck.pj_id;

                string strPjType = string.Empty;

                StringBuilder strSQL = new StringBuilder();
                strSQL.Append("select d.d_code, d.d_name, m.mi_code, m.mi_name, p.pj_code, p.d_id, p.pj_name, y.yut_name, p.pj_year, p.pj_budget, pj_integrateProject, pj_relateDept, pj_background, pj_urgency, pj_type");
                strSQL.Append(" from projects p, department d, ministry m, yutasad y");
                strSQL.Append(" where p.d_id = d.d_id and p.mi_id = m.mi_id and p.pj_yut_id = y.yut_id and p.pj_id = '" + strPJid + "'");

                SqlDataSource4.SelectCommand = strSQL.ToString();
                SqlDataSource4.DataBind();

                DataView dv1 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

                foreach (DataRow dRow in dv1.Table.Rows)
                {
                    lblDeptCode.Text     = dRow["mi_code"].ToString();
                    lblDeptName.Text     = dRow["mi_name"].ToString();
                    lblDivisionCode.Text = dRow["d_code"].ToString();
                    lblDivisionName.Text = dRow["d_name"].ToString();
                    lblProjectName.Text  = dRow["pj_name"].ToString();
                    lblProjectCode.Text  = dRow["pj_code"].ToString();
                    lblYutasard.Text     = dRow["yut_name"].ToString();
                    //lblIntegrateProject.Text = dRow["pj_integrateProject"].ToString();
                    //lblRelateDept.Text = dRow["pj_relateDept"].ToString();
                    lblBudget.Text = dRow["pj_budget"].ToString();
                    lblYear.Text   = dRow["pj_year"].ToString();

                    strPjType = dRow["pj_type"].ToString();
                }

                if (strPjType.Trim() == "โครงการใหม่")
                {
                    linkQuestionE.Visible = false;
                }
                else if (strPjType.Trim() == "โครงการต่อเนื่องหรือโครงการขยายผล")
                {
                    linkQuestionE.Visible = true;
                }
                else
                {
                    Response.Redirect("default.aspx");
                }
            }
            else
            {
                //redirect to login page
                Response.Redirect("default.aspx");
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ManageCookie mgCookie = new ManageCookie();
            users        ck       = mgCookie.ReadCookies();

            if (ck != null)
            {
                String strPJid = ck.pj_id;
                //String strPJCode = "01001-100";

                StringBuilder strSQL = new StringBuilder();
                strSQL.Append("select d.d_code, d.d_name, m.mi_code, m.mi_name, p.pj_code, p.d_id, p.pj_name, y.yut_name, p.pj_year, p.pj_budget, pj_integrateProject, pj_relateDept, pj_background, pj_urgency, pj_category");
                strSQL.Append(" from projects p, department d, ministry m, yutasad y");
                strSQL.Append(" where p.d_id = d.d_id and p.mi_id = m.mi_id and p.pj_yut_id = y.yut_id and p.pj_id = " + strPJid);

                SqlDataSource4.SelectCommand = strSQL.ToString();
                SqlDataSource4.DataBind();

                DataView dv1 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

                foreach (DataRow dRow in dv1.Table.Rows)
                {
                    lblDeptCode.Text         = dRow["mi_code"].ToString();
                    lblDeptName.Text         = dRow["mi_name"].ToString();
                    lblDivisionCode.Text     = dRow["d_code"].ToString();
                    lblDivisionName.Text     = dRow["d_name"].ToString();
                    lblProjectName.Text      = dRow["pj_name"].ToString();
                    lblProjectCode.Text      = dRow["pj_code"].ToString();
                    lblYutasard.Text         = dRow["yut_name"].ToString();
                    lblIntegrateProject.Text = dRow["pj_integrateProject"].ToString();
                    lblRelateDept.Text       = dRow["pj_relateDept"].ToString();
                    lblBudget.Text           = dRow["pj_budget"].ToString();
                    lblYear.Text             = dRow["pj_year"].ToString();

                    if (dRow["pj_category"].ToString() != string.Empty)
                    {
                        if (dRow["pj_category"].ToString() == "บริหารทั่วไป")
                        {
                            radProjectCate.SelectedIndex = 0;
                        }
                        else if (dRow["pj_category"].ToString() == "บริหารสังคม")
                        {
                            radProjectCate.SelectedIndex = 1;
                        }
                        else if (dRow["pj_category"].ToString() == "เศรษฐกิจ")
                        {
                            radProjectCate.SelectedIndex = 2;
                        }
                    }
                }
            }
            else
            {
                //redirect to login page
            }
        }
    }
    protected void getData()
    {
        DataView stud_Address = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in stud_Address)
        {
            DataRow row = drv.Row;
            lblSadd.Text  = row["Address1"].ToString();
            lblSadd1.Text = row["Address2"].ToString();
            lblPost.Text  = row["Postcode"].ToString();
            lblCity.Text  = row["City"].ToString();
            lblState.Text = row["State"].ToString();
        }

        DataView parentF = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in parentF)
        {
            DataRow row = drv.Row;

            lblFname.Text   = row["Name"].ToString();
            lblFOcc.Text    = row["Occupation"].ToString();
            lblFsalary.Text = row["Salary"].ToString();
            lblphone.Text   = row["Contact"].ToString();
        }

        DataView parentAdd = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in parentAdd)
        {
            DataRow row = drv.Row;
            lblFadd.Text   = row["Address1"].ToString();
            lblFpost.Text  = row["Postcode"].ToString();
            lblFstate.Text = row["State"].ToString();
            lblFcity.Text  = row["City"].ToString();
        }
        DataView parentM = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in parentM)
        {
            DataRow row = drv.Row;
            lblMname.Text   = row["Name"].ToString();
            lblMOcc.Text    = row["Occupation"].ToString();
            lblMsalary.Text = row["Salary"].ToString();
        }

        DataView stud_Acad = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drv in stud_Acad)
        {
            DataRow row = drv.Row;
            lblSIns.Text  = row["Name_of_Institution"].ToString();
            lblSGrad.Text = row["Date"].ToString();
            lblcgpa.Text  = row["CGPA"].ToString();
            lblField.Text = row["Field_of_Study"].ToString();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        ManageCookie mgCookie = new ManageCookie();
        users        ck       = mgCookie.ReadCookies();

        if (ck != null)
        {
            string strDeptID = ck.d_code;

            //Redirect Login users to pending page
            //redirectToPendingPage();

            //string strDeptID = "01001";
            string strProjectStatus = ck.pj_status;

            //keep project code in cookie for usage in follwing pages
            mgCookie.UpdateCookies("pj_status", strProjectStatus);

            string strSQL1 = "select * from dbo.department d, dbo.ministry m where d.mi_id = m.mi_id and d.d_code = '" + strDeptID + "'";

            SqlDataSource4.SelectCommand = strSQL1;
            SqlDataSource4.DataBind();

            DataView dv1 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

            foreach (DataRow dRow in dv1.Table.Rows)
            {
                lblDeptCode.Text     = dRow["mi_code"].ToString();
                lblDeptName.Text     = dRow["mi_name"].ToString();
                lblDivisionCode.Text = dRow["d_code"].ToString();
                lblDivisionName.Text = dRow["d_name"].ToString();

                mgCookie.UpdateCookies("mi_id", dRow["mi_id"].ToString());
            }


            if (!Page.IsPostBack)
            {
                string strSQL = "SELECT * from dbo.projects where pj_id = " + ck.pj_id;

                SqlDataSource2.SelectCommand = strSQL;
                SqlDataSource2.DataBind();

                DataView dv = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);

                lblProjectCode.Text       = dv.Table.Rows[0]["pj_code"].ToString();
                txtProjectName.Text       = dv.Table.Rows[0]["pj_name"].ToString();
                ddlYudtasad.SelectedValue = dv.Table.Rows[0]["pj_yut_id"].ToString();
                ddlYear.SelectedValue     = dv.Table.Rows[0]["pj_year"].ToString();
                txtBudget.Text            = dv.Table.Rows[0]["pj_budget"].ToString();

                DropDownList2.SelectedValue = dv.Table.Rows[0]["pj_budget_type"].ToString();
                //txtIntegrate.Text = dv.Table.Rows[0]["pj_integrateproject"].ToString();
                //txtRelate.Text = dv.Table.Rows[0]["pj_relateDept"].ToString();
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ManageCookie mgCookie = new ManageCookie();
            users        ck       = mgCookie.ReadCookies();

            if (ck != null)
            {
                string strPJCode   = ck.pj_code;
                string strPJStatus = ck.pj_status;
                string strPJ_ID    = ck.pj_id;


                StringBuilder strSQL = new StringBuilder();
                strSQL.Append("select d.d_code, d.d_name, m.mi_code, m.mi_name, p.pj_code, p.d_id, p.pj_name, y.yut_name, p.pj_year, p.pj_budget, pj_integrateProject, pj_relateDept, pj_filter_q1, pj_filter_q2, pj_filter_q3, pj_filter_q4 ");
                strSQL.Append(" from projects p, department d, ministry m, yutasad y");
                strSQL.Append(" where p.d_id = d.d_id and p.mi_id = m.mi_id and p.pj_yut_id = y.yut_id and p.pj_id = " + strPJ_ID);

                SqlDataSource4.SelectCommand = strSQL.ToString();
                SqlDataSource4.DataBind();

                DataView dv1 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

                if (dv1.Table.Rows.Count > 0)
                {
                    foreach (DataRow dRow in dv1.Table.Rows)
                    {
                        lblDeptCode.Text         = dRow["mi_code"].ToString();
                        lblDeptName.Text         = dRow["mi_name"].ToString();
                        lblDivisionCode.Text     = dRow["d_code"].ToString();
                        lblDivisionName.Text     = dRow["d_name"].ToString();
                        lblProjectName.Text      = dRow["pj_name"].ToString();
                        lblProjectCode.Text      = dRow["pj_code"].ToString();
                        lblYutasard.Text         = dRow["yut_name"].ToString();
                        lblIntegrateProject.Text = dRow["pj_integrateProject"].ToString();
                        lblRelateDept.Text       = dRow["pj_relateDept"].ToString();
                        lblBudget.Text           = dRow["pj_budget"].ToString();
                        lblYear.Text             = dRow["pj_year"].ToString();

                        radQ1.SelectedValue = dRow["pj_filter_q1"].ToString();
                        radQ2.SelectedValue = dRow["pj_filter_q2"].ToString();
                    }
                }
                else
                {
                    //cannot display project details, redirect to login page
                }
            }
            else
            {
                //cannot find user login cookie, redirect to login page
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ManageCookie mgCookie = new ManageCookie();
            users        ck       = mgCookie.ReadCookies();

            if (ck != null)
            {
                String strPJid = ck.pj_id;

                StringBuilder strSQL = new StringBuilder();
                strSQL.Append("select d.d_code, d.d_name, m.mi_code, m.mi_name, p.pj_code, p.d_id, p.pj_name, y.yut_name, p.pj_year, p.pj_budget, pj_integrateProject, pj_relateDept, pj_background, pj_urgency, pj_type, pj_complete_status ");
                strSQL.Append(" from projects p, department d, ministry m, yutasad y");
                strSQL.Append(" where p.d_id = d.d_id and p.mi_id = m.mi_id and p.pj_yut_id = y.yut_id and p.pj_id = '" + strPJid + "'");

                SqlDataSource4.SelectCommand = strSQL.ToString();
                SqlDataSource4.DataBind();

                DataView dv1 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

                foreach (DataRow dRow in dv1.Table.Rows)
                {
                    lblDeptCode.Text     = dRow["mi_code"].ToString();
                    lblDeptName.Text     = dRow["mi_name"].ToString();
                    lblDivisionCode.Text = dRow["d_code"].ToString();
                    lblDivisionName.Text = dRow["d_name"].ToString();
                    lblProjectName.Text  = dRow["pj_name"].ToString();
                    lblProjectCode.Text  = dRow["pj_code"].ToString();
                    lblYutasard.Text     = dRow["yut_name"].ToString();
                    //lblIntegrateProject.Text = dRow["pj_integrateProject"].ToString();
                    //lblRelateDept.Text = dRow["pj_relateDept"].ToString();
                    lblBudget.Text = dRow["pj_budget"].ToString();
                    lblYear.Text   = dRow["pj_year"].ToString();
                }

                gUtilities gt = new gUtilities();
                litRisk1.Text = gt.getReportTammaTotal(ck.pj_id);
                litRisk2.Text = gt.getReportFactorRiskTotal(ck.pj_id);
                // litRisk12.Text = gt.getReportTammaMainTotal(ck.pj_id);
                // litRisk13.Text = gt.getReportTammaSubTotal(ck.pj_id);

                if (dv1.Table.Rows[0]["pj_complete_status"].ToString() == null)
                {
                    Response.Redirect("project_summary.aspx");
                }
            }
            else
            {
                //redirect
                Response.Redirect("project_summary.aspx");
            }
        }
    }
Beispiel #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request.QueryString["OrderNo"] != null & Page.User.Identity.Name != "admin")
            {
                Session.Abandon();
                Label2.Text = Request.QueryString["OrderNo"].ToString();

                SqlDataSource1.Update();



                dview = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

                SMTP      = (string)dview.Table.Rows[0]["SMTP"];
                BCC       = (string)dview.Table.Rows[0]["BCC"];
                EmailFrom = (string)dview.Table.Rows[0]["EmailFrom"];
                Password  = (string)dview.Table.Rows[0]["Password"];
                //Ports = (int)dview.Table.Rows[0]["Port"];

                string host = HttpContext.Current.Request.Url.Host;
                // localhost
                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient(SMTP.ToString());
                mail.From = new MailAddress(EmailFrom.ToString());
                //Email acpe = new Email();
                mail.To.Add(Page.User.Identity.Name);
                mail.Bcc.Add(BCC.ToString());

                StreamReader reader   = new StreamReader(Server.MapPath("~/email/orderreceive.html"));
                string       readFile = reader.ReadToEnd();
                string       myString = "";
                myString = readFile;
                //string name = HttpUtility.UrlEncode(Encrypt(Session["UserName"].ToString().Trim()));
                //string technology = HttpUtility.UrlEncode(Encrypt(ddlTechnology.SelectedItem.Value));

                myString = myString.Replace("{#Order}", Label2.Text);
                myString = myString.Replace("{#OrderDate}", DateTime.Now.ToString());


                mail.Subject           = "Order Receipt " + DateTime.Now.ToString("dd/MMM/yyyy hh:mm:ss tt");
                mail.IsBodyHtml        = true;
                mail.Body              = myString.ToString();
                SmtpServer.Port        = 25;
                SmtpServer.Credentials = new System.Net.NetworkCredential(EmailFrom.ToString(), Password.ToString());
                SmtpServer.EnableSsl   = false;
                object userState = mail;
                SmtpServer.SendCompleted += new SendCompletedEventHandler(SMTPClientForAsy.SmtpClient_OnCompleted);
                SmtpServer.SendAsync(mail, userState);
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            ManageCookie mgCookie = new ManageCookie();
            users        ck       = mgCookie.ReadCookies();

            if (ck != null)
            {
                String strPJid = ck.pj_id;

                StringBuilder strSQL = new StringBuilder();
                strSQL.Append("select d.d_code, d.d_name, m.mi_code, m.mi_name, p.pj_code, p.d_id, p.pj_name, y.yut_name, p.pj_year, p.pj_budget, pj_integrateProject, pj_relateDept, pj_background, pj_urgency,pj_risk_info, pj_risk_reduction1, pj_risk_reduction2, pj_risk_eval1, pj_risk_eval2, pj_risk_eval3");
                strSQL.Append(" from projects p, department d, ministry m, yutasad y");
                strSQL.Append(" where p.d_id = d.d_id and p.mi_id = m.mi_id and p.pj_yut_id = y.yut_id and p.pj_id = '" + strPJid + "'");

                SqlDataSource4.SelectCommand = strSQL.ToString();
                SqlDataSource4.DataBind();

                DataView dv1 = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

                foreach (DataRow dRow in dv1.Table.Rows)
                {
                    lblDeptCode.Text     = dRow["mi_code"].ToString();
                    lblDeptName.Text     = dRow["mi_name"].ToString();
                    lblDivisionCode.Text = dRow["d_code"].ToString();
                    lblDivisionName.Text = dRow["d_name"].ToString();
                    lblProjectName.Text  = dRow["pj_name"].ToString();
                    lblProjectCode.Text  = dRow["pj_code"].ToString();
                    lblYutasard.Text     = dRow["yut_name"].ToString();
                    //lblIntegrateProject.Text = dRow["pj_integrateProject"].ToString();
                    //lblRelateDept.Text = dRow["pj_relateDept"].ToString();
                    lblBudget.Text = dRow["pj_budget"].ToString();
                    lblYear.Text   = dRow["pj_year"].ToString();

                    txtBackground.Text = dRow["pj_background"].ToString();
                    txtUrgency.Text    = dRow["pj_urgency"].ToString();

                    //txtRiskInfo.Text = dRow["pj_risk_info"].ToString();
                    //txtRiskReduction1.Text = dRow["pj_risk_reduction1"].ToString();
                    //txtRiskReduction2.Text = dRow["pj_risk_reduction2"].ToString();
                    //txtRiskEval1.Text = dRow["pj_risk_eval1"].ToString();
                    //txtRiskEval2.Text = dRow["pj_risk_eval2"].ToString();
                    //txtRiskEval3.Text = dRow["pj_risk_eval3"].ToString();
                }
            }
            else
            {
                //redirect to login page
            }
        }
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        String n  = TextBox1.Text;
        String s  = TextBox2.Text;
        String t  = TextBox3.Text;
        String dl = TextBox4.Text;

        if (n == "" || t == "" || dl == "")
        {
            Label3.Text = "Please. Enter some information in the field."; return;
        }

        DataView dv3      = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
        int      row_num1 = -1;

        for (int i = 0; i < dv3.Table.Rows.Count; i++)
        {
            if (TextBox1.Text.Trim().ToString() == (string)dv3.Table.Rows[i][1].ToString().Trim() &&
                TextBox2.Text.Trim().ToString() == (string)dv3.Table.Rows[i][2].ToString().Trim() &&
                TextBox3.Text.Trim().ToString() == (string)dv3.Table.Rows[i][3].ToString().Trim() &&
                TextBox4.Text.Trim().ToString() == (string)dv3.Table.Rows[i][4].ToString().Trim())
            {
                row_num1 = i;
            }
        }
        int cl_id = -1;

        if (row_num1 > -1)
        {
            cl_id = (int)dv3.Table.Rows[row_num1][0];
        }
        String query = "INSERT INTO client(Name,Surname,Telephone,dl_num) VALUES('" + n + "','" + s + "','" + t + "','" + dl + "')";

        if (cl_id > 0)
        {
            Label3.Text = "You are in our database. Your number is:" + cl_id.ToString();
        }
        else
        {
            SqlDataSource4.InsertCommand = query;
            SqlDataSource4.Insert();

            sendmsg.SendEmail("New client", "New client : " + n + " " + s + ". " + "Tel:" + t + ". " + "Dr. license:" + dl);
        }

        TextBox1.Text = "";
        TextBox2.Text = "";
        TextBox3.Text = "";
        TextBox4.Text = "";
    }
        protected void Calendar1_SelectionChanged(object sender, EventArgs e)
        {
            rButtonsHours.Items[0].Text = "09:00";
            rButtonsHours.Items[1].Text = "10:00";
            rButtonsHours.Items[2].Text = "11:00";
            rButtonsHours.Items[3].Text = "12:00";
            rButtonsHours.Items[4].Text = "13:00";
            rButtonsHours.Items[5].Text = "14:00";
            rButtonsHours.Items[6].Text = "15:00";
            rButtonsHours.Items[7].Text = "16:00";
            rButtonsHours.Items[8].Text = "17:00";

            rButtonsHours.Items[0].Enabled = true;
            rButtonsHours.Items[1].Enabled = true;
            rButtonsHours.Items[2].Enabled = true;
            rButtonsHours.Items[3].Enabled = true;
            rButtonsHours.Items[4].Enabled = true;
            rButtonsHours.Items[5].Enabled = true;
            rButtonsHours.Items[6].Enabled = true;
            rButtonsHours.Items[7].Enabled = true;
            rButtonsHours.Items[8].Enabled = true;

            rButtonsHours.Items[0].Selected = false;
            rButtonsHours.Items[1].Selected = false;
            rButtonsHours.Items[2].Selected = false;
            rButtonsHours.Items[3].Selected = false;
            rButtonsHours.Items[4].Selected = false;
            rButtonsHours.Items[5].Selected = false;
            rButtonsHours.Items[6].Selected = false;
            rButtonsHours.Items[7].Selected = false;
            rButtonsHours.Items[8].Selected = false;

            DataView dv = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

            foreach (DataRowView drow in dv)
            {
                ListItem item = rButtonsHours.Items.FindByValue(drow["time"].ToString().Substring(0, 5));
                if (item != null)
                {
                    item.Text   += "-" + drow["name"].ToString() + " " + drow["surname"].ToString();
                    item.Enabled = false;
                }
            }

            pnlHours.Visible     = true;
            pnlHastaTc.Visible   = false;
            pnlHastaForm.Visible = false;
        }
Beispiel #19
0
    protected void btn2_Click(object sender, EventArgs e)
    {
        String Year = DropDownList1.SelectedValue;
        String sqlx = "SELECT DISTINCT UnitType FROM SchoolTable WHERE Year='" + Year + "'";

        SqlDataSource1.SelectCommand = sqlx;
        DataView dv = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments());

        for (int i = 0; i < dv.Count; i++)
        {
            String uType = (String)dv[i][0];
            String Sql   = "select count(UnitName) from SchoolTable where UnitType='" + uType + "' AND Year='" + Year + "' AND Status='Activated'";
            SqlDataSource2.SelectCommand = Sql;
            DataView dv1   = (DataView)SqlDataSource2.Select(new DataSourceSelectArguments());
            int      uName = (int)dv1[0][0];
            String   msqlx = "select count(StudFullName) from StudentTable where UnitType='" + uType + "' AND Year='" + Year + "' AND Status='Activated'";
            SqlDataSource3.SelectCommand = msqlx;
            DataView dv2   = (DataView)SqlDataSource3.Select(new DataSourceSelectArguments());
            int      sName = (int)dv2[0][0];
            float    rf    = float.Parse(txtEnterRegistrationFeesForStudent.Text);
            float    t1    = sName * rf;
            String   msql  = "select count(FullName) from UnitLeaderTable where UnitType='" + uType + "' AND Year='" + Year + "' AND SupportingLeader='false' AND Status='Activated'";
            SqlDataSource4.SelectCommand = msql;
            DataView dv3    = (DataView)SqlDataSource4.Select(new DataSourceSelectArguments());
            int      ulName = (int)dv3[0][0];
            String   msqlv  = "select count(FullName) from UnitLeaderTable where UnitType='" + uType + "' AND Year='" + Year + "' AND SupportingLeader='true' AND Status='Activated'";
            int      sut;
            DataView dv4 = (DataView)SqlDataSource5.Select(new DataSourceSelectArguments());
            if (dv4.Count == 1)
            {
                sut = (int)dv4[0][0];
            }
            else
            {
                sut = 0;
            }

            float  urs    = float.Parse(txtEnterFeesForUnitLeader.Text);
            float  total  = (ulName + sut) * urs;
            int    mtotal = sName + ulName + sut;
            float  rtotal = t1 + total;
            String query  = "INSERT INTO UnitInformation (UnitType, TotalUnits, TotalStudent, StudentRegistrationFees, StudentTotalFees, TotalUnitLeader, TotalSupportingLeader, UnitLeaderRegistrationFees, UnitLeaderTotalFees, TotalMembers, TotalFees, Year)  VALUES('" + uType + "'," + uName + "," + sName + "," + rf + "," + t1 + "," + ulName + "," + sut + "," + urs + "," + total + "," + mtotal + "," + rtotal + ",'" + Year + "')";
            SqlDataSource6.InsertCommand = query;
            int n = SqlDataSource6.Insert();
        }
        Response.Write("<script>alert('Data inserted successfully...')</script>");
        CleartextBoxes(this);
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            //SqlDataSource3.Insert();

            dview = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

            SMTP      = (string)dview.Table.Rows[0]["SMTP"];
            BCC       = (string)dview.Table.Rows[0]["BCC"];
            EmailFrom = (string)dview.Table.Rows[0]["EmailFrom"];
            Password  = (string)dview.Table.Rows[0]["Password"];
            //Ports = (int)dview.Table.Rows[0]["Port"];

            string host = HttpContext.Current.Request.Url.Host;
            // localhost
            MailMessage mail       = new MailMessage();
            SmtpClient  SmtpServer = new SmtpClient(SMTP.ToString());
            mail.From = new MailAddress(EmailFrom.ToString());
            //Email acpe = new Email();
            mail.To.Add(Page.User.Identity.Name);
            mail.Bcc.Add(BCC.ToString());

            StreamReader reader   = new StreamReader(Server.MapPath("~/email/affiliateconfirmationemailstep1.html"));
            string       readFile = reader.ReadToEnd();
            string       myString = "";
            myString = readFile;
            //string name = HttpUtility.UrlEncode(Encrypt(Session["UserName"].ToString().Trim()));
            //string technology = HttpUtility.UrlEncode(Encrypt(ddlTechnology.SelectedItem.Value));

            myString = myString.Replace("{#UserName}", Page.User.Identity.Name);
            myString = myString.Replace("{#Password}", Session["Password"].ToString());


            mail.Subject           = "Welcome" + host.ToString() + " " + DateTime.Now.ToString("dd/MMM/yyyy hh:mm:ss tt");
            mail.IsBodyHtml        = true;
            mail.Body              = myString.ToString();
            SmtpServer.Port        = 8889;
            SmtpServer.Credentials = new System.Net.NetworkCredential(EmailFrom.ToString(), Password.ToString());
            SmtpServer.EnableSsl   = false;
            object userState = mail;
            SmtpServer.SendCompleted += new SendCompletedEventHandler(SMTPClientForAsy.SmtpClient_OnCompleted);
            SmtpServer.SendAsync(mail, userState);

            message.Visible = true;
        }
    }
    private void GetInvoiceNumber()
    {
        /*string conString = ConfigurationManager.ConnectionStrings[
         *  "HalloweenConnectionString"].ConnectionString;
         * SqlConnection conHalloween =
         *  new SqlConnection(conString);
         * SqlCommand invoiceNoCommand =
         *  new SqlCommand("Select Ident_Current('Invoices') From Invoices", conHalloween);
         * conHalloween.Open();
         * invoiceNumber = invoiceNoCommand.ExecuteScalar().ToString();
         * conHalloween.Close();*/

        SqlDataSource4.SelectParameters["cust_email"].DefaultValue = email;
        DataView dvInvoice = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);

        invoiceNumber = dvInvoice[0][0].ToString();
    }
Beispiel #22
0
    protected void btn2_Click(object sender, EventArgs e)
    {
        String Year = DropDownList1.SelectedValue;
        String sqlx = "SELECT DISTINCT UnitType FROM SchoolTable WHERE Year='" + Year + "'";

        SqlDataSource1.SelectCommand = sqlx;
        DataView ds = (DataView)SqlDataSource1.Select(new DataSourceSelectArguments());

        for (int a = 0; a < ds.Count; a++)
        {
            String uType = (String)ds[a][0];
            String Sql   = "select UnitName from SchoolTable where UnitType='" + uType + "' AND Year='" + Year + "' AND CharterNo IS NOT NULL AND Checked IS NULL";
            SqlDataSource2.SelectCommand = Sql;
            DataView dv = (DataView)SqlDataSource2.Select(new DataSourceSelectArguments());
            for (int i = 0; i < dv.Count; i++)
            {
                String uName = (String)dv[i][0];
                String msql  = "select count(StudFullName) from StudentTable where UnitName='" + uName + "' AND Year='" + Year + "'";
                String msqlx = "select count(FullName) from UnitLeaderTable where UnitName='" + uName + "' AND Year='" + Year + "'";
                SqlDataSource3.SelectCommand = msql;
                SqlDataSource4.SelectCommand = msqlx;
                DataView dv1   = (DataView)SqlDataSource3.Select(new DataSourceSelectArguments());
                DataView dv2   = (DataView)SqlDataSource4.Select(new DataSourceSelectArguments());
                int      st    = (int)dv1[0][0];
                int      ut    = (int)dv2[0][0];
                int      total = st + ut;
                int      cal   = st * (int.Parse(txtEnterTotalFeesForStudent.Text) - int.Parse(txtEnterOfficeContributionForStudent.Text)) + ut * (int.Parse(txtEnterTotalFeesForUnitLeader.Text) - int.Parse(txtEnterOfficeContributionForUnitLeader.Text));
                String   query = "INSERT INTO Confirmation (UnitName, Students, UnitLeader, Total, TotalRs, Year, UnitType, Checked) VALUES('" + uName + "'," + st + "," + ut + "," + total + "," + cal + ",'" + Year + "','" + uType + "', 'False')";
                SqlDataSource6.InsertCommand = query;
                try
                {
                    int n = SqlDataSource6.Insert();
                }
                catch (Exception er)
                {
                    Response.Write(er);
                }
            }
        }
        Response.Write("<script>alert('Data inserted successfully...')</script>");
        CleartextBoxes(this);
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlDataSource1.SelectParameters["cod"].DefaultValue = Label9.Text;
            SqlDataSource1.DataSourceMode = SqlDataSourceMode.DataReader;
            SqlDataReader datos;

            datos = (SqlDataReader)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
            if (datos.Read())
            {
                Label2.Text = "TÌTULO: " + datos["Nom_Ser"] + "<br>Descripción:" + datos["Desc_Ser"];
            }

            SqlDataSource2.SelectParameters["cod1"].DefaultValue = Label10.Text;
            SqlDataSource2.DataSourceMode = SqlDataSourceMode.DataReader;
            SqlDataReader datos1;

            datos1 = (SqlDataReader)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
            if (datos1.Read())
            {
                Label4.Text = "TÌTULO:" + datos1["Nom_Ser"] + "<br>Descripción:" + datos1["Desc_Ser"];
            }

            SqlDataSource3.SelectParameters["cod2"].DefaultValue = Label11.Text;
            SqlDataSource3.DataSourceMode = SqlDataSourceMode.DataReader;
            SqlDataReader datos2;

            datos2 = (SqlDataReader)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
            if (datos2.Read())
            {
                Label6.Text = "TÌTULO:" + datos2["Nom_Ser"] + "<br>Descripción:" + datos2["Desc_Ser"];
            }

            SqlDataSource4.SelectParameters["cod3"].DefaultValue = Label12.Text;
            SqlDataSource4.DataSourceMode = SqlDataSourceMode.DataReader;
            SqlDataReader datos3;

            datos3 = (SqlDataReader)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
            if (datos3.Read())
            {
                Label8.Text = "TÌTULO:" + datos3["Nom_Ser"] + "<br>Descripción:" + datos3["Desc_Ser"];
            }
        }
Beispiel #24
0
 protected void Button9_Click(object sender, EventArgs e)
 {
     MultiView1.ActiveViewIndex = 3;
     try
     {
         DataView  dv = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
         DataTable dt = dv.ToTable();
         Label20.Text = dt.Rows[0][1].ToString();
         Label21.Text = dt.Rows[0][2].ToString();
         Label22.Text = dt.Rows[0][3].ToString();
         Label23.Text = dt.Rows[0][4].ToString();
         Label24.Text = dt.Rows[0][5].ToString();
         Label25.Text = dt.Rows[0][6].ToString();
         Label26.Text = dt.Rows[0][7].ToString();
     }
     catch (Exception ee)
     {
         Response.Redirect("~/UserPage/UserInfo.aspx");
     }
 }
Beispiel #25
0
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (DropDownList1.SelectedValue)
            {
            case "Inner":
            {
                DataView myData = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
                GridView3.DataSource          = myData;
                GridView3.AutoGenerateColumns = true;
                GridView3.DataBind();
            }
            break;

            case "Left Outer":
            {
                DataView myData = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
                GridView3.DataSource          = myData;
                GridView3.AutoGenerateColumns = true;
                GridView3.DataBind();
            }
            break;

            case "Right Outer":
            {
                DataView myData = (DataView)SqlDataSource5.Select(DataSourceSelectArguments.Empty);
                GridView3.DataSource          = myData;
                GridView3.AutoGenerateColumns = true;
                GridView3.DataBind();
            }
            break;

            case "Full Outer":
            {
                DataView myData = (DataView)SqlDataSource6.Select(DataSourceSelectArguments.Empty);
                GridView3.DataSource          = myData;
                GridView3.AutoGenerateColumns = true;
                GridView3.DataBind();
            }
            break;
            }
        }
Beispiel #26
0
    protected void btn_buscar_carrera_Click(object sender, EventArgs e)
    {
        SqlDataSource4.DataSourceMode = SqlDataSourceMode.DataReader;
        SqlDataReader datos;

        datos = (SqlDataReader)
                SqlDataSource4.Select(DataSourceSelectArguments.Empty);

        if (datos.Read())
        {
            txt_id.Text        = datos["id_participante"] + "";
            txt_carrera.Text   = datos["num_carrera"] + "";
            txt_dorsal.Text    = datos["dorsal"] + "";
            txt_nombre.Text    = datos["nombre"] + "";
            txt_apellidos.Text = datos["apellidos"] + "";
            txt_club.Text      = datos["club"] + "";
        }
        else
        {
            lbl_resultado.Text = "Este número de carrera no existe " +
                                 "en la base de datos.";
        }
    }
Beispiel #27
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // При первой загрузке страницы создается выборка кружков, в которых участвует пользователь
            if (Page.IsPostBack == false)
            {
                SqlConnection connection = new SqlConnection(SqlDataSource4.ConnectionString);

                SqlDataSource4.SelectCommand = "    SELECT        Kruzhki.Название AS Принадлежность, UsersKruzhki.UserId, UsersKruzhki.KruzhId, UsersKruzhki.Статус  " +
                                               " FROM            Subjects INNER JOIN  " +
                                               " Kruzhki ON Subjects.SubjectId = Kruzhki.Дисциплина INNER JOIN " +
                                               " UsersKruzhki ON Kruzhki.KruzhId = UsersKruzhki.KruzhId " +
                                               " GROUP BY Subjects.Название, Kruzhki.Название,  Kruzhki.Название, UsersKruzhki.UserId, UsersKruzhki.KruzhId, UsersKruzhki.Статус " +
                                               " HAVING        ((UsersKruzhki.Статус = N'принято') AND  ( UsersKruzhki.UserId LIKE  '" + kab.getUserId(connection) + "'))";


                DataSourceSelectArguments argument = new DataSourceSelectArguments();
                connection.Open();

                SqlDataSource4.Select(argument);

                connection.Close();
                DropDownList2.DataBind();
            }
        }
Beispiel #28
0
        protected void Confirm_Click(object sender, EventArgs e)
        {
            if (!datepicker.Text.Equals(""))
            {
                //判斷使用者輸入 有沒有這項訂單存在
                SqlDataAdapter adapter2 = new SqlDataAdapter();
                string         cs2      = "Data Source=localhost;User Id=ClassManager; Password=12345678; Initial Catalog=StockManage2018";
                string         qs2      = "SELECT 股票號碼 FROM [UnsuccessfulRecord] WHERE (帳號=@帳號) AND (下單時間=@下單時間)";
                using (SqlConnection cn2 = new SqlConnection(cs2))
                {
                    cn2.Open();
                    using (SqlCommand command2 = new SqlCommand(qs2, cn2))
                    {
                        command2.Parameters.AddWithValue("@帳號", Session["ID"]);
                        command2.Parameters.AddWithValue("@下單時間", datepicker.Text);

                        DataSet dataset2 = new DataSet();
                        adapter2.SelectCommand = command2;
                        adapter2.Fill(dataset2);

                        if (dataset2.Tables[0].Rows.Count != 0)   //判斷dataset有沒有值  (有值) 有這項訂單
                        {
                            DataView dv = (DataView)SqlDataSource4.Select(DataSourceSelectArguments.Empty);
                            //將前端SQL語法引用到後端

                            Response.Write("<script>alert('已取消訂單');location.href='record.aspx'; </script>");
                        }
                        else
                        {
                            Warn.ForeColor = System.Drawing.Color.Red;
                            Warn.Text      = "沒有這項訂單";
                        }
                    }
                }
            }
        }
    public void getslides()
    {
        IDataReader reader = ((IDataReader)((IEnumerable)SqlDataSource4.Select(DataSourceSelectArguments.Empty)));

        while (reader.Read())
        {
            var li = new HtmlGenericControl("li");

            var a1 = new HtmlGenericControl("a");
            //var a2 = new HtmlGenericControl("a");

            a1.Attributes.Add("href", reader["slide_img"].ToString());
            a1.Attributes.Add("title", "title");
            ///////////////////////////////////////////////////////////////////////
            //a2.Attributes.Add("href", reader["path"].ToString());
            //a2.Attributes.Add("target", "_blank");

            var div = new HtmlGenericControl("div");
            div.Attributes.Add("dir", Resources.admin.dir);

            var h1 = new HtmlGenericControl("h1");
            h1.InnerText = reader[Resources.admin.slidename].ToString();

            var p = new HtmlGenericControl("p");
            p.InnerText = reader[Resources.admin.slidedesc].ToString();

            div.Controls.Add(h1);
            div.Controls.Add(p);
            div.Attributes.Add("style", "left:5px; top:94px; width:336px; height:0;");
            li.Controls.Add(a1);
            //li.Controls.Add(a2);
            li.Controls.Add(div);

            myslider.Controls.Add(li);
        }
    }
        protected void btnApply_Click(object sender, EventArgs e)
        {
            if (cboCompany.SelectedItem.Value != string.Empty &&
                cboCycle.SelectedItem.Value != string.Empty &&
                !string.IsNullOrEmpty(txtAcctNum.Text) &&
                !string.IsNullOrWhiteSpace(txtAcctNum.Text))
            {
                //use viewUsageSummarybyAccount view
                List <UsageItem> us = new List <UsageItem>();

                DataView dv = (DataView)SqlDataSource3.Select(System.Web.UI.DataSourceSelectArguments.Empty);

                if (dv != null)
                {
                    foreach (DataRowView dr in dv)
                    {
                        UsageItem v = new UsageItem();


                        v.BillDt       = dr["BillDt"].ToString();
                        v.UsageSummary = (double)dr["UsageSummary"];

                        us.Add(v);
                    }

                    RadChart1.DataSource                      = us;
                    RadChart1.Series[0].DataYColumn           = "UsageSummary";
                    RadChart1.PlotArea.XAxis.DataLabelsColumn = "BillDt";

                    RadChart1.DataBind();
                }
            }
            else
            {
                if (cboCompany.SelectedItem.Value != string.Empty &&
                    cboCycle.SelectedItem.Value != string.Empty)
                {
                    //use viewUsageSummaryByCycle view
                    List <UsageItem> us = new List <UsageItem>();

                    DataView dv = (DataView)SqlDataSource2.Select(System.Web.UI.DataSourceSelectArguments.Empty);

                    if (dv != null)
                    {
                        foreach (DataRowView dr in dv)
                        {
                            UsageItem v = new UsageItem();


                            v.BillDt       = dr["BillDt"].ToString();
                            v.UsageSummary = (double)dr["UsageSummary"];

                            us.Add(v);
                        }

                        RadChart1.DataSource                      = us;
                        RadChart1.Series[0].DataYColumn           = "UsageSummary";
                        RadChart1.PlotArea.XAxis.DataLabelsColumn = "BillDt";

                        RadChart1.DataBind();
                    }
                }
                else
                {
                    if (cboCompany.SelectedItem.Value != string.Empty)
                    {
                        List <UsageItem> us = new List <UsageItem>();

                        DataView dv = (DataView)SqlDataSource1.Select(System.Web.UI.DataSourceSelectArguments.Empty);

                        if (dv != null)
                        {
                            foreach (DataRowView dr in dv)
                            {
                                UsageItem v = new UsageItem();


                                v.BillDt       = dr["BillDt"].ToString();
                                v.UsageSummary = (double)dr["UsageSummary"];

                                us.Add(v);
                            }

                            RadChart1.DataSource                      = us;
                            RadChart1.Series[0].DataYColumn           = "UsageSummary";
                            RadChart1.PlotArea.XAxis.DataLabelsColumn = "BillDt";

                            RadChart1.DataBind();
                        }
                    }
                    else
                    {
                        //use all data
                        List <UsageItem> us = new List <UsageItem>();

                        DataView dv = (DataView)SqlDataSource4.Select(System.Web.UI.DataSourceSelectArguments.Empty);

                        if (dv != null)
                        {
                            foreach (DataRowView dr in dv)
                            {
                                UsageItem v = new UsageItem();


                                v.BillDt       = dr["BillDt"].ToString();
                                v.UsageSummary = (double)dr["UsageSummary"];

                                us.Add(v);
                            }

                            RadChart1.DataSource                      = us;
                            RadChart1.Series[0].DataYColumn           = "UsageSummary";
                            RadChart1.PlotArea.XAxis.DataLabelsColumn = "BillDt";

                            RadChart1.DataBind();
                        }
                    }
                }
            }
        }