protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                lista          = iusu.ListarUsuarios();
                GV1.DataSource = lista;
                GV1.DataBind();
                GV1.HeaderRow.Cells[6].Visible = false;
                GV1.HeaderRow.Cells[0].Text    = "ID Usuario";
                GV1.HeaderRow.Cells[1].Text    = "Nombre";
                GV1.HeaderRow.Cells[2].Text    = "Primer apellido";
                GV1.HeaderRow.Cells[3].Text    = "Segundo apellido";
                GV1.HeaderRow.Cells[5].Text    = "ID Rol";
                GV1.HeaderRow.Cells[7].Text    = "Correo";

                for (int w = 0; w < GV1.Rows.Count; w++)
                {
                    GV1.Rows[w].Cells[6].Visible = false;
                }


                divMantenimiento.Visible = false;
                ListItem i;
                i = new ListItem("Dentista", "1");
                DDLRol.Items.Add(i);
                i = new ListItem("Asistente", "2");
                DDLRol.Items.Add(i);
            }
        }
Beispiel #2
0
 public void QueryFunc(string qr)
 {
     try
     {
         MySqlConnection con = new MySqlConnection(connectionString);
         con.Open();
         String       query2 = @"SELECT 
                         NID,QRID,UID,
                         (SELECT FULLNAME FROM USERS WHERE UID = N.UID) AS FULLNAME,
                         UPDATEDATE,TYPEN,
                         (SELECT TYPEV FROM TYPES WHERE TYPEN = N.TYPEN) AS TYPEV,
                         TXTNOTE,LOC
                         FROM NOTES AS N WHERE QRID = @QRID ORDER BY UPDATEDATE DESC";
         MySqlCommand com2   = new MySqlCommand(query2, con);
         com2.Parameters.AddWithValue("@QRID", QRIDV);
         MySqlDataAdapter adapter = new MySqlDataAdapter(com2);
         DataSet          ds      = new DataSet();
         adapter.Fill(ds);
         con.Close();
         GV1.DataSource = ds;
         GV1.DataBind();
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }
Beispiel #3
0
    protected void GridBind()
    {
        Snlg_DBConnect vt = new Snlg_DBConnect(true);

        GV1.DataSource = vt.DBReaderOlustur("SELECT ContainerId, PHName, Title FROM snlg_V1.TblPlaceHolders ORDER BY PHName", CommandType.Text);
        GV1.DataBind();
        vt.Kapat();
    }
Beispiel #4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataModel ob = new DataModel();
         GV1.DataSource = ob.listadoEncuesta();
         GV1.DataBind();
     }
 }
Beispiel #5
0
        private void Sb_Export_Click(object sender, EventArgs e)
        {
            SaveFileDialog SFD = new SaveFileDialog();

            if (SFD.ShowDialog() == DialogResult.OK)
            {
                GV1.ExportToXlsx(SFD.FileName);
            }
        }
