public string LoginUser(LoginDetails loginDetails) { try { objDALComponent.SetParameters("@Username", SqlDbType.VarChar, 50, loginDetails.UserName); objDALComponent.SetParameters("@UserPassword", SqlDbType.VarChar, 50, loginDetails.UserPassword); objDALComponent.SqlCommandText = "ValidateUser"; object y = objDALComponent.SelectRecordValue(); if (int.Parse(y.ToString()) > 0) return y.ToString(); else return null; } catch (SqlException sqlEx) { return sqlEx.Message.ToString(); } catch (Exception ex) { return ex.Message.ToString(); } //System.Web.Script.Serialization.JavaScriptSerializer serializer = // new System.Web.Script.Serialization.JavaScriptSerializer(); // List<Dictionary<string, object>> rows = // new List<Dictionary<string, object>>(); // Dictionary<string, object> row = null; // string s = { "Exception":"","":""}; }
public string LoginAdmin(LoginDetails loginDetails) { try { objDALComponent.SetParameters("@adminName", SqlDbType.VarChar, 50, loginDetails.UserName); objDALComponent.SetParameters("@adminPassword", SqlDbType.VarChar, 50, loginDetails.UserPassword); objDALComponent.SqlCommandText = "ValidateAdmin"; object y = objDALComponent.SelectRecordValue(); if (int.Parse(y.ToString()) > 0) return y.ToString(); else return null; } catch (SqlException sqlEx) { return sqlEx.Message.ToString(); } catch (Exception ex) { return ex.Message.ToString(); } }