コード例 #1
0
        protected void Button_expandNote_Click(object sender, EventArgs e)
        {
            Button btn_expandNote     = (Button)sender;
            DataControlFieldCell cell = (DataControlFieldCell)btn_expandNote.Parent;
            GridViewRow          row  = (GridViewRow)cell.Parent;
            Button btn_next_day       = (Button)row.Cells[0].FindControl("Button_nextDate");

            Panel panel = (Panel)cell.FindControl("Panel_noteInfo");

            panel.Visible = !panel.Visible;


            if (panel.Visible)
            {
                btn_expandNote.Text  = "-";
                btn_next_day.Enabled = true;
            }
            else
            {
                btn_expandNote.Text  = "+";
                btn_next_day.Enabled = false;
                return;
            }


            Label    lbl       = (Label)row.Cells[0].FindControl("Label_effectiveDate");
            DateTime from_date = DateTime.Parse(lbl.Text);

            btn_next_day.Attributes.Add("date", from_date.ToString());
            updateNoteWithProduct(row, from_date);
        }
コード例 #2
0
        /// <summary>
        /// 行绑定、行操作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvXMProduct_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                var             Tid        = (XMTypeTest)e.Row.DataItem;
                var             product    = base.XMZMReservationService.GetXMZMReservationListByInstallationID(Id, Tid.ID);
                RadioButtonList ddlDemand  = (RadioButtonList)e.Row.FindControl("ddlDemand");
                var             DemandList = base.XMZMDemandService.GetXMZMDemandListByTid(Tid.ID);
                ddlDemand.DataSource     = DemandList;
                ddlDemand.DataTextField  = "requirements";
                ddlDemand.DataValueField = "ID";
                ddlDemand.DataBind();

                if (product != null)
                {
                    ddlDemand.SelectedValue = product.DemandID.ToString();
                }

                DataControlFieldCell cell = (DataControlFieldCell)ddlDemand.Parent;
                Label lblPrice            = (Label)cell.FindControl("lblPrice");

                if (ddlDemand.SelectedValue.ToString().Trim().Length > 0)
                {
                    if (Convert.ToInt16(ddlDemand.SelectedValue.ToString().Trim()) != -1)
                    {
                        int Did         = Convert.ToInt32(ddlDemand.SelectedValue);
                        var DemandList2 = base.XMZMDemandService.GetXMZMDemandByID(Did);
                        lblPrice.Text = DemandList2.Price.ToString();
                        lblPrice.DataBind();
                    }
                }
            }
        }
コード例 #3
0
    protected void dgvReports_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Add")
        {
            //Если нет добавленных записей, то позволяем добавить запись
            if (DS.Tables[dtGeneralReports.TableName].GetChanges(DataRowState.Added) == null)
            {
                CopyChangesToTable();

                ClearFilter();

                DataRow dr = DS.Tables[dtGeneralReports.TableName].NewRow();
                dr[Allow.ColumnName]  = 0;
                dr[Public.ColumnName] = 0;
                DS.Tables[dtGeneralReports.TableName].Rows.Add(dr);

                dgvReports.DataSource = DS.Tables[dtGeneralReports.TableName].DefaultView;

                dgvReports.DataBind();

                btnApply.Visible = true;
            }
            else
            {
                //Ищем добавленную запись и позиционируемся на нее
                foreach (GridViewRow row in dgvReports.Rows)
                {
                    if (String.IsNullOrEmpty(row.Cells[(int)GeneralReportFields.Code].Text))
                    {
                        dgvReports.SelectedIndex = row.RowIndex;
                        break;
                    }
                }
            }
        }
        else if (e.CommandName == "editPayer")
        {
            DataControlFieldCell cell = (DataControlFieldCell)((Control)e.CommandSource).Parent;
            ((TextBox)cell.FindControl("tbSearch")).Visible = true;
            ((TextBox)cell.FindControl("tbSearch")).Focus();
            ((Button)cell.FindControl("btApplyCopy")).Visible  = true;
            ((LinkButton)cell.FindControl("linkEdit")).Visible = false;

            FillDDL(((Label)cell.FindControl("lblFirmName")).Text);
        }
    }
