public IPeople GetByLoginDetails(string emailId, string password) { IPeople user = new MyDiary.Domain.Domains.People(); user.UserRoles = new List <IRole>() { new Role() }; user.UserImages = new List <IImage>() { new Image() }; SqlConnection conn = SQLDbConnection.GetNewSqlConnectionObject(); conn.Open(); SqlCommand cmd = SQLDbConnection.GetNewSqlCommandObject(conn, Constants.StoredProcedures.People.USERLOGIN_SELECT); cmd.Parameters.AddWithValue(Constants.StoredProcedures.People.Parameters.EmailId, emailId); cmd.Parameters.AddWithValue(Constants.StoredProcedures.People.Parameters.Password, password); DataTable dtUser = SQLDbConnection.FillDataSetFromDataAdapter(SQLDbConnection.GetNewSqlDataAdapterObject(cmd)); if (dtUser != null && dtUser.Rows.Count > 0) { user = Map_PeopleDataRow_To_PeopleDomain(dtUser.Rows[0]); } return(user); }
public IPeople GetByOpenSiteDetails(int siteId, string siteUserId) { IPeople user = new MyDiary.Domain.Domains.People(); user.UserRoles = new List <IRole>() { new Role() }; user.UserImages = new List <IImage>() { new Image() }; try { SqlConnection conn = SQLDbConnection.GetNewSqlConnectionObject(); conn.Open(); SqlCommand cmd = SQLDbConnection.GetNewSqlCommandObject(conn, Constants.StoredProcedures.People.DRY_USER_GET_BYOPENSITEDETAILS); cmd.Parameters.AddWithValue(Constants.StoredProcedures.People.Parameters.SiteId, siteId); cmd.Parameters.AddWithValue(Constants.StoredProcedures.People.Parameters.SiteUserId, siteUserId); DataTable dtUser = SQLDbConnection.FillDataSetFromDataAdapter(SQLDbConnection.GetNewSqlDataAdapterObject(cmd)); if (dtUser != null && dtUser.Rows.Count > 0) { user = Map_PeopleDataRow_To_PeopleDomain(dtUser.Rows[0]); } return(user); } catch (Exception) { return(user); } }
private DataTable GetFilteredIncomesDatatTable(int userId) { SqlConnection conn = SQLDbConnection.GetNewSqlConnectionObject(); SqlCommand cmd = SQLDbConnection.GetNewSqlCommandObject(conn, Constants.StoredProcedures.Incomes.DRY_GETFILTEREDINCOMES); cmd.Parameters.AddWithValue(Constants.StoredProcedures.Expenses.Parameters.UserId, userId); SqlDataAdapter sDataAdapter = SQLDbConnection.GetNewSqlDataAdapterObject(cmd); conn.Close(); return(SQLDbConnection.FillDataSetFromDataAdapter(sDataAdapter)); }
private DataTable GetAllIncomesDatatTable(int userId) { SqlConnection conn = SQLDbConnection.GetNewSqlConnectionObject(); SqlCommand cmd = SQLDbConnection.GetNewSqlCommandObject(conn, Constants.StoredProcedures.Incomes.Incomes_SelectByUserId); cmd.Parameters.AddWithValue(Constants.StoredProcedures.Incomes.Parameters.USERId, userId); SqlDataAdapter sDataAdapter = SQLDbConnection.GetNewSqlDataAdapterObject(cmd); conn.Close(); return(SQLDbConnection.FillDataSetFromDataAdapter(sDataAdapter)); }
private DataTable GetAllIncomeTypesAsDataTable(int userId) { SqlConnection conn = SQLDbConnection.GetNewSqlConnectionObject(); SqlCommand cmd = SQLDbConnection.GetNewSqlCommandObject(conn, Constants.StoredProcedures.IncomeTypes.INCOMETYPES_SELECTBYUSERID); cmd.Parameters.AddWithValue(Constants.StoredProcedures.Expenses.Parameters.UserId, userId); SqlDataAdapter sDataAdapter = SQLDbConnection.GetNewSqlDataAdapterObject(cmd); conn.Close(); return(SQLDbConnection.FillDataSetFromDataAdapter(sDataAdapter)); }
private DataTable GetFilteredExpensesDataTable(string date, string type, int userId) { SqlConnection conn = SQLDbConnection.GetNewSqlConnectionObject(); SqlCommand cmd = SQLDbConnection.GetNewSqlCommandObject(conn, Constants.StoredProcedures.ExpenseTypes.DRY_GETALLEXPENSES_BYDATEANDTYPE); cmd.Parameters.AddWithValue(Constants.StoredProcedures.Expenses.Parameters.ExpenseDate, date); cmd.Parameters.AddWithValue(Constants.StoredProcedures.Expenses.Parameters.ExpenseType, type); cmd.Parameters.AddWithValue(Constants.StoredProcedures.Expenses.Parameters.UserId, userId); SqlDataAdapter sDataAdapter = SQLDbConnection.GetNewSqlDataAdapterObject(cmd); DataTable dtExpenses = SQLDbConnection.FillDataSetFromDataAdapter(sDataAdapter); conn.Close(); return(dtExpenses); }
public List <IPeople> GetAll() { List <IPeople> users = new List <IPeople>(); SqlConnection conn = SQLDbConnection.GetNewSqlConnectionObject(); conn.Open(); SqlCommand cmd = SQLDbConnection.GetNewSqlCommandObject(conn, Constants.StoredProcedures.People.DRY_GETALLUSERS); DataTable dtUsers = SQLDbConnection.FillDataSetFromDataAdapter(SQLDbConnection.GetNewSqlDataAdapterObject(cmd)); if (dtUsers != null && dtUsers.Rows.Count > 0) { users.AddRange(this.Map_PeopleDataTable_To_PeopleList(dtUsers)); } return(users); }
public IImage GetUploadImageById(int imageId) { IImage uploadImage = new MyDiary.Domain.Domains.Image(null); SqlConnection conn = SQLDbConnection.GetNewSqlConnectionObject(); conn.Open(); SqlCommand cmd = SQLDbConnection.GetNewSqlCommandObject(conn, Constants.StoredProcedures.Image.Image_SelectById); cmd.Parameters.AddWithValue(Constants.StoredProcedures.Image.Parameters.ImageId, imageId); DataTable dtUploadImage = SQLDbConnection.FillDataSetFromDataAdapter(SQLDbConnection.GetNewSqlDataAdapterObject(cmd)); if (dtUploadImage != null && dtUploadImage.Rows.Count > 0) { uploadImage = GetImageFromDataTable(dtUploadImage); } return(uploadImage); }