/// <summary> /// Handles the OnClick event of the lbtnSave control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> protected void lbtnSave_OnClick(object sender, EventArgs e) { var sourceMonitoring = DataManager.SourceMonitoring.SelectById(SiteId, _sourceMonitoringId) ?? new tbl_SourceMonitoring(); sourceMonitoring.Name = txtName.Text; sourceMonitoring.SourceTypeID = int.Parse(ddlSourceType.SelectedValue); sourceMonitoring.StatusID = int.Parse(ddlStatus.SelectedValue); sourceMonitoring.Comment = txtComment.Text; sourceMonitoring.PopHost = txtPOPHost.Text; sourceMonitoring.PopUserName = txtPOPUserName.Text; sourceMonitoring.PopPassword = txtPOPPassword.Text; sourceMonitoring.PopPort = int.Parse(rntxtPopPort.Text); sourceMonitoring.IsSsl = chxIsSsl.Checked; sourceMonitoring.IsLeaveOnServer = chxIsLeaveOnServer.Checked; sourceMonitoring.DaysToDelete = !string.IsNullOrEmpty(rntxtDaysToDelete.Text) ? (int?)int.Parse(rntxtDaysToDelete.Text) : null; sourceMonitoring.SenderProcessingID = int.Parse(ddlSenderProcessing.SelectedValue); sourceMonitoring.ProcessingOfAutoRepliesID = int.Parse(ddlProcessingOfAutoReplies.SelectedValue); sourceMonitoring.IsRemoveAutoReplies = chxRemoveAutoReplies.Checked; sourceMonitoring.ProcessingOfReturnsID = int.Parse(ddlProcessingOfReturns.SelectedValue); sourceMonitoring.IsRemoveReturns = chxRemoveReturns.Checked; sourceMonitoring.RequestSourceTypeID = dcbRequestSourceType.SelectedIdNullable; sourceMonitoring.ReceiverContactID = ucContact.SelectedValue; sourceMonitoring.StartDate = rdpStartDate.SelectedDate; if (sourceMonitoring.ID == Guid.Empty) { sourceMonitoring.SiteID = SiteId; DataManager.SourceMonitoring.Add(sourceMonitoring); } else { DataManager.SourceMonitoring.Update(sourceMonitoring); } DataManager.SourceMonitoringFilter.DeleteAll(SiteId, sourceMonitoring.ID); DataManager.SourceMonitoringFilter.Add((List <tbl_SourceMonitoringFilter>)ViewState["SourceMonitoringFilters"]); tagsSourceMonitoring.SaveTags(sourceMonitoring.ID); Response.Redirect(UrlsData.AP_SourceMonitorings()); }
protected void Page_Load(object sender, EventArgs e) { Title = "Мониторинг внешних источников - LeadForce"; if (Page.RouteData.Values["id"] != null) { _sourceMonitoringId = Guid.Parse(Page.RouteData.Values["id"] as string); } hlCancel.NavigateUrl = UrlsData.AP_SourceMonitorings(); rgSourceMonitoringFilters.Culture = new CultureInfo("ru-RU"); tagsSourceMonitoring.ObjectID = _sourceMonitoringId; if (!Page.IsPostBack) { BindData(); } }