Exemplo n.º 1
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = clsWeeklyOffHandler.GetWeekendWeekoffDetails("All");
                if (textreasonid.Text.ToString() == "" && textreasonname.Text.ToString() == "")
                {
                    gvReason.DataSource = dt;
                    gvReason.DataBind();
                }
                else
                {
                    String[,] values =
                    {
                        { "MWK_CD~" + textreasonid.Text.Trim(),   "S" },
                        { "MWK_CD~" + textreasonname.Text.Trim(), "S" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT             = _sc.searchTable(values, dt);
                    gvReason.DataSource = _tempDT;
                    gvReason.DataBind();
                }
                DropDownList ddl = (DropDownList)gvReason.BottomPagerRow.FindControl("ddlPageNo");
                for (int i = 1; i <= gvReason.PageCount; i++)
                {
                    ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
                ddl.SelectedValue = (gvReason.PageIndex + 1).ToString();
                Label lblcount = (Label)gvReason.BottomPagerRow.FindControl("lblTotal");
                lblcount.Text = ((DataTable)gvReason.DataSource).Rows.Count.ToString() + " Records.";
                if (gvReason.PageCount == 0)
                {
                    ((Button)gvReason.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                    ((Button)gvReason.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                }
                if (gvReason.PageIndex + 1 == gvReason.PageCount)
                {
                    ((Button)gvReason.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                }
                if (gvReason.PageIndex == 0)
                {
                    ((Button)gvReason.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                }

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

                gvReason.BottomPagerRow.Visible = true;
            }


            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }
Exemplo n.º 2
0
        // bug 87 solved start --swapnil
        protected void cmdSearch_Click(object sender, EventArgs e)
        {
            string strsql = "SELECT CLIENT_ID,CLIENT_NAME,CLIENT_DESC,CLIENT_SITE_ADDRESS,CLIENT_HO_ADDRESS,CLIENT_PHONE1," +
                            " CLIENT_PHONE2,CLIENT_CONTACT_PERSON1,CLIENT_CONTPER1_PHONE1,CLIENT_CONTPER1_PHONE2" +
                            " ,CLIENT_CONTACT_PERSON2,CLIENT_CONTPER2_PHONE1,CLIENT_CONTPER2_PHONE2 FROM TE_CLIENT_FILE where CLIENT_ISDELETED = '0'";

            SqlDataAdapter daLVdetails = new SqlDataAdapter(strsql, conn);
            DataTable      dtLVdetails = new DataTable();

            daLVdetails.Fill(dtLVdetails);

            if (txtCompanyId.Text.ToString() == "" && txtCompanyName.Text.ToString() == "")
            {
                cmdReset_Click(sender, e);
            }
            else
            {
                String[,] values =
                {
                    { "CLIENT_ID-" + txtCompanyId.Text.Trim(),     "S" },
                    { "CLIENT_NAME-" + txtCompanyName.Text.Trim(), "S" }
                };
                DataTable _tempDT = new DataTable();
                Search    _sc     = new Search();
                if (_tempDT != null)
                {
                    _tempDT.Rows.Clear();
                }
                _tempDT         = _sc.searchTable(values, dtLVdetails);
                Grid.DataSource = _tempDT;
                Grid.DataBind();
            }
        }
        protected void cmdSearch_Click(object sender, EventArgs e)
        {
            string strsql = " SELECT SCHEDULER_TASK_TYPE,SCHEDULER_DESCRIPTION,SCHEDULER_FREQUENCY,SUBSTRING(CONVERT(VARCHAR,SCHEDULER_TIME,114),0,6) AS SCHEDULER_TIME " +
                            " FROM SCHEDULER Where SCHEDULER_ISDELETED = '0' ORDER BY CASE WHEN ISNUMERIC(SCHEDULER_TASK_TYPE) = 1 THEN 0 ELSE 1 END, " +
                            " CASE WHEN ISNUMERIC(SCHEDULER_TASK_TYPE) = 1 THEN CAST(SCHEDULER_TASK_TYPE AS INT) ELSE 0 END ";
            SqlDataAdapter da = new SqlDataAdapter(strsql, AccessController.m_connecton);
            DataTable      dt = new DataTable();

            da.Fill(dt);
            if (txtCompanyId.Text.ToString() == "" && txtCompanyName.Text.ToString() == "")
            {
                cmdReset_Click(sender, e);
            }
            else
            {
                String[,] values =
                {
                    { "SCHEDULER_TASK_TYPE-" + txtCompanyId.Text.Trim(),     "S" },
                    { "SCHEDULER_DESCRIPTION-" + txtCompanyName.Text.Trim(), "S" }
                };
                DataTable _tempDT = new DataTable();
                Search    _sc     = new Search();
                if (_tempDT != null)
                {
                    _tempDT.Rows.Clear();
                }
                _tempDT = _sc.searchTable(values, dt);
                gvScheduleSettings.DataSource = _tempDT;
                gvScheduleSettings.DataBind();
            }
        }
Exemplo n.º 4
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                lblMessages.Visible   = false;
                ReportViewer1.Visible = false;
                DataTable dt = clsEmployeeLeftHandler.GetAllLeftEmployees();
                if (txtSearchEmployeeid.Text.ToString() == "")
                {
                    gvLeaveData.DataSource = dt;
                    gvLeaveData.DataBind();
                }
                else
                {
                    String[,] values =
                    {
                        { "EL_EMP_ID~" + txtSearchEmployeeid.Text.Trim(), "S" },
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt);
                    gvLeaveData.DataSource = _tempDT;
                    gvLeaveData.DataBind();
                }

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

                gvLeaveData.BottomPagerRow.Visible = true;
            }
            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = getTable();

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

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

                gvEvent.BottomPagerRow.Visible = true;
            }
            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "HolidayView");
            }
        }
