public IHttpActionResult GetNotificationMessage(NotificationInputParameters notificationInputObj) { try { //Notification objNotification = new Notification(); string query = string.Empty; //For Individual Query : SELECT n.* FROM APTCCRM r UNNEST r.['notification'] n where n.['UserCode'] = "individual_12332" //For RoleCode Query : SELECT n.* FROM APTCCRM r UNNEST r.['notification'] n where n.['RoleCode'] = 'HODP' and n.['DeptCode'] = 'CMOW' if (notificationInputObj.NotificationType >= 1) { query = @"SELECT NM.notificationText, NM.notificationType, NM.notificationDescription FROM " + _bucketRef.Name + " r use keys 'NotificationTypeMaster' " + "unnest r.['notificationTypeMaster'] NM where NM.['roleCode'] = '" + notificationInputObj.RoleCode + "' " + "and NM.['deptCode'] = '" + notificationInputObj.DeptCode + "' and NM.notificationType = " + notificationInputObj.NotificationType + ""; var objNotification = _bucket.Query <NotificationMessage>(query).ToList(); if (objNotification == null) { return(Content(HttpStatusCode.NoContent, "214-please enter valid RoleCode/DeptCode/NotificationType.")); } else { return(Content(HttpStatusCode.OK, objNotification)); } } return(Content(HttpStatusCode.Forbidden, "Error")); } catch (Exception ex) { return(Content(HttpStatusCode.Forbidden, ex.Message)); } }
public IHttpActionResult GetNotificationRolewiseUserwise(NotificationInputParameters notificationInputObj) { try { //Notification objNotification = new Notification(); string query = string.Empty; //For Individual Query : SELECT n.* FROM APTCCRM r UNNEST r.['notification'] n where n.['UserCode'] = "individual_12332" //For RoleCode Query : SELECT n.* FROM APTCCRM r UNNEST r.['notification'] n where n.['RoleCode'] = 'HODP' and n.['DeptCode'] = 'CMOW' if (!string.IsNullOrEmpty(notificationInputObj.UserCode)) { // query = @"SELECT n.* From " + _bucket.Name + " r UNNEST r.['notification'] n where n.['UserCode'] = '" + notificationInputObj.UserCode + "'"; query = @"select meta().id as notificationID,r.deptCode,r.roleCode,r.validity,r.notificationType, r.notificationText,r.notificationDescription ,notificationCreatedDate, readReceipt from " + _bucket.Name + " r where meta().id like '%notification_%' and userCode = '" + notificationInputObj.UserCode + "' and notificationType = " + notificationInputObj.NotificationType + " and readReceipt=false"; } else { //query = @"SELECT n.* From " + _bucket.Name + " r UNNEST r.['notification'] n where n.['RoleCode'] = '" + notificationInputObj.RoleCode + "' and n.['DeptCode'] = '" + notificationInputObj.DeptCode + "'"; query = @"select meta().id as notificationID,r.deptCode,r.roleCode,r.validity,r.notificationType, r.notificationText,r.notificationDescription,notificationCreatedDate, readReceipt from " + _bucket.Name + " r where meta().id like '%notification_%' and deptCode = '" + notificationInputObj.DeptCode + "' and roleCode ='" + notificationInputObj.RoleCode + "' and notificationType = " + notificationInputObj.NotificationType + " and readReceipt=false"; } var objNotification = _bucket.Query <Notification>(query).ToList(); if (objNotification.Count == 0) { return(Content(HttpStatusCode.NoContent, "213-please enter valid RoleCode/DeptCode/UserCode.")); } else { return(Content(HttpStatusCode.OK, objNotification)); } } catch (Exception ex) { return(Content(HttpStatusCode.Forbidden, ex.Message)); } }