Пример #1
0
        public dynamic GetNotifications([FromBody] GetNCallsRequestData noti_post)
        {
            GetNotificationCallsResponseData noti_response = new GetNotificationCallsResponseData();
            string userName;

            if (HttpContext.Current.Request.UrlReferrer.Host.Contains("localhost") && HttpContext.Current.Request.UrlReferrer.Port == 51268)
            {
                userName = "******";// HttpContext.Current.User.Identity.Name;
            }
            else
            {
                userName = HttpContext.Current.User.Identity.Name;
            }
            using (SqlConnection sqlCon = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CC_ProdConn"].ConnectionString))
            {
                SqlCommand sq = new NotificationLayer().PrepareParams("[getNotificationsReportByUser]", userName, noti_post);
                sq.CommandType    = CommandType.StoredProcedure;
                sq.Connection     = sqlCon;
                sq.CommandTimeout = int.MaxValue;
                SqlDataAdapter adapter = new SqlDataAdapter(sq);
                DataSet        ds      = new DataSet();

                adapter.Fill(ds);

                List <NotificationByUser> usernot = new List <NotificationByUser>();

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    NotificationByUser not = new NotificationByUser();
                    UserInformation    ui  = new UserInformation();

                    ui.userData   = new User();
                    ui.userRole   = new Role();
                    not.scorecard = new Scorecard()
                    {
                        scorecardName = dr.Field <string>("short_name"),
                        scorecardId   = dr.Field <int>("scorecard")
                    };
                    ui.userData.userName     = dr.Field <string>("userName");
                    ui.userData.userId       = dr.Field <string>("userName");
                    ui.userRole.userRoleName = dr.Field <string>("user_role");
                    ui.userRole.userRoleId   = dr.Field <string>("user_role");
                    not.app = new UserApp()
                    {
                        appName = dr.Field <string>("appname"),
                        appId   = dr.Field <string>("appname")
                    };
                    not.user        = ui;
                    not.canWork     = dr.Field <int>("canWork");
                    not.created     = dr.Field <int>("created");
                    not.closed      = dr.Field <int>("closed");;
                    not.avgDaysOpen = dr.Field <double?>("avgDaysOpen");
                    usernot.Add(not);
                }

                return(usernot);
            }
        }
Пример #2
0
        public dynamic GetNotificationCallss([FromBody] GetNCallsRequestData noti_post)
        {
            GetNotificationCallsResponseData noti_response = new GetNotificationCallsResponseData();
            string userName;

            if (HttpContext.Current.Request.UrlReferrer.Host.Contains("localhost") && HttpContext.Current.Request.UrlReferrer.Port == 51268)
            {
                userName = "******";// HttpContext.Current.User.Identity.Name;
            }
            else
            {
                userName = HttpContext.Current.User.Identity.Name;
            }
            using (SqlConnection sqlCon = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CC_ProdConn"].ConnectionString))
            {
                SqlCommand sq = new NotificationLayer().PrepareParams("[getNotificationsReportByScorecard]", userName, noti_post);
                sq.CommandType    = CommandType.StoredProcedure;
                sq.CommandTimeout = int.MaxValue;
                sq.Connection     = sqlCon;
                SqlDataAdapter adapter = new SqlDataAdapter(sq);
                DataSet        ds      = new DataSet();
                adapter.Fill(ds);

                List <NotificationByScorecard> scnot = new List <NotificationByScorecard>();

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    NotificationByScorecard not = new NotificationByScorecard();
                    Scorecard sc  = new Scorecard();
                    UserApp   app = new UserApp();
                    sc.scorecardId        = dr.Field <int>("scorecard");
                    sc.scorecardName      = dr.Field <string>("scorecardName").ToString();
                    not.scorecard         = sc;
                    not.app               = app;
                    not.totalCount        = dr.Field <int>("totalNotifications");
                    not.openedByCC        = dr.Field <int>("openNotificationsByCC");
                    not.openedByClient    = dr.Field <int>("openNotificationsByClient");
                    not.closedWithDisp    = dr.Field <int>("closedWithDisp");
                    not.closedWithoutDisp = dr.Field <int>("closedWithoutDisp");
                    not.nonbillableTime   = dr.Field <int>("nonbillableTime");
                    not.billableTime      = dr.Field <int>("billableTime");
                    not.avgDaysOpen       = dr.Field <int>("avgDaysOpen");

                    scnot.Add(not);
                }
                return(scnot);
            }
        }
