Пример #1
0
        /// <summary>
        /// 初始化防止重复提交在Page_Load
        /// 初始化之前要在前台加入一个隐藏域web控件&lt;asp:HiddenField ID="HidSign" runat="server" /&gt;
        /// <param name="_Page">Page对象</param>
        /// <param name="_HiddenField">隐藏域对象ID</param>
        /// </summary>
        public static void Start_HidSign(System.Web.UI.Page _Page, System.Web.UI.WebControls.HiddenField _HiddenField)
        {
            string S_Sign = MathRandom.RandomDateTime(false, true).ToString() + MathRandom.RandomNumber(6);

            _HiddenField.Value        = S_Sign;
            _Page.Session["WHidSign"] = S_Sign;
        }
Пример #2
0
        /// <summary>
        /// 判断不是重复提交
        /// </summary>
        /// <param name="_Page">Page对象</param>
        /// <param name="_HiddenField">隐藏域对象ID</param>
        /// <returns>不是重复提交返回true,重复提交返回false</returns>
        public static bool IsNotReback(System.Web.UI.Page _Page, System.Web.UI.WebControls.HiddenField _HiddenField)
        {
            bool M_S = false;

            if (_Page.Session["WHidSign"] == null)
            {
                StopReback.Start_HidSign(_Page, _HiddenField);
                //正常提交
                M_S = true;
            }
            else
            {
                string M_A = _HiddenField.Value.ToString();
                string M_B = _Page.Session["WHidSign"].ToString();

                if (M_A.Equals(M_B))
                {
                    //正常提交
                    M_S = true;
                }
                else
                {
                    //重复提交
                    M_S = false;
                }
            }

            StopReback.Start_HidSign(_Page, _HiddenField);

            return(M_S);
        }
Пример #3
0
 private void AddHiddenField(System.Web.UI.WebControls.Panel p, string id)
 {
     using (System.Web.UI.WebControls.HiddenField hidden = new System.Web.UI.WebControls.HiddenField())
     {
         hidden.ID = id;
         p.Controls.Add(hidden);
     }
 }
Пример #4
0
 public static void ResetPanel(System.Web.UI.Control p_obj)
 {
     foreach (System.Web.UI.Control control in p_obj.Controls)
     {
         if (control.GetType().FullName == "DevExpress.Web.ASPxTextBox")
         {
             DevExpress.Web.ASPxTextBox ctr = (DevExpress.Web.ASPxTextBox)control;
             ctr.Text = "";
         }
         else if (control.GetType().FullName == "DevExpress.Web.ASPxMemo")
         {
             DevExpress.Web.ASPxMemo ctr = (DevExpress.Web.ASPxMemo)control;
             ctr.Text = "";
         }
         else if (control.GetType().FullName == "DevExpress.Web.ASPxComboBox")
         {
             DevExpress.Web.ASPxComboBox ctr = (DevExpress.Web.ASPxComboBox)control;
             ctr.SelectedIndex = 0;
         }
         else if (control.GetType().FullName == "DevExpress.Web.ASPxSpinEdit")
         {
             DevExpress.Web.ASPxSpinEdit ctr = (DevExpress.Web.ASPxSpinEdit)control;
             ctr.MinValue            = 0;
             ctr.MaxValue            = 9999999999999999999;
             ctr.Number              = 0;
             ctr.DisplayFormatString = "#,###";
             ctr.Value = ctr.MinValue;
         }
         else if (control.GetType().FullName == "DevExpress.Web.ASPxDateEdit")
         {
             DevExpress.Web.ASPxDateEdit ctr = (DevExpress.Web.ASPxDateEdit)control;
             ctr.Value = null;
         }
         else if (control.GetType().FullName == "DevExpress.Web.ASPxTimeEdit")
         {
             DevExpress.Web.ASPxTimeEdit ctr = (DevExpress.Web.ASPxTimeEdit)control;
             ctr.Value = null;
         }
         else if (control.GetType().FullName == "DevExpress.Web.ASPxCheckBox")
         {
             DevExpress.Web.ASPxCheckBox ctr = (DevExpress.Web.ASPxCheckBox)control;
             ctr.Checked = false;
         }
         else if (control.GetType().FullName == "DevExpress.Web.Bootstrap.BootstrapComboBox")
         {
             DevExpress.Web.Bootstrap.BootstrapComboBox ctr = (DevExpress.Web.Bootstrap.BootstrapComboBox)control;
             ctr.SelectedIndex = 0;
         }
         else if (control.GetType().FullName == "System.Web.UI.WebControls.HiddenField")
         {
             System.Web.UI.WebControls.HiddenField objD = (System.Web.UI.WebControls.HiddenField)control;
             if (objD.ID != "hdfFunc")
             {
                 objD.Value = "-1";
             }
         }
     }
 }
Пример #5
0
        protected override void OnInit(EventArgs e)
        {
            var hdnArea = new System.Web.UI.WebControls.HiddenField();

            hdnArea.ID    = ID + "_hdnArea";
            hdnArea.Value = "";

            Controls.Add(hdnArea);
        }
Пример #6
0
        protected override void OnInit(EventArgs e)
        {
            if (Template == TextAreaTemplate.TextEditor)
            {
                var hdnArea = new System.Web.UI.WebControls.HiddenField();
                hdnArea.ID    = ID + "_hdnArea";
                hdnArea.Value = "";

                Controls.Add(hdnArea);
            }

            base.OnInit(e);
        }
        /// <summary>
        /// 分页方法
        /// </summary>
        /// <param name="_Page">Page类</param>
        /// <param name="_DS">dataset数据源</param>
        /// <param name="_Repeater">数据绑定控件 Repeater 或者 DataList</param>
        /// <param name="_HtmlGenericControl">Div 加 runat='server'</param>
        /// <param name="_HiddenField">隐藏域</param>
        public void Paged(System.Web.UI.Page _Page, System.Data.DataSet _DS, System.Web.UI.WebControls.Repeater _Repeater, System.Web.UI.HtmlControls.HtmlGenericControl _HtmlGenericControl, System.Web.UI.WebControls.HiddenField _HiddenField)
        {
            //赋值
            __DS                 = _DS;
            __Repeater           = _Repeater;
            __HtmlGenericControl = _HtmlGenericControl;
            _SessionString       = _HiddenField.ID.ToString();
            M_HiddenField        = _HiddenField;

            if (M_HiddenField.Value == String.Empty)
            {
                M_HiddenField.Value = "0";
            }

            //执行分页
            DoPage(_Page, __DS, __Repeater);
        }
