private void LoadDisplayName()
    {
        string organizationName = string.Empty;

        if (Convert.ToInt32(Session["SignInAccountTypeId"]) == 0)
        {
            lblUserText.Text = "You signed in as " + Session["SignInId"].ToString();
            return;
        }
        lblUserId.Text = "<span class=\"LoggedInSub\">You signed in as " + Session["SignInId"].ToString() + "<br/>";

        switch ((AccountType)Convert.ToInt32(Session["SignInAccountTypeId"]))
        {
            case AccountType.Organization:
                lblUserId.Text += " (Administration)</span>";
                break;
            case AccountType.Doctor:
                organizationName = new OrganizationBAL().GetOrganizationNameById(Convert.ToInt32(Session["SignInOrganizationId"]));
                if (organizationName.Length > 50)
                    organizationName = organizationName.Substring(0, 50) + "...";
                lblUserId.Text += " (Doctor in " + organizationName + ")</span>";
                break;
            case AccountType.Service:
                organizationName = new OrganizationBAL().GetOrganizationNameById(Convert.ToInt32(Session["SignInOrganizationId"]));
                if (organizationName.Length > 50)
                    organizationName = organizationName.Substring(0, 50) + "...";
                lblUserId.Text += " (Service in " + organizationName + ")</span>";
                break;
            case AccountType.Patient:
                lblUserId.Text += " (Patient)</span>";
                break;
        }
    }
    private void LoadDisplayName()
    {
        string displayName = string.Empty;
        string organizationName = string.Empty;

        if (Session["SignInAccountId"] != null)
            displayName = new CommonBAL().GetNameBySignInId(Session["SignInId"].ToString(), Convert.ToInt32(Session["SignInAccountTypeId"]), Convert.ToInt32(Session["SignInAccountId"]), Convert.ToInt32(Session["SignInOrganizationId"]));
        else
            displayName = new CommonBAL().GetNameBySignInId(Session["SignInId"].ToString(), 0, 0, Convert.ToInt32(Session["SignInOrganizationId"]));

        if ((AccountType)Convert.ToInt32(Session["SignInAccountTypeId"]) == AccountType.Organization)
        {
            organizationName = new OrganizationBAL().GetOrganizationNameById(Convert.ToInt32(Session["SignInOrganizationId"]));
            lblUser.ToolTip = "Welcome " + organizationName;

            if (organizationName.Length > 50)
                lblUser.Text = "Welcome " + organizationName.Substring(0, 50) + "...";
            else
                lblUser.Text = "Welcome " + organizationName;
            return;
        }
        else
        {
            lblUser.Text = "Welcome " + displayName;
            return;
        }
    }
    protected void lnkActivate_OnActivate(object sender, CommandEventArgs e)
    {
        int OrganizationId = Convert.ToInt32(e.CommandArgument);

        new AdministrationBAL().UpdateHospitalActivation(OrganizationId);

        OrganizationDO o = new OrganizationBAL().GetOrganizationById(OrganizationId);
        LoginNewDO l = new LoginBAL().GetAccount(o.LoginId);

        if (l.MobileId.Substring(0, 2) == "91")
            CommunicationBAL.SendSMSToIndiaWithoutCheckingNotification(l.MobileId, OrganizationRegisteredSMSFormat(o.OrganizationName), (int)AccountType.Organization, "Account Activation", o.OrganizationId);
        else
            CommunicationBAL.SendSMSToNonIndiaWithoutCheckingNotification(l.MobileId, OrganizationRegisteredSMSFormat(o.OrganizationName), (int)AccountType.Organization, "Account Activation", o.OrganizationId);

        string inCharge = l.FirstName + " " + l.LastName;
        string emailBody = OrganizationAccountActivatedEmailFormat(inCharge);
        CommunicationBAL.SendEmailWithoutCheckingNotification(l.EmailId, "MedAppointment - Organization Account Activated", emailBody, true);

        //EmailSmsBAL.ActivatedOrganization(l.MobileId, l.EmailId, inCharge, o.OrganizationName);

        BindHospital(false);

        ShowAlertMessage("Activated Successfully!");
    }
 //protected void txtSubDomain_TextChanged(object sender, EventArgs e)
 //{
 //    if (ValidateSubDomain(txtSubDomain.Text.Trim()))
 //    {
 //        cvSubDomain.IsValid = true;
 //    }
 //    else
 //    {
 //        cvSubDomain.IsValid = false;
 //    }
 //}
 private bool ValidateSubDomain(string subDomain)
 {
     int organizationId = 0;
     OrganizationBAL objOrganizationBal = new OrganizationBAL();
     if (objOrganizationBal.ValidateSubDomain(subDomain, organizationId) > 0)
         return false;
     else
         return true;
 }
    private bool ValidateOrganization(string organizationName)
    {
        int _organizationId = 0;
        OrganizationBAL objOrganizationBal = new OrganizationBAL();

        if (objOrganizationBal.ValidateOrganization(organizationName) > 0)
            return false;
        else
            return true;
    }
    private void SaveOrganization()
    {
        //string titleCaseorganizationAddress = txtAddress.Text.ToLower();
        string titleCaseorganizationName = txtOrganizationName.Text.ToLower();
        //string titleCasepersonIncahrge = txtInCharge.Text.ToLower();
        //string titleCaseBranchName = txtBranchName.Text.ToLower();
        //string titleCaseRefferedBy = txtReferedBy.Text.ToLower();
        string titleCaseSubDomain = txtSubDomain.Text.ToLower();
        //txtAddress.Text = ToTitleCase(titleCaseorganizationAddress);
        txtOrganizationName.Text = ToTitleCase(titleCaseorganizationName);
        //txtInCharge.Text = ToTitleCase(titleCasepersonIncahrge);
        //txtBranchName.Text = ToTitleCase(titleCaseBranchName);
        //txtEmail.Text = txtEmail.Text.ToLower();
        //txtReferedBy.Text = ToTitleCase(titleCaseRefferedBy);
        txtSubDomain.Text = ToTitleCase(titleCaseSubDomain);

        OrganizationDO o = new OrganizationDO();
        //o.LoginId = Convert.ToInt32(Session["SignInLoginId"]);
        //o.OrganizationName = Regex.Replace(txtOrganizationName.Text.Trim(), @"\s+", " ");
        //o.CountryId = Convert.ToInt32(ddlCountry.SelectedValue);
        //if (trState.Visible)
        //    o.StateId = Convert.ToInt32(ddlState.SelectedValue);
        //else
        //    o.StateId = 0;
        //if (trCity.Visible)
        //    o.CityId = Convert.ToInt32(ddlCity.SelectedValue);
        //else
        //    o.CityId = 0;
        //o.BranchName = Regex.Replace(txtBranchName.Text.Trim(), @"\s+", " ");
        ////o.Address = null;
        //o.PostalCode = txtPostalCode.Text;
        //o.TimeZone = ddlTimeZone.SelectedValue;
        //o.Phone = null;
        //o.Mobile = hfMobile.Value;
        //o.InCharge = null;
        //o.IsExternalReference = Convert.ToBoolean(0);
        //o.MaxAppointmentDays = 0; //txtPriorDays.Text
        //o.IsApprovalSystem = false; //chkApprovalSystem.Checked
        //o.IsCarParkFacility = Convert.ToBoolean(0);
        //o.IsConditionsPage = Convert.ToBoolean(0);
        //o.SubDomain = txtSubDomain.Text; //sb.ToString();
        //o.CNameUrl = ""; //txtCNameUrl.Text;
        //o.WelcomeTitle = ""; //txtShortDescription.Text;
        //o.AboutOrganization = ""; //txtAboutOrganization.Text;
        //o.ReferedBy = null;
        //o.ReferenceToken = new CommonBAL().GetNewToken();

        int organizationId = new OrganizationBAL().SaveOrganization(txtOrganizationName.Text, txtSubDomain.Text);

        if (organizationId > 0)
        {
            Response.Redirect("Job_ManageAdmin.aspx");
            //ViewState["OrganizationId"] = organizationId;
            //organizationName = Regex.Replace(txtOrganizationName.Text.Trim(), @"\s+", " ") + " " + Regex.Replace(txtBranchName.Text.Trim(), @"\s+", " ");
            //ClientScriptManager cs = Page.ClientScript;
            //Type cType = this.GetType();
            //string cScript = "$(document).ready(function () { $.colorbox({ inline: true, width: \"700px\", href: \"#inline_content\" }) });";
            //cs.RegisterStartupScript(cType, "popup", cScript,true);
        }
    }