Beispiel #1
0
 void btnSave_Click(object sender, EventArgs e)
 {
     if (int.Parse(ddSmtpBoxes.SelectedValue) > 0)
     {
         OutgoingEmailServiceConfig.AssignWithSmtpBox(OutgoingEmailServiceType.SendFile, int.Parse(ddSmtpBoxes.SelectedValue));
     }
     else
     {
         OutgoingEmailServiceConfig.AssignWithDefaultSmtpBox(OutgoingEmailServiceType.SendFile, null);
     }
     Response.Redirect("~/Admin/SearchSettings.aspx", true);
 }
Beispiel #2
0
        protected void btn_Save(object sender, System.EventArgs e)
        {
            Page.Validate();
            if (!Page.IsValid)
            {
                return;
            }

            int UserId = (int)ViewState["UserId"];

            try
            {
                // TODO: зачем сохранять два раза?
                Company.UpdateAlertInfo(cbUseAS.Checked, tbFirstname.Text, tbLastName.Text, tbEmail.Text);
                Company.UpdateAlertNotificationInfo(UserId, tbFirstname.Text, tbLastName.Text, tbEmail.Text);

                if (int.Parse(ddSmtpBoxes.SelectedValue) > 0)
                {
                    OutgoingEmailServiceConfig.AssignWithSmtpBox(OutgoingEmailServiceType.AlertService, int.Parse(ddSmtpBoxes.SelectedValue));
                }
                else
                {
                    OutgoingEmailServiceConfig.AssignWithDefaultSmtpBox(OutgoingEmailServiceType.AlertService, null);
                }

                PortalConfig.AlertSubjectFormat = txtSubjectTemp.Text;
                PortalConfig.UseIM = cbUseIMServer.Checked;

                Response.Redirect("~/Apps/Administration/Pages/default.aspx?NodeId=MAdmin4");
            }
            catch (EmailDuplicationException)
            {
                int    iUserId   = User.GetUserByEmail(tbEmail.Text);
                string sUserName = String.Empty;

                if (iUserId > 0)
                {
                    sUserName = CommonHelper.GetUserStatusPureName(iUserId);
                }

                cv1.IsValid      = false;
                cv1.ErrorMessage = LocRM.GetString("EmailDuplicate") + " (" + sUserName + ")";
            }
        }
Beispiel #3
0
        private void BindSavedValues()
        {
            using (IDataReader rdr = Mediachase.IBN.Business.User.GetUserInfoByLogin("Alert"))
            {
                if (rdr.Read())
                {
                    ViewState["UserId"] = rdr["UserId"];
                    tbFirstname.Text    = rdr["FirstName"].ToString();
                    tbLastName.Text     = rdr["LastName"].ToString();
                    tbEmail.Text        = rdr["Email"].ToString();
                }
            }
            SmtpBox box = OutgoingEmailServiceConfig.FindSmtpBox(OutgoingEmailServiceType.AlertService, false);

            if (box != null)
            {
                CommonHelper.SafeSelect(ddSmtpBoxes, box.SmtpBoxId.ToString());
            }
            cbUseAS.Checked       = PortalConfig.EnableAlerts;
            txtSubjectTemp.Text   = PortalConfig.AlertSubjectFormat;
            cbUseIMServer.Checked = PortalConfig.UseIM;
        }