Beispiel #6
0
 protected void btn3_Click(object sender, EventArgs e)
 {
     MultiView1.ActiveViewIndex = 2;
     if (!IsPostBack)
     {
         DataModel ob = new DataModel();
         GV1.DataSource = ob.listadoEncuesta();
         GV1.DataBind();
     }
 }
        protected void ddlCuatri_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (ddlCarrera.SelectedIndex != 0 && ddlCuatri.SelectedIndex != 0)
            {
                if (GV1.Rows.Count > 1)
                {
                    for (int i = 2; i < GV1.Columns.Count; i++)
                    {
                        GV1.Columns[i].Visible = false;
                    }
                }
                strSQL = "select id, Nombre from catMateria where CveCarrera='" + ddlCarrera.SelectedValue.ToString() + "' and CveCuatri='" + ddlCuatri.SelectedValue.ToString() + "'";
                dt2    = conex.ObtenerDatos(strSQL);
                claves = new int[dt2.Rows.Count];
                for (int i = 0; i < dt2.Rows.Count; i++)
                {
                    claves[i] = int.Parse(dt2.Rows[i]["id"].ToString());
                }
                Session["columnas"] = dt2.Rows.Count;
                Session["claves"]   = claves;
                DataTable dt = new DataTable();
                DataRow   row;

                for (int i = 0; i < 21; i++)
                {
                    row = dt.NewRow();
                    dt.Rows.Add(row);
                }
                GV1.DataSource = dt;
                GV1.DataBind();
                for (int j = 1; j < 21; j++)
                {
                    GV1.Rows[j].Cells[0].Text = j.ToString();
                    GV1.Rows[j].Cells[1].Text = Pregs[j];
                }
                GV1.Columns[0].Visible = true;
                GV1.Columns[1].Visible = true;
                for (int k = 2; cont < dt2.Rows.Count; k++)
                {
                    GV1.HeaderRow.Cells[k].Text = dt2.Rows[cont]["nombre"].ToString();
                    cont++;
                    if (!GV1.HeaderRow.Cells[k].Text.Contains("Materia"))
                    {
                        GV1.Columns[k].Visible = true;
                    }
                    else
                    {
                        GV1.Columns[k].Visible = false;
                    }
                }
            }
            GV1.Rows[0].Visible  = false;
            FilaObserva.Visible  = true;
            TextoObserva.Visible = true;
        }
Beispiel #8
0
    void filldata()
    {
        con.Open();
        SqlDataAdapter da = new SqlDataAdapter("select SlNO,ContractNO,Event,Frequency,ExecutionDate,Basis,InvoiceNo,InvoiceRaised,AmountInRs,Status from Royality where ContractNo='" + txtContractNo.Text.Trim() + "'", con);
        DataTable      dt = new DataTable();

        da.Fill(dt);
        GV1.DataSource = dt;
        GV1.DataBind();
        con.Close();
    }
