protected void DDLEmp_SelectedIndexChanged(object sender, EventArgs e) { try { string query = "select * from tbl_MSalary where employeeID ='" + DDLEmp.SelectedValue.Trim() + "'"; dt_ = DataAccess.DBConnection.GetDataTable(query); if (dt_.Rows.Count > 0) { HFMSalary_ID.Value = dt_.Rows[0]["MSal_ID"].ToString(); TB_BS.Text = dt_.Rows[0]["Basic_Sal"].ToString(); TB_INC.Text = dt_.Rows[0]["Incre"].ToString(); TB_SalPerDay.Text = dt_.Rows[0]["sal_per_day"].ToString(); TB_SalPerHR.Text = dt_.Rows[0]["sal_per_hr"].ToString(); TB_DyAbsnt.Text = dt_.Rows[0]["days_absnt"].ToString(); TB_DyAttn.Text = dt_.Rows[0]["days_attn"].ToString(); //Over Time TBHRS.Text = dt_.Rows[0]["ot_hrs"].ToString(); TBDays.Text = dt_.Rows[0]["ot_days"].ToString(); TBOTAmt.Text = dt_.Rows[0]["ot_amt"].ToString(); //Deduction TBAdvDTC.Text = dt_.Rows[0]["adv_deduction"].ToString(); TBLNDTC.Text = dt_.Rows[0]["loan_deduction"].ToString(); TBCrtnTyp.Text = dt_.Rows[0]["Ctns_typ"].ToString(); TBBtlsTyp.Text = dt_.Rows[0]["btls_typ"].ToString(); TBCrtnPric.Text = dt_.Rows[0]["rs_Ctns"].ToString(); TBBtlsPric.Text = dt_.Rows[0]["rs_btls"].ToString(); TB_BS.Focus(); } else { HFMSalary_ID.Value = ""; TB_BS.Text = "0"; TB_INC.Text = "0"; TB_SalPerDay.Text = "0"; TB_SalPerHR.Text = "0"; TB_DyAbsnt.Text = "0"; TB_DyAttn.Text = "0"; //Over Time TBHRS.Text = "0"; TBDays.Text = "0"; TBOTAmt.Text = "0"; //Deduction TBAdvDTC.Text = "0"; TBLNDTC.Text = "0"; TBCrtnTyp.Text = "-"; TBBtlsTyp.Text = "-"; TBCrtnPric.Text = "0"; TBBtlsPric.Text = "0"; TB_BS.Focus(); } } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true); lblalert.Text = ex.Message; } }
protected void GVEmp_RowCommand(object sender, GridViewCommandEventArgs e) { try { GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); if (e.CommandName == "Show") { string RPTID = Server.HtmlDecode(GVEmp.Rows[row.RowIndex].Cells[0].Text.ToString()); ScriptManager.RegisterStartupScript(this, this.GetType(), "onclick", "javascript:window.open( 'ReportViewer.aspx?ID=Salaryrpt&RPTID=" + RPTID + "','_blank','height=600px,width=600px,scrollbars=1');", true); } if (e.CommandName == "Select") { //GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); string EmpID = GVEmp.DataKeys[row.RowIndex].Values[0].ToString(); HFEmpSalID.Value = EmpID; dt_ = DBConnection.GetQueryData("select * from tbl_MSalary where MSal_ID = '" + HFEmpSalID.Value.Trim() + "'"); if (dt_.Rows.Count > 0) { DDLEmp.SelectedValue = dt_.Rows[0]["employeeID"].ToString(); HFMSalary_ID.Value = dt_.Rows[0]["MSal_ID"].ToString(); TB_BS.Text = dt_.Rows[0]["Basic_Sal"].ToString(); TB_INC.Text = dt_.Rows[0]["Incre"].ToString(); TB_SalPerDay.Text = dt_.Rows[0]["sal_per_day"].ToString(); TB_SalPerHR.Text = dt_.Rows[0]["sal_per_hr"].ToString(); TB_DyAbsnt.Text = dt_.Rows[0]["days_absnt"].ToString(); TB_DyAttn.Text = dt_.Rows[0]["days_attn"].ToString(); //Over Time TBHRS.Text = dt_.Rows[0]["ot_hrs"].ToString(); TBDays.Text = dt_.Rows[0]["ot_days"].ToString(); TBOTAmt.Text = dt_.Rows[0]["ot_amt"].ToString(); //Deduction TBAdvDTC.Text = dt_.Rows[0]["adv_deduction"].ToString(); TBLNDTC.Text = dt_.Rows[0]["loan_deduction"].ToString(); TBCrtnTyp.Text = dt_.Rows[0]["Ctns_typ"].ToString(); TBBtlsTyp.Text = dt_.Rows[0]["btls_typ"].ToString(); TBCrtnPric.Text = dt_.Rows[0]["rs_Ctns"].ToString(); TBBtlsPric.Text = dt_.Rows[0]["rs_btls"].ToString(); TB_BS.Focus(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true); lblalert.Text = "Not Record Found!"; } } } catch (Exception ex) { // throw; ScriptManager.RegisterStartupScript(this, this.GetType(), "isActive", "Alert();", true); lblalert.Text = ex.Message; } }