using Common.Helper; using Repository.DAO; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; using System.Web.UI.WebControls; namespace JMEAgentSystem.Library.Remittance { public class RemittanceLibrary : RemittanceDao { public bool CheckAuthentication(string functionId) { CheckSession(); if (!HasRight(functionId)) { HttpContext.Current.Response.Redirect(GetStatic.GetAuthenticationPage()); } return true; } public void CheckSession() { //var user = GetStatic.GetUser(); //if (string.IsNullOrWhiteSpace(user)) //{ // HttpContext.Current.Response.Redirect(GetStatic.GetLogoutPage()); //} //UserPool userPool = UserPool.GetInstance(); //var loggedUser = GetStatic.GetLoggedInUser(); //if (string.IsNullOrWhiteSpace(loggedUser.UserName)) //{ // HttpContext.Current.Response.Redirect(GetStatic.GetLogoutPage()); //} //if (!userPool.IsUserExists(GetStatic.GetUser())) //{ // HttpContext.Current.Response.Redirect(GetStatic.GetLogoutPage()); //} } public bool HasRight(string functionId) { //var applicationUserDao = new ApplicationUserDao(); //return applicationUserDao.HasRight(functionId, GetStatic.GetUser()); return true; } public void SetDDL(ref DropDownList ddl, string sql, string valueField, string textField, string valueToBeSelected, string label) { var ds = ExecuteDataset(sql); ListItem item = null; if (ds.Tables.Count == 0) { if (label != "") { item = new ListItem(label, ""); ddl.Items.Add(item); } return; } var dt = ds.Tables[0]; ddl.Items.Clear(); if (label != "") { item = new ListItem(label, ""); ddl.Items.Add(item); } foreach (DataRow row in dt.Rows) { item = new ListItem(); item.Value = row[valueField].ToString(); item.Text = row[textField].ToString(); if (row[valueField].ToString().ToUpper() == valueToBeSelected.ToUpper()) item.Selected = true; ddl.Items.Add(item); } } } }