Beispiel #4
0
        protected void BindSettings()
        {
            if (PortalConfig.UseFullTextSearch.HasValue)
            {
                trFTSNotInstalled.Visible = false;
                trFTSNotEnabled.Visible   = false;
                trFTSEnabled.Visible      = true;
                if ((bool)PortalConfig.UseFullTextSearch)
                {
                    ftsStat.Visible = true;
                    try
                    {
                        FullTextSearchInfo info = FullTextSearch.GetInformation();
                        lbIndSize.Text        = Util.CommonHelper.ByteSizeToStr(info.IndexSize * 1024 * 1024);
                        lbStat.Text           = info.PopulateStatus.ToString();
                        ftsInfoOK.Visible     = true;
                        ftsInfoFailed.Visible = false;
                    }
                    catch (Exception ex)
                    {
                        ftsInfoOK.Visible      = false;
                        ftsInfoFailed.Visible  = true;
                        lbFTSErrorMessage.Text = ex.Message;
                    }
                }
                else
                {
                    trFTSEnabled.Visible    = false;
                    ftsStat.Visible         = false;
                    trFTSNotEnabled.Visible = true;
                }
            }
            else
            {
                if (!FullTextSearch.IsInstalled())
                {
                    trFTSNotInstalled.Visible = true;
                    trFTSNotEnabled.Visible   = false;
                    trFTSEnabled.Visible      = false;
                }
                if (FullTextSearch.IsInstalled())
                {
                    trFTSNotInstalled.Visible = false;
                    trFTSNotEnabled.Visible   = true;
                    trFTSEnabled.Visible      = false;
                }
            }

            if (PortalConfig.UseWebDav.HasValue)
            {
                if ((bool)PortalConfig.UseWebDav)
                {
                    trWDDisabled.Visible = false;
                    trWDEnabled.Visible  = true;
                }
                else
                {
                    trWDDisabled.Visible = true;
                    trWDEnabled.Visible  = false;
                }
            }
            else
            {
                trWDDisabled.Visible = true;
                trWDEnabled.Visible  = false;
            }

            SmtpBox box = OutgoingEmailServiceConfig.FindSmtpBox(OutgoingEmailServiceType.SendFile, false);

            if (box != null)
            {
                CommonHelper.SafeSelect(ddSmtpBoxes, box.SmtpBoxId.ToString());
            }
        }
Beispiel #5
0
        private void imbSave_ServerClick(object sender, EventArgs e)
        {
            if (BoxId > 0)
            {
                EMailRouterPop3Box box = EMailRouterPop3Box.Load(BoxId);
                if (box != null)
                {
                    box.Name         = txtName.Text;
                    box.Server       = tbServer.Text.Trim();
                    box.Port         = int.Parse(tbPort.Text.Trim());
                    box.Login        = tbLogin.Text;
                    box.Pass         = tbPassword.Text != string.Empty ? tbPassword.Text : ViewState["Pop3Box_Password"].ToString();
                    box.EMailAddress = tbInternalEmail.Text;
                    switch (rblSecureConnection.SelectedValue)
                    {
                    case "Never":
                        box.SecureConnectionType = Pop3SecureConnectionType.None;
                        break;

                    case "SSL":
                        box.SecureConnectionType = Pop3SecureConnectionType.Ssl;
                        break;

                    case "TLS":
                        box.SecureConnectionType = Pop3SecureConnectionType.Tls;
                        break;
                    }
                    EMailRouterPop3Box.Update(box);

                    if (int.Parse(ddSmtpBoxes.SelectedValue) > 0)
                    {
                        OutgoingEmailServiceConfig.AssignWithSmtpBox(OutgoingEmailServiceType.HelpDeskEmailBox, BoxId, int.Parse(ddSmtpBoxes.SelectedValue));
                    }
                    else
                    {
                        OutgoingEmailServiceConfig.AssignWithDefaultSmtpBox(OutgoingEmailServiceType.HelpDeskEmailBox, BoxId);
                    }
                }
            }
            else
            {
                Pop3SecureConnectionType sct = Pop3SecureConnectionType.None;
                switch (rblSecureConnection.SelectedValue)
                {
                case "Never":
                    sct = Pop3SecureConnectionType.None;
                    break;

                case "SSL":
                    sct = Pop3SecureConnectionType.Ssl;
                    break;

                case "TLS":
                    sct = Pop3SecureConnectionType.Tls;
                    break;
                }
                if (IsInternal)
                {
                    int boxId = EMailRouterPop3Box.CreateInternal(txtName.Text, tbInternalEmail.Text.Trim(), tbServer.Text.Trim(), int.Parse(tbPort.Text.Trim()), tbLogin.Text, tbPassword.Text != string.Empty ? tbPassword.Text : ViewState["Pop3Box_Password"].ToString(), sct);
                    if (int.Parse(ddSmtpBoxes.SelectedValue) > 0)
                    {
                        OutgoingEmailServiceConfig.AssignWithSmtpBox(OutgoingEmailServiceType.HelpDeskEmailBox, boxId, int.Parse(ddSmtpBoxes.SelectedValue));
                    }
                    else
                    {
                        OutgoingEmailServiceConfig.AssignWithDefaultSmtpBox(OutgoingEmailServiceType.HelpDeskEmailBox, boxId);
                    }
                }
                else
                {
                    int boxId = EMailRouterPop3Box.CreateExternal(txtName.Text, tbInternalEmail.Text, tbServer.Text.Trim(), int.Parse(tbPort.Text.Trim()), tbLogin.Text, tbPassword.Text != string.Empty ? tbPassword.Text : ViewState["Pop3Box_Password"].ToString(), sct);
                    if (int.Parse(ddSmtpBoxes.SelectedValue) > 0)
                    {
                        OutgoingEmailServiceConfig.AssignWithSmtpBox(OutgoingEmailServiceType.HelpDeskEmailBox, boxId, int.Parse(ddSmtpBoxes.SelectedValue));
                    }
                    else
                    {
                        OutgoingEmailServiceConfig.AssignWithDefaultSmtpBox(OutgoingEmailServiceType.HelpDeskEmailBox, boxId);
                    }
                }
            }

            Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                    "try {window.opener.location.href=window.opener.location.href;}" +
                                                    "catch (e){} window.close();", true);
        }
