public static DataAccessProvider CreateDataAccess(DataAccessProviderConfiguration objConfig) { if (objProvider != null) return objProvider; Type type = Type.GetType(((Provider) objConfig.Providers[objConfig.DefaultProvider]).ProviderType); objProvider = (DataAccessProvider)Activator.CreateInstance(type, AppEnv.GetConnectionString(((Provider)objConfig.Providers[objConfig.DefaultProvider]).ConnectionString)); return objProvider; }
public IHttpActionResult PostStaffLogin([FromBody] StaffAuthenticationRequest request) { StaffAuthenticationResponse response = new StaffAuthenticationResponse(); try { DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.AddParameter("@ParamUserName", request.UserName); string data = DBAgent.ExecuteStoredProcedure("dbo.spGetUserDetails"); if (string.IsNullOrEmpty(data)) { response.ErrorMessage = "Invalid Username/Password conbination. Please try again"; response.IsAuthenticated = false; response.LoginID = -1; DBAgent.ClearParams(); DBAgent.AddParameter("@ParamRefID", 0); DBAgent.AddParameter("@ParamRefType", "Users"); DBAgent.AddParameter("@ParamAction", "FL"); DBAgent.AddParameter("@ParamComment", "Login Failed from Mobile App- " + request.UserName); DBAgent.ExecuteNonQuery("dbo.spAddUserAction"); } else { DataSet ds = CommonHelpers.GetDataSetFromXml(data); if (ds.Tables.Count > 0) { securityAgent = new CryptoProvider(); DataRow dRow = ds.Tables[0].Rows[0]; string upassword = securityAgent.decryptText(dRow["Password"].ToString().Replace(" ", "+")); if (upassword.Equals(request.Password)) { DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); DBAgent.AddParameter("@ParamRefID", dRow["LoginID"].ToString()); DBAgent.AddParameter("@ParamRefType", "Users"); DBAgent.AddParameter("@ParamAction", "LI"); DBAgent.AddParameter("@ParamComment", "Successful Login from Mobile App- " + request.UserName); DBAgent.ExecuteNonQuery("dbo.spAddUserAction"); response.IsAuthenticated = true; response.UserFirstName = dRow["FirstName"].ToString(); response.UserLastName = dRow["LastName"].ToString(); response.UserToken = ConfigurationManager.AppSettings["UserToken"]; } else { response.IsAuthenticated = false; response.ErrorMessage = "Invalid Username/Password conbination. Please try again"; DBAgent = new DataAccessProvider(DataAccessProvider.ParamType.ServerCredentials, ConfigurationManager.AppSettings["DBServerName"], ConfigurationManager.AppSettings["DBUserName"], ConfigurationManager.AppSettings["DBPassword"]); DBAgent.ClearParams(); DBAgent.AddParameter("@ParamRefID", 0); DBAgent.AddParameter("@ParamRefType", "Users"); DBAgent.AddParameter("@ParamAction", "FL"); DBAgent.AddParameter("@ParamComment", "Login Failed from Mobile App- " + request.UserName); DBAgent.ExecuteNonQuery("dbo.spAddUserAction"); } } } } catch (Exception ex) { response.ErrorMessage = ex.Message; response.IsAuthenticated = false; CommonHelpers.writeLogToFile("API: PostStaffLogin - StaffLoginController.cs", ex.Message + Environment.NewLine + ex.StackTrace); } return(Ok(response)); }
public static void DeleteKeHoachThangBoPhanHoTro(int idDotDanhGia, int idCongViec, int idBoPhanHoTro) { DataAccessProvider.Instance().DeleteKeHoachThangBoPhanHoTro(idDotDanhGia, idCongViec, idBoPhanHoTro); }
public static DataTable GetKeHoachThangBoPhanHoTro(int idDotDanhGia, int idCongViec) { return(DataAccessProvider.Instance().GetKeHoachThangBoPhanHoTro(idDotDanhGia, idCongViec)); }
public static void UpdateKeHoachThang(DanhGiaThang_DGCBCNVDanhGiaTTCVInfo _DotDanhGiaInfo) { DataAccessProvider.Instance().UpdateKeHoachThang_DGCBCNVDanhGiaTTCV(_DotDanhGiaInfo); }
public static DanhGiaThang_DGCBCNVDanhGiaTTCVInfo GetInfo(int _id) { return(DataAccessProvider.Instance().GetInfoDanhGiaThang_DGCBCNVDanhGiaTTCV(_id)); }
public static void Delete(int _id) { DataAccessProvider.Instance().DeleteDanhGiaThang_DGCBCNVDanhGiaTTCV(_id); }
public static int InsertKeHoachThang(DanhGiaThang_DGCBCNVDanhGiaTTCVInfo _DotDanhGiaInfo) { return(DataAccessProvider.Instance().InsertKeHoachThang_DGCBCNVDanhGiaTTCV(_DotDanhGiaInfo)); }
public static DataTable GetAll(int loai, int IDDotDanhGia, int IDNhanVien) { return(DataAccessProvider.Instance().GetAllDanhGiaThang_DGCBCNVDanhGiaTTCV(loai, IDDotDanhGia, IDNhanVien)); }
public static DataTable DanhGiaThang_GetAllCongViecCanHoTro(int loai, int IDDotDanhGia, int IDBoPhan) { return(DataAccessProvider.Instance().DanhGiaThang_GetAllCongViecCanHoTro(loai, IDDotDanhGia, IDBoPhan)); }
public static DGCBCNVDanhGiaChiTietInfo GetInfo(int id) { return(DataAccessProvider.Instance().GetInfoDGCBCNVDanhGiaChiTiet(id)); }
public static void Delete(int id) { DataAccessProvider.Instance().DeleteDGCBCNVDanhGiaChiTiet(id); }
public static void Update(DGCBCNVDanhGiaChiTietInfo _DotDanhGiaInfo) { DataAccessProvider.Instance().UpdateDGCBCNVDanhGiaChiTiet(_DotDanhGiaInfo); }
public static DataTable GetAll(int loai, int idDotDanhGia, int idNhanVien) { return(DataAccessProvider.Instance().GetAllDGCBCNVDanhGiaChiTiet(loai, idDotDanhGia, idNhanVien)); }
public override DataTable FindAll() { var table = DataAccessProvider.ExecuteQuery("SELECT * FROM Teachers"); return(table); }