Beispiel #9
0
    private void QueryFunc(string Qr = "")
    {
        try
        {
            string          connectionString = ConfigurationManager.ConnectionStrings["ConnDB"].ConnectionString;
            MySqlConnection conn             = new MySqlConnection(connectionString);
            conn.Open();
            if (Session["OID"] != null)
            {
                Qr = Session["OID"].ToString();
            }

            MySqlCommand cmd = new MySqlCommand(@"SELECT QRID,NID,UID,OID
                                            ,(SELECT NAME FROM OFFICES WHERE OID = N.OID) AS NAME
                                            ,(SELECT FULLNAME FROM USERS WHERE UID = N.UID) AS FULLNAME
                                            ,UPDATEDATE,TYPEN,
                                            (SELECT TYPEV FROM TYPES WHERE TYPEN = N.TYPEN) AS TYPEV
                                            ,(SELECT COUNT(QRID) FROM NOTES WHERE QRID = N.QRID) as COUNTQRID
                                            ,TXTNOTE,LOC FROM NOTES AS N
                                            WHERE NID = (SELECT MAX(NID) FROM notes WHERE QRID = N.QRID GROUP BY QRID)
                                            AND OID = @OID
                                            GROUP BY QRID
                                            ORDER BY UPDATEDATE DESC", conn);

            cmd.Parameters.AddWithValue("@OID", Qr);
            MySqlDataAdapter adapter = new MySqlDataAdapter(cmd);
            DataSet          ds      = new DataSet();
            adapter.Fill(ds);
            conn.Close();

            if (ds.Tables[0].Rows.Count == 0)
            {
                //Response.Write("<script>alert('حدث خطأ :  لاتوجد ملاحظات')</script>");

                //P1.Visible = false;
                //Response.Redirect("Home.aspx");
                ScriptManager.RegisterStartupScript(this, this.GetType(),
                                                    "alert",
                                                    "alert('حدث خطأ :  لاتوجد ملاحظات');window.location ='Home.aspx';",
                                                    true);
            }
            else
            {
                GV1.DataSource = ds;
                GV1.DataBind();
                P1.Visible = true;
            }
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('" + "حدث خطأ : " + ex.Message + "')</script>");
        }
    }
Beispiel #10
0
 protected void OnPaging(object sender, GridViewPageEventArgs e)
 {
     try
     {
         GV1.PageIndex = e.NewPageIndex;
         GV1.DataBind();
         QueryFunc(TbQRID.Text);
     }
     catch (Exception ex)
     {
         Response.Write("<script>alert('" + "حدث خطأ : " + ex.Message + "')</script>");
     }
 }
Beispiel #11
0
        protected void SearchBT_Click(object sender, EventArgs e)
        {
            decimal d1 = 0, d2 = 0;

            if (!string.IsNullOrEmpty(StyleTB.Text.Trim()))
            {
                入庫應付LB.BackColor = System.Drawing.Color.White;
                入庫應付LB.ForeColor = System.Drawing.Color.Black;
                入庫暫估LB.BackColor = System.Drawing.Color.White;
                入庫暫估LB.ForeColor = System.Drawing.Color.Black;

                DataTable dt = new DataTable();

                using (SqlConnection Conn = new SqlConnection(strConnectString))
                {
                    SqlDataAdapter myAdapter = new SqlDataAdapter(DB1(), Conn);
                    myAdapter.Fill(dt);    //---- 這時候執行SQL指令。取出資料,放進 DataSet。
                }
                if (dt.Rows.Count > 0)
                {
                    d1             = Convert.ToDecimal(dt.Compute("Sum(數量)", "true"));
                    GV1.DataSource = dt;
                    GV1.DataBind();
                }

                DataTable dt2 = new DataTable();
                using (SqlConnection Conn = new SqlConnection(strConnectString))
                {
                    SqlDataAdapter myAdapter = new SqlDataAdapter(DB2(), Conn);
                    myAdapter.Fill(dt2);    //---- 這時候執行SQL指令。取出資料,放進 DataSet。
                }
                if (dt2.Rows.Count > 0)
                {
                    d2             = Convert.ToDecimal(dt2.Compute("Sum(數量)", "true"));
                    GV2.DataSource = dt2;
                    GV2.DataBind();
                }
                入庫應付LB.Text = d1.ToString();
                入庫暫估LB.Text = d2.ToString();
                if (d1 > d2)
                {
                    入庫應付LB.BackColor = System.Drawing.Color.Red;
                    入庫應付LB.ForeColor = System.Drawing.Color.Yellow;
                }
                else if (d1 < d2)
                {
                    入庫暫估LB.BackColor = System.Drawing.Color.Red;
                    入庫暫估LB.ForeColor = System.Drawing.Color.Yellow;
                }
            }
        }
    protected void btnGridDisplay_Click(object sender, EventArgs e)
    {
        string qry = "select * from emp";
        //dbc.executeIUD("insert into emp values (4, 'Ruhita', 20000, 2)");
        //DataTable dt = dbc.executeSelectQueryWithDT(qry);
        //SqlDataReader dr = dbc.executeSelectQueryWithDR(qry);
        DataSet ds = new DataSet();

        ds = dbc.executeSelectQueryWithDS(qry);
        //DG1.AutoGenerateColumns = true;
        GV1.DataSource = ds.Tables[0];
        GV1.DataBind();
        DG1.DataSource = ds.Tables[0];
        DG1.DataBind();
        //Persist.print = "<br />Success!";
    }
Beispiel #13
0
        protected void RecieveNewRequest(object sender, EventArgs e)
        {
            String        connectionString;
            SqlConnection cnn;

            connectionString = WebConfigurationManager.ConnectionStrings["constr"].ConnectionString;
            cnn = new SqlConnection(connectionString);

            cnn.Open();



            SqlCommand cmd = new SqlCommand("Receive_New_Request", cnn);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;

            cmd.Parameters.Add(new SqlParameter("@contributor_id", 1));

            cmd.Parameters.Add("@can_receive", System.Data.SqlDbType.Int).Direction = System.Data.ParameterDirection.Output;

            SqlDataReader rdr = cmd.ExecuteReader();

            int can_receive = Convert.ToInt32(cmd.Parameters["@can_receive"].Value);

            rdr.Close();
            if (can_receive == 1)
            {
                SqlCommand dbo = new SqlCommand("Receive_New_Requests", cnn); //CommandType = System.Data
                dbo.CommandType = System.Data.CommandType.StoredProcedure;
                dbo.Parameters.Add(new SqlParameter("@contributor_id", 1));
                if (L.Text.Equals(""))
                {
                    dbo.Parameters.Add(new SqlParameter("@request_id", DBNull.Value));
                }
                else
                {
                    dbo.Parameters.Add(new SqlParameter("@request_id", L.Text));
                }
                GV1.DataSource = dbo.ExecuteReader();
                GV1.DataBind();
            }
            else
            {
                label.Text = "No New Requests";
            }
            cnn.Close();
        }
Beispiel #14
0
        protected void BtnExcel_Click(object sender, EventArgs e)
        {
            if (GV1.Rows.Count < 1)
            {
                Misc.Message(Response, "无数据要导出!");
                return;
            }
            Response.ClearContent();
            Response.AddHeader("content-disposition", "attachment; filename=wuzixuqiu.xls");
            Response.ContentType = "application/excel";
            StringWriter   sw  = new StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);

            GV1.RenderControl(htw);
            Response.Write(sw.ToString());
            Response.End();
        }