Пример #8
0
        protected override void CreateChildControls()
        {
            UpdatePanel up = _InternalUpdatePanel;

            System.Web.UI.WebControls.HiddenField h = new System.Web.UI.WebControls.HiddenField();
            h.ID    = up.ID + "_HiddenField";
            h.Value = string.Empty;
            up.ContentTemplateContainer.Controls.Add(h);

            System.Web.UI.WebControls.LinkButton lb = new System.Web.UI.WebControls.LinkButton();
            lb.ID = up.ID + "_LB"; // "_LinkButton";
            up.ContentTemplateContainer.Controls.Add(lb);

            this.Controls.Add(up);

            base.CreateChildControls();
        }
Пример #9
0
        private void btnDelete_Click(object sender, System.EventArgs e)
        {
            bool flag  = true;
            bool flag2 = true;

            foreach (System.Web.UI.WebControls.DataListItem item in this.photoDataList.Controls)
            {
                System.Web.UI.WebControls.CheckBox    box   = (System.Web.UI.WebControls.CheckBox)item.FindControl("checkboxCol");
                System.Web.UI.WebControls.HiddenField field = (System.Web.UI.WebControls.HiddenField)item.FindControl("HiddenFieldImag");
                if (box != null && box.Checked)
                {
                    flag2 = false;
                    try
                    {
                        int photoId = (int)this.photoDataList.DataKeys[item.ItemIndex];
                        StoreHelper.DeleteImage(field.Value);
                        if (!GalleryHelper.DeletePhoto(photoId))
                        {
                            flag = false;
                        }
                    }
                    catch
                    {
                        this.ShowMsg("删除文件错误", false);
                        this.BindImageData();
                    }
                }
            }
            if (flag2)
            {
                this.ShowMsg("未选择删除的图片", false);
            }
            else
            {
                if (flag)
                {
                    this.ShowMsg("删除图片成功", true);
                }
                this.BindImageData();
            }
        }
Пример #10
0
        protected override void OnInit(EventArgs e)
        {
            // Cria um campo hidden para gerenciar os arquivos que foram inseridos/deletados
            var hdnFiles = FindControl(this.ClientID + "_hdnFiles");

            if (hdnFiles == null)
            {
                hdnFiles    = new System.Web.UI.WebControls.HiddenField();
                hdnFiles.ID = this.ClientID + "_hdnFiles";
                ((System.Web.UI.WebControls.HiddenField)hdnFiles).Value = "";
                this.Controls.Add(hdnFiles);
            }

            var errorStatus = FindControl(this.ClientID + "_errorStatus");

            if (errorStatus == null)
            {
                errorStatus    = new System.Web.UI.WebControls.HiddenField();
                errorStatus.ID = this.ClientID + "_errorStatus";
                ((System.Web.UI.WebControls.HiddenField)errorStatus).Value = "false";
                this.Controls.Add(errorStatus);
            }

            if (NaoPossibilitarUpload == false)
            {
                //Cria o Botão de Upload do Componentte
                var btnUpload = FindControl(this.ID + "_btnUpload");
                if (btnUpload == null)
                {
                    btnUpload    = new Button();
                    btnUpload.ID = String.Format("{0}_btnUpload", this.ID);
                    ((Button)btnUpload).Attributes["Style"] = "display:none; background:transparent;";
                    ((Button)btnUpload).Click += btnUpload_Click;
                    this.Controls.Add(btnUpload);
                }
            }

            base.OnInit(e);
        }
Пример #11
0
        protected override void OnInit(EventArgs e)
        {
            if (paneldefaultcontenttemplate != null)
            {
                this.Controls.Add(paneldefaultcontenttemplate);
            }

            foreach (var item in PanelContentTemplateCollection)
            {
                this.Controls.Add(item);
            }

            if (btnMinimize)
            {
                PanelHeaderButtonCollection.Add(new PanelHeaderButton()
                {
                    Icon = initMinimized ? FontAwesomeIcons.ChevronDown : FontAwesomeIcons.ChevronUp, CssClass = "btn-minimize"
                });
            }

            if (btnClose)
            {
                PanelHeaderButtonCollection.Add(new PanelHeaderButton()
                {
                    Icon = FontAwesomeIcons.Close, CssClass = "btn-close"
                });
            }

            if (PanelHeaderTemplateCollection != null && PanelHeaderTemplateCollection.Count > 1)
            {
                hdnSelectedTab    = new System.Web.UI.WebControls.HiddenField();
                hdnSelectedTab.ID = "hdnSelectedTab";
                Controls.Add(hdnSelectedTab);
            }

            base.OnInit(e);
        }
Пример #12
0
        protected override void CreateChildControls()
        {
            tb = new System.Web.UI.WebControls.TextBox();
            tb.ID = "tb" + this.ID;
            tb.CssClass = "text";
            //this.Controls.Add(tb);

            ca = new CalendarExtender();
            DateTimeFormatInfo di = Thread.CurrentThread.CurrentCulture.DateTimeFormat;
            ca.Format = di.ShortDatePattern;
            ca.TargetControlID = tb.ID;
            ca.ID = "ce" + this.ID;
            //this.Controls.Add(ca);

            hf = new System.Web.UI.WebControls.HiddenField();
            hf.ID = "hidden" + this.ID;

            cal = new System.Web.UI.WebControls.Calendar();
            cal.ID = "cal" + this.ID;
            cal.CssClass = "calendar";
            cal.SelectionChanged += new EventHandler(cal_SelectionChanged);
            //this.Controls.Add(cal);
        }