Пример #3
0
        public dynamic GetNotificationCalls([FromBody] GetNCallsRequestData noti_post)
        {
            GetNotificationCallsResponseData noti_response = new GetNotificationCallsResponseData();
            string userName;

            if (HttpContext.Current.Request.UrlReferrer.Host.Contains("localhost") && HttpContext.Current.Request.UrlReferrer.Port == 51268)
            {
                userName = "******";// HttpContext.Current.User.Identity.Name;
            }
            else
            {
                userName = HttpContext.Current.User.Identity.Name;
            }
            using (SqlConnection sqlCon = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["CC_ProdConn"].ConnectionString))
            {
                SqlCommand sq = new NotificationLayer().PrepareParams("[getNotificationsReportAllCals]", userName, noti_post);


                sq.CommandType    = CommandType.StoredProcedure;
                sq.CommandTimeout = int.MaxValue;
                sq.Connection     = sqlCon;
                SqlDataAdapter adapter = new SqlDataAdapter(sq);
                DataSet        ds      = new DataSet();
                adapter.Fill(ds);
                DataTable notify_dt = ds.Tables[1];

                int total = notify_dt.Rows[0].Field <int>("total");

                List <Notification> notifications = new List <Notification>();

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    Notification not = new Notification
                    {
                        app = new UserApp()
                        {
                            appId = dr.Field <string>("appname").ToString(), appName = dr.Field <string>("appname").ToString()
                        }
                    };
                    UserInformation ui = new UserInformation
                    {
                        userData = new User()
                    };
                    ui.userData.userName = dr.Field <string>("assigned_to") == null ? "" : dr.Field <string>("assigned_to");
                    ui.userData.userId   = dr.Field <string>("assigned_to") == null ? "" : dr.Field <string>("assigned_to");
                    ui.userRole          = new Role
                    {
                        userRoleName = dr.Field <string>("role") == null ? "" : dr.Field <string>("role"),
                        userRoleId   = dr.Field <string>("role") == null ? "" : dr.Field <string>("role")
                    };
                    not.assignTo       = ui;
                    not.calibratorName = "";
                    not.callType       = dr.Field <string>("review_type") == null ? "" : dr.Field <string>("review_type");
                    not.closedDate     = dr.Field <DateTime?>("date_closed");
                    not.notificationId = dr.Field <int>("FN_ID");
                    not.callId         = dr.Field <int>("F_ID");
                    not.phone          = dr.Field <string>("phone");
                    not.openDate       = dr.Field <DateTime?>("date_created");
                    //not.questionInfo =
                    not.reviewedDate = dr.Field <DateTime?>("review_date");
                    not.reviewerName = dr.Field <string>("reviewer") == null ? "" : dr.Field <string>("reviewer");
                    not.agentName    = dr.Field <string>("agent") == null ? "" : dr.Field <string>("agent");
                    Scorecard sc = new Scorecard();
                    sc.scorecardId   = dr.Field <int>("scorecard");
                    sc.scorecardName = dr.Field <string>("scorecard_name") == null ? "" : dr.Field <string>("scorecard_name");
                    not.scorecard    = sc;
                    //not.supervisor = "";
                    not.teamLeadName       = dr.Field <string>("team_lead") == null ? "" : dr.Field <string>("team_lead");
                    not.notificationStatus = dr.Field <string>("notificationStatus") == null ? "" : dr.Field <string>("notificationStatus");
                    notifications.Add(not);
                }
                return(new { notifications, total });
            }
        }