Example #1
0
        private void ReadUserControlValues(UserControl userControl, ref Models.Channel item)
        {
            item.Enabled          = (bool)(userControl.FindControl("cbEnabled") as RadCheckBox).Checked;
            item.Name             = (userControl.FindControl("txtChannelName") as RadTextBox).Text;
            item.ChannelNameAlias = (userControl.FindControl("txtChannelNameAlias") as RadTextBox).Text;
            item.OutputType       = /*(Models.ChannelType) */ ((userControl.FindControl("DropDownListType") as RadDropDownList).SelectedItem.Index);

            item.PDFType            = /*(Models.PDFType) */ ((userControl.FindControl("RadDropDownListPDFType") as RadDropDownList).SelectedItem.Index);
            item.MergedPDF          = (bool)(userControl.FindControl("cbMergedPDF") as RadCheckBox).Checked;
            item.EditionsToGenerate = ((userControl.FindControl("RadDropDownListEditionsToGenerate") as RadDropDownList).SelectedItem.Index);
            item.SendCommonPages    = (bool)(userControl.FindControl("cbSendCommonPages") as RadCheckBox).Checked;

            //            item.PublisherID = Utils.GetPublisherID((userControl.FindControl("RadDropDownListPublisher") as RadDropDownList).SelectedItem.Value);
            //            item.ChannelGroupID = Utils.GetChannelGroupID((userControl.FindControl("RadDropDownListChannelGroup") as RadDropDownList).SelectedItem.Value);

            item.UseReleaseTime = (bool)(userControl.FindControl("cbUseReleaseTime") as RadCheckBox).Checked;
            TimeSpan?dtStart = (userControl.FindControl("RadTimePickerReleaseTime") as RadTimePicker).SelectedTime;
            TimeSpan?dtEnd   = (userControl.FindControl("RadTimePickerReleaseTimeEnd") as RadTimePicker).SelectedTime;

            if (dtStart.HasValue)
            {
                item.ReleaseTime = dtStart.Value.Hours * 100 + dtStart.Value.Minutes;
            }
            if (dtEnd.HasValue)
            {
                item.ReleaseTimeEnd = dtEnd.Value.Hours * 100 + dtEnd.Value.Minutes;
            }

            item.TransmitNameFormat        = (userControl.FindControl("txtTransmitNameFormat") as RadTextBox).Text;
            item.TransmitNameDateFormat    = (userControl.FindControl("txtTransmitNameDateFormat") as RadTextBox).Text;
            item.SubFolderNamingConvension = (userControl.FindControl("txtSubFolderNamingConvension") as RadTextBox).Text;
            item.TransmitNameUseAbbr       = ((userControl.FindControl("RadDropDownListTransmitNameUseAbbr") as RadDropDownList).SelectedItem.Index);
            item.OutputFolder    = (userControl.FindControl("txtOutputFolder") as RadTextBox).Text;
            item.UseSpecificUser = (bool)(userControl.FindControl("cbSpecificUser") as RadCheckBox).Checked;
            item.UserName        = (userControl.FindControl("txtUserName") as RadTextBox).Text;
            item.Password        = (userControl.FindControl("txtPassword") as RadTextBox).Text;

            item.FTPServer     = (userControl.FindControl("txtFtpServer") as RadTextBox).Text;
            item.FTPUserName   = (userControl.FindControl("txtFtpUsername") as RadTextBox).Text;
            item.FTPPassword   = (userControl.FindControl("txtFtpPassword") as RadTextBox).Text;
            item.FTPfolder     = (userControl.FindControl("txtFtpFolder") as RadTextBox).Text;
            item.FTPPasv       = (bool)(userControl.FindControl("cbFtpPassive") as RadCheckBox).Checked;
            item.FTPXCRC       = (bool)(userControl.FindControl("cbFtpXcrc") as RadCheckBox).Checked;
            item.FTPEncryption = /*(Models.EncryptionType)*/ ((userControl.FindControl("RadDropDownListEncryption") as RadDropDownList).SelectedItem.Index);
            item.FTPPostCheck  = ((userControl.FindControl("RadDropDownListFTPPostCheck") as RadDropDownList).SelectedItem.Index);
        }
Example #2
0
        protected void RadGridExport_InsertCommand(object source, GridCommandEventArgs e)
        {
            UserControl userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);

            Models.Channel newItem = new Models.Channel()
            {
                ChannelID = 0
            };

            ReadUserControlValues(userControl, ref newItem);

            DataProviders.DBaccess db = new DataProviders.DBaccess();
            if (db.InsertUpdateChannel(newItem, out string errmsg) == false)
            {
                LabelError.Text = errmsg;
                e.Canceled      = true;
            }
            Session["EditedChannelDataItem"] = null;
        }
