protected void Page_LoadComplete(object sender, EventArgs e)
        {
            SQLDatabase  sql         = new SQLDatabase();    sql.CommandTimeout = 120;
            SQLParamList sqlParams   = new SQLParamList();
            var          fltProperty = Master.GetFilter <ReportFilterListBox>("fltProperty");

            fltProperty.AddToQuery(sqlParams);
            DataTable dt = sql.ExecStoredProcedureDataTable("[spReports_SnapshotStatus]", sqlParams);

            if (!sql.HasError)
            {
                Data = dt;
                if (_runExport)
                {
                    string fileName = String.Format("SnapshotStatus-{0}.csv", ReportingTools.AdjustAndDisplayDate(DateTime.Now, "yyyy-MM-dd-hh-mm-ss", User));
                    string fullPath = Server.MapPath(Path.Combine(Config.CacheFileDirectory, fileName));
                    if (Data.DataTableToCSV(fullPath, true))
                    {
                        Response.Clear();
                        Response.ContentType = "text/csv";
                        Response.AddHeader("content-disposition", String.Format(@"attachment;filename=""{0}""", fileName));
                        Response.WriteFile(fullPath);
                        Response.End();
                    }
                }
            }
        }
示例#2
0
 public void AddToQuery(SQLParamList sqlParams)
 {
     if (IsActive)
     {
         sqlParams.Add("@" + DBColumn, SelectedValue);
     }
 }
        public static void SaveWordCounts(SurveyType surveyType, int recordID, Dictionary <string, int> wordCounts)
        {
            SQLDatabase   sql       = new SQLDatabase();    sql.CommandTimeout = 120;
            StringBuilder query     = new StringBuilder();
            SQLParamList  sqlParams = new SQLParamList();
            int           i         = 1;

            sqlParams.Add("@RecordID", recordID);
            foreach (string key in wordCounts.Keys)
            {
                i += 2;
                query.AppendFormat("INSERT INTO [tblSurveyWords] VALUES ({0}, @RecordID, @Word{1}, @Count{1});\n", (int)surveyType, i);
                sqlParams.Add("@Word" + i, key).Add("@Count" + i, wordCounts[key]);
                if (i >= 2097)
                {
                    //Only ~2100 parameters are allowed
                    query.Append("DELETE FROM [tblSurveyWords] WHERE Word IN (SELECT [Word] FROM [tblSurveyWords_Banned]);");
                    sql.NonQuery(query.ToString(), sqlParams);
                    i         = 1;
                    sqlParams = new SQLParamList().Add("@RecordID", recordID);
                }
            }
            if (i > 1)
            {
                query.Append("DELETE FROM [tblSurveyWords] WHERE Word IN (SELECT [Word] FROM [tblSurveyWords_Banned]);");
                sql.NonQuery(query.ToString(), sqlParams);
            }
            if (sql.HasError)
            {
                ErrorHandler.WriteLog("SharedClasses.SurveyTools.SaveWordCounts", String.Format("Unable to save word counts for {0} record ID {1}", surveyType.ToString(), recordID), ErrorHandler.ErrorEventID.SQLError, sql.ExceptionList[0]);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            Title = "GCC Food & Beverage Dashboard &raquo; " + PropertyTools.GetCasinoName((int)PropertyShortCode);
            Master.HidePropertyFilter = true;
            if (!IsPostBack && PropertyShortCode == GCCPropertyShortCode.GCC)
            {
                //Set up the restaurant list if we're looking at all locations
                SQLDatabase  sql       = new SQLDatabase();    sql.CommandTimeout = 120;
                SQLParamList sqlParams = GetFilters();
                DataTable    dt        = sql.QueryDataTable(
                    @"SELECT [RestaurantID]
                            ,[Name]
                    FROM [GCC].[dbo].[tblRestaurants]
                    WHERE RestaurantID IN (SELECT RestaurantID FROM tblPropertyRestaurants WHERE PropertyID = @PropertyID)
	                OR @PropertyID = 1
                    ORDER BY Name", sqlParams);
                if (!sql.HasError)
                {
                    ddlSelectedLocation.Items.Clear();
                    foreach (DataRow dr in dt.Rows)
                    {
                        ddlSelectedLocation.Items.Add(new ListItem(dr["Name"].ToString(), dr["RestaurantID"].ToString()));
                    }
                }
            }
        }
示例#5
0
        public bool UpdatePassword(string newPassword, out string errorMessage)
        {
            if (!IsPasswordValid(newPassword, out errorMessage))
            {
                return(false);
            }
            if (!ValidateUser(out errorMessage))
            {
                return(false);
            }

            SQLDatabaseReporting sql = new SQLDatabaseReporting();
            SqlParameter         affectedRows;
            SQLParamList         sqlParams = new SQLParamList()
                                             .Add("@UserID", UserID)
                                             .Add("@NewPassword", newPassword)
                                             .AddOutputParam("@AffectedRows", 4, out affectedRows);

            sql.ExecStoredProcedureDataTable("spCOM_UpdatePassword", sqlParams);

            if (sql.HasError)
            {
                errorMessage = "There was a database level error while attempting to save this user. Please contact the administrator if this error persists.";
                return(false);
            }
            else if (Conversion.StringToInt(affectedRows.Value.ToString(), 0) == 0)
            {
                errorMessage = "Invalid user specified. Unable to change password.";
                return(false);
            }

            return(true);
        }
示例#6
0
        /// <summary>
        /// Add new user
        /// </summary>
        /// <returns></returns>
        public static string AddNewuser(string userName, string password, string firstName, string lastName, string email, string phone, int addToGroup, int createdUserID, out int msg)
        {
            SQLDatabaseReporting sql       = new SQLDatabaseReporting();
            SQLParamList         sqlParams = new SQLParamList();
            SqlParameter         userId    = new SqlParameter("@UserID", SqlDbType.Int);

            userId.Direction = ParameterDirection.Output;

            sqlParams.Add("@Username", userName);
            sqlParams.Add("@Password", password);
            sqlParams.Add("@ClientID", Config.clientId);
            sqlParams.Add("@CreateUserID", createdUserID);
            sqlParams.Add("@Email", email);
            sqlParams.Add("@Phone", phone);
            sqlParams.Add("@FirstName", firstName);
            sqlParams.Add("@LastName", lastName);
            sqlParams.Add("@ExpirePassword", true);
            sqlParams.Add("@AddToGroup", addToGroup);
            sqlParams.Add(userId);

            sql.ExecStoredProcedureDataTable("spCOM_CreateNewUser", sqlParams);
            if (sql.HasError)
            {
                msg = 1;
                return(UserResource.Error_UnableToSaveUser);
            }
            else
            {
                msg = 0;
                return(UserResource.Message_AddSuccess);
            }
        }
        protected SQLParamList GetFilters()
        {
            Dashboard    dm        = Master as Dashboard;
            SQLParamList sqlParams = new SQLParamList();

            if (dm != null)
            {
                sqlParams = dm.GetFilters();
                if (dm.IsPropertyUser)
                {
                    SQLParamList sp2 = new SQLParamList();
                    foreach (SqlParameter sp in sqlParams.ToArray())
                    {
                        if (sp.ParameterName.Equals("@Property"))
                        {
                            sp2.Add("@PropertyID", (int)User.PropertyShortCode);
                        }
                        else
                        {
                            sp2.Add(sp);
                        }
                    }
                    sqlParams = sp2;
                }
                else
                {
                    sqlParams.Add("@PropertyID", (int)PropertyShortCode);
                }
            }
            else
            {
                sqlParams.Add("@PropertyID", (int)PropertyShortCode);
            }
            return(sqlParams);
        }
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            string currentSort    = RequestVars.Get("s", "D");; //Date
            string currentSortDir = RequestVars.Get("d", "D");; //Desc

            SQLDatabase  sql       = new SQLDatabase();    sql.CommandTimeout = 120;
            SQLParamList sqlParams = Master.GetFilters()
                                     .Add("@Sort", currentSort)
                                     .Add("@SortDir", currentSortDir);

            if (CurrentPage == -1)
            {
                sqlParams.Add("@ShowAllRows", true);
            }
            else
            {
                sqlParams.Add("@Page", CurrentPage)
                .Add("@RowsPerPage", ROWS_PER_PAGE);
            }
            DataTable dt = sql.ExecStoredProcedureDataTable("spReports_Survey_List", sqlParams);

            if (!sql.HasError)
            {
                Data = dt;
            }
        }
示例#9
0
        /// <summary>
        /// Updating existing user with new password
        /// </summary>
        /// <param name="newPswd"></param>
        /// <param name="outputValue"></param>
        public bool UpdatePassword(int userId, string newPswd, out string outputMsg)
        {
            if (!CommonFunctions.IsPasswordValid(newPswd, out outputMsg))
            {
                return(false);
            }
            if (!SubFunctions.ValidateUser(out outputMsg))
            {
                return(false);
            }

            SQLDatabaseReporting sql = new SQLDatabaseReporting();
            SqlParameter         affectedRows;
            SQLParamList         sqlParams = new SQLParamList()
                                             .Add("@UserID", userId)
                                             .Add("@NewPassword", newPswd)
                                             .AddOutputParam("@AffectedRows", 4, out affectedRows);

            sql.ExecStoredProcedureDataTable("spCOM_UpdatePassword", sqlParams);
            if (sql.HasError)
            {
                outputMsg = AccountResource.Error_DatabaseLevel;
                return(false);
            }
            else if (Conversion.StringToInt(affectedRows.Value.ToString(), 0) == 0)
            {
                outputMsg = AccountResource.Error_InvalidUserCantChangePassword;
                return(false);
            }

            return(true);
        }
示例#10
0
        protected void btnExport_Click(object sender, EventArgs e)
        {
            string[]     dateDetails = ddlMonthYear.SelectedValue.Split('-');
            SQLDatabase  sql         = new SQLDatabase();    sql.CommandTimeout = 120;
            SQLParamList sqlParams   = new SQLParamList()
                                       .Add("@Year", dateDetails[0].StringToInt())
                                       .Add("@Month", dateDetails[1].StringToInt());
            SqlParameter isNewParam = new SqlParameter("@IsNew", SqlDbType.Bit);

            isNewParam.Direction = ParameterDirection.Output;
            sqlParams.Add(isNewParam);
            DataTable dt = sql.ExecStoredProcedureDataTable("spAdmin_GetGEIWinners", sqlParams);

            if (sql.HasError)
            {
                TopMessage.ErrorMessage = "Unable to query the details from the database.";
            }
            else
            {
                string fileName = String.Format("WinnerSelection-{0}.csv", ReportingTools.AdjustAndDisplayDate(DateTime.Now, "yyyy-MM-dd-hh-mm-ss", User));
                string fullPath = Server.MapPath(Path.Combine(Config.CacheFileDirectory, fileName));
                if (dt.DataTableToCSV(fullPath, true))
                {
                    Response.Clear();
                    Response.ContentType = "text/csv";
                    Response.AddHeader("content-disposition", String.Format(@"attachment;filename=""{0}""", fileName));
                    Response.WriteFile(fullPath);
                    Response.End();
                }
            }
        }
        protected void btnReloadData_Click(object sender, EventArgs e)
        {
            SQLDatabase sql_keywords = new SQLDatabase();
            DataTable   dt           = sql_keywords.QueryDataTable("SELECT PropertyID, Keyword, Includes FROM tblGCC_SocialMediaKeywords");

            if (sql_keywords.HasError)
            {
                mmMessage.ErrorMessage = "There was a database error loading property keywords.  Please try again later.";
                return;
            }
            else
            {
                foreach (DataRow dr in dt.Rows)
                {
                    string keyword    = dr["Keyword"].ToString();
                    string includes   = dr["Includes"].ToString();
                    int    propertyID = Conversion.StringToInt(dr["PropertyID"].ToString());
                    json = new WebClient().DownloadString(String.Format("http://api.trackur.com/api/v2/?api_key=65c0c2c7-2ea2-4f7c-b50f-c9bec7b6ad7b&keyword={0}&includes={1}&limit=100", keyword, includes));
                    json = json.Trim();
                    JObject o = JObject.Parse(json);
                    if (o["results"] != null)
                    {
                        List <object> results = o["results"].ToList <object>();
                        foreach (object result in results)
                        {
                            JObject      parsed_result = JObject.Parse(result.ToString());
                            SQLDatabase  sql           = new SQLDatabase();    sql.CommandTimeout = 120;
                            SQLParamList sqlParams     = new SQLParamList();
                            sqlParams.Add("@keyword", keyword);
                            sqlParams.Add("@propertyID", propertyID);
                            sqlParams.Add("@id", parsed_result["id"].ToString());
                            sqlParams.Add("@title", parsed_result["title"].ToString());
                            sqlParams.Add("@source", parsed_result["source"].ToString());

                            string   published = parsed_result["published"].ToString();
                            DateTime published_date;
                            if (!DateTime.TryParse(published, null,
                                                   DateTimeStyles.None, out published_date))
                            {
                                published_date = DateTime.MinValue;
                            }

                            sqlParams.Add("@published", published_date);
                            sqlParams.Add("@url", parsed_result["url"].ToString());
                            sqlParams.Add("@influence", DBNull.Value);
                            sqlParams.Add("@content", parsed_result["content"].ToString());
                            sqlParams.Add("@sentiment", parsed_result["sentiment"].ToString());
                            sqlParams.Add("@location", parsed_result["location"].ToString());
                            sql.ExecStoredProcedureDataSet("[spMergeSocialMedia]", sqlParams);
                            if (sql.HasError)
                            {
                                mmMessage.ErrorMessage = "There was a database error.  Please try again later.";
                                return;
                            }
                        }
                    }
                }
            }
            mmMessage.InfoMessage = "Data loaded successfully.";
        }
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(GUID))
            {
                SQLDatabase  sql       = new SQLDatabase();    sql.CommandTimeout = 120;
                SQLParamList sqlParams = new SQLParamList();
                UserInfo     ui        = SessionWrapper.Get <UserInfo>("UserInfo");
                sqlParams.Add("@GUID", GUID)
                .Add("@UpdateLastViewedTime", !(ui != null || RequestVars.Get <string>("a", null) != null));
                DataSet ds = sql.ExecStoredProcedureDataSet("[spFeedback_GetGuestItem]", sqlParams);
                if (!sql.HasError)
                {
                    Data = ds;

                    GCCPropertyShortCode sc = (GCCPropertyShortCode)Conversion.StringToInt(ds.Tables[0].Rows[0]["PropertyID"].ToString(), 1);

                    Master.ForceSpecificProperty      = sc;
                    MessageTimeline.PropertyShortCode = sc;

                    MessageTimeline.Messages = ds.Tables[1];
                    int feedbackStatus = Conversion.StringToInt(ds.Tables[0].Rows[0]["FeedbackStatusID"].ToString());
                    MessageTimeline.HideReplyBox = ui != null || RequestVars.Get <string>("a", null) != null;

                    Title = PropertyTools.GetCasinoName((int)sc) + " Feedback";
                }
            }
        }
