Exemplo n.º 1
0
        private void FillDivisionEntity()
        {
            try
            {
                string strSql = "";

                strSql = "SELECT oce_id as ID,replace(convert(char(20),ltrim(OCE_DESCRIPTION  )) + oce_id,' ',' ' ) as NAME FROM ent_org_common_entities where cem_entity_id='DIV' and  oce_isdeleted='0'";

                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlCommand     cmd         = new SqlCommand(strSql, conn);
                SqlDataAdapter adpt        = new SqlDataAdapter(cmd);
                DataSet        thisDataSet = new DataSet();
                adpt.Fill(thisDataSet);

                LstDivision.DataValueField = "ID";
                LstDivision.DataTextField  = "NAME";

                LstDivision.DataSource = thisDataSet.Tables[0];

                LstDivision.DataBind();
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "EmployeeManagerHierarchyAdd");
            }
        }
Exemplo n.º 2
0
        private void FillCompanyEntity()
        {
            try
            {
                string strSql = "";

                //strSql = "SELECT COMPANY_ID as ID,replace(convert(char(23),ltrim(COMPANY_NAME  ))+ COMPANY_ID,' ',' ' ) as NAME FROM ENT_COMPANY where COMPANY_ISDELETED='0'";
                strSql = "select zone_id,ZONE_DESCRIPTION from zone where ZONE_ISDELETED=0";
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlCommand     cmd         = new SqlCommand(strSql, conn);
                SqlDataAdapter adpt        = new SqlDataAdapter(cmd);
                DataSet        thisDataSet = new DataSet();
                adpt.Fill(thisDataSet);

                LstCompany.DataValueField = "zone_id";
                LstCompany.DataTextField  = "ZONE_DESCRIPTION";

                LstCompany.DataSource = thisDataSet.Tables[0];

                LstCompany.DataBind();
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "EmployeeManagerHierarchyAdd");
            }
        }
Exemplo n.º 3
0
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                clsCommon objCommon = new clsCommon();
                objCommon.ID          = txtID.Text.Trim();
                objCommon.ENTID       = lstFile.SelectedValue;
                objCommon.Description = txtDesc.Text.Trim();
                objCommon.CreatedBy   = Session["uid"].ToString();
                CMS.UNO.Core.Handler.clsCommonViewHandler.InsertCommonDetails(objCommon, "Insert", "", ref strErrMsg, ref strSuccMsg, clsCommonHandler.PageName());

                if (strErrMsg.Trim().Length >= 1)
                {
                    lblerror.Visible = true;
                    lblerror.Text    = strErrMsg;
                    mpeAddCommon.Show();
                    return;
                }
                else
                {
                    lblerror.Text         = strSuccMsg;
                    lblerror.Visible      = true;
                    txtID.Text            = "";
                    txtDesc.Text          = "";
                    lstFile.SelectedValue = "0";
                    lstFile.Focus();
                    mpeAddCommon.Show();
                    bindDataGrid();
                }
            }

            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }
Exemplo n.º 4
0
        public void fillModifydata(string strIdEmp)
        {
            try
            {
                string strsql = "select ess_OD_Empid as EmpCode,convert(VARCHAR(20),Ess_OD_fromdt,103) as FromDate, Convert(VARCHAR(20),Ess_OD_Todt,103) " +
                                " AS ToDate,Ess_OD_ODcd as ODCode, ESS_OD_RSNID, Case  ESS_OD_Status WHEN 'N' then 'Pending For Approval'" +
                                " when 'A' then 'Approved' When 'R' then 'Rejected' When 'C' then 'Cancelled' End as ESS_OD_Status, " +
                                " ESS_OD_REMARK from ESS_TA_OD where ESS_OD_RowId =  " + strIdEmp + "";
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlDataAdapter da = new SqlDataAdapter(strsql, conn);
                DataTable      dt = new DataTable();
                da.Fill(dt);

                strFrmdt = DateTime.ParseExact(dt.Rows[0]["FromDate"].ToString(), "dd/MM/yyyy", null).ToString("dd/MM/yyyy");

                strtodt = DateTime.ParseExact(dt.Rows[0]["ToDate"].ToString(), "dd/MM/yyyy", null).ToString("dd/MM/yyyy");


                txtFrmDate.Text = strFrmdt;

                txtTDate.Text             = strtodt;
                ddlReasonOD.SelectedValue = dt.Rows[0]["ESS_OD_RSNID"].ToString();
                txtRemark.Text            = dt.Rows[0]["ESS_OD_REMARK"].ToString();
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "ESS_TA_OD_View");
            }
        }
Exemplo n.º 5
0
        public void ModifyLeaveMaster(string strRowid)
        {
            try
            {
                clsLeaveFileView objData = clsLeaveFileViewHandler.GetLeaveDetails("FillEditData", Convert.ToInt32(strRowid));

                if (objData != null)
                {
                    txtModifyLeaveID.Text             = objData.LeaveID;
                    txtModifyLeaveDesc.Text           = objData.LeaveDescr;
                    cmbModifyPaidLeave.SelectedValue  = Convert.ToString(objData.IsPaid);
                    cmbModifyLeaveGroup.SelectedValue = objData.LeaveGroup;
                }
                else
                {
                    lblMessages.Visible = true;
                    lblMessages.Text    = "Records not found";
                }
            }
            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }
Exemplo n.º 6
0
 public bool RunExecuteNonQuery(string _strQuery, SqlConnection _sqlconn)
 {
     try
     {
         if (_sqlconn.State == ConnectionState.Closed)
         {
             _sqlconn.Open();
         }
         int        _result = 0;
         SqlCommand _sc     = new SqlCommand();
         _sc.Connection  = _sqlconn;
         _sc.CommandText = _strQuery;
         _result         = _sc.ExecuteNonQuery();
         if (_sqlconn.State == ConnectionState.Open)
         {
             _sqlconn.Close();
         }
         if (_result == 0)
         {
             return(false);
         }
         else
         {
             return(true);
         }
     }
     catch (Exception ex)
     {
         if (_sqlconn.State == ConnectionState.Open)
         {
             _sqlconn.Close();
         }
         UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "UpdateNetwork");
         return(false);
     }
 }
