Exemplo n.º 1
0
        public void BindData(string sortDate, string sortType)
        {
            string strSeclctEmp = "";

            if (txtSearchId.Text != "")
            {
                strSeclctEmp += "emp_id LIKE '%" + txtSearchId.Text.Trim() + "%' ";
            }
            if (txtSearchName.Text != "")
            {
                if (strSeclctEmp != "")
                {
                    strSeclctEmp += " AND ";
                }
                strSeclctEmp += "(profix_name LIKE '%" + txtSearchName.Text.Trim() + "%' OR emp_name LIKE '%" + txtSearchName.Text.Trim() + "%' OR emp_lname LIKE '%" + txtSearchName.Text.Trim() + "%')";
            }
            if (txtSearchCpoint.SelectedValue != "")
            {
                if (strSeclctEmp != "")
                {
                    strSeclctEmp += " AND ";
                }
                strSeclctEmp += "cpoint_name LIKE '%" + txtSearchCpoint.SelectedItem + "%' ";
            }
            if (txtSearchPos.SelectedValue != "")
            {
                if (strSeclctEmp != "")
                {
                    strSeclctEmp += " AND ";
                }
                strSeclctEmp += "pos_name LIKE '%" + txtSearchPos.SelectedItem + "%' ";
            }
            if (txtSearchAffi.SelectedValue != "")
            {
                if (strSeclctEmp != "")
                {
                    strSeclctEmp += " AND ";
                }
                strSeclctEmp += "affi_name LIKE '%" + txtSearchAffi.SelectedItem + "%' ";
            }

            if (strSeclctEmp != "")
            {
                strSeclctEmp = "(" + strSeclctEmp + ") AND ";
            }

            string sql = "SELECT * FROM tbl_emp_profile JOIN tbl_profix ON emp_profix_id = profix_id JOIN tbl_cpoint ON emp_cpoint_id = cpoint_id JOIN tbl_pos ON emp_pos_id = pos_id JOIN tbl_affiliation ON affi_id = emp_affi_id JOIN tbl_type_emp ON type_emp_id = emp_type_emp_id JOIN tbl_type_add ON type_add_id = emp_add_type WHERE " + strSeclctEmp + " emp_staus_working = '1' ORDER BY " + sortDate + " " + sortType + " LIMIT 0,20";

            Session["sqlEmp"] = sql;
            MySqlDataAdapter da = dbScript.getDataSelect(sql);
            DataTable        ds = new DataTable();

            da.Fill(ds);
            GridViewEmp.DataSource = ds;
            GridViewEmp.DataBind();
            LaGridViewData.Text = "พบข้อมูลจำนวน " + ds.Rows.Count + " แถว";

            resultCard.Visible = true;
            dbScript.CloseConnection();
        }
Exemplo n.º 2
0
        private void ShowByID(int id)
        {
            try
            {
                clearFields();
                //Se solicita desde capa negocio mediante la función ShowByID, los datos completos del empelado solicitado.
                _empleado = _empleadoVerif.ShowByID(id);

                if (_empleado != null)
                {
                    GridViewEmp.DataSource = new Empleado[1] {
                        _empleado
                    };
                    GridViewEmp.DataBind();
                    GridViewEmp.Visible = true;
                }
                else
                {
                    errorLabel.Text = "El empleado solicitado no existe";
                }
            }
            catch (Exception ex)
            {
                errorLabel.Text = string.Format("Error: {0}", ex.Message);
            }
        }
        protected void GV_Bind()
        {
            String ID_Emp_Login = (from p in db.AccountEmps
                                   where p.Username == Request.Cookies["Username"].Value
                                   select p.ID_Emp).Single();

            GridViewEmp.DataSource = db.Employees.Select(p => p).Where(p => p.ID_Emp != ID_Emp_Login);
            GridViewEmp.DataBind();
            FormatSex();
        }