示例#13
0
        public void LogInUser(string usernameOrEmail, string password, bool useEmailForLogin, int clientID, out int outputValue)
        {
            outputValue = -1;
            //Set up the sql request
            SQLDatabaseReporting sql       = new SQLDatabaseReporting();
            SQLParamList         sqlParams = new SQLParamList();

            sqlParams.Add(useEmailForLogin ? "@Email" : "@Username", usernameOrEmail);

            SqlParameter outParam;

            sqlParams.Add("@Password", password)
            .Add("@ClientID", clientID)
            .Add("@IP", RequestVars.GetRequestIPv4Address())
            .AddOutputParam("@OutputValue", 4, out outParam);

            //Try and get the user's info
            DataTable dt = sql.ExecStoredProcedureDataTable("spCOM_WebReportingLogon", sqlParams);

            if (!sql.HasError)
            {
                outputValue = Conversion.StringToInt(outParam.Value.ToString(), -1);
                if (outputValue == 0 && dt.Rows.Count > 0)
                {
                    //Success!
                    SetUserDataFromDr(dt.Rows[0]);
                    //SessionWrapper.Add<UserInfoModel>("AccountDetail", this);
                    return;
                }
            }
            UserID = -1;
        }
示例#14
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            string currentSort    = RequestVars.Get("s", "F");;           //Feedback status
            string currentSortDir = RequestVars.Get("d", "D");;           //Desc

            SQLDatabase sql = new SQLDatabase();    sql.CommandTimeout = 120;

            sql.CommandTimeout = 120;
            SQLParamList sqlParams = Master.GetFilters()
                                     .Add("@Sort", currentSort)
                                     .Add("@SortDir", currentSortDir);

            if (CurrentPage == -1)
            {
                sqlParams.Add("@ShowAllRows", true);
            }
            else
            {
                sqlParams.Add("@Page", CurrentPage)
                .Add("@RowsPerPage", ROWS_PER_PAGE);
            }
            if (txtRecordIDSearch.Text.Length > 0)
            {
                sqlParams.Add("RecordID", txtRecordIDSearch.Text);
            }
            DataTable dt = sql.ExecStoredProcedureDataTable("[spFeedback_GetList]", sqlParams);

            if (!sql.HasError)
            {
                Data = dt;
            }
        }
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            try
            {
                SQLDatabase sql = new SQLDatabase(); sql.CommandTimeout = 120;
                sql.CommandTimeout = 520;
                SQLParamList sqlParams = Master.GetFilters();
                DataSet      ds        = sql.ExecStoredProcedureDataSet("[spReports_Main]", sqlParams);



                if (!sql.HasError)
                {
                    Data = ds;
                    if (ds.Tables[DATA_SCORES].Rows.Count > 0)
                    {
                        Master.RecordCount = ds.Tables[DATA_SCORES].Rows[0]["TotalRecords"].ToString();
                    }
                }
                else
                {
                    ErrorHandler.WriteLog("GCC_Web_Portal.SurveyGEI", sql.ExceptionList.ToString().ToString(), ErrorHandler.ErrorEventID.General);
                    Console.Write(sql.ExceptionList.ToString());
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.WriteLog("GCC_Web_Portal.SurveyGEI", ex.Message.ToString().ToString(), ErrorHandler.ErrorEventID.General);
            }
        }
        protected void LoadData()
        {
            SQLDatabase  sql       = new SQLDatabase();    sql.CommandTimeout = 120;
            SQLParamList sqlParams = Master.GetFilters();

            Data = sql.ExecStoredProcedureDataSet("spGetSocialMediaCharts", sqlParams);
        }
 public void PrepareQuestionForDB(StringBuilder columnList, SQLParamList sqlParams)
 {
     if (SelectedValue != -1)
     {
         columnList.AppendFormat(",[{0}]", DBColumn);
         sqlParams.Add("@" + DBColumn, GetValue());
     }
 }
 public void PrepareQuestionForDB(StringBuilder columnList, SQLParamList sqlParams)
 {
     if (Checked && !String.IsNullOrEmpty(DBColumn))
     {
         columnList.AppendFormat(",[{0}]", DBColumn);
         sqlParams.Add("@" + DBColumn, DBValue);
     }
 }
