private void BindgvEmpDetails()
        {
            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlCommand cmd = new SqlCommand("getEmployeePersoDetails", conn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 0;
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                if (txtEmpID.Text.ToString() == "" && txtEmpName.Text.ToString() == "")
                {
                    gvEmpDetails.DataSource = dt;
                    gvEmpDetails.DataBind();
                }
                else
                {
                    String[,] values =
                    {
                        { "EPD_EMPID~" + txtEmpID.Text.Trim(),  "S" },
                        { "Emp_Name~" + txtEmpName.Text.Trim(), "S" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt);
                    gvEmpDetails.DataSource = _tempDT;
                    gvEmpDetails.DataBind();
                }
                if (dt.Rows.Count > 0)
                {
                    DropDownList ddl = (DropDownList)gvEmpDetails.BottomPagerRow.FindControl("ddlPageNo");
                    for (int i = 1; i <= gvEmpDetails.PageCount; i++)
                    {
                        ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                    }
                    ddl.SelectedValue = (gvEmpDetails.PageIndex + 1).ToString();
                    Label lblcount = (Label)gvEmpDetails.BottomPagerRow.FindControl("lblTotal");
                    lblcount.Text = ((DataTable)gvEmpDetails.DataSource).Rows.Count.ToString() + " Records.";
                    if (gvEmpDetails.PageCount == 0)
                    {
                        ((Button)gvEmpDetails.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                        ((Button)gvEmpDetails.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                    }
                    if (gvEmpDetails.PageIndex + 1 == gvEmpDetails.PageCount)
                    {
                        ((Button)gvEmpDetails.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                    }
                    if (gvEmpDetails.PageIndex == 0)
                    {
                        ((Button)gvEmpDetails.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                    }
                    ((Label)gvEmpDetails.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((gvEmpDetails.PageSize * gvEmpDetails.PageIndex) + 1) + " to " + (gvEmpDetails.PageSize * (gvEmpDetails.PageIndex + 1));

                    gvEmpDetails.BottomPagerRow.Visible = true;
                }
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 2
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                lblMessages.Text = string.Empty;
                lblMsg.Text      = string.Empty;
                lblError.Text    = string.Empty;
                DataTable dt = clsTimeZoneViewHandler.GetAllDetails("All");

                if (txtTimezoneDesc.Text.ToString() == "" && txtTimezoneId.Text.ToString() == "")
                {
                    gvTimezone.DataSource = dt;
                    gvTimezone.DataBind();
                }
                else
                {
                    String[,] values =
                    {
                        { "TZ_CODE~" + txtTimezoneId.Text.Trim(),          "S" },
                        { "TZ_DESCRIPTION~" + txtTimezoneDesc.Text.Trim(), "S" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt);
                    gvTimezone.DataSource = _tempDT;
                    gvTimezone.DataBind();
                }

                DropDownList ddl = (DropDownList)gvTimezone.BottomPagerRow.FindControl("ddlPageNo");
                for (int i = 1; i <= gvTimezone.PageCount; i++)
                {
                    ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
                ddl.SelectedValue = (gvTimezone.PageIndex + 1).ToString();
                Label lblcount = (Label)gvTimezone.BottomPagerRow.FindControl("lblTotal");
                lblcount.Text = ((DataTable)gvTimezone.DataSource).Rows.Count.ToString() + " Records.";
                if (gvTimezone.PageCount == 0)
                {
                    ((Button)gvTimezone.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                    ((Button)gvTimezone.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                }
                if (gvTimezone.PageIndex + 1 == gvTimezone.PageCount)
                {
                    ((Button)gvTimezone.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                }
                if (gvTimezone.PageIndex == 0)
                {
                    ((Button)gvTimezone.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                }

                ((Label)gvTimezone.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((gvTimezone.PageSize * gvTimezone.PageIndex) + 1) + " to " + (((gvTimezone.PageSize * (gvTimezone.PageIndex + 1)) - gvTimezone.PageSize) + gvTimezone.Rows.Count);

                gvTimezone.BottomPagerRow.Visible = true;
            }
            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }
Ejemplo n.º 3
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                String    _strWhere = "";
                DataTable dt        = new DataTable();
                if (cmbContrller.SelectedValue.ToString() == "-1")
                {
                    _strWhere = "";
                }
                else
                {
                    _strWhere = " and C.CTLR_ID='" + cmbContrller.SelectedValue.ToString() + "'";
                }

                String _tableName = "EVENT_LOG_";
                if (DateTime.Now.Date.Month < 10)
                {
                    _tableName = _tableName + "0" + DateTime.Now.Date.Month + DateTime.Now.Date.Year;
                }
                else
                {
                    _tableName = _tableName + DateTime.Now.Date.Month + DateTime.Now.Date.Year;
                }

                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }

                try
                {
                    SqlCommand cmd = new SqlCommand("usp_GetActivityData", conn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@tableName", _tableName);
                    cmd.Parameters.AddWithValue("@strwhereclause", _strWhere);
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                    da.SelectCommand.CommandTimeout = 0;

                    da.Fill(dt);
                    //cmd.ExecuteNonQuery();
                }


                catch (Exception ex)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }

                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }

                if (txtUserID.Text.ToString() == "" && txtLevelID.Text.ToString() == "")
                {
                    gvActivity.DataSource = dt;
                    gvActivity.DataBind();
                }
                else
                {
                    String[,] values =
                    {
                        { "CTLR_DESCRIPTION-" + txtUserID.Text.Trim(), "S" },
                        { "EVENT_DESC-" + txtLevelID.Text.Trim(),      "S" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt);
                    gvActivity.DataSource = _tempDT;
                    gvActivity.DataBind();
                }
                DropDownList ddl = (DropDownList)gvActivity.BottomPagerRow.FindControl("ddlPageNo");
                for (int i = 1; i <= gvActivity.PageCount; i++)
                {
                    ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
                ddl.SelectedValue = (gvActivity.PageIndex + 1).ToString();
                Label lblcount = (Label)gvActivity.BottomPagerRow.FindControl("lblTotal");
                lblcount.Text = ((DataTable)gvActivity.DataSource).Rows.Count.ToString() + " Records.";
                if (gvActivity.PageCount == 0)
                {
                    ((Button)gvActivity.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                    ((Button)gvActivity.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                }
                if (gvActivity.PageIndex + 1 == gvActivity.PageCount)
                {
                    ((Button)gvActivity.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                }
                if (gvActivity.PageIndex == 0)
                {
                    ((Button)gvActivity.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                }
                //((Label)gvActivity.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((gvActivity.PageSize * gvActivity.PageIndex) + 1) + " to " + (gvActivity.PageSize * (gvActivity.PageIndex + 1));

                ((Label)gvActivity.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((gvActivity.PageSize * gvActivity.PageIndex) + 1) + " to " + (((gvActivity.PageSize * (gvActivity.PageIndex + 1)) - 10) + gvActivity.Rows.Count);

                gvActivity.BottomPagerRow.Visible = true;
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "HolidayView");
            }
        }
Ejemplo n.º 4
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                lblMessages.Text = "";

                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                string strsql1 = "select ESS_OD_RowID,ent_employee_personal_dtls.Epd_First_Name+ ' ' +ent_employee_personal_dtls.Epd_Last_Name as Name,ess_OD_empid as EmpCode,convert(VARCHAR(20),Ess_OD_fromdt,103) as FromDate, case when convert(VARCHAR(20),Ess_OD_Todt,103)= convert(VARCHAR(20),Ess_OD_fromdt,103) " +
                                 " then convert(VARCHAR(20),Ess_OD_fromdt,103) else convert(VARCHAR(20),Ess_OD_Todt,103)  end as ToDate, ESS_OD_ODCD , Case  ESS_OD_Status WHEN 'N' then 'Pending For Approval' " +
                                 " when 'A' then 'Approved' When 'R' then 'Rejected' When 'C' then 'Cancelled' End as ESS_OD_Status from ESS_TA_OD,ent_employee_personal_dtls  where" +
                                 "   ess_ta_od.ess_OD_empid=ent_employee_personal_dtls.epd_empid " +
                                 "  and ess_od_empid='" + userid + "'  and ess_od_isdeleted='0'  order by convert(datetime,Ess_OD_fromdt,103)  desc ";
                SqlDataAdapter da = new SqlDataAdapter(strsql1, conn);
                DataTable      dt = new DataTable();
                da.SelectCommand.CommandTimeout = 0;
                da.Fill(dt);
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }


                if (txtTodate.Text.ToString() == "" && txtFromDate.Text.ToString() == "")
                {
                    gvOD.DataSource = dt;
                    gvOD.DataBind();
                }
                else
                {
                    String[,] values =
                    {
                        { "fromdate~" + txtFromDate.Text.Trim(), "D" },
                        { "Todate~" + txtTodate.Text.Trim(),     "D" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT         = _sc.searchTable(values, dt);
                    gvOD.DataSource = _tempDT;
                    gvOD.DataBind();
                }

                DropDownList ddl = (DropDownList)gvOD.BottomPagerRow.FindControl("ddlPageNo");
                for (int i = 1; i <= gvOD.PageCount; i++)
                {
                    ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
                ddl.SelectedValue = (gvOD.PageIndex + 1).ToString();
                Label lblcount = (Label)gvOD.BottomPagerRow.FindControl("lblTotal");
                lblcount.Text = ((DataTable)gvOD.DataSource).Rows.Count.ToString() + " Records.";
                if (gvOD.PageCount == 0)
                {
                    ((Button)gvOD.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                    ((Button)gvOD.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                }
                if (gvOD.PageIndex + 1 == gvOD.PageCount)
                {
                    ((Button)gvOD.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                }
                if (gvOD.PageIndex == 0)
                {
                    ((Button)gvOD.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                }
                ((Label)gvOD.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((gvOD.PageSize * gvOD.PageIndex) + 1) + " to " + (gvOD.PageSize * (gvOD.PageIndex + 1));

                gvOD.BottomPagerRow.Visible = true;
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "ESS_TA_OD_View");
            }
        }
        private void bindDataGrid()
        {
            try
            {
                DataSet          ds = null;
                StringDictionary sd = new StringDictionary();
                sd.Add("@cmd", "0");
                ds = ExecuteSQL.ExecuteDataSet("PROC_ASSET_CTLR_MASTER", sd);
                if (ds != null)
                {
                    ddlLocation.DataSource     = ds.Tables[1];
                    ddlLocation.DataTextField  = "OCE_DESCRIPTION";
                    ddlLocation.DataValueField = "OCE_ID";
                    ddlLocation.DataBind();
                    ddlLocation.Items.Insert(0, "Select Location");
                    ddlEditLocation.DataSource     = ds.Tables[1];
                    ddlEditLocation.DataTextField  = "OCE_DESCRIPTION";
                    ddlEditLocation.DataValueField = "OCE_ID";
                    ddlEditLocation.DataBind();
                    ddlEditLocation.Items.Insert(0, "Select Location");

                    if (txtControllerCode.Text.ToString() == "" && txtControllerDescription.Text.ToString() == "")
                    {
                        gvController.DataSource = ds.Tables[0];
                        gvController.DataBind();
                    }
                    else
                    {
                        DataTable _tempDT = new DataTable();
                        String[,] values =
                        {
                            { "CtlrCode~" + txtControllerCode.Text.Trim(),        "S" },
                            { "CtlrDesc~" + txtControllerDescription.Text.Trim(), "S" }
                        };
                        Search _sc = new Search();
                        if (_tempDT != null)
                        {
                            _tempDT.Rows.Clear();
                        }
                        _tempDT = _sc.searchTable(values, ds.Tables[0]);
                        gvController.DataSource = _tempDT;
                        gvController.DataBind();
                    }
                    if (gvController.Rows.Count > 0)
                    {
                        DropDownList ddl = (DropDownList)gvController.BottomPagerRow.FindControl("ddlPageNo");
                        for (int i = 1; i <= gvController.PageCount; i++)
                        {
                            ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                        }
                        ddl.SelectedValue = (gvController.PageIndex + 1).ToString();
                        Label lblcount = (Label)gvController.BottomPagerRow.FindControl("lblTotal");
                        lblcount.Text = ((DataTable)gvController.DataSource).Rows.Count.ToString() + " Records.";
                        if (gvController.PageCount == 0)
                        {
                            ((Button)gvController.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                            ((Button)gvController.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                        }
                        if (gvController.PageIndex + 1 == gvController.PageCount)
                        {
                            ((Button)gvController.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                        }
                        if (gvController.PageIndex == 0)
                        {
                            ((Button)gvController.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                        }
                        ((Label)gvController.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((gvController.PageSize * gvController.PageIndex) + 1) + " to " + (gvController.PageSize * (gvController.PageIndex + 1));

                        gvController.BottomPagerRow.Visible = true;
                    }
                }
            }
            catch (Exception ex)
            {
                lblMessages.Text = ex.Message;
            }
        }