protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                Cobrador.Mensaje = "Ventana de cobro";
                SqlDataSource3.SelectParameters["IdTienda"].DefaultValue = Session["IdTienda"].ToString();
                SqlDataSource3.DataSourceMode = SqlDataSourceMode.DataReader;
                SqlDataReader totalP;
                totalP = (SqlDataReader)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
                if (totalP.Read())
                {
                    Label1.Text = totalP["total"].ToString();
                }
            }
            catch
            {
                Response.Redirect("Login.aspx");
            }

            //SqlDataSource2.DataSourceMode = SqlDataSourceMode.DataReader;
            //SqlDataReader totalRec;
            //totalRec = (SqlDataReader)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
            //if (totalRec.Read())
            //{
            //    Label2.Text = "Q. " + Convert.ToDecimal(totalRec["TOTAL"]).ToString("0.00");
            //}
        }
예제 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SqlDataSource1.DataSourceMode = SqlDataSourceMode.DataReader;
            SqlDataReader datosProd1;

            datosProd1 = (SqlDataReader)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
            if (datosProd1.Read())
            {
                lblNombre1.Text      = " " + datosProd1["nombreProd"];
                lblDescripcion1.Text = " " + datosProd1["descripcionProd"];
            }

            SqlDataSource2.DataSourceMode = SqlDataSourceMode.DataReader;
            SqlDataReader datosProd2;

            datosProd2 = (SqlDataReader)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
            if (datosProd2.Read())
            {
                lblNombre2.Text      = " " + datosProd2["nombreProd"];
                lblDescripcion2.Text = " " + datosProd2["descripcionProd"];
            }

            SqlDataSource3.DataSourceMode = SqlDataSourceMode.DataReader;
            SqlDataReader datosProd3;

            datosProd3 = (SqlDataReader)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
            if (datosProd3.Read())
            {
                lblNombre3.Text      = " " + datosProd3["nombreProd"];
                lblDescripcion3.Text = " " + datosProd3["descripcionProd"];
            }
        }
예제 #3
0
    protected void CheckReorderStatus()
    {
        DataView dv = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
        int      reorderedProducts = (int)dv.Table.Rows[0][0] + 1;

        TextBox14.Text = reorderedProducts.ToString();
    }
        protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                total2 = total2 + Convert.ToDecimal(e.Row.Cells[4].Text);
                SqlDataSource3.SelectParameters["ID_Compra"].DefaultValue = e.Row.Cells[2].Text;
                SqlDataSource3.DataSourceMode = SqlDataSourceMode.DataReader;
                SqlDataReader total;
                total = (SqlDataReader)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
                if (total.Read())
                {
                    if (Convert.ToInt16(total["TOTAL"].ToString()) > 0)
                    {
                        e.Row.Cells[7].Text     = "No";
                        e.Row.Cells[7].CssClass = "label-danger";
                        e.Row.Cells[0].Enabled  = false;
                    }
                    else
                    {
                        e.Row.Cells[7].Text     = "Si";
                        e.Row.Cells[7].CssClass = "label-success";
                    }
                }
            }

            Label8.Text = total2.ToString();
        }
예제 #5
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();
     }
 }
예제 #6
0
        protected void LogIn(object sender, EventArgs e)
        {
            Upwd        = Password.Text;
            Uemail      = email.Text;
            lbl.Visible = true;

            SqlDataSource3.SelectCommand = ("SELECT customer_ID FROM [customer] where customer_email ='" + Uemail + "' AND customer_pwd = '" + Upwd + "'");

            DataSourceSelectArguments sr = new DataSourceSelectArguments();

            System.Data.DataView dv = (System.Data.DataView)SqlDataSource3.Select(sr);
            if (dv.Count != 0)
            {
                Session["uid"] = dv[0][0].ToString();
            }


            if (correctUser.Equals(true))
            {
                lbl.Text = "Correct Credentials Inserted";
                Response.Redirect("~/user_management/userHomePage", false); //create a user page with few options (book, view profile, view booking list)
                Session["email"] = Uemail;
                Session["state"] = "logged in";
            }
            else
            {
                lbl.Text = "Wrong Credentials inserted";
            }
        }