Beispiel #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //creating a table manually
        DataTable dt = new DataTable();

        dt.Columns.Add(new DataColumn("BlogID", Type.GetType("System.String")));
        dt.Columns.Add(new DataColumn("BlogText", Type.GetType("System.String")));
        dt.Columns.Add(new DataColumn("Mood", Type.GetType("System.String")));
        dt.Rows.Add(dt.NewRow());
        dt.Rows.Add(dt.NewRow());
        dt.Rows.Add(dt.NewRow());
        dt.Rows[0]["BlogID"]   = "FirstID";
        dt.Rows[0]["BlogText"] = "Awesome!";
        dt.Rows[0]["Mood"]     = "This is for awesome people";
        dt.Rows[1]["BlogID"]   = "SecondID";
        dt.Rows[1]["BlogText"] = "Take it easy...";
        dt.Rows[1]["Mood"]     = "Stop messing";
        dt.Rows[2]["BlogID"]   = "ThirdID";
        dt.Rows[2]["BlogText"] = "Great!";
        dt.Rows[2]["Mood"]     = "Well done";

        dt.PrimaryKey  = new DataColumn[] { dt.Columns["BlogID"] };
        GV3.DataSource = dt;
        GV3.DataBind();

        DataSet ds = new DataSet();

        ds.Tables.Add(dt);
        GV4.DataSource = ds.Tables[0];
        GV4.DataBind();


        DALBlog blogDAL = new DALBlog("cheeseConnectionString");

        GV1.DataSource = blogDAL.GetDataTable("SELECT * FROM Blogs", "Blog");
        GV1.DataBind();

        Database db = DatabaseFactory.CreateDatabase("cheeseConnectionString");

        GV2.DataSource = db.ExecuteDataSet(db.GetSqlStringCommand("SELECT * FROM Blogs"));
        GV2.DataBind();
    }
        protected void showall(object sender, EventArgs e)
        {
            //Response.Write(L1.Text);
            cnn = new SqlConnection(connectionString);
            cnn.Open();
            SqlCommand cmd = new SqlCommand("Show_Event", cnn);

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            if (L1.Text.Equals(""))
            {
                cmd.Parameters.Add(new SqlParameter("@event_id", DBNull.Value));
            }
            else
            {
                cmd.Parameters.Add(new SqlParameter("@event_id", L1.Text));
            }
            GV1.DataSource = cmd.ExecuteReader();
            GV1.DataBind();
            cnn.Close();
        }
        protected void ShowMessages(object sender, EventArgs e)
        {
            String        connectionString;
            SqlConnection cnn;

            connectionString = WebConfigurationManager.ConnectionStrings["constr"].ConnectionString;
            cnn = new SqlConnection(connectionString);

            cnn.Open();

            String ID = Session["ids"].ToString();


            SqlCommand dbo = new SqlCommand("Show_Message", cnn);

            dbo.CommandType = System.Data.CommandType.StoredProcedure;
            dbo.Parameters.Add(new SqlParameter("@contributor_id", Convert.ToInt32(ID)));
            GV1.DataSource = dbo.ExecuteReader();
            GV1.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (HttpContext.Current.Application["AccessToken"] != null)
            {
                List <UserType>      userList      = new List <UserType>();
                List <AttributeType> attributeList = new List <AttributeType>();


                string accessKey = RDSContext.Create().awsCredentials.FirstOrDefault().AccessKey;
                string secretKey = RDSContext.Create().awsCredentials.FirstOrDefault().SecretKey;


                BasicAWSCredentials basicAWSCredentials = new BasicAWSCredentials(accessKey, secretKey);

                AmazonCognitoIdentityProviderClient provider = new AmazonCognitoIdentityProviderClient(basicAWSCredentials);

                if (HttpContext.Current.Application["AccessToken"] != null)
                {
                    ListUsersRequest listUserRequest = new ListUsersRequest
                    {
                        UserPoolId      = ConfigurationManager.AppSettings["USERPOOL_ID"],
                        AttributesToGet = new List <string> {
                            "email"
                        },
                    };

                    ListUsersResponse response = provider.ListUsers(listUserRequest);

                    userList.AddRange(response.Users);

                    foreach (UserType u in userList)
                    {
                        attributeList.AddRange(u.Attributes);
                    }

                    GV1.DataSource = attributeList.Select(t => t.Value);
                    GV1.DataBind();
                    GV1.HeaderRow.Cells[0].Text = "Email List";
                }
            }
        }
 protected void btnAceptar_Click(object sender, EventArgs e)
 {
     r = Valida();
     if (r)
     {
         int   cl      = 0;
         int   total   = 0;
         int   colum   = (int)Session["columnas"];
         int[] claves1 = (int[])Session["claves"];
         col = 1;
         for (int j = 1; j <= colum; j++)
         {
             strSQL = "insert into evaluacion values(";
             for (int i = 1; i < 21; i++)
             {
                 TextBox t1 = (GV1.Rows[i].Cells[j].FindControl("txt" + col) as TextBox);
                 strSQL += int.Parse(t1.Text) + ",";
                 total  += int.Parse(t1.Text);
             }
             col++;
             strSQL += total + ",'" + ddlGpo.SelectedItem.ToString() + "','" + Convert.ToDateTime(txtFecha.Text) + "','" + txtObserva.Text + "'," + claves1[cl] + ")";
             cl++;
             try
             {
                 conex.GuardarDatos(strSQL);
             }
             catch (Exception ex)
             {
                 Response.Write("<script type=text/javascript>alert('" + ex.Message + "')</script>");
                 return;
             }
             strSQL = "";
             total  = 0;
         }
     }
     Response.Write("<script type=text/javascript>alert('¡Gracias por responder la encuesta!')</script>");
     GV1.Dispose();
     Response.Redirect("~/Inicio.aspx");
 }