Example #3
0
        protected void RadGridExport_UpdateCommand(object source, GridCommandEventArgs e)
        {
            GridEditableItem editedItem  = e.Item as GridEditableItem;
            UserControl      userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);

            if (editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["ChannelID"] == null)
            {
                RadGridExport.Controls.Add(new LiteralControl("Unable to locate the ChannelID for updating."));
                e.Canceled = true;
                return;
            }
            int?channelID = (int?)editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["ChannelID"];

            if (channelID.HasValue == false)
            {
                RadGridExport.Controls.Add(new LiteralControl("Unable to locate the ChannelID for updating."));
                e.Canceled = true;
                return;
            }

            Models.Channel selectedItem = new Models.Channel()
            {
                ChannelID = channelID.Value
            };

            ReadUserControlValues(userControl, ref selectedItem);
            selectedItem.RegularExpressions = ((Models.Channel)Session["EditedChannelDataItem"]).RegularExpressions;
            DataProviders.DBaccess db = new DataProviders.DBaccess();
            if (db.InsertUpdateChannel(selectedItem, out string errmsg) == false)
            {
                LabelError.Text = errmsg;
                e.Canceled      = true;
            }

            Session["EditedChannelDataItem"] = null;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Models.Channel channel = new Models.Channel();
                channel.ChannelID    = 0;
                channel.PDFProcessID = 1;

                int channelIDFromMainForm = 0;
                if (Request.QueryString["ChannelID"] != null)
                {
                    channelIDFromMainForm = Utils.StringToInt(Request.QueryString["ChannelID"]);
                    DataProviders.DBaccess db = new DataProviders.DBaccess();
                    db.GetChannel(channelIDFromMainForm, ref channel, out string errmsg);

                    btnUpdate.Text = "Update";
                }
                Channel = channel;

                RadDropDownListPDFProcessID.Items.Clear();
                List <string> pdfProcessNames = Utils.GetPDFProcessNames();
                foreach (string s in pdfProcessNames)
                {
                    RadDropDownListPDFProcessID.Items.Add(new DropDownListItem(s, s));
                }
                RadDropDownListPDFProcessID.SelectedIndex = 0;


                if (Channel != null)
                {
                    cbEnabled.Checked                               = Channel.Enabled;
                    txtChannelName.Text                             = Channel.Name;
                    txtChannelNameAlias.Text                        = Channel.ChannelNameAlias;
                    RadDropDownListPDFType.SelectedIndex            = Channel.PDFType;
                    cbMergedPDF.Checked                             = Channel.MergedPDF;
                    RadDropDownListEditionsToGenerate.SelectedIndex = Channel.EditionsToGenerate;
                    cbSendCommonPages.Checked                       = Channel.SendCommonPages;
                    cbUseReleaseTime.Checked                        = Channel.UseReleaseTime;
                    int h = Channel.ReleaseTime / 100;
                    RadTimePickerReleaseTime.SelectedTime = new TimeSpan(h, Channel.ReleaseTime - h * 100, 0);
                    h = Channel.ReleaseTimeEnd / 100;
                    RadTimePickerReleaseTimeEnd.SelectedTime = new TimeSpan(h, Channel.ReleaseTimeEnd - h * 100, 0);
                    txtTransmitNameFormat.Text        = Channel.TransmitNameFormat;
                    txtTransmitNameDateFormat.Text    = Channel.TransmitNameDateFormat;
                    txtSubFolderNamingConvension.Text = Channel.SubFolderNamingConvension;
                    RadDropDownListTransmitNameUseAbbr.SelectedIndex = Channel.TransmitNameUseAbbr;
                    //cbSendMail.Checked = Channel.SendMail;
                    DropDownListType.SelectedIndex = Channel.OutputType;
                    txtOutputFolder.Text           = Channel.OutputFolder;
                    cbSpecificUser.Checked         = Channel.UseSpecificUser;
                    txtUserNameX.Text    = Channel.UserName;
                    txtPasswordX.Text    = Channel.Password;
                    txtFtpServer.Text    = Channel.FTPServer;
                    txtFtpFolder.Text    = Channel.FTPfolder;
                    txtFtpUsername.Text  = Channel.FTPUserName;
                    txtFtpPassword.Text  = Channel.FTPPassword;
                    cbFtpPassive.Checked = Channel.FTPPasv;
                    cbFtpXcrc.Checked    = Channel.FTPXCRC;
                    RadDropDownListEncryption.SelectedIndex   = Channel.FTPEncryption;
                    RadDropDownListFTPPostCheck.SelectedIndex = Channel.FTPPostCheck;

                    RadDropDownListTriggerMode.SelectedIndex = Channel.TriggerMode;
                    txtEmailReceivers.Text = Channel.TriggerEmail;

                    cbDeleteOldOutputFiles.Checked = Channel.DeleteOldOutputFilesDays > 0; // reuse...

                    cbUsePackageNames.Checked = Channel.UsePackageNames;

                    cbSelectedPagesOnly.Checked     = channel.OnlySentSelectedPages;
                    RadNumericTextBoxFromPage.Value = channel.PageNumberStart;
                    RadNumericTextBoxToPage.Value   = channel.PageNumberEnd;

                    if (Channel.PDFType == (int)Models.PDFtype.PDFHighRes)
                    {
                        RadDropDownListPDFProcessID.SelectedText = "None";
                    }
                    else
                    {
                        Models.PDFProcess pdfProcess = Utils.GetPDFProcessFromID(channel.PDFProcessID);
                        if (pdfProcess != null)
                        {
                            RadDropDownListPDFProcessID.SelectedText = pdfProcess.ProcessName;
                        }
                    }

                    txtEmailServer.Text        = Channel.EmailServer;
                    txtEmailPort.Text          = Channel.EmailPort.ToString();
                    txtEmailSubject.Text       = Channel.EmailSubject;
                    txtEmailTimeout.Text       = Channel.EmailTimeout.ToString();
                    RadEmailBody.Text          = Channel.EmailBody;
                    txtEmailCC.Text            = Channel.EmailCC;
                    txtEmailFrom.Text          = Channel.EmailFrom;
                    cbEmailHTML.Checked        = Channel.EmailHTML;
                    txtEmailPassword.Text      = Channel.EmailPassword;
                    txtEmailTo.Text            = Channel.EmailTo;
                    txtEmailUserName.Text      = Channel.EmailUserName;
                    cbEmailUseSSL.Checked      = Channel.EmailUseSSL;
                    cbEmailUseStartTLS.Checked = Channel.EmailUseStartTLS;
                }

                DropDownListType_SelectedIndexChanged(null, null);
            }
        }
