Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
        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));
        }
Exemplo n.º 4
0
        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));
        }
Exemplo n.º 5
0
        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));
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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);
        }