Exemplo n.º 6
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            if (txtemp_code.Text.ToString() == "" && txtemp_name.Text.ToString() == "")
            {
                cmdReset_Click(sender, e);
            }
            else
            {
                String[,] values =
                {
                    { "EPD_EMPID~" + txtemp_code.Text.Trim(),    "S" },
                    { "EPD_EMP_NAME~" + txtemp_name.Text.Trim(), "S" }
                };

                Search _sc = new Search();
                if (_tempDT != null)
                {
                    _tempDT.Rows.Clear();
                }
                _tempDT = _sc.searchTable(values, _baseDT);
                gvEmployee.DataSource = _tempDT;
                gvEmployee.DataBind();
                if (_tempDT.Rows.Count != 0)
                {
                    DropDownList ddl = (DropDownList)gvEmployee.BottomPagerRow.FindControl("ddlPageNo");
                    for (int i = 1; i <= gvEmployee.PageCount; i++)
                    {
                        ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                    }
                    ddl.SelectedValue = (gvEmployee.PageIndex + 1).ToString();
                    Label lblcount = (Label)gvEmployee.BottomPagerRow.FindControl("lblTotal");
                    lblcount.Text = ((DataTable)gvEmployee.DataSource).Rows.Count.ToString() + " Records.";
                    if (gvEmployee.PageCount == 0)
                    {
                        ((Button)gvEmployee.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                        ((Button)gvEmployee.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                    }
                    if (gvEmployee.PageIndex + 1 == gvEmployee.PageCount)
                    {
                        ((Button)gvEmployee.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                    }
                    if (gvEmployee.PageIndex == 0)
                    {
                        ((Button)gvEmployee.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                    }
                    //((Label)gvEmployee.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((gvEmployee.PageSize * gvEmployee.PageIndex) + 1) + " to " + (gvEmployee.PageSize * (gvEmployee.PageIndex + 1));

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

                    gvEmployee.BottomPagerRow.Visible = true;
                }
            }
        }
Exemplo n.º 7
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                lblMessages.Text     = string.Empty;
                lblSaveMessages.Text = string.Empty;
                clsEmployee objEmp = new clsEmployee();
                DataTable   dt     = clsEmployeeHandler.GetEmployeeManagerDetails(ddlEmpStatus.SelectedValue.ToString(), "AllEmployees", "");

                if (txtCompanyName.Text.ToString() == "" && txtCompanyID.Text.ToString() == "")
                {
                    cmdReset_Click(sender, e);
                }
                else
                {
                    String[,] values =
                    {
                        { "EPD_empid~" + txtCompanyID.Text.Trim(),  "S" },
                        { "EPD_Name~" + txtCompanyName.Text.Trim(), "S" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt);
                    gvEmployee.DataSource = _tempDT;
                    gvEmployee.DataBind();
                    _tempDT = _sc.searchTable(values, dt);
                    gvEmployee.DataSource = _tempDT;
                    gvEmployee.DataBind();

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


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

                    gvEmployee.BottomPagerRow.Visible = true;
                }
            }


            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "EmployeeMasterView");
            }
        }
Exemplo n.º 8
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());
            }
        }
Exemplo n.º 9
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                lblMessages.Text = "";

                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                string strsql = "select ESS_GP_RowID,ess_GP_empid as EmpCode,ent_employee_personal_dtls.Epd_First_Name+ ' ' +ent_employee_personal_dtls.Epd_Last_Name as Name,convert(VARCHAR(20),Ess_GP_fromdt,103) as FromDate, case when convert(VARCHAR(20),Ess_GP_Todt,103)= convert(VARCHAR(20),Ess_GP_fromdt,103) " +
                                "  then ''else convert(VARCHAR(20),Ess_GP_Todt,103)  end as ToDate,convert(char(5),ESS_GP_FROMTM,8) as [In],convert(char(5),ESS_GP_TOTM,8) as [Out], Case  ESS_GP_Status WHEN 'N' then 'Pending For Approval' " +
                                " when 'A' then 'Approved' When 'R' then 'Rejected' When 'C' then 'Cancelled' End as ESS_GP_Status from ESS_TA_GP,ent_employee_personal_dtls  " +
                                " where  ess_ta_gp.ess_gp_empid=ent_employee_personal_dtls.epd_empid " +
                                " and ess_gp_empid= '" + userid + "' and ess_gp_isdeleted='0'  order by convert(datetime,Ess_GP_fromdt,103)  desc";

                SqlDataAdapter da = new SqlDataAdapter(strsql, 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() == "")
                {
                    gvGP.DataSource = dt;
                    gvGP.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);
                    gvGP.DataSource = _tempDT;
                    gvGP.DataBind();
                }

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

                gvGP.BottomPagerRow.Visible = true;
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "ESS_TA_GP_View");
            }
        }