Exemplo n.º 7
0
        public void setControllers()
        {
            cmbContrller.Items.Clear();
            cmbContrller.Items.Add(new ListItem("ALL", "-1"));
            cmbContrller.SelectedValue = "-1";

            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                string    _strsql = "select CTLR_ID,CTLR_DESCRIPTION from ACS_CONTROLLER where CTLR_ISDELETED='0' ";
                DataTable _dt     = new DataTable();
                _dt = getDataTable(_strsql, conn);
                if (_dt.Rows.Count != 0)
                {
                    for (int i = 0; i <= _dt.Rows.Count - 1; i++)
                    {
                        cmbContrller.Items.Add(new ListItem(_dt.Rows[i][1].ToString(), _dt.Rows[i][0].ToString()));
                    }
                }
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "AcitvityBrowser");
            }
        }
Exemplo n.º 8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         //this.ddlMngrcode.Focus();
         if (!Page.IsPostBack)
         {
             FillManagerEntity();
             //FillEmployeeEntity();
             FillCompanyEntity();
             FillLocationEntity();
             FillDivisionEntity();
             FillDepartmentEntity();
             FillCategoryEntity();
             Page.ClientScript.RegisterStartupScript(typeof(System.String), this.ClientID, "<script>CacheValues();</script>");
             //FillEntitydrp();
             //FillManagerdrp();
         }
     }
     catch (Exception ex)
     {
         UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "EmployeeManagerHierarchyAdd");
     }
 }
Exemplo n.º 9
0
        public void UpdateLeaveData()
        {
            DateTime dtfromdt = DateTime.ParseExact(txtLeaveFrDt.Text, "dd/MM/yyyy", null);

            DateTime dtttodt = DateTime.ParseExact(TxtLeaveTodt.Text, "dd/MM/yyyy", null);

            TimeSpan difference = dtttodt - dtfromdt;
            int      LvDays     = difference.Days + 1;

            SqlConnection conn = new SqlConnection(m_connectons);

            conn.Open();

            SqlCommand objcmd = new SqlCommand();

            objcmd.Connection = conn;

            try
            {
                /*
                 * objcmd.CommandType = CommandType.Text;
                 * objcmd.CommandText = "Update TA_ODFDTR set OD_REQ_START_DATE = convert(datetime,'" + txtLeaveFrDt.Text + "',103), OD_REQ_END_DATE = convert(datetime,'" + TxtLeaveTodt.Text + "',103), " +
                 *                    "OD_REQ_DURATION = " + LvDays + ",OD_REQ_TYPE = '" + ddlODType.SelectedValue.ToString() + "',OD_REQ_REASONID = '" + ddlReasonType.SelectedValue.ToString() + "', " +
                 *                    "OD_REQ_REMARK = '" + txt_Remarks.Text.ToString() + "',OD_IsDeleted = 'False' where OD_REQ_EMPLOYEE_ID = '" + txtEmployeeCode.Text + "' and OD_REQ_DATE = convert(datetime,'" + Session["LeaveRequestDt"] + "',103) " +
                 *                    "and OD_REQ_START_DATE = convert(datetime,'" + Session["OldLeaveFrDate"] + "',103) and OD_REQ_END_DATE = convert(datetime,'" + Session["OldLeaveToDate"] + "',103) ";
                 */


                string txtEntity = "OD";

                objcmd.CommandType = CommandType.StoredProcedure;
                objcmd.CommandText = "Proc_Update_HRENTRY";

                objcmd.Parameters.AddWithValue("@pREQ_RECID", ViewState["OD_ID"].ToString());
                objcmd.Parameters.AddWithValue("@EntityFlag", txtEntity);
                objcmd.Parameters.AddWithValue("@ReasonCode", ddlReasonType.SelectedValue.ToString());
                objcmd.Parameters.AddWithValue("@Remarks", txt_Remarks.Text);
                objcmd.Parameters.AddWithValue("@LeaveCode", ddlODType.SelectedValue.ToString());

                // objcmd.Parameters.AddWithValue("@LeaveCode", LvDays);

                objcmd.Parameters.AddWithValue("@leaveFromdate", DateTime.ParseExact(txtLeaveFrDt.Text, "dd/MM/yyyy", null));

                if (TxtLeaveTodt.Text != "")
                {
                    objcmd.Parameters.AddWithValue("@leaveTodate", DateTime.ParseExact(TxtLeaveTodt.Text, "dd/MM/yyyy", null));
                }
                else
                {
                    objcmd.Parameters.AddWithValue("@leaveTodate", DateTime.ParseExact(txtLeaveFrDt.Text, "dd/MM/yyyy", null));
                }

                objcmd.Parameters.AddWithValue("@from_time", "");
                objcmd.Parameters.AddWithValue("@to_time", "");
                objcmd.Parameters.AddWithValue("@MA_Mode", "");


                objcmd.ExecuteNonQuery();
                // this.messageDiv.InnerHtml = "Record Saved Successfully";
                lblMessages.Text = "Record Updated Successfully";
                conn.Close();

                string someScript3 = "";
                // someScript3 = "<script language='javascript'>setTimeout(\"clearMessageDiv('messageDiv')\",2000);</script>";
                Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", someScript3);
            }

            catch (Exception ex)
            {
                //this.messageDiv.InnerHtml = ex.ToString();
                conn.Close();
                conn.Dispose();
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "OdEdit");
            }
        }