示例#19
0
        private List <SqliteParameter> GetCommandParameters(SQLParamList Params)
        {
            List <SqliteParameter> param = new List <SqliteParameter>();

            for (int index = 0; index < Params.Count(); index++)
            {
                param.Add(new SqliteParameter(Params.GetParameter(index), Params.GetValue(index)));
            }
            return(param);
        }
 protected void Page_LoadComplete(object sender, EventArgs e)
 {
     if (RespondentEmail != null || RespondentEncoreNumber != null)
     {
         SQLDatabase  sql       = new SQLDatabase();    sql.CommandTimeout = 120;
         SQLParamList sqlParams = new SQLParamList()
                                  .Add("@EncoreNum", RespondentEncoreNumber)
                                  .Add("@Email", RespondentEmail);
         Data = sql.ExecStoredProcedureDataSet("[spReports_RespondentDetails]", sqlParams);
     }
 }
示例#21
0
 public void PrepareQuestionForDB(StringBuilder columnList, SQLParamList sqlParams)
 {
     columnList.AppendFormat(",[{0}]", DBColumn);
     if (Checked)
     {
         sqlParams.Add("@" + DBColumn, DBValue);
     }
     else
     {
         sqlParams.Add("@" + DBColumn, DBNull.Value);
     }
 }
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(GUID))
            {
                SQLDatabase  sql       = new SQLDatabase();    sql.CommandTimeout = 120;
                SQLParamList sqlParams = new SQLParamList();
                sqlParams.Add("@GUID", GUID);
                DataSet ds = sql.ExecStoredProcedureDataSet("[spFeedback_GetItem]", sqlParams);
                if (!sql.HasError)
                {
                    Data = ds;

                    //Check permissions
                    GCCPropertyShortCode sc = (GCCPropertyShortCode)Data.Tables[0].Rows[0]["PropertyID"].ToString().StringToInt(1);
                    if ((User.Group == UserGroups.PropertyManagers && User.PropertyShortCode != sc && User.PropertyShortCode != GCCPropertyShortCode.None) ||
                        (User.Group == UserGroups.PropertyStaff && User.PropertyShortCode != sc)
                        )
                    {
                        Data = null;
                        TopMessage.ErrorMessage  = "You do not have permission to view this piece of feedback.";
                        TopMessage.TitleOverride = "Unauthorized";
                        return;
                    }


                    MessageTimeline.Messages = ds.Tables[1];
                    int feedbackStatus = Conversion.StringToInt(ds.Tables[0].Rows[0]["FeedbackStatusID"].ToString());
                    MessageTimeline.HideReplyBox      = IssueIsClosed;
                    MessageTimeline.PropertyShortCode = (GCCPropertyShortCode)ds.Tables[0].Rows[0]["PropertyID"].ToString().StringToInt(1);

                    //Reset tier DDL item labels
                    ddlTier.Items[0].Text = "Tier 1";
                    ddlTier.Items[1].Text = "Tier 2";
                    ddlTier.Items[2].Text = "Tier 3";

                    //Set the selected values and append " (Current)" to the current one for this record
                    ddlTier.SelectedValue      = Data.Tables[0].Rows[0]["Tier"].ToString();
                    hdnOldTier.Value           = ddlTier.SelectedValue;
                    ddlTier.SelectedItem.Text += " (Current)";

                    //Add JS check to notify the user what happens on change to Tier 3
                    btnSaveTier.OnClientClick = "var oldTier=" + ds.Tables[0].Rows[0]["Tier"] + ",newTier=parseInt($('#" + ddlTier.ClientID + "').val());if(oldTier!=newTier&&3==newTier&&!confirm('Are you sure you want to set this to Tier 3? This will cause a notification to be sent to the appropriate staff members.'))return false;";

                    //Hide Invalid Button if Case Closed
                    if (IssueIsClosed)
                    {
                        //Work in progress
                        //btnShowInvalidModal.Visible = false;
                    }
                }
            }
        }