예제 #7
0
    protected void Button_View_Click(object sender, EventArgs e)
    {
        //string sessionid = this.Session.SessionID;
        //HttpCookie cookie = Request.Cookies[sessionid];


        if (userflag(UserList.SelectedValue) == true)
        {
            DataView dv  = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
            DataRow  row = dv.Table.Rows[0];
            //SqlDataSource1.SelectCommand = "SELECT * FROM Profile WHERE (Username = @username1)";
            //SqlDataSource1.SelectParameters.Add("username1", UserList.SelectedValue);

            Label_Name.Text      = (string)row["Name"];
            Label_Age.Text       = (string)row["Age"];
            Label_Address.Text   = (string)row["Address"];
            Label_Email.Text     = (string)row["Email"];
            Label_Telephone.Text = (string)row["Telephone"];
            Label_Gender.Text    = (string)row["gender"];

            Comment.Text = "The profile is displayed";
        }
        else
        {
            Comment.Text = "There is no profile for you, please create your profile first";
        }
    }
예제 #8
0
 public bool sendmailf(string subject, string body)
 {
     try
     {
         string      mailstring = "";
         string      host       = "";
         string      pass       = "";
         IDataReader reader     = ((IDataReader)((IEnumerable)SqlDataSource3.Select(DataSourceSelectArguments.Empty)));
         while (reader.Read())
         {
             mailstring = reader["send_mail"].ToString();
             pass       = reader["pass"].ToString();
             host       = reader["host"].ToString();
         }
         SmtpClient SmtpServer = new SmtpClient();
         SmtpServer.Credentials = new System.Net.NetworkCredential(mailstring, pass);
         SmtpServer.Port        = 25;
         SmtpServer.Host        = host;
         SmtpServer.EnableSsl   = false;
         MailMessage mail = new MailMessage();
         mail.From = new MailAddress(mailstring);
         mail.To.Add(mailstring);
         mail.Subject    = subject;
         mail.Body       = body;
         mail.IsBodyHtml = true;
         SmtpServer.Send(mail);
         return(true);
     }
     catch
     {
         return(false);
     }
 }
예제 #9
0
    /* protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
     * {
     *
     *   int x = 0; ;
     *   DataView dv = (DataView)ReservedDateSelect.Select(DataSourceSelectArguments.Empty);
     *   foreach (DataRow dr in dv.Table.Rows)
     *   {
     *       if (e.Day.Date == (DateTime)dv.Table.Rows[x][0])
     *       {
     *           e.Day.IsSelectable = true;
     *           e.Cell.CssClass = "testing2";
     *       }
     *       x++;
     *   }
     *   if (e.Day.Date < DateTime.Now)
     *   {
     *       e.Day.IsSelectable = false;
     *       e.Cell.Font.Strikeout = true;
     *       e.Cell.ForeColor = System.Drawing.Color.Black;
     *       e.Cell.BackColor = System.Drawing.Color.White;
     *   }
     * }
     * protected void Calendar2_DayRender(object sender, DayRenderEventArgs e)
     * {
     *   int x = 0; ;
     *   DataView dv = (DataView)ReservedDateSelect0.Select(DataSourceSelectArguments.Empty);
     *   foreach (DataRow dr in dv.Table.Rows)
     *   {
     *       if (e.Day.Date == (DateTime)dv.Table.Rows[x][0])
     *       {
     *           e.Day.IsSelectable = true;
     *           e.Cell.CssClass = "testing2";
     *       }
     *       x++;
     *   }
     *   if (e.Day.Date < DateTime.Now)
     *   {
     *       e.Day.IsSelectable = false;
     *       e.Cell.Font.Strikeout = true;
     *       e.Cell.ForeColor = System.Drawing.Color.Black;
     *       e.Cell.BackColor = System.Drawing.Color.White;
     *   }
     * }*/
    protected void Button1_Click(object sender, EventArgs e)
    {
        System.Threading.Thread.Sleep(1000);
        string   x   = "";
        DataView dv  = (DataView)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
        DataView dv2 = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
        int      y   = (int)dv2.Table.Rows[0][0];

        if (y == 1)
        {
            x = (string)dv.Table.Rows[0][3];
        }

        if (x == "prac")
        {
            Panel2.Visible = false;
            Panel3.Visible = false;
            Panel1.Visible = true;
        }
        else if (x == "res")
        {
            Panel1.Visible = false;
            Panel2.Visible = true;
            Panel3.Visible = false;
            int z = (int)dv.Table.Rows[0][2];;
            TextBox6.Text = z.ToString();
        }
        else
        {
            Panel1.Visible = false;
            Panel3.Visible = false;
            Panel3.Visible = true;
        }
    }
