/// <summary> /// Populeaza tabela cu judete /// </summary> public void PopulareTabela() { Index = listDataGrid.CurrentPageIndex * 30 + 1; Salaries.Business.AdminFunctii objAdminFunctii = new Salaries.Business.AdminFunctii(); listDataGrid.DataSource = objAdminFunctii.LoadInfoFunctii(); listDataGrid.DataBind(); }
/// <summary> /// Daca pagina de administrare a fost deschisa din AddAngajat cream functia care va face refresh la combo-ul cu functii /// </summary> private void CreateRefreshFunctionForAddAngajat() { string outStr = ""; //Lungu Andreea - 28.07.2008 string sirFunctii = GetSirFunctiiScutireImpozit(); sirFunctii = sirFunctii.Substring(1); sirFunctii = sirFunctii.Substring(0, sirFunctii.Length - 1); //Response.Write("<script>var window.opener.sirFunctii = "+sirFunctii+";</script>"); Response.Write("<script>window.opener.CreazaSirFunctii('" + sirFunctii + "');</script>"); //cream scriptul care va contine functia de refresh //ne bazam pe faptul ca se cunoaste numele selectului care contine functiile //initial se sterg toate intrarile din combo outStr += "<script> \r\n function RefreshAddAngajatPage() \r\n" + "{ \r\n" + "window.opener.DeleteFunctiiCombo(); \r\n" + " FillFunctiiCOmbo(); \r\n" + "} \r\n"; //acum se creeaza functie care adauga functiile din recordset //se foloseste o functie din AddAngajat ... FillFunctieCombo Salaries.Business.AdminFunctii objAdminFunctii = new Salaries.Business.AdminFunctii(); outStr += " function FillFunctiiCOmbo() \r\n" + "{ \r\n"; for (int i = 0; i < objAdminFunctii.LoadInfoFunctii().Tables[0].Rows.Count; i++) //for (int i=objAdminFunctii.LoadInfoFunctii().Tables[0].Rows.Count-1; i>=0; i--) { DataRow dataRow = objAdminFunctii.LoadInfoFunctii().Tables[0].Rows[i]; outStr += "window.opener.FillFunctieCombo('" + dataRow["Cod"].ToString() + " - " + dataRow["Nume"].ToString() + "'," + dataRow["FunctieID"].ToString() + ");"; } outStr += "} \r\n" + "</script>"; Response.Write(outStr); }
/// <summary> /// Se trece la pagina urmatoare in lista cu judete /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void listDataGrid_PageIndexChanged(Object sender, DataGridPageChangedEventArgs e) { Salaries.Business.AdminFunctii objAdminFunctii = new Salaries.Business.AdminFunctii(); DataSet dt = objAdminFunctii.LoadInfoFunctii(); CompletareTitlu(); listDataGrid.CurrentPageIndex = e.NewPageIndex; DataView dv = dt.Tables[0].DefaultView; listDataGrid.DataSource = dv; Index = (e.NewPageIndex * listDataGrid.PageSize) + 1; listDataGrid.DataBind(); }
//Lungu Andreea - 28.07.2008 private string GetSirFunctiiScutireImpozit() { Salaries.Business.AdminFunctii functii = new Salaries.Business.AdminFunctii(); DataSet ds = functii.LoadInfoFunctii(); string sirFunctii = "["; string sirFunctiiUnic = ""; for (int i = 0; i < ds.Tables[0].Rows.Count - 1; i++) { DataRow dr = ds.Tables[0].Rows[i]; string suportaScutire = ""; if ((bool)dr["PosibilaScutireImpozit"]) { suportaScutire = "Da"; } else { suportaScutire = "Nu"; } sirFunctiiUnic = "[" + dr["FunctieId"].ToString() + "," + dr["Cod"].ToString() + " - " + dr["Nume"].ToString() + "," + suportaScutire + "]"; sirFunctii += sirFunctiiUnic + ";"; //era cu "," } if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[ds.Tables[0].Rows.Count - 1]; string suportaScutire = ""; if ((bool)dr["PosibilaScutireImpozit"]) { suportaScutire = "Da"; } else { suportaScutire = "Nu"; } sirFunctiiUnic = "[" + dr["FunctieId"].ToString() + "," + dr["Cod"].ToString() + " - " + dr["Nume"].ToString() + "," + suportaScutire + "]"; sirFunctii += sirFunctiiUnic + "]"; } else { sirFunctii = "[]"; } return(sirFunctii); }