Beispiel #6
0
        private void BindData()
        {
            ddSmtpBoxes.DataSource     = SmtpBox.List();
            ddSmtpBoxes.DataTextField  = "Name";
            ddSmtpBoxes.DataValueField = "SmtpBoxId";
            ddSmtpBoxes.DataBind();
            ddSmtpBoxes.Items.Insert(0, new ListItem(LocRM.GetString("tDefaultValue"), "-1"));
            if (BoxId > 0)
            {
                EMailRouterPop3Box box = EMailRouterPop3Box.Load(BoxId);
                if (box != null)
                {
                    txtName.Text         = box.Name;
                    tbInternalEmail.Text = box.EMailAddress;
                    tbServer.Text        = box.Server;
                    tbPort.Text          = box.Port.ToString();
                    tbLogin.Text         = box.Login;
                    //tbPassword.Text = box.Pass;
                    ViewState["Pop3Box_Password"] = box.Pass;
                    ListItem li = null;
                    switch (box.SecureConnectionType)
                    {
                    case Pop3SecureConnectionType.Ssl:
                        li = rblSecureConnection.Items.FindByValue("SSL");
                        if (li != null)
                        {
                            li.Selected = true;
                        }
                        break;

                    case Pop3SecureConnectionType.Tls:
                        li = rblSecureConnection.Items.FindByValue("TLS");
                        if (li != null)
                        {
                            li.Selected = true;
                        }
                        break;

                    default:
                        li = rblSecureConnection.Items.FindByValue("Never");
                        if (li != null)
                        {
                            li.Selected = true;
                        }
                        break;
                    }
                    SmtpBox smtp = OutgoingEmailServiceConfig.FindSmtpBox(OutgoingEmailServiceType.HelpDeskEmailBox, BoxId, false);
                    if (smtp != null)
                    {
                        CommonHelper.SafeSelect(ddSmtpBoxes, smtp.SmtpBoxId.ToString());
                    }
                }
                trConfirmPassword.Visible = false;
                rfvPassword.Enabled       = false;
            }
            else
            {
                trConfirmPassword.Visible = true;
                rfvPassword.Enabled       = true;
            }
        }