public static void UpdatePermis(Permis per) { String connectionString = DataManager.OraConnString(); string query = " update utl_usergrant set allow_add= '" + per.AllowAdd + "', allow_edit= '" + per.AllowEdit + "', " + " allow_view= '" + per.AllowView + "', allow_delete= '" + per.AllowDelete + "', allow_print= '" + per.AllowPrint + "', " + " allow_autho= '" + per.AllowAutho + "' where upper(user_name)='" + per.UserName.ToUpper() + "' and mod_id='" + per.ModId + "'"; DataManager.ExecuteNonQuery(connectionString, query); }
public static void CreatePermis(Permis per) { String connectionString = DataManager.OraConnString(); string query = " insert into utl_usergrant (user_name,mod_id,allow_add,allow_edit,allow_view, " + " allow_delete,allow_print,allow_autho) values ( '" + per.UserName + "', " + " '" + per.ModId + "', '" + per.AllowAdd + "', '" + per.AllowEdit + "', " + " '" + per.AllowView + "', '" + per.AllowDelete + "', '" + per.AllowPrint + "', '" + per.AllowAutho + "')"; DataManager.ExecuteNonQuery(connectionString, query); }
protected void btnSave_Click(object sender, EventArgs e) { if (txtUserName.Text == "") { ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('Nothing to save!!');", true); } else { Permis per; DataTable dtPermis = (DataTable)Session["perm"]; foreach (DataRow dr in dtPermis.Rows) { per = PermisManager.getPermis(txtUserName.Text.ToString().Trim(), dr["mod_id"].ToString()); if (per == null) { per = new Permis(); per.UserName = txtUserName.Text.ToString().Trim(); per.ModId = dr["mod_id"].ToString(); per.AllowAdd = dr["allow_add"].ToString(); per.AllowEdit = dr["allow_Edit"].ToString(); per.AllowView = dr["allow_View"].ToString(); per.AllowDelete = dr["allow_delete"].ToString(); per.AllowPrint = dr["allow_print"].ToString(); per.AllowAutho = dr["allow_autho"].ToString(); PermisManager.CreatePermis(per); } else { if (per.AllowAdd != dr["allow_add"].ToString() | per.AllowEdit != dr["allow_Edit"].ToString() | per.AllowView != dr["allow_View"].ToString() | per.AllowDelete != dr["allow_delete"].ToString() | per.AllowPrint != dr["allow_print"].ToString() | per.AllowAutho != dr["allow_autho"].ToString()) { per.AllowAdd = dr["allow_add"].ToString(); per.AllowEdit = dr["allow_Edit"].ToString(); per.AllowView = dr["allow_View"].ToString(); per.AllowDelete = dr["allow_delete"].ToString(); per.AllowPrint = dr["allow_print"].ToString(); per.AllowAutho = dr["allow_autho"].ToString(); PermisManager.UpdatePermis(per); } } } ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('Saved successfully!!');", true); } }
protected void Page_Load(object sender, EventArgs e) { try { if (Session["user"] == null) { Response.Redirect("Default.aspx"); } else { string pageName = DataManager.GetCurrentPageName(); string modid = PermisManager.getModuleId(pageName); per = PermisManager.getUsrPermis(Session["user"].ToString().Trim().ToUpper(), modid); if (per != null && per.AllowView == "Y") { ((Label)Page.Master.FindControl("lblLogin")).Text = Session["wnote"].ToString(); ((LinkButton)Page.Master.FindControl("lbLogout")).Visible = true; } else { Response.Redirect("Default.aspx"); } } } catch { Response.Redirect("Default.aspx"); } txtOpenDate.Attributes.Add("onBlur", "formatdate('" + txtOpenDate.ClientID + "')"); if (!IsPostBack) { DataTable dtLvl = LvlManager.GetLevels(); dgLevel.DataSource = dtLvl; dgLevel.DataBind(); dgGlCoaGen.DataSource = LvlManager.GetLevelsGrid(); dgGlCoaGen.DataBind(); Populate(); TreeView1.CollapseAll(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { if (Session.SessionID != "" | Session.SessionID != null) { clsSession ses = clsSessionManager.getSession(Session.SessionID); if (ses != null) { Session["user"] = ses.UserId; Session["wnote"] = UsersManager.getUserName(ses.UserId); Session["book"] = "AMB"; string connectionString = DataManager.OraConnString(); SqlDataReader dReader; SqlConnection conn = new SqlConnection(); conn.ConnectionString = connectionString; SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "Select ID,user_grp,description from utl_userinfo where upper(user_name)=upper('" + Session["user"].ToString().ToUpper() + "') and status='A'"; conn.Open(); dReader = cmd.ExecuteReader(); string wnot = ""; if (dReader.HasRows == true) { while (dReader.Read()) { Session["userlevel"] = int.Parse(dReader["user_grp"].ToString()); wnot = dReader["description"].ToString(); } Session["wnote"] = wnot; Session["USER_ID"] = dReader["ID"].ToString(); cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "Select book_desc,company_address1,company_address2,separator_type from gl_set_of_books where book_name='" + Session["book"].ToString() + "' "; if (dReader.IsClosed == false) { dReader.Close(); } dReader = cmd.ExecuteReader(); if (dReader.HasRows == true) { while (dReader.Read()) { Session["septype"] = dReader["separator_type"].ToString(); Session["org"] = dReader["book_desc"].ToString(); Session["add1"] = dReader["company_address1"].ToString(); Session["add2"] = dReader["company_address2"].ToString(); } } } dReader.Close(); conn.Close(); } } } try { string pageName = DataManager.GetCurrentPageName(); string modid = PermisManager.getModuleId(pageName); per = PermisManager.getUsrPermis(Session["user"].ToString().Trim().ToUpper(), modid); if (per != null & per.AllowView == "Y") { ((Label)Page.Master.FindControl("lblLogin")).Text = Session["wnote"].ToString(); ((LinkButton)Page.Master.FindControl("lbLogout")).Visible = true; } else { Response.Redirect("Home.aspx?sid=sam"); } } catch { Response.Redirect("Default.aspx?sid=sam"); } if (!IsPostBack) { RefreshAll(); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { if (Session.SessionID != "" | Session.SessionID != null) { clsSession ses = clsSessionManager.getSession(Session.SessionID); if (ses != null) { Session["user"] = ses.UserId; Session["book"] = "AMB"; string connectionString = DataManager.OraConnString(); SqlDataReader dReader; SqlConnection conn = new SqlConnection(); conn.ConnectionString = connectionString; SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "Select user_grp,description from utl_userinfo where upper(user_name)=upper('" + Session["user"].ToString().ToUpper() + "') and status='A'"; conn.Open(); dReader = cmd.ExecuteReader(); string wnot = ""; if (dReader.HasRows == true) { while (dReader.Read()) { Session["userlevel"] = int.Parse(dReader["user_grp"].ToString()); wnot = "KHSC Mr. " + dReader["description"].ToString(); } Session["wnote"] = wnot; cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "Select book_desc,company_address1,company_address2,separator_type from gl_set_of_books where book_name='" + Session["book"].ToString() + "' "; if (dReader.IsClosed == false) { dReader.Close(); } dReader = cmd.ExecuteReader(); if (dReader.HasRows == true) { while (dReader.Read()) { Session["septype"] = dReader["separator_type"].ToString(); Session["org"] = dReader["book_desc"].ToString(); Session["add1"] = dReader["company_address1"].ToString(); Session["add2"] = dReader["company_address2"].ToString(); } } } dReader.Close(); conn.Close(); } } } try { //ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('" + Session.SessionID + "');", true); string pageName = DataManager.GetCurrentPageName(); string modid = PermisManager.getModuleId(pageName); per = PermisManager.getUsrPermis(Session["user"].ToString().Trim().ToUpper(), modid); if (per != null & per.AllowView == "Y") { ((Label)Page.Master.FindControl("lblLogin")).Text = Session["wnote"].ToString(); ((LinkButton)Page.Master.FindControl("lbLogout")).Visible = true; } else { Response.Redirect("Home.aspx?sid=sam"); } } catch { Response.Redirect("Default.aspx?sid=sam"); } if (!Page.IsPostBack) { DataTable dt = clsDesigManager.getDesigDetails(""); dgDesig.DataSource = dt; dgDesig.DataBind(); ddlMgrCode.Items.Clear(); string queryDesig = "select '' desig_code, '' desig_name union select desig_code,dbo.initcap(desig_name) desig_name from pmis_desig_code order by 2 desc"; util.PopulationDropDownList(ddlMgrCode, "Designation", queryDesig, "desig_name", "desig_code"); /*ddlGradeCode.Items.Clear(); * string queryScale = "select '' scale_detail_id, '' scale union select convert(scale_detail_id),scale from v_scale order by 2 desc"; * util.PopulationDropDownList(ddlGradeCode, "Scale", queryScale, "scale", "scale_detail_id"); */ ddlClass.Items.Clear(); string queryClass = "select '' class_id, '' class_name union select convert(varchar,class_id),class_name from pmis_class order by 2 desc"; util.PopulationDropDownList(ddlClass, "Scale", queryClass, "class_name", "class_id"); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { if (Session.SessionID != "" | Session.SessionID != null) { clsSession ses = clsSessionManager.getSession(Session.SessionID); if (ses != null) { Session["user"] = ses.UserId; Session["book"] = "AMB"; string connectionString = DataManager.OraConnString(); SqlDataReader dReader; SqlConnection conn = new SqlConnection(); conn.ConnectionString = connectionString; SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "Select user_grp,description from utl_userinfo where upper(user_name)=upper('" + Session["user"].ToString().ToUpper() + "') and status='A'"; conn.Open(); dReader = cmd.ExecuteReader(); string wnot = ""; if (dReader.HasRows == true) { while (dReader.Read()) { Session["userlevel"] = int.Parse(dReader["user_grp"].ToString()); wnot = dReader["description"].ToString(); } Session["wnote"] = wnot; cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "Select book_desc,company_address1,company_address2,separator_type from gl_set_of_books where book_name='" + Session["book"].ToString() + "' "; if (dReader.IsClosed == false) { dReader.Close(); } dReader = cmd.ExecuteReader(); if (dReader.HasRows == true) { while (dReader.Read()) { Session["septype"] = dReader["separator_type"].ToString(); Session["org"] = dReader["book_desc"].ToString(); Session["add1"] = dReader["company_address1"].ToString(); Session["add2"] = dReader["company_address2"].ToString(); } } } dReader.Close(); conn.Close(); } } } try { string pageName = DataManager.GetCurrentPageName(); string modid = PermisManager.getModuleId(pageName); per = PermisManager.getUsrPermis(Session["user"].ToString().Trim().ToUpper(), modid); if (per != null && per.AllowView == "Y") { ((Label)Page.Master.FindControl("lblLogin")).Text = Session["wnote"].ToString(); ((LinkButton)Page.Master.FindControl("lbLogout")).Visible = true; } else { Response.Redirect("Default.aspx?sid=sam"); } } catch { Response.Redirect("Default.aspx?sid=sam"); } if (!IsPostBack) { try { DataTable dt = StudentManager.GetStudentAllCurrentStatus("", "", "", ""); dgPayHistory.DataSource = dt; dgPayHistory.DataBind(); } catch (FormatException fex) { ClientScript.RegisterStartupScript(this.GetType(), "Warning", "alert('" + fex.Message + "');", true); } catch (Exception ex) { if (ex.Message.Contains("Database")) { ClientScript.RegisterStartupScript(this.GetType(), "Warning", "alert('Database Maintain Error. Contact to the Software Provider..!!');", true); } else { ClientScript.RegisterStartupScript(this.GetType(), "Warning", "alert('There is some problem to do the task. Try again properly.!!');", true); } } } }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { if (Session.SessionID != "" | Session.SessionID != null) { clsSession ses = clsSessionManager.getSession(Session.SessionID); if (ses != null) { Session["user"] = ses.UserId; Session["book"] = "AMB"; string connectionString = DataManager.OraConnString(); using (SqlConnection conn = new SqlConnection(connectionString)) { string query = "Select user_grp,description from utl_userinfo where upper(user_name)=upper('" + Session["user"].ToString().ToUpper() + "') and status='A'"; using (SqlCommand cmd = new SqlCommand(query, conn)) { cmd.CommandType = CommandType.Text; conn.Open(); using (SqlDataReader dreader = cmd.ExecuteReader()) { if (dreader.HasRows == true) { while (dreader.Read()) { Session["userlevel"] = int.Parse(dreader["user_grp"].ToString()); Session["wnote"] = "Welcome Mr. " + dreader["description"].ToString(); } } } } } using (SqlConnection conn = new SqlConnection(connectionString)) { string query = "Select book_desc,company_address1,company_address2,separator_type from gl_set_of_books where book_name='" + Session["book"].ToString() + "' "; using (SqlCommand cmd = new SqlCommand(query, conn)) { cmd.CommandType = CommandType.Text; conn.Open(); using (SqlDataReader dreader = cmd.ExecuteReader()) { if (dreader.HasRows == true) { while (dreader.Read()) { Session["septype"] = dreader["separator_type"].ToString(); Session["org"] = dreader["book_desc"].ToString(); Session["add1"] = dreader["company_address1"].ToString(); Session["add2"] = dreader["company_address2"].ToString(); } } } } } } } } try { //ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('" + ViewState.ViewStateID + "');", true); string pageName = DataManager.GetCurrentPageName(); string modid = PermisManager.getModuleId(pageName); per = PermisManager.getUsrPermis(Session["user"].ToString().Trim().ToUpper(), modid); if (per != null && per.AllowView == "Y") { ((Label)Page.Master.FindControl("lblLogin")).Text = Session["wnote"].ToString(); ((LinkButton)Page.Master.FindControl("lbLogout")).Visible = true; } else { Response.Redirect("Default.aspx?sid=sam"); } } catch { //ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('"+ex.Message+"!!');", true); Response.Redirect("Default.aspx?sid=sam"); } if (!IsPostBack) { } }
protected void Page_Load(object sender, EventArgs e) { if (Session["user"] == null) { if (Session.SessionID != "" | Session.SessionID != null) { clsSession ses = clsSessionManager.getSession(Session.SessionID); if (ses != null) { Session["user"] = ses.UserId; Session["book"] = "AMB"; string connectionString = DataManager.OraConnString(); SqlDataReader dReader; SqlConnection conn = new SqlConnection(); conn.ConnectionString = connectionString; SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "Select user_grp,description from utl_userinfo where upper(user_name)=upper('" + Session["user"].ToString().ToUpper() + "') and status='A'"; conn.Open(); dReader = cmd.ExecuteReader(); string wnot = ""; if (dReader.HasRows == true) { while (dReader.Read()) { Session["userlevel"] = int.Parse(dReader["user_grp"].ToString()); wnot = "KHSC Mr. " + dReader["description"].ToString(); } Session["wnote"] = wnot; cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandType = CommandType.Text; cmd.CommandText = "Select book_desc,company_address1,company_address2,separator_type from gl_set_of_books where book_name='" + Session["book"].ToString() + "' "; if (dReader.IsClosed == false) { dReader.Close(); } dReader = cmd.ExecuteReader(); if (dReader.HasRows == true) { while (dReader.Read()) { Session["septype"] = dReader["separator_type"].ToString(); Session["org"] = dReader["book_desc"].ToString(); Session["add1"] = dReader["company_address1"].ToString(); Session["add2"] = dReader["company_address2"].ToString(); } } } dReader.Close(); conn.Close(); } } } try { //ClientScript.RegisterStartupScript(this.GetType(), "ale", "alert('" + Session.SessionID + "');", true); string pageName = DataManager.GetCurrentPageName(); string modid = PermisManager.getModuleId(pageName); per = PermisManager.getUsrPermis(Session["user"].ToString().Trim().ToUpper(), modid); if (per != null & per.AllowView == "Y") { ((Label)Page.Master.FindControl("lblLogin")).Text = Session["wnote"].ToString(); ((LinkButton)Page.Master.FindControl("lbLogout")).Visible = true; } else { Response.Redirect("Home.aspx?sid=sam"); } } catch { Response.Redirect("Default.aspx?sid=sam"); } if (!Page.IsPostBack) { //string queryBank = "select '' BANK_ID, '' BANK_NAME union select BANK_ID,BANK_NAME from BANK_INFO order by 1"; //util.PopulationDropDownList(ddlBankNo, "Bank", queryBank, "BANK_NAME", "BANK_ID"); } }
/// <summary> /// Ajoute une nouvelle civilité à la liste à l'aide d'une nouvelle fenêtre /// </summary> public Permis Add() { //Affichage du message "ajout en cours" ((App)App.Current)._theMainWindow.parametreMain.progressBarMainWindow.IsIndeterminate = true; ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Ajout d'un permis en cours ..."; //Initialisation de la fenêtre PermisWindowParametre permisWindow = new PermisWindowParametre(); //Création de l'objet temporaire Permis tmp = new Permis(); //Mise de l'objet temporaire dans le datacontext permisWindow.DataContext = tmp; //booléen nullable vrai ou faux ou null bool? dialogResult = permisWindow.ShowDialog(); if (dialogResult.HasValue && dialogResult.Value == true) { //Si j'appuie sur le bouton Ok, je renvoi l'objet banque se trouvant dans le datacontext de la fenêtre return (Permis)permisWindow.DataContext; } else { try { //On détache la commande ((App)App.Current).mySitaffEntities.Detach((Permis)permisWindow.DataContext); } catch (Exception) { } //Si j'appuie sur le bouton annuler, je préviens que j'annule mon ajout ((App)App.Current)._theMainWindow.parametreMain.progressBarMainWindow.IsIndeterminate = false; this.recalculMax(); ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Ajout d'un permis annulé : " + this.mesPermis.Count() + " / " + this.max; return null; } }
/// <summary> /// Met à jour l'état en bas pour l'utilisateur /// </summary> /// <param name="typeEtat">texte : "Filtrage", "Ajout", "Modification", "Suppression", "Look", "" ("" = Chargement)</param> /// <param name="dao">un objet Commande_Fournisseur soit pour l'ajouter au listing, soit pour afficher qui a été modifié ou supprimé</param> public void MiseAJourEtat(string typeEtat, Permis lib) { //Je racalcul le nombre max d'élements this.recalculMax(); //En fonction de l'libion, j'affiche le message if (typeEtat == "Filtrage") { ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "filtrage des permis terminé : " + this.mesPermis.Count() + " / " + this.max; } else if (typeEtat == "Ajout") { //J'ajoute la commande_fournisseur dans le linsting this.mesPermis.Add(lib); //Je racalcul le nombre max d'élements après l'ajout this.recalculMax(); ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Ajout d'un permis dénommé '" + lib.Libelle + "' effectué avec succès. Nombre d'élements : " + this.mesPermis.Count() + " / " + this.max; } else if (typeEtat == "Modification") { //Je raffraichis mon datagrid this._DataGridMain.Items.Refresh(); ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Modification d'un permis dénommé : '" + lib.Libelle + "' effectuée avec succès. Nombre d'élements : " + this.mesPermis.Count() + " / " + this.max; } else if (typeEtat == "Suppression") { //Je supprime de mon listing l'élément supprimé this.mesPermis.Remove(lib); //Je racalcul le nombre max d'élements après la suppression this.recalculMax(); ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Suppression d'un permis dénommé : '" + lib.Libelle + "' effectuée avec succès. Nombre d'élements : " + this.mesPermis.Count() + " / " + this.max; } else if (typeEtat == "Look") { } else { ((App)App.Current)._theMainWindow.parametreMain.textBlockMainWindow.Text = "Chargement des permis terminé : " + this.mesPermis.Count() + " / " + this.max; } //Je retri les données dans le sens par défaut this.triDatas(); //J'arrete la progressbar ((App)App.Current)._theMainWindow.parametreMain.progressBarMainWindow.IsIndeterminate = false; }