Пример #13
0
        protected override void OnInit(EventArgs e)
        {
            hdnOpenedModal       = new System.Web.UI.WebControls.HiddenField();
            hdnOpenedModal.ID    = "OpenedModal";
            hdnOpenedModal.Value = "false";
            Controls.Add(hdnOpenedModal);

            Button btn = new Button();

            if (BtnFecharSemPostBack)
            {
                btn.Click        += null;
                AbertoSemPostBack = false;

                string ctrlName = this.Page.Request.Params.Get("__EVENTTARGET");

                if (ctrlName != null)
                {
                    if (ctrlName.Contains(this.ID + "$"))
                    {
                        AbertoSemPostBack = true;
                    }
                }


                btn.OnClientClick = string.Format("$('#{0}').hide();$('.modal-backdrop').remove();$('#{1}').val(false);return false;", this.ID, hdnOpenedModal.ClientID);
            }


            else if (BtnFecharClick == null)
            {
                btn.Click += new System.EventHandler(btn_Click);
            }
            else
            {
                btn.Click += BtnFecharClick;
            }

            btn.CssClass = "close";
            btn.Attributes.Add("data-dismiss", "modal");
            btn.Attributes.Add("aria-hidden", "true");

            if (!BtnFecharSemPostBack)
            {
                btn.Attributes.Add("runat", "server");
            }

            btn.Text = "x";
            btn.ID   = "btnCloseModal";

            Controls.Add(btn);

            Controls.Add(body);

            if (footer != null)
            {
                Controls.Add(footer);
            }


            base.OnInit(e);
        }
Пример #14
0
        private void btnSendMessage_Click(object sender, System.EventArgs e)
        {
            SiteSettings siteSetting = this.GetSiteSetting();
            string       sMSSender   = siteSetting.SMSSender;

            if (string.IsNullOrEmpty(sMSSender))
            {
                this.ShowMsg("请先选择发送方式", false);
                return;
            }
            ConfigData configData = null;

            if (siteSetting.SMSEnabled)
            {
                configData = new ConfigData(HiCryptographer.Decrypt(siteSetting.SMSSettings));
            }
            if (configData == null)
            {
                this.ShowMsg("请先选择发送方式并填写配置信息", false);
                return;
            }
            if (!configData.IsValid)
            {
                string text = "";
                foreach (string current in configData.ErrorMsgs)
                {
                    text += Formatter.FormatErrorMessage(current);
                }
                this.ShowMsg(text, false);
                return;
            }
            string text2 = this.txtmsgcontent.Value.Trim();

            if (string.IsNullOrEmpty(text2))
            {
                this.ShowMsg("请先填写发送的内容信息", false);
                return;
            }
            int    smsValidCount = this.GetSmsValidCount();
            string text3         = null;

            foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdMemberList.Rows)
            {
                System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol");
                if (checkBox.Checked)
                {
                    string text4 = ((System.Web.UI.DataBoundLiteralControl)gridViewRow.Controls[4].Controls[0]).Text.Trim().Replace("<div></div>", "").Replace("&nbsp;", "");
                    System.Web.UI.WebControls.HiddenField hiddenField = (System.Web.UI.WebControls.HiddenField)gridViewRow.FindControl("hidCellPhone");
                    text4 = hiddenField.Value;
                    if (!string.IsNullOrEmpty(text4) && System.Text.RegularExpressions.Regex.IsMatch(text4, "^(13|14|15|18)\\d{9}$"))
                    {
                        text3 = text3 + text4 + ",";
                    }
                }
            }
            if (text3 == null)
            {
                this.ShowMsg("请先选择要发送的会员或检测所选手机号格式是否正确", false);
                return;
            }
            text3 = text3.Substring(0, text3.Length - 1);
            string[] array;
            if (text3.Contains(","))
            {
                array = text3.Split(new char[]
                {
                    ','
                });
            }
            else
            {
                array = new string[]
                {
                    text3
                };
            }
            if (smsValidCount < array.Length)
            {
                this.ShowMsg("发送失败,您的剩余短信条数不足。可用条数:" + smsValidCount.ToString(), false);
                return;
            }
            SMSSender sMSSender2 = SMSSender.CreateInstance(sMSSender, configData.SettingsXml);
            string    msg;
            bool      success = sMSSender2.Send(array, text2, out msg);

            this.ShowMsg(msg, success);
            this.ValidSmsNum = this.GetSmsValidCount().ToString();
        }
        /// <summary>
        /// Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.
        /// </summary>
        protected override void CreateChildControls()
        {
            if (this.Configuration == null)
                throw new ConfigurationErrorsException(Resources.Ctrl_PropertyConfigurationNotSpecified);

            base.CreateChildControls();

            // create layout panels
            List<KeyValuePair<QueryFieldConfiguration, IEnumerable<IQueryFieldControl>>> queryFieldControlsByConfigurations = new List<KeyValuePair<QueryFieldConfiguration, IEnumerable<IQueryFieldControl>>>();
            foreach (QueryFieldConfiguration queryFieldConfiguration in this.Configuration.Controls)
            {
                IEnumerable<IQueryFieldControl> queryFieldControlsByConfiguration = QueryFieldControlFactory.CreateQueryControls(queryFieldConfiguration);
                queryFieldControlsByConfigurations.Add(new KeyValuePair<QueryFieldConfiguration, IEnumerable<IQueryFieldControl>>(queryFieldConfiguration, queryFieldControlsByConfiguration));
                foreach (IQueryFieldControl queryFieldControl in queryFieldControlsByConfiguration)
                    this.queryFieldControlsByFieldName.Add(new KeyValuePair<IQueryFieldControl, string>(queryFieldControl, queryFieldConfiguration.FieldName));
            }

            IQueryPanelLayout queryPanelLayoutGenerator = SpringContext.Current.GetObject<IQueryPanelLayout>();
            Control queryPanelLayout = queryPanelLayoutGenerator.Create(queryFieldControlsByConfigurations);
            this.Controls.Add(queryPanelLayout);

            IEnumerable<IQueryFieldControl> queryFieldControls = this.queryFieldControlsByFieldName.Select(kvp => kvp.Key);
            QueryFieldControlFactory.AssignQueryFieldControlIDAndIndex(queryFieldControls);

            // create hiddenfield to store all client variables for query field controls.
            StringBuilder queryFieldControlVariablesBuilder = new StringBuilder();
            foreach (IQueryFieldControl queryFieldControl in queryFieldControls)
            {
                if (queryFieldControlVariablesBuilder.Length > 0)
                    queryFieldControlVariablesBuilder.Append(";");

                queryFieldControlVariablesBuilder.AppendFormat("{0}{1}:{2}", WebUtility.QUERY_FIELD_CONTROL_POST_PREFRIX_NAME, queryFieldControl.ControlIndex, queryFieldControl.ClientVariableName);
            }

            this.hiddenFieldQueryFieldControlVariables = new System.Web.UI.WebControls.HiddenField { ID = "HiddenFieldQueryFieldControlVariables" };
            this.hiddenFieldQueryFieldControlVariables.Value = queryFieldControlVariablesBuilder.ToString();
            this.Controls.Add(this.hiddenFieldQueryFieldControlVariables);

            HtmlTable tableButtons = new HtmlTable { ID="ButtonPanel", CellPadding = 0, CellSpacing = 0, Width = "100%" };
            tableButtons.Attributes["class"] = "querypanel-buttons";
            this.Controls.Add(tableButtons);

            HtmlTableRow rowButton = new HtmlTableRow();
            tableButtons.Rows.Add(rowButton);

            HtmlTableCell cellButton = new HtmlTableCell { Align = "center" };
            cellButton.Style["padding-top"] = "6px";
            rowButton.Cells.Add(cellButton);

            this.buttonQuery = new Button { ID = "ButtonQuery", Configuration = new ButtonConfiguration { ButtonRenderType = ButtonRenderTypes.Button, Text = Resources.Ctrl_QueryButtonText } };
            cellButton.Controls.Add(this.buttonQuery);

            HtmlGenericControl buttonSeparator = new HtmlGenericControl("span") { InnerHtml = "    " };
            buttonSeparator.Style["padding-left"] = "2px";
            buttonSeparator.Style["padding-right"] = "2px";
            cellButton.Controls.Add(buttonSeparator);

            this.buttonReset = new Button { ID = "ButtonReset", Configuration = new ButtonConfiguration { ButtonRenderType = ButtonRenderTypes.Button, Text = Resources.Ctrl_ResetButtonText } };
            cellButton.Controls.Add(this.buttonReset);
        }