예제 #10
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();
        }
    }
예제 #11
0
        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())
            {
                Label1.Text = "Nombre:" + 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())
            {
                Label3.Text = "Nombre:" + 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())
            {
                Label5.Text = "Nombre:" + datos2["Nom_Ser"] + "<br>Descripción:" + datos2["Desc_Ser"];
            }
        }
예제 #12
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            SqlDataSource3.SelectParameters["reserva"].DefaultValue = GridView3.Rows[0].Cells[0].Text;
            SqlDataSource3.DataSourceMode = SqlDataSourceMode.DataReader;
            SqlDataReader registros;

            registros = (SqlDataReader)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
        }
예제 #13
0
    protected void UploadDocument2(object sender, EventArgs e)
    {
        string  input = "", DirRoot = "", filename = "";
        int     stringindex = 0, cut = 0;
        Boolean check = false;

        if (fuDocument2.HasFile)
        {
            HttpPostedFile postedFile = fuDocument2.PostedFile;

            DirRoot = System.IO.Path.GetExtension(postedFile.FileName).ToUpper().Replace(".", "");

            SqlDataSource3.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
            SqlDataSource3.SelectCommand    = "select id,name from filename_extension";
            SqlDataSource3.DataBind();
            DataView ou1 = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
            for (int i = 0; i < ou1.Count; i++)
            {
                if (DirRoot.ToUpper() == ou1.Table.Rows[i]["name"].ToString().ToUpper())
                {
                    check = true;
                }
            }
            if (check)
            {
                int fileSize = fuDocument2.PostedFile.ContentLength;

                // Allow only files less than (16 MB)=16777216 bytes to be uploaded.
                if (fileSize < 16777216)
                {
                    SqlDataSource sql_insert = new SqlDataSource();
                    sql_insert.ConnectionString = System.Web.Configuration.WebConfigurationManager.ConnectionStrings["connStr"].ConnectionString;

                    filename = DateTime.Now.ToString("yyyyMMddHHmmssffff") + @"." + DirRoot;

                    //AmazonUpload aws = new AmazonUpload();
                    //string imgurl = aws.AmazonUpload_file("", "upload/test", filename, postedFile.InputStream);

                    Google.Apis.Auth.OAuth2.GoogleCredential credential = GCP_AUTH.AuthExplicit();
                    string imgurl = GCP_AUTH.upload_file_stream("", "upload/test", filename, postedFile.InputStream, credential);

                    //fuDocument.SaveAs(Server.MapPath("important_images") + "\\" + filename);
                    type2_Image.ImageUrl = imgurl;
                    Image10.Visible      = true;
                    Image11.Visible      = false;
                    //GridView1.DataBind();
                }
                else
                {
                    ScriptManager.RegisterStartupScript(fuDocument2, fuDocument2.GetType(), "alert", "alert('File is out of memory 16MB!')", true);
                }
            }
            else
            {
                ScriptManager.RegisterStartupScript(fuDocument2, fuDocument2.GetType(), "alert", "alert('filename extension is not in role!')", true);
            }
        }
    }
예제 #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataView dvSql = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drvSql in dvSql)
        {
            RadDateTimePicker1.SelectedDate = (DateTime.Parse(drvSql["Day0"].ToString()));
        }
    }
    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();
        }
    }