示例#23
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            SQLDatabase sql = new SQLDatabase();    sql.CommandTimeout = 120;

            sql.CommandTimeout = 90;
            SQLParamList sqlParams = Master.GetFilters();
            DataTable    dt        = sql.ExecStoredProcedureDataTable("[spReports_TopBottomQuestions]", sqlParams);

            if (!sql.HasError)
            {
                Data = dt;
            }
        }
 protected void fltStatus_AddToQuery(ReportFilterListBox control, SQLParamList sqlParams)
 {
     if (control.IsActive)
     {
         /* No Response Required = 1
          * Response required - Active = 2
          * Response required - Inactive = 3
          */
         StringBuilder sb = new StringBuilder();
         foreach (ListItem li in control.Items)
         {
             if (li.Selected)
             {
                 if (li.Value.Equals("1"))
                 {
                     sb.Append(@"OR NOT (  Q29 = 0
                                         OR Q30 = 1 OR Q30 = 2
                                         OR Q31A = 1 OR Q31A = 2
                                         OR Q31B = 1 OR Q31B = 2
                                         OR Q31C = 1 OR Q31C = 2
                                         OR Q31D = 1 OR Q31D = 2
                                         OR Q31E = 1 OR Q31E = 2) ");
                 }
                 else if (control.Equals("2"))
                 {
                     sb.Append(@" OR ( (Q29 = 0
                                         OR Q30 = 1 OR Q30 = 2
                                         OR Q31A = 1 OR Q31A = 2
                                         OR Q31B = 1 OR Q31B = 2
                                         OR Q31C = 1 OR Q31C = 2
                                         OR Q31D = 1 OR Q31D = 2
                                         OR Q31E = 1 OR Q31E = 2) AND ResponseComplete = 0 ) ");
                 }
                 else if (control.Equals("3"))
                 {
                     sb.Append(@" OR ( (Q29 = 0
                                         OR Q30 = 1 OR Q30 = 2
                                         OR Q31A = 1 OR Q31A = 2
                                         OR Q31B = 1 OR Q31B = 2
                                         OR Q31C = 1 OR Q31C = 2
                                         OR Q31D = 1 OR Q31D = 2
                                         OR Q31E = 1 OR Q31E = 2) AND ResponseComplete = 1 ) ");
                 }
             }
             if (sb.Length > 4)
             {
                 sb.Remove(0, 4);
             }
         }
     }
 }
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            SQLDatabase sql = new SQLDatabase();    sql.CommandTimeout = 120;

            sql.CommandTimeout = 120;
            SQLParamList sqlParams = GetFilters();

            if (PropertyShortCode == GCCPropertyShortCode.GCC)
            {
                sqlParams.Add("@RestaurantID", ddlSelectedLocation.SelectedValue);
            }
            DataSet ds = sql.ExecStoredProcedureDataSet("[spReports_FoodAndBev]", sqlParams);

            if (!sql.HasError)
            {
                DataFull = ds;
                //Set the dashboard counts
                if (PropertyShortCode == GCCPropertyShortCode.GCC)
                {
                    //Set it up if we're looking at all locations
                    Data = ds.Tables[1];
                }
                else
                {
                    Data = ds.Tables[0];
                    //Set it up if we're looking at a particular location
                    if (!IsPostBack)
                    {
                        for (int i = 0; i < 13; i++)
                        {
                            string name;
                            if (PropertyTools.HasFoodAndBev(PropertyShortCode, i + 1, out name))
                            {
                                ddlSelectedLocation.Items[i].Enabled = true;
                                ddlSelectedLocation.Items[i].Text    = name;
                            }
                            else
                            {
                                ddlSelectedLocation.Items[i].Enabled = false;
                            }
                        }
                    }
                }
                if (Data.Rows.Count > 0)
                {
                    string suffix = PropertyShortCode == GCCPropertyShortCode.GCC ? String.Empty : "_M" + SelectedMention;
                    Master.RecordCount = Data.Rows[0]["Count" + suffix].ToString();
                }
            }
        }
        public SQLParamList GetFilters()
        {
            SQLParamList sqlParams = new SQLParamList();

            foreach (IReportFilter flt in Filters)
            {
                if (!IsFilterHidden(flt) ||
                    (IsPropertyUser && flt.ID.Equals("fltProperty")))
                { //Make sure the property filter is always added for the property users
                    flt.AddToQuery(sqlParams);
                }
            }
            return(sqlParams);
        }