Пример #16
0
        public void btnSetSchedule_Click(object sender, EventArgs e)
        {
            if (OnSaveSchedule != null)
            {
                OnSaveSchedule(sender, e);
            }
            else
            {
                System.Web.UI.WebControls.HiddenField hdMsg = (System.Web.UI.WebControls.HiddenField) this.Parent.FindControl("hdMsg");
                if ((UcSchedule.ActivityID == null && UcSchedule.SpecialtyID == null) ||
                    (UcSchedule.ActivityID != null && UcSchedule.SpecialtyID != null))
                {
                    //throw new Exception("参数设置错误");
                    hdMsg.Value = "参数设置错误!";
                }

                DateTime dt;
                if (!string.IsNullOrEmpty(txtDeclarationBeginDate.Text) &&
                    DateTime.TryParse(txtDeclarationBeginDate.Text, out dt))
                {
                    UcSchedule.DeclarationBeginDate = dt;
                }

                if (!string.IsNullOrEmpty(txtDeclarationEndDate.Text) &&
                    DateTime.TryParse(txtDeclarationEndDate.Text, out dt))
                {
                    UcSchedule.DeclarationEndDate = dt;
                }

                //UcSchedule.IsDeclarationStart = cbIsDeclarationStart.Checked;
                UcSchedule.IsDeclarationStart = ddlIsDeclarationStart.SelectedValue == "True";
                //UcSchedule.IsDeclarationAutoStart = cbIsDeclarationAutoStart.Checked;
                UcSchedule.IsDeclarationAutoStart = ddlIsDeclarationAutoStart.SelectedValue == "True";
                //UcSchedule.IsDeclarationAutoEnd = cbIsDeclarationAutoEnd.Checked;
                UcSchedule.IsDeclarationAutoEnd = ddlIsDeclarationAutoEnd.SelectedValue == "True";

                if (!string.IsNullOrEmpty(txtPrimaryElectionBeginDate.Text) &&
                    DateTime.TryParse(txtPrimaryElectionBeginDate.Text, out dt))
                {
                    UcSchedule.PrimaryElectionBeginDate = dt;
                }

                if (!string.IsNullOrEmpty(txtPrimaryElectionEndDate.Text) &&
                    DateTime.TryParse(txtPrimaryElectionEndDate.Text, out dt))
                {
                    UcSchedule.PrimaryElectionEndDate = dt;
                }

                UcSchedule.IsPrimaryElectionStart = ddlIsPrimaryElectionStart.SelectedValue == "True";
                //UcSchedule.IsPrimaryElectionStart = cbIsPrimaryElectionStart.Checked;
                UcSchedule.IsPrimaryElectionAutoStart = ddlIsPrimaryElectionAutoStart.SelectedValue == "True";
                //UcSchedule.IsPrimaryElectionAutoStart = cbIsPrimaryElectionAutoStart.Checked;
                UcSchedule.IsPrimaryElectionAutoEnd = ddlIsPrimaryElectionAutoEnd.SelectedValue == "True";
                //UcSchedule.IsPrimaryElectionAutoEnd = cbIsPrimaryElectionAutoEnd.Checked;

                if (!string.IsNullOrEmpty(txtExpertReviewBeginDate.Text) &&
                    DateTime.TryParse(txtExpertReviewBeginDate.Text, out dt))
                {
                    UcSchedule.ExpertReviewBeginDate = dt;
                }

                if (!string.IsNullOrEmpty(txtExpertReviewEndDate.Text) &&
                    DateTime.TryParse(txtExpertReviewEndDate.Text, out dt))
                {
                    UcSchedule.ExpertReviewEndDate = dt;
                }

                UcSchedule.IsExpertReviewStart = ddlIsExpertReviewStart.SelectedValue == "True";
                //UcSchedule.IsExpertReviewStart = cbIsExpertReviewStart.Checked;
                UcSchedule.IsExpertReviewAutoStart = ddlIsExpertReviewAutoStart.SelectedValue == "True";
                //UcSchedule.IsExpertReviewAutoStart = cbIsExpertReviewAutoStart.Checked;
                UcSchedule.IsExpertReviewAutoEnd = ddlIsExpertReviewAutoEnd.SelectedValue == "True";
                //UcSchedule.IsExpertReviewAutoEnd = cbIsExpertReviewAutoEnd.Checked;



                if (!string.IsNullOrEmpty(txtDownloadBeginDate.Text) &&
                    DateTime.TryParse(txtDownloadBeginDate.Text, out dt))
                {
                    UcSchedule.DownloadBeginDate = dt;
                }

                if (!string.IsNullOrEmpty(txtDownloadEndDate.Text) &&
                    DateTime.TryParse(txtDownloadEndDate.Text, out dt))
                {
                    UcSchedule.DownloadEndDate = dt;
                }

                UcSchedule.IsDownloadStart = ddlIsDownloadStart.SelectedValue == "True";
                //UcSchedule.IsDownloadStart = cbIsDownloadStart.Checked;
                UcSchedule.IsDownloadAutoStart = ddlIsDownloadAutoStart.SelectedValue == "True";
                //UcSchedule.IsDownloadAutoStart = cbIsDownloadAutoStart.Checked;
                UcSchedule.IsDownloadAutoEnd = ddlIsDownloadAutoEnd.SelectedValue == "True";
                //UcSchedule.IsDownloadAutoEnd = cbIsDownloadAutoEnd.Checked;

                //投票
                if (!string.IsNullOrEmpty(txtVoteBeginDate.Text) &&
                    DateTime.TryParse(txtVoteBeginDate.Text, out dt))
                {
                    UcSchedule.VoteBeginDate = dt;
                }
                if (!string.IsNullOrEmpty(txtVoteEndDate.Text) &&
                    DateTime.TryParse(txtVoteEndDate.Text, out dt))
                {
                    UcSchedule.VoteEndDate = dt;
                }
                UcSchedule.IsVoteStart     = ddlIsVoteStart.SelectedValue == "True";
                UcSchedule.IsVoteAutoStart = ddlIsVoteAutoStart.SelectedValue == "True";
                UcSchedule.IsVoteAutoEnd   = ddlIsVoteAutoEnd.SelectedValue == "True";

                UcSchedule.IsReVoteStart = ddlIsReVoteStart.SelectedValue == "True";
                //UcSchedule.IsReVoteStart = cbIsReVoteStart.Checked;

                OleDbConnection conn = new OleDbConnection(Dal.OleDbHlper.ConnectionString);
                conn.Open();

                OleDbTransaction trans = conn.BeginTransaction();

                try
                {
                    BLL.Schedule.SetSchedule(UcSchedule, conn, trans);
                    trans.Commit();
                    hdMsg.Value = "时间节点设置成功!";
                }
                catch (Exception ex)
                {
                    trans.Rollback();
                    hdMsg.Value = ex.Message;
                    ViewState["ErrorMessage"] = ex.Message;
                }

                conn.Close();
            }
        }