Beispiel #20
0
    protected void btnExportWord_Click(object sender, EventArgs e)
    {
        try
        {
            //////////////////////////////////////
            GV1.AllowPaging = false;
            QueryFunc(TbQRID.Text);
            GV1.Columns[8].Visible = false;
            GV1.Columns[9].Visible = false;
            /////////////////////////////////////
            Response.Clear();
            Response.Buffer = true;
            Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.doc");
            Response.Charset     = "";
            Response.ContentType = "application/vnd.ms-word ";
            StringWriter   sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);

            GV1.AllowPaging = false;
            GV1.DataBind();
            QueryFunc(TbQRID.Text);
            //GV1.Columns[8].Visible = false;
            //GV1.Columns[9].Visible = false;

            GV1.RenderControl(hw);
            Response.Output.Write(sw.ToString());
            Response.Flush();
            Response.End();

            //////////////////////////////////////
            GV1.Columns[8].Visible = true;
            GV1.Columns[9].Visible = true;
            /////////////////////////////////////
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('" + "حدث خطأ : " + ex.Message + "')</script>");
        }
    }
Beispiel #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            _logger.Info("Start program.");

            try
            {
                string s = "abc";
                int    i = int.Parse(s);
            }
            catch (Exception ex)
            {
                _logger.Debug(ex);
            }

            _logger.Info("Stop program.");
            DataAccess a   = new DataAccess();
            string     da  = "select * from HR_tblEmp";
            string     da1 = "select LSDeptID from LS_tblDepartment";
            string     da2 = "select LSJobTitleID from LS_tblJobTitle";
            string     da3 = "select LSNationalityID from LS_tblNationality";

            GV1.DataSource = a.ExcuteReader(da);
            GV1.DataBind();

            ddldept.DataSource     = a.ExcuteReader(da1);
            ddldept.DataTextField  = "LSDeptID";
            ddldept.DataValueField = "LSDeptID";
            ddldept.DataBind();

            ddlJob.DataSource     = a.ExcuteReader(da2);
            ddlJob.DataTextField  = "LSJobTitleID";
            ddlJob.DataValueField = "LSJobTitleID";
            ddlJob.DataBind();

            ddlNation.DataSource     = a.ExcuteReader(da3);
            ddlNation.DataTextField  = "LSNationalityID";
            ddlNation.DataValueField = "LSNationalityID";
            ddlNation.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!IsPostBack)
                {
                    divMantenimiento.Visible = false;
                    ListItem i;
                    i = new ListItem("Niño", "1");
                    DDLTipoOntograma.Items.Add(i);
                    i = new ListItem("Adulto", "2");
                    DDLTipoOntograma.Items.Add(i);
                    //int admin = Convert.ToInt32(Session["id"]);



                    lista          = usu.ListarPacientes();
                    GV1.DataSource = lista;
                    GV1.DataBind();
                    GV1.HeaderRow.Cells[7].Visible = false;
                    GV1.HeaderRow.Cells[0].Text    = "ID Paciente";
                    GV1.HeaderRow.Cells[1].Text    = "Nombre";
                    GV1.HeaderRow.Cells[2].Text    = "Primer apellido";
                    GV1.HeaderRow.Cells[3].Text    = "Segundo apellido";
                    GV1.HeaderRow.Cells[4].Text    = "Telefono";
                    GV1.HeaderRow.Cells[5].Text    = "Correo";
                    GV1.HeaderRow.Cells[6].Text    = "Fecha de Naciemiento";

                    for (int w = 0; w < GV1.Rows.Count; w++)
                    {
                        GV1.Rows[w].Cells[7].Visible = false;
                    }
                }
            }
            catch (Exception)
            {
                MostrarMensajeError("Ha ocurrido un error al cargar los datos, intente mas tarde");
            }
        }