Exemplo n.º 10
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.º 11
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            bool   Check  = false;
            string SelStr = "";

            for (int i = 0; i < gvTimeAttendanceView.Rows.Count; i++)
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlCommand objcmd = new SqlCommand();
                objcmd.Connection = conn;
                //  SqlTransaction trans;
                // trans = conn.BeginTransaction();
                try
                {
                    // objcmd.Transaction = trans;
                    CheckBox delrows = (CheckBox)gvTimeAttendanceView.Rows[i].FindControl("DeleteRows");
                    if (delrows.Checked == true)
                    {
                        string Empcde = gvTimeAttendanceView.Rows[i].Cells[2].Text;

                        SelStr = "select TDAY_EMPCDE from TDAY where " +
                                 " TDAY_EMPCDE='" + Empcde + "'";
                        SqlDataAdapter da1 = new SqlDataAdapter(SelStr, conn);
                        da1.SelectCommand.CommandTimeout = 0;
                        DataTable dt = new DataTable();
                        da1.Fill(dt);
                        if (conn.State == ConnectionState.Open)
                        {
                            conn.Close();
                        }
                        int recordcnt = dt.Rows.Count;
                        if (recordcnt != 0)
                        {
                            //messageDiv.InnerHtml = "This Employee " + Empcde + " can not be deleted since it is already in use.";
                            lblMessages.Text    = "This Employee " + Empcde + " can not be deleted since it is already in use.";
                            lblMessages.Visible = true;
                            //Response.Write("<script language='javascript'>alert('select Records.');</script>");
                            return;
                        }
                        if (conn.State == ConnectionState.Closed)
                        {
                            conn.Open();
                        }
                        Check = true;
                        objcmd.CommandText = "update TNA_EMPLOYEE_TA_CONFIG set etc_isdeleted='1' ,etc_deleteddate = GETDATE() where ETC_EMP_ID='" + gvTimeAttendanceView.Rows[i].Cells[2].Text + "'";
                        objcmd.ExecuteNonQuery();
                        if (conn.State == ConnectionState.Open)
                        {
                            conn.Close();
                        }
                        //  trans.Commit();
                        //Response.Write("<script language='javascript'>alert('Controller deleted Successfully.');</script>");
                    }
                }
                catch (Exception ex)
                {
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "EmployeeTimeAttendanceView");
                    //  trans.Rollback();
                    // throw ex;
                }
            }
            if (Check == false)
            {
                lblMessages.Text    = "Please select record to delete.";
                lblMessages.Visible = true;
            }
            if (Check == true)
            {
                // messageDiv.InnerHtml = "Records Deleted Successfully";
                lblMessages.Text    = "Records Deleted Successfully";
                lblMessages.Visible = true;
                bindDataGrid();

                //string someScript = "";
                //someScript = "<script language='javascript'>setTimeout(\"clearFunction('LblMsg')\",2000);</script>";
                //Page.ClientScript.RegisterStartupScript(this.GetType(), "onload", someScript);



                return;
            }


            bindDataGrid();
        }
Exemplo n.º 12
0
        private void ShowReport()
        {
            try
            {
                ReportViewer1.LocalReport.ReportPath = "RDLC\\assetReport.rdlc";
                viewer.Visible        = true;
                ReportViewer1.Visible = true;

                SqlCommand cmd = new SqlCommand("PROC_ASSET_REPORT", conn);
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.CommandTimeout = 0;
                cmd.Parameters.AddWithValue("@cmd", 0);

                cmd.Parameters.AddWithValue("@strEmployeeHdn", EmployeeHdn.Value);
                cmd.Parameters.AddWithValue("@strComapnyHdn", ComapnyHdn.Value);
                cmd.Parameters.AddWithValue("@strLocationHdn", LocationHdn.Value);
                cmd.Parameters.AddWithValue("@strDivisionHdn", DivisionHdn.Value);
                cmd.Parameters.AddWithValue("@strDepartmentHdn", DepartmentHdn.Value);
                cmd.Parameters.AddWithValue("@strGradeHdn", GradeHdn.Value);
                cmd.Parameters.AddWithValue("@strGoupHdn", GroupHdn.Value);
                cmd.Parameters.AddWithValue("@fromDate", txtCalendarFrom.Text);
                cmd.Parameters.AddWithValue("@toDate", txtToDate.Text);

                DataSet        ds   = new DataSet();
                SqlDataAdapter adpt = new SqlDataAdapter(cmd);
                adpt.Fill(ds);

                string strReportHeader = "Generated on " + DateTime.Today.ToString("dd/MM/yyyy") + " at " + DateTime.Now.ToString("HH:mm") + " Hrs for ";


                string strReportHeader2 = "";
                if (txtCalendarFrom.Text == txtToDate.Text)
                {
                    strReportHeader = strReportHeader + txtCalendarFrom.Text;
                }
                else
                {
                    strReportHeader = strReportHeader + txtCalendarFrom.Text + " to " + txtToDate.Text;
                }
                ReportParameter para = new ReportParameter("myparameter1", strReportHeader);
                ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { para });


                ReportParameter para5 = new ReportParameter("user", Session["uid"].ToString() + " " + Session["loginName"].ToString());

                DataTable       dtReport = clsCommonHandler.GetReportHeader();
                ReportParameter header   = new ReportParameter("header", dtReport.Rows[0]["value"].ToString());
                ReportParameter address  = new ReportParameter("address", dtReport.Rows[1]["value"].ToString());

                ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { para5, header, address });

                ReportDataSource datasource = new ReportDataSource();
                datasource.Name  = "DataSet1";
                datasource.Value = ds.Tables[0];
                ReportViewer1.LocalReport.DataSources.Add(datasource);
                ReportViewer1.LocalReport.Refresh();

                HeadPnl.Visible   = false;
                HeadPanel.Visible = false;
            }

            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }
Exemplo n.º 13
0
        protected void gvController_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Modify")
                {
                    string id = e.CommandArgument.ToString();
                    ViewState["RowID"] = id;
                    if (conn.State == ConnectionState.Closed)
                    {
                        conn.Open();
                    }
                    string        selectData = "select * from veh_controller where id=" + id + "";
                    SqlCommand    cmdUpdate  = new SqlCommand(selectData, conn);
                    SqlDataReader dr         = cmdUpdate.ExecuteReader();
                    while (dr.Read())
                    {
                        if (dr["ControllerStatus"].ToString() == "Enabled")
                        {
                            ddlEditStatus.SelectedValue = "Enabled";
                        }
                        else
                        {
                            ddlEditStatus.SelectedValue = "Disabled";
                        }


                        txtEditControllerLoc.Text        = dr["location"].ToString();
                        txtEditControllerID.Text         = dr["controllerID"].ToString();
                        txtEdiControllerIp.Text          = dr["controllerIp"].ToString();
                        txtEditControllerDescrption.Text = dr["controllerDescription"].ToString();
                    }

                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                    lblMsg.Text = "";
                    mpeEditController.Show();
                }
                if (e.CommandName == "Remove")
                {
                    string id = e.CommandArgument.ToString();
                    ViewState["deleteRowID"] = id;
                    lblMsg.Text = "";
                    mpeDelController.Show();
                }
                if (e.CommandName == "ChangeStatus")
                {
                    lblMsg.Text = "";
                    string status = "", update = "";
                    if (conn.State == ConnectionState.Closed)
                    {
                        conn.Open();
                    }
                    string      id = e.CommandArgument.ToString();
                    LinkButton  lbtnAction;
                    GridViewRow row;
                    row        = (GridViewRow)((LinkButton)e.CommandSource).Parent.Parent;
                    lbtnAction = gvController.Rows[row.RowIndex].FindControl("lnlStatus") as LinkButton;
                    status     = lbtnAction.Text;

                    if (status == "Enabled")
                    {
                        update             = "update veh_controller set ControllerStatus='Disabled' where id='" + id + "'";
                        lbtnAction.ToolTip = "Click here to disable record";
                    }
                    else
                    {
                        lbtnAction.ToolTip = "Click here to Enable record";
                        update             = "update veh_controller set ControllerStatus='Enabled' where id='" + id + "'";
                    }
                    SqlCommand cmdUpdate = new SqlCommand(update, conn);
                    cmdUpdate.ExecuteNonQuery();
                    binddata();
                    if (conn.State == ConnectionState.Open)
                    {
                        conn.Close();
                    }
                }
                if (e.CommandName == "Reinit")
                {
                    try
                    {
                        string controllerId = e.CommandArgument.ToString();
                        if (conn.State == ConnectionState.Closed)
                        {
                            conn.Open();
                        }
                        SqlCommand cmd = new SqlCommand("sp_ReinitializeFlag", conn);
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@CtrlID", controllerId);
                        cmd.ExecuteNonQuery();

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

            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "AddController");
            }
        }
Exemplo n.º 14
0
        protected void btnDelete_Click1(object sender, EventArgs e)
        {
            try
            {
                bool Check  = false;
                bool marked = false;
                for (int i = 0; i < gvGP.Rows.Count; i++)
                {
                    if (conn.State == ConnectionState.Closed)
                    {
                        conn.Open();
                    }
                    SqlCommand objcmd = new SqlCommand();
                    objcmd.Connection = conn;
                    SqlTransaction trans = null;
                    try
                    {
                        trans = conn.BeginTransaction();
                        objcmd.Transaction = trans;
                        CheckBox delrows  = (CheckBox)gvGP.Rows[i].FindControl("DeleteRows");
                        Label    lblRowId = (Label)gvGP.Rows[i].FindControl("lblRowID");
                        if (delrows.Checked == true)
                        {
                            if (marked == false)
                            {
                                marked = true;
                            }

                            objcmd.CommandText = "Update ESS_TA_GP set ESS_GP_isdeleted = '1', ESS_GP_DELETEDDATE = convert(datetime,'" + manualattnddeletedate + "',103) where ESS_GP_Rowid = '" + lblRowId.Text + "' ";
                            objcmd.ExecuteNonQuery();

                            trans.Commit();
                            Check = true;
                        }
                        conn.Close();
                    }

                    catch (Exception ex)
                    {
                        trans.Rollback();
                        throw ex;
                    }
                }


                if (Check == true)
                {
                    lblMessages.Text    = "Record Deleted Successfully";
                    lblMessages.Visible = true;
                    chkMailConfiguration();
                    if (strMailOption == "Y")
                    {
                        SendMailDelete();
                    }
                }
                else if (marked == false)
                {
                    lblMessages.Text    = "Please select record to Delete";
                    lblMessages.Visible = true;
                }
                bindDataGrid();
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "ESS_TA_GP_View");
            }
        }
Exemplo n.º 15
0
        private void bindDataGrid()
        {
            try
            {
                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";


                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                SqlDataAdapter da = new SqlDataAdapter(strsql, conn);
                DataTable      dt = new DataTable();
                da.Fill(dt);
                gvGP.DataSource = dt;
                gvGP.DataBind();



                if (dt.Rows.Count != 0)
                {
                    btnSearch.Enabled = true;
                    btnDelete.Enabled = true;
                    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;
                }
                else
                {
                    btnSearch.Enabled = false;
                    btnDelete.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "ESS_TA_GP_View");
            }
        }
Exemplo n.º 16
0
        protected void gvCompany_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName == "Modify")
                {
                    lblErrorEdit.Text = "";
                    lstSShiftEdit.Items.Clear();
                    string    CompanyId = e.CommandArgument.ToString();
                    DataTable dt        = clsShiftPatternViewHandler.GetShiftDetails("GetEditData", CompanyId);

                    lstAShiftEdit.Items.Clear();
                    intializeControlEdit();
                    if (dt.Rows.Count > 0)
                    {
                        txtSpidEdit.Text        = dt.Rows[0]["SHIFT_PATTERN_ID"].ToString();
                        txtdescriptionEdit.Text = dt.Rows[0]["SHIFT_PATTERN_DESCRIPTION"].ToString();
                        cmbShiftPatternTypeEdit.SelectedValue = ((dt.Rows[0]["SHIFT_PATTERN_TYPE"].ToString() == "") ? "0" : dt.Rows[0]["SHIFT_PATTERN_TYPE"].ToString());
                        txtshiftEdit.Text               = dt.Rows[0]["SHIFT_PATTERN"].ToString();
                        txtSpidEdit.Enabled             = false;
                        cmbShiftPatternTypeEdit.Enabled = false;



                        if (cmbShiftPatternTypeEdit.SelectedItem.Text == "DAILY")
                        {
                            int index = lstAShiftEdit.Items.IndexOf(lstAShiftEdit.Items.FindByText("OFF"));
                            if (index >= 0)
                            {
                                lstAShiftEdit.Items.RemoveAt(index);
                            }
                            lstAShiftEdit.Items.Clear();

                            lstAShiftEdit.Items.Add(new ListItem("OFF", "OFF"));
                            intializeControlEdit();
                        }
                        else if (cmbShiftPatternTypeEdit.SelectedItem.Text != "SELECT ONE")
                        {
                            int index = lstAShiftEdit.Items.IndexOf(lstAShiftEdit.Items.FindByText("OFF"));
                            if (index >= 0)
                            {
                                lstAShiftEdit.Items.RemoveAt(index);
                            }
                            lstAShiftEdit.Items.Clear();

                            intializeControlEdit();
                        }

                        if (txtshiftEdit.Text != string.Empty)
                        {
                            string[] list = txtshiftEdit.Text.Split('-');
                            for (int count = 0; count < list.Length; count++)
                            {
                                int index = lstAShiftEdit.Items.IndexOf(lstAShiftEdit.Items.FindByValue(list[count]));
                                if (index == -1)
                                {
                                    lstSShiftEdit.Items.Add(new ListItem("OFF", "OFF"));
                                }
                                else
                                {
                                    lstAShiftEdit.SelectedIndex = index;
                                    lstSShiftEdit.Items.Add(new ListItem(lstAShiftEdit.SelectedItem.Text, lstAShiftEdit.SelectedItem.Value.ToString()));
                                }
                            }
                            lstAShiftEdit.SelectedIndex = 0;
                            lstSShiftEdit.SelectedIndex = 0;
                        }
                        else
                        {
                            lstAShiftEdit.SelectedIndex = 0;
                        }
                        mpeEditTC.Show();
                    }
                    else
                    {
                        lblMessages.Text    = "Records not found";
                        lblMessages.Visible = true;
                    }
                }
            }
            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }
Exemplo n.º 17
0
        public String getString()
        {
            String _strStatus = "";

            try
            {
                if (chkAll.Checked == true)
                {
                    _strStatus = "111111";
                }
                else
                {
                    if (chkAccessLevel.Checked == true)
                    {
                        _strStatus = "1";
                    }
                    else
                    {
                        _strStatus = "0";
                    }

                    if (chkAccessPoint.Checked == true)
                    {
                        _strStatus = _strStatus + "1";
                    }
                    else
                    {
                        _strStatus = _strStatus + "0";
                    }

                    if (chkController.Checked == true)
                    {
                        _strStatus = _strStatus + "1";
                    }
                    else
                    {
                        _strStatus = _strStatus + "0";
                    }


                    if (chkTimeZone.Checked == true)
                    {
                        _strStatus = _strStatus + "1";
                    }
                    else
                    {
                        _strStatus = _strStatus + "0";
                    }

                    if (chkUAC.Checked == true)
                    {
                        _strStatus = _strStatus + "1";
                    }
                    else
                    {
                        _strStatus = _strStatus + "0";
                    }

                    _strStatus = _strStatus + "0";
                }
                return(_strStatus);
            }
            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "UpdateNetwork");
                return("");
            }
        }
Exemplo n.º 18
0
        protected void gvHoliday_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                lblErrorEdit.Text = "";
                if (e.CommandName == "Modify")
                {
                    clsHoliday objHoliday = new clsHoliday();
                    string     HolidayID  = e.CommandArgument.ToString();
                    DataTable  dtLocation = clsHolidayHandler.GetHolidayLocationDetails(HolidayID, "HolidayLoc", ref objHoliday);

                    if (dtLocation.Rows.Count != 0)
                    {
                        chkSelectLocationEdit.SelectedIndex = 1;
                    }
                    else
                    {
                        chkSelectLocationEdit.SelectedIndex = 0;
                    }

                    if (chkSelectLocationEdit.SelectedIndex == 1)
                    {
                        divgvHolidayLocationsEdit.Attributes.Add("class", "divOverflow");
                    }
                    else
                    {
                        divgvHolidayLocationsEdit.Attributes.Add("class", "divHide");
                    }

                    for (int i = 0; i < gvHolidayLocationsEdit.Rows.Count; i++)
                    {
                        CheckBox  chkDeletebox    = (CheckBox)gvHolidayLocationsEdit.Rows[i].FindControl("DeleteRows");
                        CheckBox  EditOptChk      = (CheckBox)gvHolidayLocationsEdit.Rows[i].FindControl("optionalChk");
                        string    strHolidayLocID = gvHolidayLocationsEdit.Rows[i].Cells[1].Text;
                        string    strfilter       = " holiday_loc_id= '" + strHolidayLocID + "'";
                        DataRow[] drholiday       = dtLocation.Select(strfilter);
                        if (drholiday.Length > 0)
                        {
                            chkDeletebox.Checked = true;
                            if (drholiday[0][2].ToString().ToLower() == "true")
                            {
                                EditOptChk.Checked = true;
                            }
                            else
                            {
                                EditOptChk.Checked = false;
                            }
                        }
                        else
                        {
                            chkDeletebox.Checked = false;
                        }
                    }


                    txtHolidayIDEdit.Text               = objHoliday.HOLIDAY_ID;
                    txtDescriptionEdit.Text             = objHoliday.HOLIDAY_DESCRIPTION;
                    ddlHolidayTypeEdit.SelectedValue    = objHoliday.HOLIDAY_TYPE;
                    txtHolidayDateEdit.Text             = objHoliday.HOLIDAY_DATE;
                    txtSwapDateEdit.Text                = objHoliday.HOLIDAY_SWAP;
                    chkSelectLocationEdit.SelectedValue = objHoliday.HOLIDAY_LOCATION;
                    ViewState["OldLocation"]            = HolidayLocation(gvHolidayLocationsEdit, txtHolidayIDEdit.Text.Trim()).ToString();
                }

                if (ddlHolidayTypeEdit.SelectedValue.ToLower() == "n")
                {
                    chkSelectLocationEdit.Enabled = false;
                }
                else
                {
                    chkSelectLocationEdit.Enabled = true;
                }
                txtHolidayIDEdit.Enabled = false;
                mpeEditHolidays.Show();
            }

            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }
Exemplo n.º 19
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.º 20
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                bool Check  = false;
                bool marked = false;
                for (int i = 0; i < gvAnnouncement.Rows.Count; i++)
                {
                    if (conn.State == ConnectionState.Closed)
                    {
                        conn.Open();
                    }
                    SqlCommand objcmd = new SqlCommand("USP_AdminAnnouncement");
                    objcmd.Connection = conn;
                    SqlTransaction trans;
                    trans = conn.BeginTransaction();
                    try
                    {
                        objcmd.Transaction = trans;
                        CheckBox delrows  = (CheckBox)gvAnnouncement.Rows[i].FindControl("DeleteRows");
                        Label    lblRowId = (Label)gvAnnouncement.Rows[i].FindControl("lblRowID");
                        if (delrows.Checked == true)
                        {
                            if (marked == false)
                            {
                                marked = true;
                            }

                            // SqlCommand cmd = new SqlCommand("USP_AdminAnnouncement", conn);
                            objcmd.CommandType = CommandType.StoredProcedure;
                            objcmd.Parameters.AddWithValue("@strCommand", "Delete");
                            objcmd.Parameters.AddWithValue("@intID", lblRowId.Text);
                            objcmd.ExecuteNonQuery();
                            trans.Commit();
                            Check = true;
                        }
                        conn.Close();
                    }
                    catch (Exception ex)
                    {
                        trans.Rollback();
                        throw ex;
                    }
                }


                if (Check == true)
                {
                    lblMessages.Text    = "Record Deleted Successfully";
                    lblMessages.Visible = true;
                }
                else if (marked == false)
                {
                    lblMessages.Text    = "Please select record to Delete";
                    lblMessages.Visible = true;
                }
                bindDataGrid();
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "AdminAnnouncement");
            }
        }
Exemplo n.º 21
0
        protected void btnSearch_Click(object sender, EventArgs e)
        {
            try
            {
                DataTable dt = clsShiftPatternViewHandler.GetShiftDetails("All");

                if (txtCompanyID.Text.ToString() == "" && txtCompanyName.Text.ToString() == "")
                {
                    gvTempCard.DataSource = dt;
                    gvTempCard.DataBind();
                }
                else
                {
                    String[,] values =
                    {
                        { "SHIFT_PATTERN_ID~" + txtCompanyID.Text.Trim(),            "S" },
                        { "SHIFT_PATTERN_DESCRIPTION~" + 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();
                }
                if (gvTempCard.Rows.Count > 0)
                {
                    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)) - 10) + gvTempCard.Rows.Count);

                    gvTempCard.BottomPagerRow.Visible = true;
                }
            }
            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }
        protected void Modify_Data(string CATID)
        {
            try
            {
                clsCategory objData = clsCategoryMasterViewHandler.GetCategoryDetails("All", Convert.ToInt16(CATID));

                if (objData != null)
                {
                    ddlCategory.SelectedValue = objData.CatID;
                    ddlCategory.Visible       = true;
                    ddlCategory.Enabled       = false;

                    if (objData.EarlyGoing == "" || objData.EarlyGoing == "00:00")
                    {
                        Erl_Alwd.Text = "";
                    }
                    else
                    {
                        Erl_Alwd.Text = objData.EarlyGoing.ToString();
                    }
                    if (objData.LateComing == "" || objData.LateComing == "00:00")
                    {
                        Lt_Alwd.Text = "";
                    }
                    else
                    {
                        Lt_Alwd.Text = objData.LateComing.ToString();
                    }

                    if (objData.CatExtraCheck == true)
                    {
                        ChkAllowed.Checked = true;
                        Bef_Shft.Enabled   = true;
                        Aft_shft.Enabled   = true;
                        ErlD.Enabled       = true;
                        LtD.Enabled        = true;
                    }
                    else
                    {
                        ChkAllowed.Checked = false;
                        Bef_Shft.Enabled   = false;
                        Aft_shft.Enabled   = false;
                        ErlD.Enabled       = false;
                        LtD.Enabled        = false;
                    }
                    if (objData.ExtraHrsBeforeShiftHrs == "" || objData.EarlyGoing == "00:00")
                    {
                        Bef_Shft.Text = "";
                    }
                    else
                    {
                        Bef_Shft.Text = objData.ExtraHrsBeforeShiftHrs;
                    }
                    if (objData.ExtraHrsAfterShiftHrs == null || objData.EarlyGoing == "00:00")
                    {
                        Aft_shft.Text = "";
                    }
                    else
                    {
                        Aft_shft.Text = objData.ExtraHrsAfterShiftHrs;
                    }
                    Comp_Sts.Text = objData.CompensatoryCode;
                    if (objData.CompensatoryCode != "")
                    {
                        string Str = objData.CompensatoryCode;
                        if (Str.Contains("W1"))
                        {
                            ChkW1.Checked = true;
                        }
                        if (Str.Contains("W2"))
                        {
                            ChkW2.Checked = true;
                        }
                        if (Str.Contains("HO"))
                        {
                            ChkHO.Checked = true;
                        }
                        if (Str.Contains("WD"))
                        {
                            ChkWD.Checked = true;
                        }
                    }

                    if (objData.CatDeductedFromExtHrsEarlyGng == true)
                    {
                        ErlD.Checked = true;
                    }
                    else
                    {
                        ErlD.Checked = false;
                    }
                    if (objData.CatDeductedFromExtHrsLateCmg == true)
                    {
                        LtD.Checked = true;
                    }
                    else
                    {
                        LtD.Checked = false;
                    }
                }
            }
            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }
Exemplo n.º 23
0
        private void ShowReport()
        {
            try
            {
                SqlDataAdapter da;
                DataTable      dtData;
                SqlConnection  conn = new SqlConnection(m_connectons);
                ReportViewer1.LocalReport.ReportPath = "RDLC\\Emp_AndNon_Emp_Strength.rdlc";
                viewer.Visible        = true;
                ReportViewer1.Visible = true;
                SqlCommand cmd = new SqlCommand();
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.Connection     = conn;
                cmd.CommandTimeout = 0;
                cmd.CommandText    = "SAC_Emp_AndNon_Emp_Strength_Report";
                cmd.Parameters.AddWithValue("@EMP_ID", EmployeeHdn.Value);
                cmd.Parameters.AddWithValue("@Center", ComapnyHdn.Value);
                cmd.Parameters.AddWithValue("@Unit", LocationHdn.Value);
                cmd.Parameters.AddWithValue("@ENTITY", DivisionHdn.Value);
                cmd.Parameters.AddWithValue("@GROUP", DepartmentHdn.Value);
                cmd.Parameters.AddWithValue("@Division", GradeHdn.Value);
                cmd.Parameters.AddWithValue("@Section", GroupHdn.Value);
                cmd.Parameters.AddWithValue("@TODATE", txtToDate.Text);
                cmd.Parameters.AddWithValue("@FROM_DATE", txtCalendarFrom.Text);
                cmd.Parameters.AddWithValue("@EmpType", ddlPersonnelType.SelectedValue);
                dtData = new DataTable();
                da     = new SqlDataAdapter(cmd);
                da.Fill(dtData);


                String dataSetName = "EmpAndNonEmpReport";

                string          strReportHeader = "Generated on " + DateTime.Today.ToString("dd/MM/yyyy") + " at " + DateTime.Now.ToString("HH:mm") + " Hrs ";
                ReportParameter para            = new ReportParameter("myParameter1", strReportHeader);
                string          Header          = "";
                if (ddlPersonnelType.SelectedValue == "E")
                {
                    Header = "Employees Strength Report";
                }
                else
                {
                    Header = "Non-Employees Strength Report";
                }
                lblHeader.Text = Header;
                DataTable dt          = GroupBy("Employee", "Employee", dtData);
                string    strEmpCount = "0";

                if (dt.Rows.Count > 0)
                {
                    strEmpCount = dt.Rows[0]["Count"].ToString();
                }

                ReportParameter empTotal = new ReportParameter("EmpCount", strEmpCount);
                ReportParameter rpHeader = new ReportParameter("Header", Header);
                DataTable       dtReport = clsCommonHandler.GetReportHeader();
                ReportParameter header   = new ReportParameter("heading", dtReport.Rows[0]["value"].ToString());
                ReportParameter address  = new ReportParameter("address", dtReport.Rows[1]["value"].ToString());
                ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { para, empTotal, rpHeader, header, address });


                ReportDataSource datasource = new ReportDataSource();
                datasource.Name  = dataSetName;
                datasource.Value = dtData;
                ReportViewer1.LocalReport.DataSources.Add(datasource);
                ReportViewer1.LocalReport.Refresh();
                HeadPnl.Visible   = false;
                HeadPanel.Visible = false;
            }

            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }
        protected void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string Bef_sh  = "";
                string Aftr_Sh = "";
                string Erl     = "";
                string Lt      = "";

                if (ChkAllowed.Checked == true)
                {
                    Bef_sh  = Bef_Shft.Text;
                    Aftr_Sh = Aft_shft.Text;
                }
                else
                {
                    Bef_sh  = null;
                    Aftr_Sh = null;
                }

                if (Erl_Alwd.Text == "")
                {
                    Erl = null;
                }
                else
                {
                    Erl = Erl_Alwd.Text;
                }

                if (Lt_Alwd.Text == "")
                {
                    Lt = null;
                }
                else
                {
                    Lt = Lt_Alwd.Text;
                }

                clsCategory objData = new clsCategory();
                objData.CatID                         = ddlCategory.SelectedValue;
                objData.EarlyGoing                    = Erl;
                objData.LateComing                    = Lt;
                objData.CatExtraCheck                 = ChkAllowed.Checked == true ? true : false;
                objData.ExtraHrsBeforeShiftHrs        = Bef_sh;
                objData.ExtraHrsAfterShiftHrs         = Aftr_Sh;
                objData.CompensatoryCode              = Comp_Sts.Text.Trim();
                objData.CatDeductedFromExtHrsEarlyGng = ErlD.Checked == true ? true : false;
                objData.CatDeductedFromExtHrsLateCmg  = LtD.Checked == true ? true : false;
                objData.CreatedBy                     = Session["uid"].ToString();
                if (ViewState["PageMode"].ToString() != "Modify")
                {
                    clsCategoryMasterViewHandler.UpdateUserDetails(objData, "Insert", "", ref strErrMsg, ref strSuccMsg, clsCommonHandler.PageName());
                    if (strErrMsg.Length >= 1)
                    {
                        lblMessageAdd.Text    = strErrMsg;
                        lblMessageAdd.Visible = true;
                        return;
                    }
                    else
                    {
                        lblMessageAdd.Text        = strSuccMsg;
                        ddlCategory.SelectedIndex = 0;
                        Erl_Alwd.Text             = "";
                        Lt_Alwd.Text       = "";
                        Bef_Shft.Text      = "";
                        Aft_shft.Text      = "";
                        Comp_Sts.Text      = "";
                        ChkAllowed.Checked = false;
                        ChkW1.Checked      = false;
                        ChkW2.Checked      = false;
                        ChkHO.Checked      = false;
                        ChkWD.Checked      = false;
                        ErlD.Checked       = false;
                        LtD.Checked        = false;
                        ScriptManager.RegisterClientScriptBlock(updatepanel4, updatepanel4.GetType(), "Script", "validateChosen();", true);
                        mpeAddCategory.Show();
                    }
                }
                else
                {
                    clsCategoryMasterViewHandler.UpdateUserDetails(objData, "Update", "", ref strErrMsg, ref strSuccMsg, clsCommonHandler.PageName());
                    if (strErrMsg.Trim().Length >= 1)
                    {
                        lblMessages.Text = strErrMsg;
                    }
                    else
                    {
                        ddlCategory.SelectedIndex = 0;
                        Erl_Alwd.Text             = "";
                        Lt_Alwd.Text       = "";
                        Bef_Shft.Text      = "";
                        Aft_shft.Text      = "";
                        Comp_Sts.Text      = "";
                        ChkAllowed.Checked = false;
                        ChkW1.Checked      = false;
                        ChkW2.Checked      = false;
                        ChkHO.Checked      = false;
                        ChkWD.Checked      = false;
                        ErlD.Checked       = false;
                        LtD.Checked        = false;
                        mpeAddCategory.Hide();
                        lblMessages.Text = strSuccMsg;
                    }
                }


                bindDataGrid();
            }

            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }
Exemplo n.º 25
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.º 26
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.º 27
0
        public void binddata()
        {
            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }
                string         strGetData = "select * from veh_controller where isdeleted=0";
                SqlCommand     cmd        = new SqlCommand(strGetData, conn);
                DataTable      dt         = new DataTable();
                SqlDataAdapter dap        = new SqlDataAdapter(cmd);
                dap.Fill(dt);
                gvController.DataSource = dt;
                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;

                if (dt.Rows.Count != 0)
                {
                    btnSearch.Enabled = true;
                }
                else
                {
                    btnSearch.Enabled = false;
                }
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "VehicleErollment");
            }
        }