示例#27
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            SQLDatabase  sql       = new SQLDatabase();    sql.CommandTimeout = 120;
            SQLParamList sqlParams = GetFilters();
            DataTable    dt        = sql.ExecStoredProcedureDataTable("[spReports_GEINPS]", sqlParams);

            if (!sql.HasError)
            {
                Data = dt;
                if (dt.Rows.Count > 1)
                {
                    Master.RecordCount = dt.Rows[1]["TotalRecords"].ToString();
                }
            }
        }
示例#28
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            SQLDatabase  sql       = new SQLDatabase();    sql.CommandTimeout = 120;
            SQLParamList sqlParams = Master.GetFilters();
            DataSet      ds        = sql.ExecStoredProcedureDataSet("[spReports_RespondentProfile]", sqlParams);

            if (!sql.HasError)
            {
                Data = ds.Tables[0];
                if (ds.Tables[0].Rows.Count > 1)
                {
                    Master.RecordCount = ds.Tables[0].Rows[1]["TotalRecords"].ToString();
                }
            }
        }
示例#29
0
        protected void Page_LoadComplete(object sender, EventArgs e)
        {
            SQLDatabase  sql       = new SQLDatabase();    sql.CommandTimeout = 120;
            SQLParamList sqlParams = Master.GetFilters();
            DataTable    dt        = sql.ExecStoredProcedureDataTable("spAdmin_Abandonment", sqlParams);

            if (!sql.HasError)
            {
                Data = dt;
            }
            else
            {
                TopMessage.ErrorMessage = "We were unable to pull this information from the database.";
            }
        }
示例#30
0
 public void AddToQuery(SQLParamList sqlParams)
 {
     if (IsActive)
     {
         //Adjust dates from user's timezone
         if (BeginDate.HasValue)
         {
             sqlParams.Add("@" + DBColumn + "_Begin", BeginDate.Value);
         }
         if (EndDate.HasValue)
         {
             sqlParams.Add("@" + DBColumn + "_End", EndDate.Value);
         }
     }
 }