コード例 #4
0
ファイル: MergePersonField.cs プロジェクト: waldo2590/Rock
            /// <summary>
            /// Handles the DataBinding event of the cell control.
            /// </summary>
            /// <param name="sender">The source of the event.</param>
            /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
            private void cell_DataBinding(object sender, EventArgs e)
            {
                DataControlFieldCell cell = sender as DataControlFieldCell;
                var row = cell.DataItemContainer as GridViewRow;

                Literal         contentHtmlLiteral          = cell.FindControl($"contentHtmlLiteral_{MergePersonField.PersonId}") as Literal;
                Panel           selectionControlContainer   = cell.FindControl($"selectionControlContainer_{MergePersonField.PersonId}") as Panel;
                RockCheckBox    selectionControlCheckbox    = selectionControlContainer.FindControl($"selectionControlCheckbox_{MergePersonField.PersonId}") as RockCheckBox;
                RockRadioButton selectionControlRadioButton = selectionControlContainer.FindControl($"selectionControlRadioButton_{MergePersonField.PersonId}") as RockRadioButton;

                MergePersonFieldRowEventArgs mergePersonFieldRowEventArgs = new MergePersonFieldRowEventArgs(row, MergePersonField);

                MergePersonField.HandleOnDataBound(sender, mergePersonFieldRowEventArgs);

                if (mergePersonFieldRowEventArgs.ContentDisplayType == ContentDisplayType.ContentWrapper)
                {
                    contentHtmlLiteral.Visible       = true;
                    contentHtmlLiteral.Text          = $"<div class='merge-property-value'>{mergePersonFieldRowEventArgs.ContentHTML}</div>";
                    selectionControlCheckbox.Text    = null;
                    selectionControlRadioButton.Text = null;
                }
                else
                {
                    contentHtmlLiteral.Visible       = false;
                    selectionControlCheckbox.Text    = mergePersonFieldRowEventArgs.ContentHTML;
                    selectionControlRadioButton.Text = mergePersonFieldRowEventArgs.ContentHTML;
                }

                selectionControlCheckbox.Visible = mergePersonFieldRowEventArgs.SelectionControlType == SelectionControlType.Checkbox;
                selectionControlCheckbox.Checked = mergePersonFieldRowEventArgs.Selected;

                selectionControlRadioButton.Visible = mergePersonFieldRowEventArgs.SelectionControlType == SelectionControlType.RadioButton;
                selectionControlRadioButton.Checked = mergePersonFieldRowEventArgs.Selected;

                selectionControlRadioButton.GroupName = $"selectionControlRadioButtonGroup_{row.RowIndex}";
            }
コード例 #5
0
        protected void ddlDemand_SelectedIndexChanged(object sender, EventArgs e)
        {
            RadioButtonList      ddlDemand = (RadioButtonList)sender;
            DataControlFieldCell cell      = (DataControlFieldCell)ddlDemand.Parent;
            Label lblPrice = (Label)cell.FindControl("lblPrice");

            if (ddlDemand.SelectedValue.ToString().Trim().Length > 0)
            {
                if (Convert.ToInt16(ddlDemand.SelectedValue.ToString().Trim()) != -1)
                {
                    int Did        = Convert.ToInt32(ddlDemand.SelectedValue);
                    var DemandList = base.XMZMDemandService.GetXMZMDemandByID(Did);
                    lblPrice.Text = DemandList.Price.ToString();
                    lblPrice.DataBind();
                }
            }
        }
コード例 #6
0
        /// <summary>
        /// Gets the value that should be exported to Excel
        /// </summary>
        /// <param name="row">The row.</param>
        /// <param name="dataControlFieldCell">The data control field cell.</param>
        /// <returns></returns>
        public override object GetExportValue(GridViewRow row, DataControlFieldCell dataControlFieldCell)
        {
            var literal = dataControlFieldCell.FindControl(this.ID) as Literal;

            return(literal?.Text);
        }
コード例 #7
0
        protected void gvXMProduct_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            var Tid = (XMTypeTest)e.Row.DataItem;

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                RadioButtonList ddlDemand  = (RadioButtonList)e.Row.FindControl("ddlDemand");
                var             DemandList = IoC.Resolve <IXMZMDemandService>().GetXMZMDemandListByTid(Tid.ID);
                ddlDemand.DataSource     = DemandList;
                ddlDemand.DataTextField  = "requirements";
                ddlDemand.DataValueField = "ID";
                ddlDemand.DataBind();
                ddlDemand.SelectedIndex = 1;

                DataControlFieldCell            cell     = (DataControlFieldCell)ddlDemand.Parent;
                System.Web.UI.WebControls.Label lblPrice = (System.Web.UI.WebControls.Label)cell.FindControl("lblPrice");

                if (ddlDemand.SelectedValue.ToString().Trim().Length > 0)
                {
                    if (Convert.ToInt16(ddlDemand.SelectedValue.ToString().Trim()) != -1)
                    {
                        int Did         = Convert.ToInt32(ddlDemand.SelectedValue);
                        var DemandList2 = IoC.Resolve <IXMZMDemandService>().GetXMZMDemandByID(Did);
                        lblPrice.Text = DemandList2.Price.ToString();
                        lblPrice.DataBind();
                    }
                }
            }
        }
コード例 #8
0
        /// <summary>
        /// Gets the value that should be exported to Excel
        /// </summary>
        /// <param name="row">The row.</param>
        /// <param name="dataControlFieldCell">The data control field cell.</param>
        /// <returns></returns>
        public override object GetExportValue(GridViewRow row, DataControlFieldCell dataControlFieldCell)
        {
            var literal = dataControlFieldCell.FindControl(this.ID) as Literal;

            return(literal?.Text.ConvertBrToCrLf().StripHtml());
        }