Ejemplo n.º 1
0
        public UserInboxBEL DeleteUserNotification(string User_id, string notification_id)
        {
            UserInboxBEL UserInbox = new UserInboxBEL();

            try
            {
                DataSet ds = null;

                SqlParameter[] SqlParms = new SqlParameter[3];

                SqlParms[0]           = new SqlParameter("@User_id", SqlDbType.NVarChar);
                SqlParms[0].Direction = ParameterDirection.Input;
                SqlParms[0].Value     = User_id;

                SqlParms[1]           = new SqlParameter("@Notification_id", SqlDbType.NVarChar);
                SqlParms[1].Direction = ParameterDirection.Input;
                SqlParms[1].Value     = notification_id;


                SqlParms[2]           = new SqlParameter("@Error", SqlDbType.NVarChar, 150);
                SqlParms[2].Direction = ParameterDirection.Output;

                ds = SqlHelper.ExecuteDataset(connectionString, CommandType.StoredProcedure, "Delete_Notification", SqlParms);

                if (Convert.ToString(SqlParms[2].Value) == string.Empty)
                {
                    UserInbox.Success = true;
                }
                else
                {
                    UserInbox.Success = false;
                }

                return(UserInbox);
            }
            catch (Exception ex)
            {
                UserInbox.Success      = false;
                UserInbox.ErrorMessage = Convert.ToString(ex.Message.ToString());

                return(UserInbox);
            }
        }
Ejemplo n.º 2
0
        public List <UserInboxBEL> GetUserInbox(string User_id)
        {
            List <UserInboxBEL> UserInboxList = new List <UserInboxBEL>();

            try
            {
                DataSet ds = null;

                SqlParameter[] SqlParms = new SqlParameter[2];

                SqlParms[0]           = new SqlParameter("@User_id", SqlDbType.NVarChar);
                SqlParms[0].Direction = ParameterDirection.Input;
                SqlParms[0].Value     = User_id;


                SqlParms[1]           = new SqlParameter("@Error", SqlDbType.NVarChar, 150);
                SqlParms[1].Direction = ParameterDirection.Output;

                //SqlParms[7] = new SqlParameter("@UserId", SqlDbType.NVarChar, 20);
                //SqlParms[7].Direction = ParameterDirection.Output;

                //jfhjff

                ds = SqlHelper.ExecuteDataset(connectionString, CommandType.StoredProcedure, "Get_Notifications", SqlParms);


                if (ds != null && ds.Tables[0].Rows.Count > 0 && Convert.ToString(SqlParms[1].Value) != "0")
                {
                    for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                    {
                        UserInboxBEL UserInbox = new UserInboxBEL();

                        UserInbox.User_Id         = Convert.ToInt32(ds.Tables[0].Rows[i]["User_id"]);
                        UserInbox.Notification_ID = Convert.ToInt32(ds.Tables[0].Rows[i]["Notification_ID"]);
                        UserInbox.Subject         = ds.Tables[0].Rows[i]["Subject"].ToString();
                        UserInbox.Message         = ds.Tables[0].Rows[i]["Message"].ToString();
                        if (ds.Tables[0].Rows[i]["Dt_Created"] != DBNull.Value)
                        {
                            UserInbox.Dt_Created = Convert.ToDateTime(ds.Tables[0].Rows[i]["Dt_Created"]);
                        }

                        UserInbox.READYN       = Convert.ToChar(ds.Tables[0].Rows[i]["READYN"]);
                        UserInbox.UserSpecific = Convert.ToChar(ds.Tables[0].Rows[i]["UserSpecific"]);

                        UserInboxList.Add(UserInbox);
                    }

                    return(UserInboxList);
                }

                else
                {
                    UserInboxBEL UserInbox = new UserInboxBEL();
                    UserInbox.Success      = false;
                    UserInbox.ErrorMessage = Convert.ToString(SqlParms[1].Value);
                    UserInboxList.Add(UserInbox);
                    return(UserInboxList);
                }
            }
            catch (Exception ex)
            {
                UserInboxBEL UserInbox = new UserInboxBEL();
                UserInbox.Success      = false;
                UserInbox.ErrorMessage = Convert.ToString(ex.Message.ToString());
                UserInboxList.Add(UserInbox);
                return(UserInboxList);
            }

            //  return AvailableParkings;
        }