Exemplo n.º 10
0
        public void bindDataGrid()
        {
            try
            {
                DataTable _tempDT = new DataTable();
                DataTable dt      = new DataTable();
                dt = GetDataTable(userid, cmbEntity.SelectedValue, ddlStatus.SelectedValue);
                if (txtTodate.Text.ToString() == "" && txtFromDate.Text.ToString() == "" && txtEmpCode.Text.ToString() == "" && txtName.Text.ToString() == "")
                {
                    gvManualAttnd.DataSource = dt;
                    gvManualAttnd.DataBind();
                    if (dt.Rows.Count != 0)
                    {
                        btnApprove.Enabled = true;
                        btnDelete.Enabled  = true;
                        DropDownList ddl = (DropDownList)gvManualAttnd.BottomPagerRow.FindControl("ddlPageNo");
                        for (int i = 1; i <= gvManualAttnd.PageCount; i++)
                        {
                            ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                        }
                        ddl.SelectedValue = (gvManualAttnd.PageIndex + 1).ToString();
                        Label lblcount = (Label)gvManualAttnd.BottomPagerRow.FindControl("lblTotal");
                        lblcount.Text = ((DataTable)gvManualAttnd.DataSource).Rows.Count.ToString() + " Records.";
                        if (gvManualAttnd.PageCount == 0)
                        {
                            ((Button)gvManualAttnd.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                            ((Button)gvManualAttnd.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                        }
                        if (gvManualAttnd.PageIndex + 1 == gvManualAttnd.PageCount)
                        {
                            ((Button)gvManualAttnd.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                        }
                        if (gvManualAttnd.PageIndex == 0)
                        {
                            ((Button)gvManualAttnd.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                        }
                        ((Label)gvManualAttnd.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((gvManualAttnd.PageSize * gvManualAttnd.PageIndex) + 1) + " to " + (gvManualAttnd.PageSize * (gvManualAttnd.PageIndex + 1));

                        gvManualAttnd.BottomPagerRow.Visible = true;
                        selectChk();
                    }
                    else
                    {
                        btnDelete.Enabled  = false;
                        btnApprove.Enabled = false;
                    }
                }
                else
                {
                    String[,] values =
                    {
                        { "fromdate~" + txtFromDate.Text.Trim(), "D" },
                        { "Todate~" + txtTodate.Text.Trim(),     "D" },
                        { "EmpID~" + txtEmpCode.Text.Trim(),     "S" },
                        { "Name~" + txtName.Text.Trim(),         "S" }
                    };
                    Search _sc = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt);
                    gvManualAttnd.DataSource = _tempDT;
                    gvManualAttnd.DataBind();
                    if (_tempDT.Rows.Count != 0)
                    {
                        DropDownList ddl = (DropDownList)gvManualAttnd.BottomPagerRow.FindControl("ddlPageNo");
                        for (int i = 1; i <= gvManualAttnd.PageCount; i++)
                        {
                            ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                        }
                        ddl.SelectedValue = (gvManualAttnd.PageIndex + 1).ToString();
                        Label lblcount = (Label)gvManualAttnd.BottomPagerRow.FindControl("lblTotal");
                        lblcount.Text = ((DataTable)gvManualAttnd.DataSource).Rows.Count.ToString() + " Records.";
                        if (gvManualAttnd.PageCount == 0)
                        {
                            ((Button)gvManualAttnd.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                            ((Button)gvManualAttnd.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                        }
                        if (gvManualAttnd.PageIndex + 1 == gvManualAttnd.PageCount)
                        {
                            ((Button)gvManualAttnd.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                        }
                        if (gvManualAttnd.PageIndex == 0)
                        {
                            ((Button)gvManualAttnd.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                        }
                        ((Label)gvManualAttnd.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((gvManualAttnd.PageSize * gvManualAttnd.PageIndex) + 1) + " to " + (gvManualAttnd.PageSize * (gvManualAttnd.PageIndex + 1));

                        gvManualAttnd.BottomPagerRow.Visible = true;
                        btnApprove.Enabled = true;
                        btnDelete.Enabled  = true;
                    }
                    else
                    {
                        btnDelete.Enabled  = false;
                        btnApprove.Enabled = false;
                    }
                }

                CommonValue();
            }
            catch (Exception ex)
            {
            }
        }
Exemplo n.º 11
0
        protected void cmdSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }


                string strsql = "SELECT ESS_CO_RowID AS CO_ROWID,ESS_CO_EMPID CO_EMPID,'CO' AS LEAVECODE," +
                                "ESS_CO_REQUESTDT CO_REQUESTDT,CONVERT(VARCHAR(10),ESS_CO_FROMDT,105)  CO_FROMDT," +
                                "ESS_CO_CD CO_CD,ESS_CO_RSNID CO_RSNID,ESS_CO_REMARK CO_REMARK,ESS_CO_SANCID CO_SANCID," +
                                "ESS_CO_SANCDT CO_SANCDT,ESS_CO_SANC_REMARK CO_SANC_REMARK," +
                                "ESS_CO_ORDER CO_ORDER,isnull(ESS_CO_STATUS,'N') CO_STATUS,ESS_CO_OLDSTATUS CO_OLDSTATUS," +
                                "ESS_CO_ISDELETED CO_ISDELETED,ESS_CO_DELETEDDATE CO_DELETEDDATE," +
                                "ESS_CO_DAYS CO_DAYS,CONVERT(VARCHAR(10),ESS_CO_LEAVEAGANISTDATE,105) ESS_CO_LEAVEAGANISTDATE" +
                                "   FROM ESS_TA_CO WHERE ESS_CO_ISDELETED = 0 AND  ESS_CO_STATUS =  'N'";

                SqlDataAdapter da = new SqlDataAdapter(strsql, conn);
                da.SelectCommand.CommandTimeout = 0;
                DataTable dt = new DataTable();
                da.Fill(dt);
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }

                if (txtfromDate.Text.ToString() == "")
                {
                    cmdReset_Click(sender, e);
                }
                else
                {
                    String[,] values =
                    {
                        { "CO_EMPID~" + txtfromDate.Text.Trim(), "S" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt);
                    gvLVDetails.DataSource = _tempDT;
                    gvLVDetails.DataBind();
                    _tempDT = _sc.searchTable(values, dt);
                    gvLVDetails.DataSource = _tempDT;
                    gvLVDetails.DataBind();

                    DropDownList ddl = (DropDownList)gvLVDetails.BottomPagerRow.FindControl("ddlPageNo1");
                    for (int i = 1; i <= gvLVDetails.PageCount; i++)
                    {
                        ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                    }
                    ddl.SelectedValue = (gvLVDetails.PageIndex + 1).ToString();
                    Label lblcount = (Label)gvLVDetails.BottomPagerRow.FindControl("lblTotal1");
                    lblcount.Text = ((DataTable)gvLVDetails.DataSource).Rows.Count.ToString() + " Records.";
                    if (gvLVDetails.PageCount == 0)
                    {
                        ((Button)gvLVDetails.BottomPagerRow.FindControl("btnPrevious1")).Enabled = false;
                        ((Button)gvLVDetails.BottomPagerRow.FindControl("btnNext1")).Enabled     = false;
                    }
                    if (gvLVDetails.PageIndex + 1 == gvLVDetails.PageCount)
                    {
                        ((Button)gvLVDetails.BottomPagerRow.FindControl("btnNext1")).Enabled = false;
                    }
                    if (gvLVDetails.PageIndex == 0)
                    {
                        ((Button)gvLVDetails.BottomPagerRow.FindControl("btnPrevious1")).Enabled = false;
                    }
                    ((Label)gvLVDetails.BottomPagerRow.FindControl("lblShowing1")).Text = "Showing " + ((gvLVDetails.PageSize * gvLVDetails.PageIndex) + 1) + " to " + (gvLVDetails.PageSize * (gvLVDetails.PageIndex + 1));

                    gvLVDetails.BottomPagerRow.Visible = true;
                }
            }

            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "EmployeeMasterView");
            }
        }
        private void BindgvPersonalisation()
        {
            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlCommand cmd;
                if (ddlMode.SelectedValue == "Personalised")
                {
                    //cmd = new SqlCommand("Select EPD_EMPID, EPD_FIRST_NAME + coalesce( EPD_MIDDLE_NAME, '' )+ EPD_LAST_NAME as Name from ENT_EMPLOYEE_PERSONAL_DTLS where EPD_PERSO_FLAG = 'P' or EPD_PERSO_FLAG is not null", conn);
                    cmd = new SqlCommand("Select EPD_EMPID, EPD_FIRST_NAME + coalesce( EPD_MIDDLE_NAME, '' )+ EPD_LAST_NAME as Name from ENT_EMPLOYEE_PERSONAL_DTLS EPD inner join ENT_EMPLOYEE_OFFICIAL_DTLS EOD on EPD.EPD_EMPID=EOD.EOD_EMPID where EOD.EOD_ACTIVE=1 and EPD_PERSO_FLAG = 'P' or EPD_PERSO_FLAG is not null", conn);
                    gvPersonalisation.Columns[0].Visible = false;
                }
                else if (ddlMode.SelectedValue == "NonPersonalised")
                {
                    //cmd = new SqlCommand("Select EPD_EMPID, EPD_FIRST_NAME + coalesce( EPD_MIDDLE_NAME, '' )+ EPD_LAST_NAME as Name from ENT_EMPLOYEE_PERSONAL_DTLS where EPD_PERSO_FLAG <> 'P' or EPD_PERSO_FLAG is null", conn);
                    cmd = new SqlCommand("Select EPD_EMPID, EPD_FIRST_NAME + coalesce( EPD_MIDDLE_NAME, '' )+ EPD_LAST_NAME as Name from ENT_EMPLOYEE_PERSONAL_DTLS EPD inner join ENT_EMPLOYEE_OFFICIAL_DTLS EOD on EPD.EPD_EMPID=EOD.EOD_EMPID where EOD.EOD_ACTIVE=1 AND EPD_PERSO_FLAG <> 'P' or EPD_PERSO_FLAG is null", conn);
                    gvPersonalisation.Columns[0].Visible = true;
                }
                else
                {
                    //cmd = new SqlCommand("Select EPD_EMPID, EPD_FIRST_NAME + coalesce( EPD_MIDDLE_NAME, '' )+ EPD_LAST_NAME as Name from ENT_EMPLOYEE_PERSONAL_DTLS", conn);
                    cmd = new SqlCommand("Select EPD_EMPID, EPD_FIRST_NAME + coalesce( EPD_MIDDLE_NAME, '' )+ EPD_LAST_NAME as Name from ENT_EMPLOYEE_PERSONAL_DTLS EPD inner join ENT_EMPLOYEE_OFFICIAL_DTLS EOD on EPD.EPD_EMPID=EOD.EOD_EMPID where EOD.EOD_ACTIVE=1", conn);
                    gvPersonalisation.Columns[0].Visible = true;
                }
                cmd.CommandType = CommandType.Text;
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }

                if (txtCompanyName.Text.ToString() == "" && txtCompanyID.Text.ToString() == "")
                {
                    gvPersonalisation.DataSource = dt;
                    gvPersonalisation.DataBind();

                    //BindgvPersonalisation();
                    //cmdReset_Click(sender, e);
                }
                else
                {
                    String[,] values =
                    {
                        { "EPD_empid~" + txtCompanyID.Text.Trim(), "S" },
                        { "Name~" + txtCompanyName.Text.Trim(),    "S" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt);
                    gvPersonalisation.DataSource = _tempDT;
                    gvPersonalisation.DataBind();
                    _tempDT = _sc.searchTable(values, dt);
                    gvPersonalisation.DataSource = _tempDT;
                    gvPersonalisation.DataBind();
                }


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

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

                gvPersonalisation.BottomPagerRow.Visible = true;


                //if (dt.Rows.Count != 0)
                //{
                //    btnDelete.Enabled = true;
                //    btnSearch.Enabled = true;
                //}

                //else
                //{
                //    btnDelete.Enabled = false;
                //    btnSearch.Enabled = false;
                //}
            }
            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "SACPersonalisation");
            }
        }
Exemplo n.º 13
0
        protected void cmdSearch_Click(object sender, EventArgs e)
        {
            lblMessages.Text = "";
            DataTable dt = GetOutPassData();

            if (txtCompanyId.Text.ToString() == "" && txtCompanyName.Text.ToString() == "")
            {
                cmdReset_Click(sender, e);
            }
            else
            {
                String[,] values =
                {
                    { "OP_EMPID~" + txtCompanyId.Text.Trim(), "S" },
                    { "name~" + txtCompanyName.Text.Trim(),   "S" }
                };
                DataTable _tempDT = new DataTable();
                Search    _sc     = new Search();
                if (_tempDT != null)
                {
                    _tempDT.Rows.Clear();
                }
                _tempDT = _sc.searchTable(values, dt);
                gvOutpass.DataSource = _tempDT;
                gvOutpass.DataBind();
                if (_tempDT.Rows.Count > 0)
                {
                    btnDelete.Enabled = true;
                    btnSearch.Enabled = true;
                    DropDownList ddl = (DropDownList)gvOutpass.BottomPagerRow.FindControl("ddlPageNo");
                    for (int i = 1; i <= gvOutpass.PageCount; i++)
                    {
                        ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                    }
                    ddl.SelectedValue = (gvOutpass.PageIndex + 1).ToString();
                    Label lblcount = (Label)gvOutpass.BottomPagerRow.FindControl("lblTotal");
                    lblcount.Text = ((DataTable)gvOutpass.DataSource).Rows.Count.ToString() + " Records.";
                    if (gvOutpass.PageCount == 0)
                    {
                        ((Button)gvOutpass.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                        ((Button)gvOutpass.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                    }
                    if (gvOutpass.PageIndex + 1 == gvOutpass.PageCount)
                    {
                        ((Button)gvOutpass.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                    }
                    if (gvOutpass.PageIndex == 0)
                    {
                        ((Button)gvOutpass.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                    }


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

                    gvOutpass.BottomPagerRow.Visible = true;
                }
                else
                {
                    btnDelete.Enabled = false;
                    btnSearch.Enabled = false;
                }
            }
        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                this.lblErrorEdit.Text = string.Empty;
                clsEmployeeHierarchy objData = new clsEmployeeHierarchy();
                DataTable            dt      = clsEmployeeHierarchyHandler.GetEmployeeManagerDetails("MngrHierarchy", objData);
                if (txtCompanyId.Text.ToString() == "" && txtCompanyName.Text.ToString() == "")
                {
                    gvEmpMgrHier.DataSource = dt;
                    gvEmpMgrHier.DataBind();
                }
                else
                {
                    String[,] values =
                    {
                        { "empid~" + txtCompanyId.Text.Trim(),     "S" },
                        { "EmpName~" + txtCompanyName.Text.Trim(), "S" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt);
                    gvEmpMgrHier.DataSource = _tempDT;
                    gvEmpMgrHier.DataBind();
                }

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


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

                gvEmpMgrHier.BottomPagerRow.Visible = true;

                if (dt.Rows.Count != 0)
                {
                    btnDelete.Enabled = true;
                    btnSearch.Enabled = true;
                }
                else
                {
                    btnDelete.Enabled = false;
                    btnSearch.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "EmployeeManagerHierarchy");
            }
        }
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                string strsql = "";
                if (Mstr_Con.State == ConnectionState.Closed)
                {
                    Mstr_Con.Open();
                }
                strsql = "Select  TC_TMP_CARD_ID,TC_EMPLOYEE_ID,CONVERT(VARCHAR(10),TC_ISSUEDT,103) AS TC_ISSUEDT ,CONVERT(VARCHAR(10),TC_RETURNDT,103) AS TC_RETURNDT,TC_REASON_ID FROM TA_TEMPCARD WHERE TC_ISDELETED=0";
                SqlDataAdapter da = new SqlDataAdapter(strsql, Mstr_Con);
                DataTable      dt = new DataTable();
                da.SelectCommand.CommandTimeout = 0;
                da.Fill(dt);
                if (Mstr_Con.State == ConnectionState.Open)
                {
                    Mstr_Con.Close();
                }


                if (txtCompanyID.Text.ToString() == "" && txtCompanyName.Text.ToString() == "")
                {
                    gvTempCard.DataSource = dt;
                    gvTempCard.DataBind();
                }
                else
                {
                    String[,] values =
                    {
                        { "TC_TMP_CARD_ID~" + txtCompanyID.Text.Trim(),   "S" },
                        { "TC_EMPLOYEE_ID~" + txtCompanyName.Text.Trim(), "S" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt);
                    gvTempCard.DataSource = _tempDT;
                    gvTempCard.DataBind();
                }

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

                gvTempCard.BottomPagerRow.Visible = true;
            }
            catch (Exception ex)
            {
                if (Mstr_Con.State == ConnectionState.Open)
                {
                    Mstr_Con.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "TemporaryCardViewMaster");
            }
        }
Exemplo n.º 16
0
        protected void cmdSearch_Click(object sender, EventArgs e)
        {
            lblMessages.Text = "";

            string strsql = " select MA_RECID, MA_EMPID , ent_employee_personal_dtls.Epd_First_Name + ' ' +ent_employee_personal_dtls.EPD_LAST_NAME as Name,convert(VARCHAR(20),MA_SWIPEFROMDATE,103) as FromDate, " +
                            " case " +
                            " when convert(VARCHAR(20),MA_SWIPETODATE,103)= convert(VARCHAR(20), " +
                            " MA_SWIPEFROMDATE,103) " +
                            " then '' else convert(VARCHAR(20),MA_SWIPETODATE,103)  end as " +
                            " ToDate ,convert(char(5),MA_SWIPEFROMTIME,8) " +
                            " as [In_Time],convert(char(5),MA_SWIPETOTIME,8) as [Out_Time], " +
                            " MA_STATUS from TA_Manual_Att,ent_employee_personal_dtls " +
                            " inner join ENT_EMPLOYEE_OFFICIAL_DTLS " +
                            " on EPD_EMPID=EOD_EMPID " +
                            " where  TA_Manual_Att.MA_EMPID=ent_employee_personal_dtls.epd_empid  " +
                            " and MA_ISDELETED='0' and EPD_ISDELETED='0' and EOD_ACTIVE='1'  ";

            SqlDataAdapter da = new SqlDataAdapter(strsql, m_connectons);
            DataTable      dt = new DataTable();

            da.Fill(dt);
            if (txtCompanyId.Text.ToString() == "" && txtCompanyName.Text.ToString() == "")
            {
                cmdReset_Click(sender, e);
            }
            else
            {
                String[,] values =
                {
                    { "MA_EMPID~" + txtCompanyId.Text.Trim(), "S" },
                    { "name~" + txtCompanyName.Text.Trim(),   "S" }
                };
                DataTable _tempDT = new DataTable();
                Search    _sc     = new Search();
                if (_tempDT != null)
                {
                    _tempDT.Rows.Clear();
                }
                _tempDT = _sc.searchTable(values, dt);
                gvManualAttnd.DataSource = _tempDT;
                gvManualAttnd.DataBind();
                if (_tempDT.Rows.Count > 0)
                {
                    btnDelete.Enabled = true;
                    btnSearch.Enabled = true;
                    DropDownList ddl = (DropDownList)gvManualAttnd.BottomPagerRow.FindControl("ddlPageNo");
                    for (int i = 1; i <= gvManualAttnd.PageCount; i++)
                    {
                        ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                    }
                    ddl.SelectedValue = (gvManualAttnd.PageIndex + 1).ToString();
                    Label lblcount = (Label)gvManualAttnd.BottomPagerRow.FindControl("lblTotal");
                    lblcount.Text = ((DataTable)gvManualAttnd.DataSource).Rows.Count.ToString() + " Records.";
                    if (gvManualAttnd.PageCount == 0)
                    {
                        ((Button)gvManualAttnd.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                        ((Button)gvManualAttnd.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                    }
                    if (gvManualAttnd.PageIndex + 1 == gvManualAttnd.PageCount)
                    {
                        ((Button)gvManualAttnd.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                    }
                    if (gvManualAttnd.PageIndex == 0)
                    {
                        ((Button)gvManualAttnd.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                    }
                    //((Label)gvManualAttnd.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((gvManualAttnd.PageSize * gvManualAttnd.PageIndex) + 1) + " to " + (gvManualAttnd.PageSize * (gvManualAttnd.PageIndex + 1));

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

                    gvManualAttnd.BottomPagerRow.Visible = true;
                }
                else
                {
                    btnDelete.Enabled = false;
                    btnSearch.Enabled = false;
                }
            }
        }
Exemplo n.º 17
0
        protected void bindDataGrid()
        {
            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlCommand cmd = new SqlCommand("USP_CARD_VIEW", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@strCommand", "SelectAll");
                cmd.Parameters.Add("@nvarUserId", EmpId);
                SqlDataAdapter da         = new SqlDataAdapter(cmd);
                DataSet        dsTemplate = new DataSet();
                da.Fill(dsTemplate);
                conn.Close();


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

                    gvCardView.BottomPagerRow.Visible = true;
                    btnDelete.Enabled = true;
                    btnSearch.Enabled = true;
                }
                else
                {
                    btnDelete.Enabled = false;
                    btnSearch.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "Card_View");
            }
        }
Exemplo n.º 18
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                lblMessages.Text = "";

                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlCommand cmd = new SqlCommand("USP_AdminAnnouncement", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@strCommand", "Select");
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                if (txtTodate.Text.ToString() == "" && txtFromDate.Text.ToString() == "")
                {
                    gvAnnouncement.DataSource = dt;
                    gvAnnouncement.DataBind();
                }
                else
                {
                    String[,] values =
                    {
                        { "dtFromDate~" + txtFromDate.Text.Trim(), "S" },
                        { "dtToDate~" + txtTodate.Text.Trim(),     "S" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt);
                    gvAnnouncement.DataSource = _tempDT;
                    gvAnnouncement.DataBind();
                }

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

                gvAnnouncement.BottomPagerRow.Visible = true;
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "AdminAnnouncement");
            }
        }
Exemplo n.º 19
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                string strsql = "";
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                strsql = "EXEC Sp_InsertUnicode @strCommand ='View'";

                SqlDataAdapter da = new SqlDataAdapter(strsql, conn);
                DataTable      dt = new DataTable();
                da.SelectCommand.CommandTimeout = 0;
                da.Fill(dt);
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }


                if (txtCtlrID.Text.ToString() == "" && txtCtlrDesc.Text.ToString() == "")
                {
                    gvView.DataSource = dt;
                    gvView.DataBind();
                }
                else
                {
                    String[,] values =
                    {
                        { "EMP_NAME~" + txtCtlrID.Text.Trim(),    "S" },
                        { "EPD_EMPID~" + txtCtlrDesc.Text.Trim(), "S" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT           = _sc.searchTable(values, dt);
                    gvView.DataSource = _tempDT;
                    gvView.DataBind();
                }

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

                gvView.BottomPagerRow.Visible = true;
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }
        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)
            {
            }
        }
Exemplo n.º 21
0
        public void bindDataGrid()
        {
            try
            {
                DataSet          ds;
                StringDictionary sd = new StringDictionary();
                sd.Add("@cmd", "0");
                ds = ExecuteSQL.ExecuteDataSet("PROC_ASSET_TAG_MASTER", sd);
                if (ds.Tables.Count > 0)
                {
                    if (txtTagNo.Text.ToString() == "" && txtTagStatus.Text.ToString() == "")
                    {
                        grdAsset.DataSource = ds.Tables[0];
                        grdAsset.DataBind();
                    }
                    else
                    {
                        DataTable _tempDT = new DataTable();
                        String[,] values =
                        {
                            { "TagEPCID~" + txtTagNo.Text.Trim(),      "S" },
                            { "CurStatus~" + txtTagStatus.Text.Trim(), "S" }
                        };
                        Search _sc = new Search();
                        if (_tempDT != null)
                        {
                            _tempDT.Rows.Clear();
                        }
                        _tempDT             = _sc.searchTable(values, ds.Tables[0]);
                        grdAsset.DataSource = _tempDT;
                        grdAsset.DataBind();
                    }
                    if (grdAsset.Rows.Count > 0)
                    {
                        DropDownList ddl = (DropDownList)grdAsset.BottomPagerRow.FindControl("ddlPageNo");
                        for (int i = 1; i <= grdAsset.PageCount; i++)
                        {
                            ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                        }
                        ddl.SelectedValue = (grdAsset.PageIndex + 1).ToString();
                        Label lblcount = (Label)grdAsset.BottomPagerRow.FindControl("lblTotal");
                        lblcount.Text = ((DataTable)grdAsset.DataSource).Rows.Count.ToString() + " Records.";
                        if (grdAsset.PageCount == 0)
                        {
                            ((Button)grdAsset.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                            ((Button)grdAsset.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                        }
                        if (grdAsset.PageIndex + 1 == grdAsset.PageCount)
                        {
                            ((Button)grdAsset.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                        }
                        if (grdAsset.PageIndex == 0)
                        {
                            ((Button)grdAsset.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                        }
                        ((Label)grdAsset.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((grdAsset.PageSize * grdAsset.PageIndex) + 1) + " to " + (grdAsset.PageSize * (grdAsset.PageIndex + 1));

                        grdAsset.BottomPagerRow.Visible = true;
                    }
                }
            }
            catch (Exception ex)
            {
                lblMessages.Text = ex.Message;
            }
        }
Exemplo n.º 22
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                String _strWhereClause = "";
                if (RBLDataType.SelectedValue.ToString() == "A")
                {
                    _strWhereClause = "where AE.Event_Type in('01','02')";
                }
                if (RBLDataType.SelectedValue.ToString() == "01")
                {
                    _strWhereClause = "where AE.Event_Type='01'";
                }
                if (RBLDataType.SelectedValue.ToString() == "02")
                {
                    _strWhereClause = "where AE.Event_Type='02'";
                }
                string strsql = "select AE.Event_ID," + _strDecodeForEVENTTYPE + ",AE.Event_Datetime ," + //AE.Event_Trace,"+
                                "Case when AE.Event_Employee_Code=NULL then NULL " +
                                "else ( select EMP.EPD_FIRST_NAME+' '+EMP.EPD_LAST_NAME from ENT_EMPLOYEE_PERSONAL_DTLS EMP where EMP.EPD_EMPID=AE.Event_Employee_Code) " +
                                "End as Empname, " +
                                "Case when AE.Event_Employee_Code=NULL then NULL else AE.Event_Employee_Code END as Event_Employee_Code, " +
                                "Case  When AE.Event_Reader_ID=NULL then NULL " +
                                "else ( Select READER_DESCRIPTION from ACS_READER where READER_ID=AE.Event_Reader_ID and CTLR_ID=AE.Event_Controller_ID) END as ReaderD ," +
                                "Case When AE.Event_Controller_ID=NULL then NULL " +
                                "else ( Select CTLR_DESCRIPTION from ACS_CONTROLLER where CTLR_ID= AE.Event_Controller_ID) END as CtrlD, " +
                                _strDecodeForCARDSTATUS + "," + _strDecodeForALARMTYPE + "," + _strDecodeForALARMACTION + " " +
                                " ,Event_Card_Code " +
                                "from ACS_Events AE " + _strWhereClause + " and Convert(varchar(20), AE.Event_Datetime, 101)= Convert(varchar(20), getdate(), 101) " +
                                "order by  AE.Event_Datetime desc ";

                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlCommand cmd = new SqlCommand(strsql, conn);
                cmd.CommandType = CommandType.Text;
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.SelectCommand.CommandTimeout = 0;
                DataTable dt = new DataTable();
                da.Fill(dt);
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }

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

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

                gvEvent.BottomPagerRow.Visible = true;
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "HolidayView");
            }
        }
Exemplo n.º 23
0
        protected void btnSearchDisbled_Click(object sender, EventArgs e)
        {
            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }

                SqlCommand cmd = new SqlCommand("spGetEnableRecords", conn);
                cmd.CommandType = CommandType.StoredProcedure;
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.SelectCommand.CommandTimeout = 0;
                DataTable dt = new DataTable();
                da.Fill(dt);
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }

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

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

                gvDisabled.BottomPagerRow.Visible = true;
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "VehicleAdministration");
            }
        }
Exemplo n.º 24
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                string strsql = "";
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                //strsql = " select COMPANY_ID,COMPANY_NAME,COMPANY_ADDRESS,COMPANY_RO_ADDRESS1,COMPANY_RO_ADDRESS1," +
                //        " COMPANY_PHONE1,COMPANY_PHONE2,COMPANY_PIN,COMPANY_RO_PIN,COMPANY_RO_PHONE1,COMPANY_RO_PHONE2," +
                //        " COMPANY_CITY,COMPANY_RO_CITY,COMPANY_STATE,COMPANY_RO_STATE from ENT_COMPANY  WHERE COMPANY_ISDELETED = '0'";

                strsql = " select emp.EPD_EMPID as cc_emp_id ,emp.EPD_CARD_ID as CARD_CODE ,pin,usecount,ignore_apb, " +
                         " status,Convert(varchar,activation_date,103) as activation_date, " +
                         " Convert(varchar,expiry_date,103) as expiry_date FROM  " +
                         " ENT_EMPLOYEE_PERSONAL_DTLS emp inner join  " +
                         " ACS_CARD_CONFIG on(emp.EPD_EMPID=ACS_CARD_CONFIG.cc_emp_id) " +
                         " inner join ENT_EMPLOYEE_OFFICIAL_DTLS eod " +
                         " on emp.EPD_EMPID=eod.EOD_EMPID " +
                         " where emp.epd_isdeleted='0' and eod.EOD_ACTIVE='1' ";



                SqlDataAdapter da = new SqlDataAdapter(strsql, conn);
                DataTable      dt = new DataTable();
                da.SelectCommand.CommandTimeout = 0;
                da.Fill(dt);
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }


                if (textzoneid.Text.ToString() == "" && textzonename.Text.ToString() == "")
                {
                    gvCardConfig.DataSource = dt;
                    gvCardConfig.DataBind();
                }
                else
                {
                    String[,] values =
                    {
                        { "cc_emp_id ~" + textzoneid.Text.Trim(),   "S" },
                        { "CARD_CODE ~" + textzonename.Text.Trim(), "S" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt);
                    gvCardConfig.DataSource = _tempDT;
                    gvCardConfig.DataBind();
                }

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

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

                gvCardConfig.BottomPagerRow.Visible = true;
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
        }
