Exemple #1
0
        private void FillRepeaterActivityDay(bool my)
        {
            DateTime  fromToday = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0, 0);
            DateTime  today     = fromToday.AddMinutes(1439);
            DataTable dtA;

            string fromDate = UC.LTZ.ToUniversalTime(fromToday).ToString(@"yyyyMMdd HH:mm:ss").Replace('.', ':');
            string toDate   = UC.LTZ.ToUniversalTime(today).ToString(@"yyyyMMdd HH:mm:ss").Replace('.', ':');

            string tempQuery = String.Format("(ACTIVITYDATE BETWEEN '{0}' AND '{1}')", fromDate, toDate);

            Trace.Warn("actoday", "SELECT * FROM CRM_WORKACTIVITYSEARCH_VIEW WHERE TODO=0 AND (" + tempQuery + ") AND ((" + GroupsSecure() + ") OR OWNERID=" + UC.UserId + ") ORDER BY ACTIVITYDATE");

            if (my)
            {
                dtA = DatabaseConnection.CreateDataset("SELECT * FROM CRM_WORKACTIVITYSEARCH_VIEW WHERE TODO=0 AND (" + tempQuery + ") AND ((" + GroupsSecure() + ") OR OWNERID=" + UC.UserId + ") ORDER BY ACTIVITYDATE").Tables[0];
            }
            else
            {
                dtA = DatabaseConnection.CreateDataset("SELECT * FROM CRM_WORKACTIVITYSEARCH_VIEW WHERE TODO=0 AND (" + tempQuery + ") AND (OWNERID=" + UC.UserId + ") ORDER BY ACTIVITYDATE").Tables[0];
            }
            if (dtA.Rows.Count > 0)
            {
                RepeaterActivityDay.DataSource = dtA;
                RepeaterActivityDay.DataBind();
                LitRepeaterActivityDayInfo.Visible = false;
            }
            else
            {
                LitRepeaterActivityDayInfo.Text    = Root.rm.GetString("Acttxt40");
                LitRepeaterActivityDayInfo.Visible = true;
                RepeaterActivityDay.Visible        = false;
            }
        }
Exemple #2
0
        private void FillRepeaterActivityLost(bool onlyMy)
        {
            DateTime  today = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0);
            DataTable dtA   = new DataTable();

            if (!onlyMy)
            {
                dtA = DatabaseConnection.CreateDataset("SELECT TOP 10 * FROM CRM_WORKACTIVITYSEARCH_VIEW WHERE TODO=0 AND ACTIVITYDATE< '" + UC.LTZ.ToUniversalTime(today).ToString(@"yyyyMMdd HH.mm.ss").Replace('.', ':') + "' AND ((" + GroupsSecure() + ") OR OWNERID=" + UC.UserId + ") ORDER BY ACTIVITYDATE").Tables[0];
            }
            else
            {
                dtA = DatabaseConnection.CreateDataset("SELECT TOP 10 * FROM CRM_WORKACTIVITYSEARCH_VIEW WHERE TODO=0 AND ACTIVITYDATE< '" + UC.LTZ.ToUniversalTime(today).ToString(@"yyyyMMdd HH.mm.ss").Replace('.', ':') + "' AND (OWNERID=" + UC.UserId + ") ORDER BY ACTIVITYDATE").Tables[0];
            }
            if (dtA.Rows.Count > 0)
            {
                RepeaterActivityDay.DataSource = dtA;
                RepeaterActivityDay.DataBind();
                LitRepeaterActivityDayInfo.Visible = false;
            }
            else
            {
                LitRepeaterActivityDayInfo.Text    = Root.rm.GetString("Acttxt40");
                LitRepeaterActivityDayInfo.Visible = true;
                RepeaterActivityDay.Visible        = false;
            }
        }
Exemple #3
0
        private void FillRepeaterActivityDayFromSearch(string contactID, string order)
        {
            string query = string.Empty;

            switch (contactID.Substring(0, 1))
            {
            case "C":
                if (Request["oppID"] != null && Request["oppID"].Length > 0)
                {
                    query = "SELECT * FROM CRM_WORKACTIVITYSEARCH_VIEW WHERE OPPORTUNITYID=" + Request["oppID"] + " AND REFERRERID=" + contactID.Substring(1) + " ORDER BY " + order + " DESC";
                }
                else
                {
                    query = "SELECT * FROM CRM_WORKACTIVITYSEARCH_VIEW WHERE REFERRERID=" + contactID.Substring(1) + " ORDER BY " + order + " DESC";
                }
                break;

            case "L":
                if (Request["oppID"] != null && Request["oppID"].Length > 0)
                {
                    query = "SELECT * FROM CRM_WORKACTIVITYSEARCH_VIEW WHERE OPPORTUNITYID=" + Request["oppID"] + " AND LEADID=" + contactID.Substring(1) + "  ORDER BY " + order + " DESC";
                }
                else
                {
                    query = "SELECT * FROM CRM_WORKACTIVITYSEARCH_VIEW WHERE LEADID=" + contactID.Substring(1) + "  ORDER BY " + order + " DESC";
                }
                break;

            case "A":
                if (Request["oppID"] != null && Request["oppID"].Length > 0)
                {
                    query = "SELECT * FROM CRM_WORKACTIVITYSEARCH_VIEW WHERE OPPORTUNITYID=" + Request["oppID"] + " AND COMPANYID=" + contactID.Substring(1) + "  ORDER BY " + order + " DESC";
                }
                else
                {
                    query = "SELECT * FROM CRM_WORKACTIVITYSEARCH_VIEW WHERE COMPANYID=" + contactID.Substring(1) + " ORDER BY " + order + " DESC";
                }
                break;
            }

            DataTable dtA = DatabaseConnection.CreateDataset(query).Tables[0];

            if (dtA.Rows.Count > 0)
            {
                RepeaterActivityDay.DataSource = dtA;
                RepeaterActivityDay.DataBind();
                LitRepeaterActivityDayInfo.Visible = false;
                RepeaterActivityDay.Visible        = true;
            }
            else
            {
                LitRepeaterActivityDayInfo.Text    = Root.rm.GetString("Acttxt40");
                LitRepeaterActivityDayInfo.Visible = true;
                RepeaterActivityDay.Visible        = false;
            }
        }
Exemple #4
0
        private void FillRepeaterActivityDay(bool my)
        {
            DataTable dtA = ActivityToday(my);

            RepeaterActivityDay.DataSource = dtA;
            RepeaterActivityDay.DataBind();
            if (RepeaterActivityDay.Items.Count > 0)
            {
                AttInDay.Visible = true;
            }
            else
            {
                AttInDay.Visible = false;
            }
        }