Ejemplo n.º 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);
 }
Ejemplo n.º 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 + ")";
            }
        }
Ejemplo n.º 3
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);
        }