Exemplo n.º 25
0
        protected void cmdSearch_Click(object sender, EventArgs e)
        {
            lblMessages.Text = "";
            string strsql = "  select   Rec_ID ,od_req_employee_id , " +
                            " convert(varchar(10),od_req_date,103) as od_req_date, " +
                            " convert(varchar(10),od_req_start_date,103) as od_req_start_date, " +
                            " convert(varchar(10),od_req_end_date,103) as od_req_end_date " +
                            " from TA_ODFDTR O  INNER JOIN ENT_EMPLOYEE_PERSONAL_DTLS E " +
                            " ON E.EPD_EMPID=O.od_req_employee_id " +
                            " INNER JOIN ENT_EMPLOYEE_OFFICIAL_DTLS EOD " +
                            " ON E.EPD_EMPID= EOD.EOD_EMPID " +
                            " and OD_IsDeleted = 0 AND EPD_ISDELETED='0' and EOD_ACTIVE='1' ";

            SqlDataAdapter daLVdetails = new SqlDataAdapter(strsql, AccessController.m_connecton);
            DataTable      dtLVdetails = new DataTable();

            daLVdetails.Fill(dtLVdetails);
            if (txtCompanyId.Text.ToString() == "" && txtCompanyName.Text.ToString() == "")
            {
                cmdReset_Click(sender, e);
            }
            else
            {
                String[,] values =
                {
                    { "LVREQ_RECID~" + txtCompanyId.Text.Trim(),   "S" },
                    { "LVREQ_EMPID~" + txtCompanyName.Text.Trim(), "S" }
                };
                DataTable _tempDT = new DataTable();
                Search    _sc     = new Search();
                if (_tempDT != null)
                {
                    _tempDT.Rows.Clear();
                }
                _tempDT = _sc.searchTable(values, dtLVdetails);
                gvLVDetails.DataSource = _tempDT;
                gvLVDetails.DataBind();
                if (_tempDT.Rows.Count > 0)
                {
                    btnDelete.Enabled = true;
                    btnSearch.Enabled = true;

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

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

                    gvLVDetails.BottomPagerRow.Visible = true;
                }
                else
                {
                    btnDelete.Enabled = false;
                    btnSearch.Enabled = false;
                }
            }
        }