Exemplo n.º 4
0
 protected void btnSearchClear_Click(object sender, EventArgs e)
 {
     txtSearchId.Text              = "";
     txtSearchName.Text            = "";
     txtSearchCpoint.SelectedIndex = 0;
     txtSearchPos.SelectedIndex    = 0;
     txtSearchAffi.SelectedIndex   = 0;
     GridViewEmp.DataSource        = null;
     GridViewEmp.DataBind();
     resultCard.Visible = false;
 }
        //Execute two select queries, and returns employees and country tables
        protected void btnReturnDS_Click(object sender, EventArgs e)
        {
            // You can also use a stored procedure instead  of two queries in one string variable
            string  sql = "SELECT * FROM Employees; SELECT * FROM Country";
            DataSet ds  = SqlHelper.ExecuteQueryDS(sql, CommandType.Text, null);

            GridViewEmp.DataSource = ds.Tables[0];
            GridViewEmp.DataBind();

            GridViewCountry.DataSource = ds.Tables[1];
            GridViewCountry.DataBind();
        }
Exemplo n.º 6
0
 public void PopulateData()
 {
     try
     {
         DataSet ds = emp.ShowReportEmployee();
         if (ds.Tables[0].Rows.Count != 0)
         {
             GridViewEmp.DataSource = ds.Tables[0];
             GridViewEmp.DataBind();
         }
     }
     catch (Exception ex)
     {
         lblMsg.Text = ex.Message;
     }
 }
Exemplo n.º 7
0
        private void SortGridView(string sortExpression, string direction)
        {
            MySqlDataAdapter da = dbScript.getDataSelect(Session["sqlEmp"].ToString());

            ds = new DataTable();
            da.Fill(ds);

            DataTable dt = ds;
            DataView  dv = new DataView(dt);

            //dv.Sort = "age asc";
            dv.Sort = sortExpression + " " + direction;
            this.GridViewEmp.DataSource = dv;
            GridViewEmp.DataBind();
            dbScript.CloseConnection();
        }
        // Execute two select queries, and returns employees and country tables
        protected void btnReturnDS_Click(object sender, EventArgs e)
        {
            // make sure parameter name of Cursor (CurEmp and CurCountry ) same as the name in the oracle PACKAGE
            string PKG_SP_Name = "GET_MULTIPLE_TABLES.GET_TABLES";

            OracleParameter[] parametersList = new OracleParameter[] {
                new OracleParameter("CurEmp", OracleDbType.RefCursor, ParameterDirection.Output),
                new OracleParameter("CurCountry", OracleDbType.RefCursor, ParameterDirection.Output),
            };
            DataSet ds = OracleHelper.ExecuteQueryDS(PKG_SP_Name, CommandType.StoredProcedure, parametersList);

            GridViewEmp.DataSource = ds.Tables[0];
            GridViewEmp.DataBind();

            GridViewCountry.DataSource = ds.Tables[1];
            GridViewCountry.DataBind();
        }
Exemplo n.º 9
0
        public void BindData()
        {
            string           sql = "SELECT * FROM tbl_emp_profile JOIN tbl_history ON id = history_emp_id JOIN tbl_profix ON profix_id=emp_profix_id JOIN tbl_status_working ON status_working_id = history_status_id WHERE emp_id_card = '" + txtSearchIDCard.Text.Trim() + "' ORDER BY history_id DESC";
            MySqlDataAdapter da  = dbScript.getDataSelect(sql);
            DataSet          ds  = new DataSet();

            da.Fill(ds);
            GridViewEmp.DataSource = ds.Tables[0];
            GridViewEmp.DataBind();
            if (ds.Tables[0].Rows.Count != 0)
            {
                LaGridViewData.Text = "พบข้อมูลจำนวน " + ds.Tables[0].Rows.Count + " แถว";
            }
            else
            {
                LaGridViewData.Text = "ไม่พบข้อมูล";
            }

            resultCard.Visible = true;
        }
Exemplo n.º 10
0
        //

        //Metodos//
        private void ShowAll()
        {
            errorLabel.Text = DefaultError;
            clearFields();

            List <Empleado> listaEmpleados = _empleadoVerif.returnAll();

            if (listaEmpleados.Count > 0)
            {
                //Luego de obtener la lista actualizada de empleados, se carga la misma en GridView de interfaz
                GridViewEmp.DataSource = listaEmpleados;
                GridViewEmp.DataBind();
                GridViewEmp.Visible = true;
            }
            else
            {
                //Se utiliza en este caso y durante toda interacción con usuario, un Label para comunicar errores y notificaciones pertinentes.
                errorLabel.Text    = "No existe ningun empleado cargado";
                errorLabel.Visible = true;
            }
        }