Example #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Models.Channel ch          = null;
            int            nOutputType = 1;

            if (DataItem is Models.Channel)
            {
                ch          = (DataItem as Models.Channel);
                nOutputType = ch.OutputType;
            }

            //   if ((bool)Session["ConfigExportDetailsFormLoaded"] == true)
            //  {
            nOutputType = DropDownListType.SelectedIndex;
            Session["ConfigExportDetailsFormLoaded"] = true;
            //   }
            PanelSMB.Visible    = false;
            PanelFTP.Visible    = false;
            PanelEmail.Visible  = false;
            PanelGoogle.Visible = false;
            PanelS3.Visible     = false;

            if (nOutputType == 1)
            {
                PanelFTP.Visible = true;
            }
            else if (nOutputType == 2)
            {
                PanelEmail.Visible = true;
            }
            else if (nOutputType == 3)
            {
                PanelGoogle.Visible = true;
            }
            else if (nOutputType == 4)
            {
                PanelS3.Visible = true;
            }
            else
            {
                PanelSMB.Visible = true;
            }

            /*  if (!IsPostBack)
             * {
             *    RadDropDownListChannelGroup.Items.Clear();
             *    if (Session["ChannelGroupList"] != null)
             *    {
             *        List<Models.ChannelGroup> channelGroupList = (List<Models.ChannelGroup>)Session["ChannelGroupList"];
             *        if (channelGroupList != null)
             *        {
             *            foreach (Models.ChannelGroup cg in channelGroupList)
             *                RadDropDownListChannelGroup.Items.Add(cg.Name);
             *        }
             *    }
             *    RadDropDownListPublisher.Items.Clear();
             *    if (Session["PubliserList"] != null)
             *    {
             *        List<Models.Publisher> publisherList = (List<Models.Publisher>)Session["PubliserList"];
             *        if (publisherList != null)
             *        {
             *            foreach (Models.Publisher publ in publisherList)
             *                RadDropDownListPublisher.Items.Add(publ.PublisherName);
             *        }
             *    }
             * }*/
        }