Ejemplo n.º 1
0
        void validateBtn_Click(object sender, ImageClickEventArgs e)
        {
            if (txtLogin.Text.Length > 0)
            {
                HyperCatalog.Business.User user = HyperCatalog.Business.User.GetByKey(txtLogin.Text);
                if (user != null)
                {
                    if (user.SendPassword())
                    {
//            lbError.CssClass = "hc_success";
                        lbError.Visible = true;
                        lbError.Text    = "Check your mailbox, you should soon receive your credentials.";
                    }
                    else
                    {
//            lbError.CssClass = "hc_error";
                        lbError.Visible = true;
                        lbError.Text    = "The email failed to be sent. Sorry for the inconveniance.<BR/>Please try again later.";
                    }
                }
                else
                {
//          lbError.CssClass = "hc_error";
                    lbError.Visible = true;
                    lbError.Text    = "User not found in the system.";
                }
            }
        }
Ejemplo n.º 2
0
        void UpdateDataEdit(string selUserId)
        {
            panelGrid.Visible = false;

            webTab.EnableViewState = false;
            webTab.Tabs.GetTab(0).ContentPane.TargetUrl = "./user/user_properties.aspx?u=" + selUserId;
            HyperCatalog.Business.User curUser = HyperCatalog.Business.User.GetByKey(Convert.ToInt32(selUserId));
            if (curUser == null)
            {
                webTab.Tabs[1].Visible = webTab.Tabs[2].Visible = webTab.Tabs[3].Visible = false;
                lbTitle.Text           = "User: New";
            }
            else
            {
                lbTitle.Text = "User: "******" " + curUser.LastName;
                webTab.Tabs.GetTab(1).ContentPane.TargetUrl = "./user/user_notifications.aspx?u=" + selUserId;
                webTab.Tabs.GetTab(2).ContentPane.TargetUrl = "./user/user_localizations.aspx?u=" + selUserId;
                webTab.Tabs.GetTab(3).ContentPane.TargetUrl = "./user/user_PLs.aspx?u=" + selUserId;
                if (curUser.Cultures != null)
                {
                    webTab.Tabs.GetTab(2).Text = "Catalogs(" + curUser.Cultures.Count.ToString() + ")";
                }
            }
            webTab.Visible          = true;
            webTab.SelectedTabIndex = 0;
        }
Ejemplo n.º 3
0
    protected void Page_Load(object sender, System.EventArgs e)
    {
        lbError.Visible = false;
        lbError.Text    = string.Empty;

        user = SessionState.User;
        if (!Page.IsPostBack)
        {
            UpdateDataView();
        }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Display grid by user
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void DisplayByUser(object sender, EventArgs e)
    {
        Display30Days();
        string u = ((CellItem)((LinkButton)sender).NamingContainer).Cell.Row.Cells.FromKey("UserId").Text;
        string d = ((CellItem)((LinkButton)sender).NamingContainer).Cell.Row.Cells.FromKey("Date").Text;

        using (HyperCatalog.Business.User user = HyperCatalog.Business.User.GetByKey(Convert.ToInt32(u)))
        {
            lbByUser.Text = "<b>Activity for the user " + user.FullName + " for " + DateTime.Parse(d).ToString(SessionState.User.FormatDate) + "</b>";
        }
        lbByDay.Visible = lbByUser.Visible = true;
        using (Database dbObj = Utils.GetMainDB())
        {
            using (DataSet ds = dbObj.RunSPReturnDataSet("dbo._Report_DailyActivity_3_ByDayByUser",
                                                         new SqlParameter("@Date", DateTime.Parse(d)),
                                                         new SqlParameter("@UserId", u),
                                                         new SqlParameter("@CultureCode", DDL_Cultures.SelectedValue.ToString())))
            {
                dbObj.CloseConnection();
                if (dbObj.LastError != string.Empty)
                {
                    lbMessage.Text     = "[ERROR] _Report_DailyActivity_3_ByDayByUser -> " + dbObj.LastError;
                    lbMessage.CssClass = "hc_error";
                    lbMessage.Visible  = true;
                }
                else
                {
                    #region Results
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        dgByUser.DataSource = ds;
                        dgByUser.DataBind();
                        Utils.InitGridSort(ref dgByUser, false);
                        dgByUser.Visible  = true;
                        dgByDay.Visible   = true;
                        lbMessage.Visible = false;
                    }
                    #endregion
                    #region No result
                    else
                    {
                        lbMessage.Text     = "No result found in this culture " + DDL_Cultures.SelectedItem.ToString() + " and at this date ";
                        lbMessage.CssClass = "hc_error";
                        lbMessage.Visible  = true;
                        dgByUser.Visible   = false;
                    }
                    #endregion
                }
            }
        }
    }