Beispiel #23
0
    ////////////////////////////////////////////////////////////////
    protected void PrintCurrentPage(object sender, EventArgs e)
    {
        try
        {
            GV1.Columns[8].Visible    = false;
            GV1.Columns[9].Visible    = false;
            GV1.PagerSettings.Visible = false;
            GV1.DataBind();
            QueryFunc(TbQRID.Text);

            StringWriter   sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);
            GV1.RenderControl(hw);
            string gridHTML = sw.ToString().Replace("\"", "'")
                              .Replace(System.Environment.NewLine, "");
            StringBuilder sb = new StringBuilder();
            sb.Append("<script type = 'text/javascript'>");
            sb.Append("window.onload = new function(){");
            sb.Append("var printWin = window.open('', '', 'left=0");
            sb.Append(",top=0,width=1000,height=600,status=0');");
            sb.Append("printWin.document.write(\"");
            sb.Append(gridHTML);
            sb.Append("\");");
            sb.Append("printWin.document.close();");
            sb.Append("printWin.focus();");
            sb.Append("printWin.print();");
            sb.Append("printWin.close();};");
            sb.Append("</script>");
            ClientScript.RegisterStartupScript(this.GetType(), "GridPrint", sb.ToString());
            GV1.PagerSettings.Visible = true;
            GV1.DataBind();
            QueryFunc(TbQRID.Text);
        }
        catch (Exception ex)
        {
            Response.Write("<script>alert('" + "حدث خطأ : " + ex.Message + "')</script>");
        }
    }