예제 #16
0
    public void getlinks()
    {
        IDataReader reader = ((IDataReader)((IEnumerable)SqlDataSource3.Select(DataSourceSelectArguments.Empty)));

        while (reader.Read())
        {
            facebook.Attributes.Add("href", reader["facebook"].ToString());
            twitter.Attributes.Add("href", reader["twitter"].ToString());
            youtube.Attributes.Add("href", reader["youtube"].ToString());
        }
    }
    protected void FormView1_ItemDeleting(object sender, FormViewDeleteEventArgs e)
    {
        SqlDataSource3.SelectParameters[0].DefaultValue = FormView1.DataKey.Value.ToString();
        DataView dv = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);

        if (dv.Count != 0)
        {
            Page.RegisterStartupScript("", "<script>alert('该商品不能删除!')</script>");
            e.Cancel = true;
        }
    }
    protected void Button7_Click(object sender, EventArgs e)
    {
        MultiView1.ActiveViewIndex = 3;
        DataView  dv = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
        DataTable dt = dv.ToTable();

        TextBox5.Text = dt.Rows[0][0].ToString();
        TextBox7.Text = dt.Rows[0][1].ToString();
        RadioButtonList2.SelectedValue = dt.Rows[0][2].ToString();
        TextBox8.Text    = dt.Rows[0][3].ToString();
        TextBox8.Enabled = false;
    }
        protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Выборка кружковых работ пользователей

            if (DropDownList1.Text == "__________")
            {
                LabelBegin.Visible = false;
                LabelEnd.Visible   = false;
                LabelReg.Visible   = false;
                GridView1.Visible  = false;
            }

            // обновляем список пользвателей

            SqlConnection connection3 = new SqlConnection(SqlDataSource3.ConnectionString);


            SqlDataSource3.SelectCommand = "   SELECT DISTINCT Users.UserId, Users.Фамилия, Users.Имя, Users.Отчество, Users.УчебноеЗаведение,  " +
                                           " Users.Группа, Users.Телефон, Users.Фамилия + N' ' + Users.Имя + N' ' + Users.Отчество AS ФИО " +
                                           " FROM Users INNER JOIN UsersKruzhki ON Users.UserId = UsersKruzhki.UserId " +
                                           "  WHERE (UsersKruzhki.Статус = N'принято') AND (UsersKruzhki.KruzhId LIKE '" + DropDownList1.SelectedValue + "')";


            DataSourceSelectArguments argument3 = new DataSourceSelectArguments();

            connection3.Open();

            SqlDataSource3.Select(argument3);

            DropDownList2.DataBind();
            connection3.Close();



            SqlConnection connection = new SqlConnection(SqlDataSource1.ConnectionString);

            SqlCommand getUser = new SqlCommand(
                "SELECT  ДатаНачала, ДатаОкончания FROM Kruzhki WHERE   (KruzhId LIKE '" + DropDownList1.SelectedValue + "');", connection);

            connection.Open();
            SqlDataReader reader = getUser.ExecuteReader();

            reader.Read();
            if (reader.HasRows)
            {
                LabelBegin.Text    = reader[0].ToString();
                LabelEnd.Text      = reader[1].ToString();
                LabelBegin.Visible = true;
                LabelEnd.Visible   = true;
            }
            reader.Close();
            connection.Close();
        }
예제 #20
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            if (tipoGrid == 1)
            {
                int msj = 0;
                SqlDataSource1.UpdateParameters["ID_Venta"].DefaultValue = DropDownList1.SelectedValue;
                msj = SqlDataSource1.Update();
                if (msj > 0)
                {
                    Response.Write("<script>alert('Entrega exitosa!')</script>");
                    Response.Redirect("EntregaPB.aspx");
                }
                else
                {
                    Response.Write("<script>alert('Error, no se realizo cambio en la Base de datos!')</script>");
                }
                //   SqlDataSource2.SelectCommand = "SELECT DISTINCT Venta.ID_Venta, 'ID Venta' + ': '+ CAST(Venta.ID_Venta AS nvarchar) +' - '+ Cliente.Nombre + ' ' + Cliente.Apellidos AS Cliente FROM Venta INNER JOIN Estados ON Venta.ID_Venta = Estados.ID_Venta inner join Cliente on Venta.ID_Cliente = Cliente.ID_Cliente WHERE (Estados.ID_Tienda = "+ Session["IdTienda"].ToString()+") AND Estados.EstadoBodega = 1";
                //  SqlDataSource2.DataBind();
                SqlDataSource3.SelectParameters["IdTienda"].DefaultValue = Session["IdTienda"].ToString();
                SqlDataSource3.DataSourceMode = SqlDataSourceMode.DataReader;
                SqlDataReader totalP;
                totalP = (SqlDataReader)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
                if (totalP.Read())
                {
                    Label1.Text = totalP["total"].ToString();
                }
            }
            else if (tipoGrid == 2)
            {
                int msj = 0;
                SqlDataSource5.UpdateParameters["ID_Cotizacion"].DefaultValue = DropDownList2.SelectedValue;
                msj = SqlDataSource5.Update();
                if (msj > 0)
                {
                    Response.Write("<script>alert('Entrega exitosa!')</script>");
                    Response.Redirect("EntregaPB.aspx");
                }
                else
                {
                    Response.Write("<script>alert('Error, no se realizo cambio en la Base de datos!')</script>");
                }

                SqlDataSource3.SelectParameters["IdTienda"].DefaultValue = Session["IdTienda"].ToString();
                SqlDataSource3.DataSourceMode = SqlDataSourceMode.DataReader;
                SqlDataReader totalP;
                totalP = (SqlDataReader)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
                if (totalP.Read())
                {
                    Label1.Text = totalP["total"].ToString();
                }
            }
        }