Ejemplo n.º 5
0
        private void UpdateDataView()
        {
            bool canSeeRealEmails = SessionState.User.HasCapability(HyperCatalog.Business.CapabilitiesEnum.SEE_REAL_EMAIL);

            using (Item _item = QDEUtils.GetItemIdFromRequest())
            {
                lItemName.Text  = _item.Name;
                lItemLevel.Text = _item.Level.Name;

                using (HyperCatalog.Business.User _user = HyperCatalog.Business.User.GetByKey(Convert.ToInt32(userId)))
                {
                    using (Database dbObj = Utils.GetMainDB())
                    {
                        using (DataSet ds = dbObj.RunSPReturnDataSet("dbo._Item_WhosWhoDetail", "Chunks",
                                                                     new SqlParameter("@ItemId", itemId),
                                                                     new SqlParameter("@CultureCode", cultureCode),
                                                                     new SqlParameter("@UserId", userId)))
                        {
                            dbObj.CloseConnection();

                            if (dbObj.LastError == string.Empty)
                            {
                                string count = ds.Tables[0].Rows.Count.ToString();
                                dg.DataSource = ds.Tables[0];
                                dg.DataBind();
                                lUserName.Text = "<a href='mailto:" + UITools.GetDisplayEmail(_user.Email.ToString()) + "'>" + _user.FullName +
                                                 "</a> (" + count + (Convert.ToInt32(count) > 1 ? " chunks)" : " chunk)");
                            }
                            else
                            {
                                dg.Visible       = false;
                                lbError.Text     = "Error: " + dbObj.LastError.ToString();
                                lbError.CssClass = "hc_error";
                                lbError.Visible  = true;
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 6
0
 private void BindUserData()
 {
     SessionState.User = HyperCatalog.Business.User.GetByKey(SessionState.User.Id);
     currentUser       = SessionState.User;
     if (currentUser != null)
     {
         Win32TimeZone[] winTimeZones;
         winTimeZones = TimeZones.GetTimeZones();
         Array.Sort(winTimeZones, new Win32TimeZoneComparer());
         DDL_TimeZone.DataSource     = winTimeZones;
         DDL_TimeZone.DataTextField  = "DisplayName";
         DDL_TimeZone.DataValueField = "Index";
         Page.DataBind();
         DDL_TimeZone.SelectedValue  = currentUser.GMTTimeZone.Index.ToString();
         DDLFormatDate.SelectedValue = currentUser.FormatDate;
         DDLFormatTime.SelectedValue = currentUser.FormatTime;
     }
     else
     {
         Response.Write("An error occurred while retrieving User");
     }
 }
Ejemplo n.º 7
0
    protected void validateuser()
    {
        LogNet.log.Debug("Login_debug: validateuser() : Start Time=" + DateTime.Now);
        if (SessionState.CheckVersion())
        {
            using (HyperCatalog.Business.User user = HyperCatalog.Business.User.GetByKey(UserId))
            {
                lbError.Text = "login incorrect.<br>Try again.";
                Response.Write("user id in  GetByKey(UserId)" + UserId);
                if (user != null)
                {
                    if (user.IsActive)
                    {
                        if (user.CulturesCount > 0)
                        {
                            if (user.ItemsCount == 0 && user.RoleId != 9)
                            {
                                lbError.Text = "Sorry, your [" + user.RoleName + "] account has no item assigned<br>Please contact the administrator.";
                            }
                            else
                            {
                                string sKey  = user.Pseudo + user.FullName;
                                string sUser = null;//Upon Shelley's request, the message will not be displayed any more.
                                if (sUser == null || sUser == String.Empty)
                                {
                                    #region Prevent multiple connections (this does not work in Web farm)"
                                    TimeSpan SessTimeOut = new TimeSpan(0, 0, HttpContext.Current.Session.Timeout, 0, 0);
                                    HttpContext.Current.Cache.Insert(sKey, sKey, null, DateTime.MaxValue, SessTimeOut,
                                                                     System.Web.Caching.CacheItemPriority.NotRemovable, null);
                                    Session["uniqueLogin"] = sKey;
                                    #endregion

                                    bool bRefresh = user.UpdateItemScope();
                                    if (bRefresh)
                                    {
                                        SessionState.User = user;
                                        lbError.Visible   = false;

                                        SessionState.User.LogCount++;
                                        SessionState.Culture = null;
                                        UITools.FindUserFirstCulture(false);
                                        if (SessionState.Culture == null)
                                        {
                                            UITools.FindUserFirstCulture(true);
                                        }
                                        SessionState.User.LastLogOnDate = DateTime.UtcNow;
                                        SessionState.User.Password      = HyperCatalog.DataAccessLayer.SqlTools.EncryptString(SessionState.User.ClearPassword);
                                        //HPP User update details
                                        SessionState.User.Pseudo    = Pseudo;
                                        SessionState.User.LastName  = LastName;
                                        SessionState.User.FirstName = FirstName;
                                        SessionState.User.Email     = Email;
                                        SessionState.User.HPPQuickSave(true);
                                        //HPP User update details

                                        SessionState.User.QuickSave(true);
                                        SessionState.TVAllItems = false;
                                        HyperCatalog.Shared.Security.User curUser = new HyperCatalog.Shared.Security.User(new HyperCatalog.Shared.Security.Identity(SessionState.User.Email, SessionState.User.Id));
                                        FormsAuthentication.Initialize();
                                        curUser.SetAuthenticationCookie();


                                        // Redirect the user to the originally requested page
                                        Session["JustLoggedIn"] = true;
                                        try
                                        {
                                            FormsAuthentication.RedirectFromLoginPage(Pseudo, false);
                                        }
                                        catch (Exception ex)
                                        {
                                            string strURL = (null != Request.QueryString["ReturnURL"] && Request.QueryString["ReturnURL"] != "") ? Request.QueryString["ReturnURL"] : "Default.aspx";
                                            FormsAuthentication.SetAuthCookie(Pseudo, false);
                                            Response.Redirect(strURL);
                                        }
                                    }
                                    else
                                    {
                                        lbError.Text = "Sorry, we cannot pre-compute your items in cache<br>Please contact the administrator.";
                                    }
                                }
                                else
                                {
                                    lbError.Text = "<br>Sorry, it seems that your are already logged with this account.<br>" +
                                                   "If it is not the case, it is because you've ended your session by closing your browser.<br><br/>" +
                                                   "To avoid this message, please always use the Logoff functionality<br/><br/>" +
                                                   "The next you will try to connect, this message will not appear";
                                    Cache.Remove(sKey);
                                }
                            }
                        }
                        else
                        {
                            lbError.Text = "Sorry, your [" + user.RoleName + "] account has no culture assigned<br>Please contact the administrator to update your catalog.";
                        }
                    }
                    else
                    {
                        lbError.Text = "Sorry, your [" + user.RoleName + "] account is not activated<br>Please contact the administrator.";
                    }
                }
            }
        }
        lbError.Visible = true;
        LogNet.log.Debug("Login_debug: validateuser() : End Time=" + DateTime.Now);
    }
Ejemplo n.º 8
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            // Get current culture
            culture = SessionState.Culture;
            user    = SessionState.User;

            try
            {
                // Get parameters
                item    = QDEUtils.GetItemIdFromRequest();
                culture = QDEUtils.UpdateCultureCodeFromRequest();

                if (Request["f"] != null)
                {
                    inputformId = Convert.ToInt32(Request["f"]);
                }
            }
            catch
            {
                UITools.DenyAccess(DenyMode.Popup);
                return;
            }

            // Check
            //	- user is valid
            //	- culture is valid
            //	- item is valid
            //	- user has the current culture in its scope
            //	- user has the item in its scope
            if (user != null && culture != null && item != null &&
                user.HasCultureInScope(culture.Code) &&
                user.HasItemInScope(item.Id))
            {
                Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "initVars", "var cultureCode='" + culture.Code + "';", true);
                if (!Page.IsPostBack)
                {
                    lbError.Visible  = false;
                    dg.Visible       = false;
                    lbResult.Visible = false;

                    // Update title (current item name)
                    if (item != null)
                    {
                        lbTitle.Text = item.FullName;
                        if (lbTitle.Text.Length > 50)
                        {
                            lbTitle.Text = lbTitle.Text.Substring(0, 49) + "...";
                        }

                        if (inputformId > -1)
                        {
                            pnlChildren.Visible = false;
                            UITools.HideToolBarSeparator(uwToolbar, "AnalyzeSep");
                            UITools.HideToolBarButton(uwToolbar, "Analyze");

                            Analyze();                             // analyse the content for this input form

                            // Retrieve input form name
                            string inputFormName = HyperCatalog.Business.InputForm.GetByKey(Convert.ToInt32(inputformId)).Name;
                            Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "InitFormName", "<script>inputFormName='" + inputFormName + "';</script>");
                        }
                        else
                        {
                            pnlChildren.Visible = true;
                            UITools.ShowToolBarSeparator(uwToolbar, "AnalyzeSep");
                            UITools.ShowToolBarButton(uwToolbar, "Analyze");
                        }
                    }
                    else
                    {
                        UITools.DenyAccess(DenyMode.Popup);
                    }
                }
            }
            else
            {
                UITools.DenyAccess(DenyMode.Popup);
            }
        }
Ejemplo n.º 9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            System.Globalization.CultureInfo ci = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
            ci.DateTimeFormat.ShortDatePattern        = SessionState.User.FormatDate;
            ci.DateTimeFormat.LongDatePattern         = SessionState.User.FormatDate;
            wdMasterPublishing.CalendarLayout.Culture = ci;
            wdMasterPublishing.MinDate = DateTime.UtcNow;

            warningMessage = "<font color='red' size='2'><b>Error:</b> Regional MATF is not possible.</font><br><br>" +
                             "This item has project with BOR date in future. Hence this item cannot be region validated. <br>" +
                             "Requesting user to try again after BOR date has reached.";

            if (SessionState.User.IsReadOnly)
            {
                uwToolbar.Items.FromKeyButton("Save").Enabled = false;
            }

            // Hide or show button switch capabilities
            if (!SessionState.User.HasCapability(CapabilitiesEnum.EDIT_DELETE_FINAL_CHUNKS_MARKET_SEGMENT))
            {
                UITools.HideToolBarButton(uwToolbar, "Save");
                UITools.HideToolBarSeparator(uwToolbar, "SaveSep");
            }

            // Retrieve current user and current culture
            user    = SessionState.User;
            culture = SessionState.Culture;

            try
            {
                // Get parameters
                if (Request["i"] != null)
                {
                    item = HyperCatalog.Business.Item.GetByKey(Convert.ToInt64(Request["i"]));
                }
                else if (QDEUtils.GetItemIdFromRequest() != null)
                {
                    item = QDEUtils.GetItemIdFromRequest();
                }

                if (Request["l"] != null)
                {
                    culture = QDEUtils.UpdateCultureCodeFromRequest("l");
                }

                if (Request["f"] != null)
                {
                    inputFormId = Convert.ToInt32(Request["f"]);
                }

                //Added by Prabhu for CR 5160 & ACQ 8.12 (PCF1: Auto TR Redesign)-- 21/May/09
                if (Request["isATRButton"] != null)
                {
                    isAutoTRButton = Convert.ToBoolean(Request["isATRButton"]);
                }

                if (inputFormId > 0)
                {
                    containerMATFList = Request["c"].ToString();
                    if (culture.Type == CultureType.Regionale && isAutoTRButton)
                    {
                        lblChkBoxAlert.Visible = true;
                        lblChkBoxAlert.Text    = "<font color='red'><b>Note:</b> Move status to will be performed on locally authored content only.</font>";
                    }
                }

                // Check
                //	- user is valid
                //	- culture is valid
                //	- item is valid
                //	- user has the current culture in its scope
                //	- user has the item in its scope
                if (user != null && culture != null && item != null &&
                    user.HasCultureInScope(culture.Code) &&
                    user.HasItemInScope(item.Id))
                {
                    if (!Page.IsPostBack)
                    {
                        DateTime today = DateTime.UtcNow;
                        item.RegionCode = culture.Code;
                        // check if this item or its inherited item has BOR date in future.
                        if (item.Milestones != null && culture.Type == CultureType.Regionale && inputFormId < 0)
                        {
                            if (!item.Milestones.Inherited)
                            {
                                if ((item.Milestones.BeginningOfRegionalization != null && item.Milestones.BeginningOfRegionalization.Value > today))
                                {
                                    panelMATF.Visible         = false;
                                    lblWarningMessage.Visible = true;
                                    lblWarningMessage.Text    = warningMessage;
                                }
                                else
                                {
                                    UpdateDataView();
                                }
                            }
                            else
                            {
                                item.Milestones.InheritedItem.RegionCode = culture.Code;
                                if ((item.Milestones.InheritedItem.Milestones.BeginningOfRegionalization != null && item.Milestones.InheritedItem.Milestones.BeginningOfRegionalization.Value > today))
                                {
                                    panelMATF.Visible         = false;
                                    lblWarningMessage.Visible = true;
                                    lblWarningMessage.Text    = warningMessage;
                                }
                                else
                                {
                                    UpdateDataView();
                                }
                            }
                        }
                        else
                        {
                            UpdateDataView();
                        }
                    }
                }
                else
                {
                    UITools.DenyAccess(DenyMode.Popup);
                    return;
                }
            }
            catch (Exception excep)
            {
                //Response.Write(excep.ToString());
                UITools.DenyAccess(DenyMode.Popup);
            }
        }