Exemplo n.º 26
0
        protected void cmdSearch_Click(object sender, EventArgs e)
        {
            string strsql = " SELECT LVREQ_RECID,LVREQ_EMPID,convert(varchar(10),LVREQ_REQDATE,103) as LVREQ_REQDATE, " +
                            " LVREQ_LV_ID, convert(varchar(10),LVREQ_FROMDATE,103) as LVREQ_FROMDATE,convert(varchar(10),LVREQ_TODATE,103) as LVREQ_TODATE, " +
                            "  LVREQ_LVDAYS,LVTLEV_STATUS,LVREQ_SANCTION_EMPID  FROM TA_LEAVE_REQ inner join ENT_EMPLOYEE_PERSONAL_DTLS e " +
                            "  on LVREQ_EMPID=e.EPD_EMPID inner join ENT_EMPLOYEE_OFFICIAL_DTLS o " +
                            "  on e.EPD_EMPID=o.EOD_EMPID where LVREQ_IsDeleted = '0' and EPD_ISDELETED='0' " +
                            "  and EOD_ACTIVE='1' ORDER BY LVREQ_RECID DESC ";

            SqlDataAdapter daLVdetails = new SqlDataAdapter(strsql, AccessController.m_connecton);
            DataTable      dtLVdetails = new DataTable();

            daLVdetails.Fill(dtLVdetails);
            if (txtCompanyId.Text.ToString() == "" && txtCompanyName.Text.ToString() == "")
            {
                cmdReset_Click(sender, e);
            }
            else
            {
                String[,] values =
                {
                    { "LVREQ_EMPID~" + txtCompanyId.Text.Trim(),   "S" },
                    { "LVREQ_LV_ID~" + txtCompanyName.Text.Trim(), "S" }
                };
                DataTable _tempDT = new DataTable();
                Search    _sc     = new Search();
                if (_tempDT != null)
                {
                    _tempDT.Rows.Clear();
                }
                _tempDT = _sc.searchTable(values, dtLVdetails);
                gvLVDetails.DataSource = _tempDT;
                gvLVDetails.DataBind();
                if (_tempDT.Rows.Count > 0)
                {
                    DropDownList ddl = (DropDownList)gvLVDetails.BottomPagerRow.FindControl("ddlPageNo");
                    for (int i = 1; i <= gvLVDetails.PageCount; i++)
                    {
                        ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                    }
                    ddl.SelectedValue = (gvLVDetails.PageIndex + 1).ToString();
                    Label lblcount = (Label)gvLVDetails.BottomPagerRow.FindControl("lblTotal");
                    lblcount.Text = ((DataTable)gvLVDetails.DataSource).Rows.Count.ToString() + " Records.";
                    if (gvLVDetails.PageCount == 0)
                    {
                        ((Button)gvLVDetails.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                        ((Button)gvLVDetails.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                    }
                    if (gvLVDetails.PageIndex + 1 == gvLVDetails.PageCount)
                    {
                        ((Button)gvLVDetails.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                    }
                    if (gvLVDetails.PageIndex == 0)
                    {
                        ((Button)gvLVDetails.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                    }
                    //((Label)gvLVDetails.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((gvLVDetails.PageSize * gvLVDetails.PageIndex) + 1) + " to " + (gvLVDetails.PageSize * (gvLVDetails.PageIndex + 1));

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

                    gvLVDetails.BottomPagerRow.Visible = true;
                    btnDelete.Enabled = true;
                    btnSearch.Enabled = true;
                }
                else
                {
                    btnDelete.Enabled = false;
                    btnSearch.Enabled = false;
                }
            }
        }
Exemplo n.º 27
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                string strsql = "select etc_rowid as rowid, etc_emp_id, EPD_FIRST_NAME +' '+ EPD_LAST_NAME as Name , etc_minimum_swipe,etc_shiftcode,etc_weekend, " +
                                " etc_weekoff,convert(varchar,etc_shift_start_date,103) as etc_shift_start_date  " +
                                " from TNA_EMPLOYEE_TA_CONFIG conf inner join ENT_EMPLOYEE_PERSONAL_DTLS emp " +
                                " on conf.ETC_EMP_ID=emp.EPD_EMPID inner join ENT_EMPLOYEE_OFFICIAL_DTLS eop " +
                                " on emp.EPD_EMPID=eop.EOD_EMPID where ETC_ISDELETED='0' and emp.EPD_ISDELETED='0' and eop.EOD_ACTIVE='1' ";

                SqlDataAdapter da = new SqlDataAdapter(strsql, conn);
                da.SelectCommand.CommandTimeout = 0;
                DataTable dt = new DataTable();
                da.Fill(dt);
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                if (textempid.Text.ToString() == "" && textshiftid.Text.ToString() == "")
                {
                    bindDataGrid();
                }
                else
                {
                    String[,] values =
                    {
                        { "etc_emp_id~" + textempid.Text.Trim(),      "S" },
                        { "etc_shiftcode~" + textshiftid.Text.Trim(), "S" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt);
                    gvTimeAttendanceView.DataSource = _tempDT;
                    gvTimeAttendanceView.DataBind();
                }
                DropDownList ddl = (DropDownList)gvTimeAttendanceView.BottomPagerRow.FindControl("ddlPageNo");
                for (int i = 1; i <= gvTimeAttendanceView.PageCount; i++)
                {
                    ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                }
                ddl.SelectedValue = (gvTimeAttendanceView.PageIndex + 1).ToString();
                Label lblcount = (Label)gvTimeAttendanceView.BottomPagerRow.FindControl("lblTotal");
                lblcount.Text = ((DataTable)gvTimeAttendanceView.DataSource).Rows.Count.ToString() + " Records.";
                if (gvTimeAttendanceView.PageCount == 0)
                {
                    ((Button)gvTimeAttendanceView.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                    ((Button)gvTimeAttendanceView.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                }
                if (gvTimeAttendanceView.PageIndex + 1 == gvTimeAttendanceView.PageCount)
                {
                    ((Button)gvTimeAttendanceView.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                }
                if (gvTimeAttendanceView.PageIndex == 0)
                {
                    ((Button)gvTimeAttendanceView.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                }
                //((Label)gvTimeAttendanceView.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((gvTimeAttendanceView.PageSize * gvTimeAttendanceView.PageIndex) + 1) + " to " + (gvTimeAttendanceView.PageSize * (gvTimeAttendanceView.PageIndex + 1));
                ((Label)gvTimeAttendanceView.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((gvTimeAttendanceView.PageSize * gvTimeAttendanceView.PageIndex) + 1) + " to " + (((gvTimeAttendanceView.PageSize * (gvTimeAttendanceView.PageIndex + 1)) - 10) + gvTimeAttendanceView.Rows.Count);
                gvTimeAttendanceView.BottomPagerRow.Visible = true;
            }


            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "EmployeeTimeAttendanceView");
            }
        }
Exemplo n.º 28
0
        protected void bindDataGrid()
        {
            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlCommand cmd = new SqlCommand();
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandText    = "USP_Backup";
                cmd.Connection     = conn;
                cmd.CommandTimeout = 0;
                cmd.Parameters.AddWithValue("@strCommand", "selectAll");
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                DataSet        dt = new DataSet();
                da.Fill(dt);
                if (txtTodate.Text.ToString() == "" && txtDbName.Text.ToString() == "")
                {
                    gvBackupData.DataSource = dt.Tables[0];
                    gvBackupData.DataBind();
                }
                else
                {
                    String[,] values =
                    {
                        { "dbName~" + txtDbName.Text.Trim(),      "S" },
                        { "createdDate~" + txtTodate.Text.Trim(), "D" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt.Tables[0]);
                    gvBackupData.DataSource = _tempDT;
                    gvBackupData.DataBind();
                }
                if (dt.Tables[0].Rows.Count != 0)
                {
                    //  btnApprove.Enabled = true;
                    // btnDelete.Enabled = true;
                    DropDownList ddl = (DropDownList)gvBackupData.BottomPagerRow.FindControl("ddlPageNo");
                    for (int i = 1; i <= gvBackupData.PageCount; i++)
                    {
                        ddl.Items.Add(new ListItem(i.ToString(), i.ToString()));
                    }
                    ddl.SelectedValue = (gvBackupData.PageIndex + 1).ToString();
                    Label lblcount = (Label)gvBackupData.BottomPagerRow.FindControl("lblTotal");
                    lblcount.Text = ((DataTable)gvBackupData.DataSource).Rows.Count.ToString() + " Records.";
                    if (gvBackupData.PageCount == 0)
                    {
                        ((Button)gvBackupData.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                        ((Button)gvBackupData.BottomPagerRow.FindControl("btnNext")).Enabled     = false;
                    }
                    if (gvBackupData.PageIndex + 1 == gvBackupData.PageCount)
                    {
                        ((Button)gvBackupData.BottomPagerRow.FindControl("btnNext")).Enabled = false;
                    }
                    if (gvBackupData.PageIndex == 0)
                    {
                        ((Button)gvBackupData.BottomPagerRow.FindControl("btnPrevious")).Enabled = false;
                    }
                    ((Label)gvBackupData.BottomPagerRow.FindControl("lblShowing")).Text = "Showing " + ((gvBackupData.PageSize * gvBackupData.PageIndex) + 1) + " to " + (gvBackupData.PageSize * (gvBackupData.PageIndex + 1));

                    gvBackupData.BottomPagerRow.Visible = true;
                }
                else
                {
                    // btnDelete.Enabled = false;
                    btnRestore.Enabled = false;
                }
                if (dt.Tables[1].Rows.Count > 0)
                {
                    Label2.Text = "Last restored backup file - " + dt.Tables[1].Rows[0]["DbName"] + " Filepath: " + dt.Tables[1].Rows[0]["DbPath"] + " at " + dt.Tables[1].Rows[0]["RestoreTime"] + " by " + dt.Tables[1].Rows[0]["UserId"];
                }
            }
            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }
Exemplo n.º 29
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                //string strsql = "select id,vehicleName,entityId,VehicleRegistrationNumber,rfId,CONVERT(varchar(10),enrollmentDate,103) as enrollmentDate,CONVERT(varchar(10),rfidValidityDate,103) as rfidValidityDate  from veh_vehicleEnrollment where isdeleted=0";
                string strsql = "select * from veh_controller where isdeleted=0";
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlCommand cmd = new SqlCommand(strsql, conn);
                cmd.CommandType = CommandType.Text;
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.SelectCommand.CommandTimeout = 0;
                DataTable dt = new DataTable();
                da.Fill(dt);
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }

                if (txtControllerIDSerch.Text.ToString() == "" && txtControllerName.Text.ToString() == "")
                {
                    gvController.DataSource = dt;
                    gvController.DataBind();
                }
                else
                {
                    String[,] values =
                    {
                        { "controllerDescription~" + txtControllerName.Text.Trim(), "S" },
                        { "controllerID~" + txtControllerIDSerch.Text.Trim(),       "S" }
                    };
                    DataTable _tempDT = new DataTable();
                    Search    _sc     = new Search();
                    if (_tempDT != null)
                    {
                        _tempDT.Rows.Clear();
                    }
                    _tempDT = _sc.searchTable(values, dt);
                    gvController.DataSource = _tempDT;
                    gvController.DataBind();
                }
                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));

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

                gvController.BottomPagerRow.Visible = true;
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "VehicleErollment");
            }
        }
        public void bindDataGrid()
        {
            DataSet          ds;
            StringDictionary sd = new StringDictionary();

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

                    grdAsset.BottomPagerRow.Visible = true;
                }

                ddlAstType.DataSource     = ds.Tables[1];
                ddlAstType.DataValueField = "CODE";
                ddlAstType.DataTextField  = "VALUE";
                ddlAstType.DataBind();
                ddlAstType.Items.Insert(0, new ListItem("Select Type", "0"));
                ddlAstType.SelectedIndex   = 0;
                ddlEditType.DataSource     = ds.Tables[1];
                ddlEditType.DataValueField = "CODE";
                ddlEditType.DataTextField  = "VALUE";
                ddlEditType.DataBind();
                ddlEditType.Items.Insert(0, new ListItem("Select Type", "0"));
            }
        }