예제 #21
0
    public void getnews()
    {
        IDataReader reader = ((IDataReader)((IEnumerable)SqlDataSource3.Select(DataSourceSelectArguments.Empty)));

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

            a.Attributes.Add("href", "dnews.aspx?nid=" + reader["n_id"].ToString());
            a.InnerText = reader[Resources.admin.pnews].ToString();
            newslide.Controls.Add(a);
        }
    }
예제 #22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.IsPostBack == false)
        {
            DropDownList2.DataBind();
            DropDownList1.DataBind();
        }

        String Year  = DropDownList2.SelectedValue;
        String utype = DropDownList1.SelectedValue;

        String Sql = "Select Sum(Students), Sum(UnitLeader), Sum(Total), Sum(TotalRs) from Confirmation where UnitType='" + utype + "' AND Year='" + Year + "'";

        SqlDataSource3.SelectCommand = Sql;
        DataView dv = (DataView)SqlDataSource3.Select(new DataSourceSelectArguments());

        if (dv[0][0] != DBNull.Value)
        {
            Label2.Text = Convert.ToString(dv[0][0]);
        }
        else
        {
            Label2.Text = "0";
        }
        if (dv[0][1] != DBNull.Value)
        {
            Label3.Text = Convert.ToString(dv[0][1]);
        }
        else
        {
            Label3.Text = "0";
        }
        if (dv[0][2] != DBNull.Value)
        {
            Label4.Text = Convert.ToString(dv[0][2]);
        }
        else
        {
            Label4.Text = "0";
        }
        if (dv[0][3] != DBNull.Value)
        {
            Label5.Text = Convert.ToString(dv[0][3]);
        }
        else
        {
            Label5.Text = "0";
        }
    }
예제 #23
0
    private Item GetSelectedProduct(int itemID)
    {
        DataView productsTable = (DataView)
                                 SqlDataSource3.Select(DataSourceSelectArguments.Empty);

        productsTable.RowFilter = " itemID = '" + itemID + "'";
        DataRowView row = (DataRowView)productsTable[0];
        Item        p   = new Item();

        p.ItemID          = row["itemID"].ToString();
        p.ItemName        = row["itemName"].ToString();
        p.ItemDescription = row["itemDescription"].ToString();
        p.ItemPrice       = (decimal)row["itemPrice"];
        return(p);
    }
예제 #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["loginProvider"] == null)
            {
                Response.Redirect("index.aspx");
            }
            PicHiddenField.Value = "";
            DataView dv        = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
            int      countRows = dv.Count;

            for (int i = 0; i < countRows; i++)
            {
                PicHiddenField.Value += dv.Table.Rows[i][1].ToString() + ";";
            }
        }
        protected void ImageButton3_Click(object sender, ImageClickEventArgs e)
        {
            MultiView1.ActiveViewIndex = 2;
            ImageButton2.BackColor     = Color.White;
            ImageButton1.BackColor     = Color.White;
            ImageButton3.BackColor     = Color.Aqua;

            SqlConnection connection = new SqlConnection(SqlDataSource3.ConnectionString);
            //Получаем   баллы за решение задач
            SqlCommand getUser = new SqlCommand(@"
            SELECT        Владелец, COUNT(TaskRezId) AS КТ, SUM(Баллы) AS OКБT
            FROM            TaskRez
            WHERE         (Владелец LIKE '" + kab.getUserId(connection) + @"' )
            GROUP BY Владелец   
                ", connection);

            SqlDataSource3.SelectCommand = @" 
            SELECT        aspnet_Users.UserName, Users.Фамилия + N'  ' + Users.Имя + N'  ' + Users.Отчество AS ФИО, Subjects.Название AS НазваниеДисциплины, 
                         Kruzhki.Название AS НазваниеКружка, SUM(TaskRez.Баллы) AS ОКБС, COUNT(TaskRez.TaskRezId) AS КС
                        FROM            Users INNER JOIN
                         UsersKruzhki ON Users.UserId = UsersKruzhki.UserId INNER JOIN
                         Kruzhki ON UsersKruzhki.KruzhId = Kruzhki.KruzhId INNER JOIN
                         aspnet_Users ON Users.UserId = aspnet_Users.UserId INNER JOIN
                         Subjects ON Kruzhki.Дисциплина = Subjects.SubjectId INNER JOIN
                         TaskRez ON UsersKruzhki.UserId = TaskRez.Владелец AND UsersKruzhki.KruzhId = TaskRez.Кружок
             WHERE  ( aspnet_Users.UserName = '******' ) " +
                                           @" GROUP BY aspnet_Users.UserName, Users.Фамилия, Users.Имя, Users.Отчество, Kruzhki.Название, Kruzhki.Дисциплина, Subjects.Название, 
                         Users.Фамилия + N'  ' + Users.Имя + N'  ' + Users.Отчество, TaskRez.Владелец, TaskRez.Кружок ";


            DataSourceSelectArguments arg = new DataSourceSelectArguments();

            connection.Open();
            SqlDataSource3.Select(arg);

            SqlDataReader reader = getUser.ExecuteReader();

            if (reader.HasRows)
            {
                reader.Read();

                LabelKS.Text   = reader[1].ToString();
                LabelOKBS.Text = reader[2].ToString();
                reader.Close();
            }
            connection.Close();
            GridView3.DataBind();
        }
예제 #26
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);
    }
