Example #1
0
    protected void continue_Click(object sender, EventArgs e)
    {
        //CA = 39, MX = 159, US = 235,JP=116, SK=124, CH = 49, AU = 14
        int    StewardShipID = Convert.ToInt32(ddlStewardship.SelectedValue.Split('-').First());
        int    CountryID     = Convert.ToInt32(ddlCountry.SelectedValue);
        string StateCode     = "";

        if (StewardShipID > 0)
        {
            // StateCode = ddlStewardship.SelectedValue.Split('-').Last().ToLower();

            DataSet ds = OrganizationInfo.GetStateCodeByStateId(Conversion.ParseInt(ddlStewardship.SelectedValue));

            StateCode = ds.Tables[0].Rows[0][0].ToString().ToLower();
            //if (ds.Tables[1].Rows.Count > 0)
            //if (ds.Tables[1].Rows[0][0] != DBNull.Value)
            //    StewardShipID = Convert.ToInt32(ds.Tables[1].Rows[0][0]);
        }
        if (ddlStewardship.SelectedItem.Value != "0")
        {
            if (CountryID == 39)
            {
                //if (Request.RawUrl.Contains("/fr/"))
                //{
                //    Utils.SetCulture("fr-CA", "fr-CA");
                //}
                if (LanguageId == 3)
                {
                    Utils.SetCulture("fr-CA", "fr-CA");
                }
                else
                {
                    Utils.SetCulture("en-CA", "en-CA");
                }

                if (StewardShipID <= 0)
                {
                    Response.Redirect("/ca/login");
                    //Response.Redirect("/ca/registrationform");
                }
                else
                {
                    Response.Redirect(String.Format("/ca/{0}/login?SSID={1}", StateCode, StewardShipID.ToString()));
                    //Response.Redirect(String.Format("/ca/{0}/registration?SSID={1}", StateCode, StewardShipID.ToString()));
                }
            }
            else if (CountryID == 159)
            {
                Utils.SetCulture("es-MX", "es-MX");
                if (StewardShipID <= 0)
                {
                    Response.Redirect("/mx/login");
                    //Response.Redirect("/mx/registrationform");
                }
                else
                {
                    Response.Redirect(String.Format("/mx/{0}/login?SSID={1}", StateCode, StewardShipID.ToString()));
                    //Response.Redirect(String.Format("/mx/{0}/registration?SSID={1}", StateCode, StewardShipID.ToString()));
                }
            }
            else if (CountryID == 235)
            {
                Utils.SetCulture("en-US", "en-US");
                if (StewardShipID <= 0)
                {
                    Response.Redirect("/us/login");
                    //Response.Redirect("/us/registrationform");
                }


                else
                {
                    Response.Redirect(String.Format("/us/{0}/login?SSID={1}", StateCode, StewardShipID.ToString()));
                    //Response.Redirect(String.Format("/us/{0}/registration?SSID={1}", StateCode, StewardShipID.ToString()));
                }
            }
            else if (CountryID == 116)
            {
                Utils.SetCulture("ja-JP", "ja-JP");
                if (StewardShipID <= 0)
                {
                    Response.Redirect("/ja/login");
                    //Response.Redirect("/ja/registrationform");
                }
                else
                {
                    Response.Redirect(String.Format("/ja/{0}/login?SSID={1}", StateCode, StewardShipID.ToString()));
                    //Response.Redirect(String.Format("/ja/{0}/registration?SSID={1}", StateCode, StewardShipID.ToString()));
                }
            }
            else if (CountryID == 124)
            {
                Utils.SetCulture("ko-KR", "ko-KR");
                if (StewardShipID <= 0)
                {
                    Response.Redirect("/sk/login");
                    //Response.Redirect("/sk/registrationform");
                }
                else
                {
                    Response.Redirect(String.Format("/sk/{0}/login?SSID={1}", StateCode, StewardShipID.ToString()));
                    //Response.Redirect(String.Format("/sk/{0}/registration?SSID={1}", StateCode, StewardShipID.ToString()));
                }
            }
            else if (CountryID == 49)
            {
                Utils.SetCulture("zh-CN", "zh-CN");
                if (StewardShipID <= 0)
                {
                    Response.Redirect("/cn/login");
                    //Response.Redirect("/cn/registrationform");
                }
                else
                {
                    Response.Redirect(String.Format("/cn/{0}/login?SSID={1}", StateCode, StewardShipID.ToString()));
                    //Response.Redirect(String.Format("/cn/{0}/registration?SSID={1}", StateCode, StewardShipID.ToString()));
                }
            }
            else if (CountryID == 14)
            {
                Utils.SetCulture("en-AU", "en-AU");
                if (StewardShipID <= 0)
                {
                    Response.Redirect("/au/login");
                    //Response.Redirect("/au/registrationform");
                }
                else if (StewardShipID > 0)
                {
                    Response.Redirect(String.Format("/au/{0}/login?SSID={1}", StateCode, StewardShipID.ToString()));
                    //Response.Redirect(String.Format("/au/{0}/registration?SSID={1}", StateCode, StewardShipID.ToString()));
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        UserInfo userinfoobj = new UserInfo(LoginMemberId);

        lblRoleName.Text    = "(" + userinfoobj.RoleName + ")";
        lblSubRoleName.Text = userinfoobj.SubRoleName;

        UserInfo obj = UserInfo.GetCurrentUserInfo();

        litLoginName.Text = obj.Login;

        //lblRoleName.Text = obj.RoleName;
        //lblSubRoleName.Text = obj.SubRoleName;


        if (obj.LastLoginDate != null && obj.LastLoginDate != DateTime.MinValue)
        {
            //29 October, 2012//11:00am
            litLastLoginDate.Text = String.Format("Last Login on <b>{0}</b>at &nbsp; <b>{1}</b>", obj.LastLoginDate.ToString("dd MMMM, yyyy"), obj.LastLoginDate.ToString("hh:mm tt"));

            litLastLoginNotAvailable.Visible = false;
            litLastLoginDate.Visible         = true;
        }
        else
        {
            litLastLoginNotAvailable.Visible = true;
            litLastLoginDate.Visible         = false;
        }
        if (!IsPostBack)
        {
            lblcompanyname.Text = OrganizationInfo.GetOrgLegalNameByOrgId(UserOrganizationId);
            int stateid = OrganizationInfo.getStateId(obj.OrganizationId);
            try
            {
                DataSet ds1 = OrganizationInfo.GetStateCodeByStateId(stateid);
                litRole.Text = ds1.Tables[0].Rows[0]["StateName"].ToString();
            }
            catch { }
            DataTable dt = OrganizationInfo.GetLogoPath(obj.OrganizationId);

            if (dt != null && dt.Rows.Count > 0)
            {
                string str = ConfigurationManager.AppSettings["LogoUploadLocation"] + dt.Rows[0]["vchLogoPath"].ToString();
                if (string.IsNullOrEmpty(dt.Rows[0]["vchLogoPath"].ToString()))
                {
                    imgLogo.Visible        = false;
                    imgLogoDefault.Visible = true;
                }
                else
                {
                    imgLogo.Visible        = true;
                    imgLogoDefault.Visible = false;
                    str = str.Replace("//", "/");
                    imgLogo.ImageUrl = str;
                }


                //  litRole.Text = dt.Rows[0]["StateName"].ToString();// +" " + dt.Rows[0]["RoleName"].ToString();
            }
            else
            {
                imgLogo.Visible        = false;
                imgLogoDefault.Visible = true;
            }
            DataSet ds    = Notifications.getAllNotifications(UserInfo.GetCurrentUserInfo().UserId, UserOrganizationId, false, true, 100000, 1);
            int     count = ds.Tables[0].Rows.Count;
            if (count == 0)
            {
                lblnotficationcount.Text = "";
            }
            else
            {
                lblnotficationcount.Text = count.ToString();
            }
            BasePage objBase = new BasePage();

            ds = UserInfo.GetAllActiveLanguages();

            DataRow dr = ds.Tables[0].Select("LanguageId =" + objBase.LanguageId)[0];
            //litLangauge.Text = Convert.ToString(dr["CountryName"]);
            img.Src = "/images/" + Convert.ToString(dr["Flag"]);
            lvmessagesmain.DataSource = Notifications.getAllNotifications(UserInfo.GetCurrentUserInfo().UserId, UserOrganizationId, false, true, 10, 1);
            lvmessagesmain.DataBind();
        }
    }