Пример #17
0
        /// <summary>
        /// Set back the updated value from the dataset to each controls of the panel
        /// Also sets validation and javascript events on the controls.
        /// </summary>
        /// <param name="PanelControls"></param>
        /// <param name="datasetDocument"></param>
        public void SetControlValues(System.Web.UI.WebControls.Panel PanelControls, DataSet datasetDocument)
        {
            try
            {
                System.Web.UI.WebControls.HiddenField HiddenFieldValidation = new System.Web.UI.WebControls.HiddenField();
                using (datasetDocument)
                {
                    HiddenFieldValidation.ID = "HiddenFieldValidation";
                    PanelControls.Controls.Add(HiddenFieldValidation);
                    System.Collections.IEnumerator eControls = PanelControls.Controls.GetEnumerator();
                    while (eControls.MoveNext())
                    {
                        object objCurrentControl = eControls.Current;
                        switch (objCurrentControl.GetType().ToString())
                        {
                        case "System.Web.UI.HtmlControls.HtmlInputHidden":
                        {
                            System.Web.UI.HtmlControls.HtmlInputHidden hdnTemp = (System.Web.UI.HtmlControls.HtmlInputHidden)objCurrentControl;
                            string primaryKey = hdnTemp.Attributes["PrimaryKey"];

                            if (!String.IsNullOrEmpty(primaryKey))
                            {
                                string fieldName = hdnTemp.Attributes["FieldName"];
                                string tableName = hdnTemp.Attributes["TableName"];
                                if (CheckFieldValues(tableName, fieldName, datasetDocument))
                                {
                                    hdnTemp.Value = datasetDocument.Tables[tableName].Rows[0][fieldName].ToString();
                                }
                            }
                            break;
                        }

                        case "System.Web.UI.WebControls.TextBox":
                        {
                            System.Web.UI.WebControls.TextBox txtTemp = (System.Web.UI.WebControls.TextBox)objCurrentControl;
                            txtTemp.Attributes.Add("OnChange", "isdirty()");
                            string fieldName  = txtTemp.Attributes["FieldName"];
                            string tableName  = txtTemp.Attributes["TableName"];
                            string validation = txtTemp.Attributes["Validate"];

                            if (!String.IsNullOrEmpty(validation))
                            {
                                if (HiddenFieldValidation.Value == "")
                                {
                                    HiddenFieldValidation.Value = txtTemp.ClientID;
                                }
                                else
                                {
                                    HiddenFieldValidation.Value += ";" + txtTemp.ClientID;
                                }
                            }
                            if (CheckFieldValues(tableName, fieldName, datasetDocument))
                            {
                                txtTemp.Text = datasetDocument.Tables[tableName].Rows[0][fieldName].ToString();
                            }
                            break;
                        }

                        case "System.Web.UI.WebControls.CheckBox":
                        {
                            System.Web.UI.WebControls.CheckBox chkTemp = (System.Web.UI.WebControls.CheckBox)objCurrentControl;
                            chkTemp.Attributes.Add("OnClick", "isdirty()");
                            string fieldName  = chkTemp.Attributes["FieldName"];
                            string tableName  = chkTemp.Attributes["TableName"];
                            string validation = chkTemp.Attributes["Validate"];

                            if (!String.IsNullOrEmpty(validation))
                            {
                                if (HiddenFieldValidation.Value == "")
                                {
                                    HiddenFieldValidation.Value = chkTemp.ClientID;
                                }
                                else
                                {
                                    HiddenFieldValidation.Value += ";" + chkTemp.ClientID;
                                }
                            }
                            if (CheckFieldValues(tableName, fieldName, datasetDocument))
                            {
                                chkTemp.Checked = datasetDocument.Tables[tableName].Rows[0][fieldName].ToString() == "Y" ? true : false;
                            }
                            break;
                        }

                        case "System.Web.UI.WebControls.DropDownList":
                        {
                            System.Web.UI.WebControls.DropDownList ddlTemp = (System.Web.UI.WebControls.DropDownList)objCurrentControl;
                            ddlTemp.Attributes.Add("OnChange", "isdirty()");
                            string fieldName      = ddlTemp.Attributes["FieldName"];
                            string tableName      = ddlTemp.Attributes["TableName"];
                            string dataSource     = ddlTemp.Attributes["DataSource"];    /////////No Need
                            string SelectCase     = ddlTemp.Attributes["SelectCase"];
                            string SelectType     = ddlTemp.Attributes["SelectType"];
                            string dataTextField  = ddlTemp.Attributes["TextField"];
                            string dataValueField = ddlTemp.Attributes["ValueField"];
                            string validation     = ddlTemp.Attributes["Validate"];

                            if (!String.IsNullOrEmpty(validation))
                            {
                                if (HiddenFieldValidation.Value == "")
                                {
                                    HiddenFieldValidation.Value = ddlTemp.ClientID;
                                }
                                else
                                {
                                    HiddenFieldValidation.Value += ";" + ddlTemp.ClientID;
                                }
                            }

                            //FillDropDowns(ddlTemp, dataSource, dataTextField, dataValueField);
                            FillDropDowns(ddlTemp, dataSource, dataTextField, dataValueField, SelectCase, SelectType);
                            if (CheckFieldValues(tableName, fieldName, datasetDocument))
                            {
                                ddlTemp.SelectedValue = datasetDocument.Tables[tableName].Rows[0][fieldName].ToString();
                            }
                            break;
                        }

                        case "System.Web.UI.WebControls.RadioButton":
                        {
                            System.Web.UI.WebControls.RadioButton rbTemp = (System.Web.UI.WebControls.RadioButton)objCurrentControl;
                            rbTemp.Attributes.Add("OnClick", "isdirty()");
                            string fieldName  = rbTemp.Attributes["FieldName"];
                            string tableName  = rbTemp.Attributes["TableName"];
                            string value      = rbTemp.Attributes["Value"];
                            string validation = rbTemp.Attributes["Validate"];

                            if (!String.IsNullOrEmpty(validation))
                            {
                                if (HiddenFieldValidation.Value == "")
                                {
                                    HiddenFieldValidation.Value = rbTemp.ClientID;
                                }
                                else
                                {
                                    HiddenFieldValidation.Value += ";" + rbTemp.ClientID;
                                }
                            }

                            if (CheckFieldValues(tableName, fieldName, datasetDocument))
                            {
                                if (datasetDocument.Tables[tableName].Rows[0][fieldName].ToString().Trim() == value.Trim())
                                {
                                    rbTemp.Checked = true;
                                }
                            }
                            break;
                        }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Пример #18
0
        public static void BindPanel(DevExpress.Web.ASPxRoundPanel p_obj, DataTable p_table)
        {
            for (int i = 0; i < p_table.Columns.Count; ++i)
            {
                foreach (System.Web.UI.Control control in p_obj.Controls)
                {
                    if (control.ID != null)
                    {
                        if (control.ID.Length > 3)
                        {
                            if (p_table.Columns[i].ColumnName.ToString().ToUpper() == control.ID.Substring(3).ToString().ToUpper())
                            {
                                if (control.GetType().FullName == "DevExpress.Web.ASPxTextBox")
                                {
                                    DevExpress.Web.ASPxTextBox ctr = (DevExpress.Web.ASPxTextBox)control;
                                    ctr.Text = p_table.Rows[0][p_table.Columns[i].ColumnName].ToString();
                                }
                                else if (control.GetType().FullName == "DevExpress.Web.ASPxMemo")
                                {
                                    DevExpress.Web.ASPxMemo ctr = (DevExpress.Web.ASPxMemo)control;
                                    ctr.Text = p_table.Rows[0][p_table.Columns[i].ColumnName].ToString();
                                }
                                else if (control.GetType().FullName == "DevExpress.Web.ASPxComboBox")
                                {
                                    DevExpress.Web.ASPxComboBox ctr = (DevExpress.Web.ASPxComboBox)control;
                                    ctr.Value = p_table.Rows[0][p_table.Columns[i].ColumnName].ToString();
                                }
                                else if (control.GetType().FullName == "DevExpress.Web.Bootstrap.BootstrapComboBox")
                                {
                                    DevExpress.Web.Bootstrap.BootstrapComboBox ctr = (DevExpress.Web.Bootstrap.BootstrapComboBox)control;
                                    ctr.Value = p_table.Rows[0][p_table.Columns[i].ColumnName].ToString();
                                }

                                else if (control.GetType().FullName == "DevExpress.Web.ASPxDateEdit")
                                {
                                    DevExpress.Web.ASPxDateEdit ctr = (DevExpress.Web.ASPxDateEdit)control;
                                    String v_date = p_table.Rows[0][p_table.Columns[i].ColumnName].ToString();
                                    if (v_date != "")
                                    {
                                        ctr.Date = Convert.ToDateTime(v_date);
                                    }
                                    else
                                    {
                                        ctr.Value = null;
                                    }
                                }
                                else if (control.GetType().FullName == "DevExpress.Web.ASPxTimeEdit")
                                {
                                    DevExpress.Web.ASPxTimeEdit ctr = (DevExpress.Web.ASPxTimeEdit)control;
                                    String v_date = p_table.Rows[0][p_table.Columns[i].ColumnName].ToString();
                                    if (v_date != "")
                                    {
                                        ctr.DateTime = DateTime.Parse(v_date);
                                    }
                                    else
                                    {
                                        ctr.Value = null;
                                    }
                                }
                                else if (control.GetType().FullName == "DevExpress.Web.ASPxSpinEdit")
                                {
                                    DevExpress.Web.ASPxSpinEdit objD = (DevExpress.Web.ASPxSpinEdit)control;
                                    objD.Value = p_table.Rows[0][p_table.Columns[i].ColumnName].ToString();
                                }
                                else if (control.GetType().FullName == "DevExpress.Web.ASPxCheckBox")
                                {
                                    DevExpress.Web.ASPxCheckBox objD = (DevExpress.Web.ASPxCheckBox)control;
                                    objD.Checked = bool.Parse(p_table.Rows[0][p_table.Columns[i].ColumnName].ToString());
                                }
                                else if (control.GetType().FullName == "System.Web.UI.WebControls.HiddenField")
                                {
                                    System.Web.UI.WebControls.HiddenField objD = (System.Web.UI.WebControls.HiddenField)control;
                                    String val = p_table.Rows[0][p_table.Columns[i].ColumnName].ToString();
                                    if (val != "")
                                    {
                                        objD.Value = val;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #19
0
        public static void BindProperty(Object p_obj, System.Web.UI.Control p_ctr)
        {
            String       sControlName;
            object       objValue;
            PropertyInfo objProperty = null;

            foreach (System.Web.UI.Control control in p_ctr.Controls)
            {
                if (control.ID != null)
                {
                    sControlName = control.ID.Substring(3).ToString().ToUpper();
                    objProperty  = GetClassProperty(p_obj.GetType(), sControlName);
                    if (objProperty != null)
                    {
                        switch (control.GetType().ToString())
                        {
                        case "DevExpress.Web.ASPxTextBox":
                        {
                            DevExpress.Web.ASPxTextBox objD = (DevExpress.Web.ASPxTextBox)control;
                            objValue = objD.Text;
                            Type t = objProperty.PropertyType;
                            if (t.FullName.IndexOf("System.Single") >= 0)
                            {
                                if (objValue.ToString() == "")
                                {
                                    objProperty.SetValue(p_obj, null, null);
                                }
                                else
                                {
                                    objValue = Single.Parse(objValue.ToString());
                                    objProperty.SetValue(p_obj, objValue, null);
                                }
                            }
                            else if (t.FullName.IndexOf("System.Int32") >= 0)
                            {
                                if (objValue.ToString() == "")
                                {
                                    objProperty.SetValue(p_obj, null, null);
                                }
                                else
                                {
                                    objValue = int.Parse(objValue.ToString());
                                    objProperty.SetValue(p_obj, objValue, null);
                                }
                            }
                            else if (t.FullName.IndexOf("System.Int64") >= 0)
                            {
                                if (objValue.ToString() == "")
                                {
                                    objProperty.SetValue(p_obj, null, null);
                                }
                                else
                                {
                                    try
                                    {
                                        objValue = long.Parse(objValue.ToString());
                                        objProperty.SetValue(p_obj, objValue, null);
                                    }
                                    catch (Exception ex)
                                    {
                                        objProperty.SetValue(p_obj, null, null);
                                    }
                                }
                            }
                            else
                            {
                                objProperty.SetValue(p_obj, objValue.ToString().Trim(), null);
                            }
                            break;
                        }

                        case "DevExpress.Web.ASPxMemo":
                        {
                            DevExpress.Web.ASPxMemo objD = (DevExpress.Web.ASPxMemo)control;
                            objValue = objD.Text;
                            objProperty.SetValue(p_obj, objValue.ToString(), null);
                            break;
                        }

                        case "DevExpress.Web.ASPxSpinEdit":
                        {
                            DevExpress.Web.ASPxSpinEdit objD = (DevExpress.Web.ASPxSpinEdit)control;
                            objValue = objD.Value;
                            Type t = objProperty.PropertyType;
                            if (t.FullName.IndexOf("System.Int32") >= 0)
                            {
                                objProperty.SetValue(p_obj, int.Parse(objValue.ToString()), null);
                            }
                            else if (t.FullName.IndexOf("System.Int64") >= 0)
                            {
                                objProperty.SetValue(p_obj, long.Parse(objValue.ToString()), null);
                            }
                            else
                            {
                                objProperty.SetValue(p_obj, int.Parse(objValue.ToString()), null);
                            }
                            break;
                        }

                        case "System.Web.UI.WebControls.HiddenField":
                        {
                            System.Web.UI.WebControls.HiddenField objD = (System.Web.UI.WebControls.HiddenField)control;
                            objValue = objD.Value;
                            if (objValue != null && objValue.ToString() != "")
                            {
                                objProperty.SetValue(p_obj, int.Parse(objValue.ToString()), null);
                            }
                            break;
                        }

                        case "DevExpress.Web.ASPxComboBox":
                        {
                            DevExpress.Web.ASPxComboBox objD = (DevExpress.Web.ASPxComboBox)control;
                            objValue = objD.Value;
                            Type t = objProperty.PropertyType;

                            if (objValue == null)
                            {
                                objProperty.SetValue(p_obj, null, null);
                            }
                            else
                            {
                                if (t.FullName == "System.Int32")
                                {
                                    objProperty.SetValue(p_obj, int.Parse(objValue.ToString()), null);
                                }
                                else if (t.FullName == "System.Int64")
                                {
                                    objProperty.SetValue(p_obj, int.Parse(objValue.ToString()), null);
                                }
                                else
                                {
                                    objProperty.SetValue(p_obj, objValue.ToString(), null);
                                }
                            }
                            break;
                        }

                        case "DevExpress.Web.ASPxRadioButtonList":
                        {
                            DevExpress.Web.ASPxRadioButtonList objD = (DevExpress.Web.ASPxRadioButtonList)control;
                            objValue = objD.Value;
                            Type t = objProperty.PropertyType;

                            if (objValue == null)
                            {
                                objProperty.SetValue(p_obj, null, null);
                            }
                            else
                            {
                                if (t.FullName == "System.Int32")
                                {
                                    objProperty.SetValue(p_obj, int.Parse(objValue.ToString()), null);
                                }
                                else if (t.FullName == "System.Int64")
                                {
                                    objProperty.SetValue(p_obj, int.Parse(objValue.ToString()), null);
                                }
                                else
                                {
                                    objProperty.SetValue(p_obj, objValue.ToString(), null);
                                }
                            }
                            break;
                        }

                        case "DevExpress.Web.Bootstrap.BootstrapComboBox":
                        {
                            DevExpress.Web.Bootstrap.BootstrapComboBox objD = (DevExpress.Web.Bootstrap.BootstrapComboBox)control;
                            objValue = objD.Value;
                            Type t = objProperty.PropertyType;

                            if (objValue == null)
                            {
                                objProperty.SetValue(p_obj, null, null);
                            }
                            else
                            {
                                if (t.FullName == "System.Int32")
                                {
                                    objProperty.SetValue(p_obj, int.Parse(objValue.ToString()), null);
                                }
                                else if (t.FullName == "System.Int64")
                                {
                                    objProperty.SetValue(p_obj, int.Parse(objValue.ToString()), null);
                                }
                                else
                                {
                                    objProperty.SetValue(p_obj, objValue.ToString(), null);
                                }
                            }
                            break;
                        }

                        case "DevExpress.Web.ASPxDateEdit":
                        {
                            DevExpress.Web.ASPxDateEdit objD = (DevExpress.Web.ASPxDateEdit)control;
                            objValue = objD.Value;
                            if (objValue == null)
                            {
                                objProperty.SetValue(p_obj, null, null);
                            }
                            else
                            {
                                objProperty.SetValue(p_obj, Convert.ToDateTime(objValue.ToString()), null);
                            }
                            break;
                        }

                        case "DevExpress.Web.ASPxTimeEdit":
                        {
                            DevExpress.Web.ASPxTimeEdit objD = (DevExpress.Web.ASPxTimeEdit)control;
                            objValue = objD.Value;
                            if (objValue == null)
                            {
                                objProperty.SetValue(p_obj, null, null);
                            }
                            else
                            {
                                objProperty.SetValue(p_obj, Convert.ToDateTime(objValue.ToString()), null);
                            }
                            break;
                        }

                        case "DevExpress.Web.ASPxCheckBox":
                        {
                            DevExpress.Web.ASPxCheckBox objD = (DevExpress.Web.ASPxCheckBox)control;
                            objValue = objD.Checked;
                            if (objValue == null)
                            {
                                objProperty.SetValue(p_obj, null, null);
                            }
                            else
                            {
                                objProperty.SetValue(p_obj, bool.Parse(objValue.ToString()), null);
                            }
                            break;
                        }
                        }
                    }
                }
            }
        }
Пример #20
0
 public void LoadExamQuestions(System.Web.UI.WebControls.Label lblQuestion, System.Web.UI.WebControls.RadioButtonList rbListQuestion, int pageIndex, System.Web.UI.WebControls.HiddenField hiddenField, System.Web.UI.WebControls.HiddenField hfCorrectAns)
 {
     try
     {
         hiddenField.Value = DS.Tables[0].Rows[pageIndex][0].ToString();
         lblQuestion.Text  = DS.Tables[0].Rows[pageIndex][1].ToString();
         rbListQuestion.Items.Add(DS.Tables[0].Rows[pageIndex][2].ToString());
         rbListQuestion.Items.Add(DS.Tables[0].Rows[pageIndex][3].ToString());
         rbListQuestion.Items.Add(DS.Tables[0].Rows[pageIndex][4].ToString());
         rbListQuestion.Items.Add(DS.Tables[0].Rows[pageIndex][5].ToString());
         hfCorrectAns.Value = DS.Tables[0].Rows[pageIndex][6].ToString();
     }
     catch (Exception e)
     {
         MessageBox.Show("Error" + e);
     }
 }