Exemplo n.º 11
0
 protected void DropDownSelectionChangedEvnt(object sender, EventArgs e)
 {
     litHeader.Text         = "Display Dept :" + DropDownListDeptName.SelectedItem.ToString() + " " + "DeptNO :" + DropDownListDeptName.SelectedItem.Value;
     GridViewEmp.DataSource = deptrepo.GetEmployees(Convert.ToInt32(DropDownListDeptName.SelectedItem.Value));
     GridViewEmp.DataBind();
 }
Exemplo n.º 12
0
        public void getSeclctEmp(string sortDate, string sortType)
        {
            //System.Threading.Thread.Sleep(5000);
            //DivLoad.Visible = true;


            string strSeclctEmp = "";

            if (txtSearchId.Text != "")
            {
                strSeclctEmp += "emp_id LIKE '%" + txtSearchId.Text.Trim() + "%' ";
            }
            if (txtSearchName.Text != "")
            {
                if (strSeclctEmp != "")
                {
                    strSeclctEmp += " AND ";
                }
                strSeclctEmp += "(profix_name LIKE '%" + txtSearchName.Text.Trim() + "%' OR emp_name LIKE '%" + txtSearchName.Text.Trim() + "%' OR emp_lname LIKE '%" + txtSearchName.Text.Trim() + "%')";
            }
            if (txtSearchCpoint.SelectedValue != "")
            {
                if (strSeclctEmp != "")
                {
                    strSeclctEmp += " AND ";
                }
                strSeclctEmp += "cpoint_id LIKE '" + txtSearchCpoint.SelectedValue + "%' ";
            }
            if (txtSearchPos.SelectedValue != "")
            {
                if (strSeclctEmp != "")
                {
                    strSeclctEmp += " AND ";
                }
                strSeclctEmp += "pos_id = '" + txtSearchPos.SelectedValue + "' ";
            }
            if (txtSearchAffi.SelectedValue != "")
            {
                if (strSeclctEmp != "")
                {
                    strSeclctEmp += " AND ";
                }
                strSeclctEmp += "affi_id = '" + txtSearchAffi.SelectedValue + "' ";
            }
            if (txtSearchType.SelectedValue != "")
            {
                if (strSeclctEmp != "")
                {
                    strSeclctEmp += " AND ";
                }
                strSeclctEmp += "emp_type_emp_id = '" + txtSearchType.SelectedValue + "'";
            }

            if (strSeclctEmp != "")
            {
                strSeclctEmp = "(" + strSeclctEmp + ") AND ";
            }

            string sql = "SELECT * FROM tbl_emp_profile JOIN tbl_profix ON emp_profix_id = profix_id JOIN tbl_cpoint ON emp_cpoint_id = cpoint_id JOIN tbl_pos ON emp_pos_id = pos_id JOIN tbl_affiliation ON affi_id = emp_affi_id JOIN tbl_type_emp ON type_emp_id = emp_type_emp_id LEFT JOIN tbl_type_add ON type_add_id = emp_add_type  WHERE " + strSeclctEmp + " emp_staus_working = '1' ORDER BY " + sortDate + " " + sortType;

            Session["sqlEmp"] = sql;
            MySqlDataAdapter da = dbScript.getDataSelect(sql);

            ds = new DataTable();
            da.Fill(ds);
            GridViewEmp.DataSource = ds;
            GridViewEmp.DataBind();
            LaGridViewData.Text = "พบข้อมูลจำนวน " + ds.Rows.Count + " แถว";


            if (GridViewEmp.DataSource != null)
            {
                DivEmp.Visible = true;
            }
            dbScript.CloseConnection();
            //DivLoad.Visible = false;
        }
Exemplo n.º 13
0
 protected void btnDisplayEmp_Click(object sender, EventArgs e)
 {
     GridViewEmp.DataSource = emprepo.GetEmployees();
     GridViewEmp.DataBind();
 }