예제 #27
0
        protected void btnRetrieve_Click(object sender, EventArgs e)
        {
            if (this.IsValid)
            {
                DataView surveyView = (DataView)
                                      SqlDataSource3.Select(DataSourceSelectArguments.Empty);

                DataRowView row = surveyView[0];

                lblResponseTime.Text           = row["response_time"].ToString();
                lblTechEfficiency.Text         = row["technician_efficiency"].ToString();
                lblProbReso.Text               = row["problem_efficiency"].ToString();
                lblContactToDiscuss.Text       = row["contact_to_discuss"].ToString();
                lblPreferredContactMethod.Text = row["preferred_contact"].ToString();
                txtAdditionalComments.Text     = row["additional_comment"].ToString();
            }
        }
예제 #28
0
 protected void ListView1_ItemCommand(object sender, ListViewCommandEventArgs e)
 {
     if (String.Equals(e.CommandName, "AddToList"))
     {
         ListViewDataItem dataItem = (ListViewDataItem)e.Item;
         TextBox5.Text = ListView1.DataKeys[dataItem.DisplayIndex].Value.ToString();
         DataView dv = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
         TextBox1.Text = (string)dv.Table.Rows[0][1];
         rph           = (Double)dv.Table.Rows[0][2];
         TextBox2.Text = rph.ToString("n2");
         int gid = (int)dv.Table.Rows[0][3];
         TextBox6.Text     = gid.ToString();
         Label11.Text      = "";
         TextBox3.ReadOnly = false;
         TextBox3.Focus();
     }
 }
    private void GetCusCode()
    {
        /* string conString = ConfigurationManager.ConnectionStrings[
         *   "group5ConnectionString"].ConnectionString;
         * SqlConnection group5ConnectionString =
         *   new SqlConnection(conString);
         * SqlCommand invoiceNoCommand =
         *   new SqlCommand("Select Ident_Current('Invoices') From Invoices", conHalloween);
         * conHalloween.Open();
         * invoiceNumber = invoiceNoCommand.ExecuteScalar().ToString();
         * conHalloween.Close();*/

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

        cuscode = dvInvoice[0][0].ToString();
    }
예제 #30
0
        protected void Page_Load(object sender, EventArgs e)
        {
            UnobtrusiveValidationMode = UnobtrusiveValidationMode.None;

            count = (DataView)SqlDataSource3.Select(DataSourceSelectArguments.Empty);
            row   = count[0];

            //bind drop-down list on first load
            if (!IsPostBack)
            {
                ddlCustomers.DataBind();
                txtIncidentNum.Text = row["count"].ToString();
            }
            //get and show customer on every load
            selectedCustomer   = this.GetSelectedCustomer();
            txtDateTime.Text   = DateTime.Now.ToString("MM/dd/yyyy:  hh:mm");
            txtCustomerId.Text = selectedCustomer.customer_id;
        }