Beispiel #24
0
 private void QueryFunc(string Qr = "")
 {
     try
     {
         HyperLink1.Text = "";
         MySqlConnection conn = new MySqlConnection(connectionString);
         conn.Open();
         Qr = '%' + Qr.Trim() + '%';
         MySqlCommand cmd = new MySqlCommand(@"SELECT * FROM pilgrims WHERE (QRID LIKE @P1 OR PASSPORTID LIKE @P1 OR
                                             FULLNAME LIKE @P1 OR NATIONALITY LIKE @P1 OR BLOOD LIKE @P1 OR ADDRESS LIKE @P1) AND OID = @OID", conn);
         cmd.Parameters.AddWithValue("@OID", Session["OID"].ToString());
         cmd.Parameters.AddWithValue("@P1", Qr);
         MySqlDataAdapter adapter = new MySqlDataAdapter(cmd);
         DataSet          ds      = new DataSet();
         adapter.Fill(ds);
         conn.Close();
         GV1.DataSource = ds;
         GV1.DataBind();
     }
     catch (Exception ex)
     {
         Response.Write("<script>alert('" + "حدث خطأ : " + ex.Message + "')</script>");
     }
 }
 protected void LoadGrid()
 {
     GV1.DataSource = GetAll(ddlType.SelectedValue);
     GV1.DataBind();
 }
Beispiel #26
0
 protected void GVDataBind()
 {
     GV1.DataSource = GVData();
     GV1.DataBind();
 }
Beispiel #27
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string     sql = "select * from HR_tblEmp";
            DataAccess db  = new DataAccess();

            string Gender = "";

            if (rdoSex.Checked == true)
            {
                Gender = "1";
            }
            else
            {
                Gender = "0";
            }
            int Active;

            if (rdoTrue.Checked == true)
            {
                Active = 1;
            }
            else
            {
                Active = 0;
            }
            if (EmpCode.Text.Length < 0 || txtAddress.Text.Length < 0 || txtDOB.Text.Length < 0 || txtFirst.Text.Length < 0 ||
                txtJoinDate.Text.Length < 0 || txtLast.Text.Length < 0)
            {
                Response.Write("Vui lòng nhập đầy đủ các thông tin trên");
            }

            else if (EmpCode.Text.Length > 5)
            {
                Response.Write("Mã không được quá 5 số");
            }

            else if (txtFirst.Text.Length > 30 || txtLast.Text.Length > 30)
            {
                Response.Write("Tên không quá 30 ký tự");
            }

            else if (kiemtrangay() < 6570)
            {
                Response.Write("Bạn chưa đủ 18 tuổi");
            }

            else if (IsNumber(EmpCode.Text) == false)
            {
                Response.Write("Mã không nhập ký tự");
            }
            else
            {
                List <SqlParameter> lst = new List <SqlParameter>();
                lst.Add(new SqlParameter("@EmpCode", EmpCode.Text));
                lst.Add(new SqlParameter("@JoinDate", txtJoinDate.Text));
                lst.Add(new SqlParameter("@LSDeptID", ddldept.SelectedValue.ToString()));
                lst.Add(new SqlParameter("@LSJobTitleID", ddlJob.SelectedValue.ToString()));
                lst.Add(new SqlParameter("@Active", Active));
                lst.Add(new SqlParameter("@FirstName", txtFirst.Text));
                lst.Add(new SqlParameter("@LastName", txtLast.Text));
                lst.Add(new SqlParameter("@DOB", txtDOB.Text));
                lst.Add(new SqlParameter("@Address", txtAddress.Text));
                lst.Add(new SqlParameter("@Gender", Gender));
                lst.Add(new SqlParameter("@LSNationalityID", ddlNation.SelectedValue.ToString()));

                db.ExcuteNonQueryPro("sp_F02", lst);
                GV1.DataSource = db.ExcuteReader(sql);
                GV1.DataBind();
                Response.Write("Success!");
            }
        }