Exemplo n.º 28
0
        public void bindEnabledata()
        {
            try
            {
                if (conn.State == ConnectionState.Closed)
                {
                    conn.Open();
                }

                SqlCommand cmd1 = new SqlCommand("spGetDisableRecords", conn);
                cmd1.CommandType = CommandType.StoredProcedure;
                //string strGetData = "select id,vehicleName,entityId,userType,VehicleRegistrationNumber,rfId,CONVERT(varchar(10),enrollmentDate,103) as enrollmentDate,CONVERT(varchar(10),rfidValidityDate,103) as rfidValidityDate  from veh_vehicleEnrollment where isdeleted=0";
                //SqlCommand cmd = new SqlCommand(strGetData, conn);
                DataTable      dt  = new DataTable();
                SqlDataAdapter dap = new SqlDataAdapter(cmd1);
                dap.Fill(dt);
                gvEnabled.DataSource = dt;
                gvEnabled.DataBind();

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

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

                gvEnabled.BottomPagerRow.Visible = true;

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


                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
            }
            catch (Exception ex)
            {
                if (conn.State == ConnectionState.Open)
                {
                    conn.Close();
                }
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, "VehicleAdministration");
            }
        }
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");
            }
        }
Exemplo n.º 30
0
        private void ShowReport()
        {
            try
            {
                ReportViewer1.LocalReport.ReportPath = "RDLC\\EarlyOrLate.rdlc";
                viewer.Visible        = true;
                ReportViewer1.Visible = true;


                String        dataSetName = "DataSet1";
                SqlConnection conn        = new SqlConnection(m_connectons);
                SqlCommand    cmd         = new SqlCommand();
                cmd.CommandType    = CommandType.StoredProcedure;
                cmd.Connection     = conn;
                cmd.CommandTimeout = 0;
                cmd.CommandText    = "usp_rpt_getChronicLateEarlyDetails";
                cmd.Parameters.AddWithValue("@strEmployeeHdn", EmployeeHdn.Value);
                cmd.Parameters.AddWithValue("@strComapnyHdn", ComapnyHdn.Value);
                cmd.Parameters.AddWithValue("@strLocationHdn", LocationHdn.Value);
                cmd.Parameters.AddWithValue("@strDivisionHdn", DivisionHdn.Value);
                cmd.Parameters.AddWithValue("@strDepartmentHdn", DepartmentHdn.Value);
                cmd.Parameters.AddWithValue("@strGradeHdn", GradeHdn.Value);
                cmd.Parameters.AddWithValue("@strGoupHdn", GroupHdn.Value);
                cmd.Parameters.AddWithValue("@strFromDate", txtCalendarFrom.Text);
                cmd.Parameters.AddWithValue("@strToDate", txtToDate.Text);
                cmd.Parameters.AddWithValue("@strCheck", ddlReportType.SelectedValue == "1" ? "1" : ddlReportType.SelectedValue == "2" ? "2" : ddlReportType.SelectedValue == "0" ? "3" : "0");
                cmd.Parameters.AddWithValue("@Count", txtcount.Text.Trim() == "" ? 0 : Convert.ToInt16(txtcount.Text));
                cmd.Parameters.AddWithValue("@strPersonnelType", ddlPersonnelType.SelectedValue);

                DataTable      dtData = new DataTable();
                SqlDataAdapter da     = new SqlDataAdapter(cmd);
                da.Fill(dtData);

                string          param2, strLateEarly = "", strInOut = "", strAll = string.Empty;
                ReportParameter para3;
                if (dtData.Rows.Count > 0)
                {
                    para3 = new ReportParameter("count", dtData.Rows.Count.ToString());

                    ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { para3 });
                }
                else
                {
                    para3 = new ReportParameter("count", "0");

                    ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { para3 });
                }


                if (ddlReportType.SelectedValue == "1")
                {
                    param2 = "Chronic Late Report";
                }
                else if (ddlReportType.SelectedValue == "2")
                {
                    param2 = " Chronic Early Going Report";
                }
                else
                {
                    param2 = " Chronic Late/Early Going Report";
                }

                if (ddlReportType.SelectedValue == "1")
                {
                    strLateEarly = "Late By";
                    strInOut     = "In Time";
                    strAll       = "P";
                }
                else if (ddlReportType.SelectedValue == "2")
                {
                    strLateEarly = "Early Going";
                    strInOut     = "Out Time";
                    strAll       = "P";
                }
                else
                {
                    strLateEarly = "and";
                    strInOut     = "and";
                    strAll       = "A";
                }

                string strReportHeader = "Generated on " + DateTime.Today.ToString("dd/MM/yyyy") + " at " + DateTime.Now.ToString("HH:mm") + " Hrs for ";
                if (txtCalendarFrom.Text == txtToDate.Text)
                {
                    strReportHeader = strReportHeader + strDate;
                }
                else
                {
                    strReportHeader = strReportHeader + strDate + " to " + txtToDate.Text;
                }
                ReportParameter para         = new ReportParameter("myparameter1", strReportHeader);
                ReportParameter para2        = new ReportParameter("myparameter2", param2);
                DataTable       dtReport     = clsCommonHandler.GetReportHeader();
                ReportParameter header       = new ReportParameter("header", dtReport.Rows[0]["value"].ToString());
                ReportParameter address      = new ReportParameter("address", dtReport.Rows[1]["value"].ToString());
                ReportParameter parLateEarly = new ReportParameter("parLateEarly", strLateEarly);
                ReportParameter parInOut     = new ReportParameter("parInOut", strInOut);
                ReportParameter parAll       = new ReportParameter("parAll", strAll);
                ReportViewer1.LocalReport.SetParameters(new Microsoft.Reporting.WebForms.ReportParameter[] { para, para2, header, address, parAll, parInOut, parLateEarly });
                ReportDataSource datasource = new ReportDataSource();
                datasource.Name  = dataSetName;
                datasource.Value = dtData;
                ReportViewer1.LocalReport.DataSources.Add(datasource);
                ReportViewer1.LocalReport.Refresh();

                HeadPnl.Visible = false;
                //Panel1.Visible = false;
                HeadPanel.Visible = false;
            }

            catch (Exception ex)
            {
                UNOException.UNO_DBErrorLog(ex.Message, ex.StackTrace, clsCommonHandler.PageName());
            }
        }