protected void Page_Load(object sender, EventArgs e)
    {
        list.Read(this);

        GridView1.AutoGenerateColumns = false;

        HyperLinkColumn urlCol = new HyperLinkColumn();

        urlCol.DataTextField        = "Text";
        urlCol.DataNavigateUrlField = "NavigateUrl";
        urlCol.HeaderText           = "File Name";

        BoundColumn size = new BoundColumn();

        size.DataField  = "Size";
        size.HeaderText = "Size (Bytes)";

        BoundColumn mod = new BoundColumn();

        mod.DataField  = "Modified";
        mod.HeaderText = "Last Modified";

        // Add three columns to collection.
        GridView1.Columns.Add(urlCol);
        GridView1.Columns.Add(size);
        GridView1.Columns.Add(mod);
        GridView1.DataSource = list.Files;
        GridView1.DataBind();
    }
Exemple #2
0
        private BoundColumn AddColumnGrid(string strHeader, string strColumn, int intAlign, string strFormatValue, bool blnVisible)
        {
            BoundColumn objField = (strFormatValue.Trim() == "") ? AddColumnGrid(strHeader, strColumn, intAlign) : AddColumnGrid(strHeader, strColumn, intAlign, strFormatValue);

            objField.Visible = blnVisible;
            return(objField);
        }
Exemple #3
0
    /// <summary>
    /// 获取Grid
    /// </summary>
    /// <returns></returns>
    private DataGrid GetExportGrid(Col[] Columns)
    {
        DataGrid child = new DataGrid();

        this.Controls.Add(child);

        child.ID = Guid.NewGuid().ToString() + "_exportGrid";
        if (Columns == null)
        {
            return(child);
        }
        child.AutoGenerateColumns = false;
        foreach (Col column in Columns)
        {
            BoundColumn column2 = new BoundColumn
            {
                DataField = column.DataField
            };
            string str = string.IsNullOrEmpty(column.HeaderText) ? column.DataField : column.HeaderText;
            column2.HeaderText = str;
            //column2.DataFormatString = column.DataFormatString;
            //column2.FooterText = column.FooterValue;
            child.Columns.Add(column2);
        }
        return(child);
    }
Exemple #4
0
        private ArrayList GetGridColumns(string linkFieldName)
        {
            ArrayList columns = new ArrayList();

            OrderColumns();
            foreach (ViewMap vm in viewMaps)
            {
                if (vm.Style != null && vm.Style == "hyperlink")
                {
                    if (linkFieldName == null)
                    {
                        Check.VerifyNotNull(vm.PrimaryKeyName, Error.NullParameter, "PrimaryKeyName");
                        linkFieldName = vm.PrimaryKeyName;
                    }
                    HyperLinkColumn column = new HyperLinkColumn();
                    column.DataTextField               = vm.PropertyName;
                    column.DataNavigateUrlField        = linkFieldName;
                    column.DataNavigateUrlFormatString = vm.NavigateUrlFormat;
                    column.HeaderText           = vm.ColumnName;
                    column.SortExpression       = vm.PropertyName;
                    column.DataTextFormatString = vm.FormatString;
                    columns.Add(column);
                }
                else
                {
                    BoundColumn column = new BoundColumn();
                    column.HeaderText       = vm.ColumnName;
                    column.SortExpression   = vm.PropertyName;
                    column.DataField        = vm.PropertyName;
                    column.DataFormatString = vm.FormatString;
                    columns.Add(column);
                }
            }
            return(columns);
        }
Exemple #5
0
        private void AddGridColumns(DataSet ds)
        {
            var hiddenColumns = ReportExtra.HideColumns.Split(',');

            foreach (DataColumn c in ds.Tables[0].Columns)
            {
                if (Array.IndexOf(hiddenColumns, c.ColumnName) < 0)
                {
                    if (IsDrilldown() && IsDrilldownColumn(c.ColumnName))
                    {
                        var dgt = new TemplateColumn();
                        dgt.ItemTemplate   = new DrilldownTemplate(c.ColumnName);
                        dgt.HeaderText     = c.Caption;
                        dgt.SortExpression = c.ColumnName;
                        dgCommand.Columns.Add(dgt);
                    }
                    else
                    {
                        var dgc = new BoundColumn();
                        dgc.DataField      = c.ColumnName;
                        dgc.HeaderText     = c.Caption;
                        dgc.SortExpression = c.ColumnName;
                        dgCommand.Columns.Add(dgc);
                    }
                }
            }
        }
Exemple #6
0
        public static TableCell GetCell(this DataGridItem row, string headerText)
        {
            var grid = (DataGrid)row.Parent.Parent;

            for (var i = 0; i < grid.Columns.Count; i++)
            {
                var col = grid.Columns[i];
                if (col is BoundColumn)
                {
                    BoundColumn tmpCol = col as BoundColumn;
                    if (tmpCol.DataField == headerText || tmpCol.HeaderText == headerText)
                    {
                        return(row.Cells[i]);
                    }
                }
                else
                {
                    if (col.HeaderText == headerText)
                    {
                        return(row.Cells[i]);
                    }
                }
            }
            return(null);
        }
Exemple #7
0
        protected void Cargar_Tabla_Consignacion()
        {
            BoundColumn prefRC, numRC, tipDoc, numDoc, ban, val, prefCons, numCons, cue, nit;

            prefRC     = new BoundColumn(); prefRC.DataField = "PREFIJO RECIBO CAJA"; prefRC.HeaderText = "Prefijo Recibo Caja";
            numRC      = new BoundColumn(); numRC.DataField = "NUMERO RECIBO CAJA"; numRC.HeaderText = "Número Recibo Caja";
            tipDoc     = new BoundColumn(); tipDoc.DataField = "TIPO DE DOCUMENTO"; tipDoc.HeaderText = "Tipo de Documento";
            numDoc     = new BoundColumn(); numDoc.DataField = "NUMERO DOCUMENTO"; numDoc.HeaderText = "Número de Documento";
            ban        = new BoundColumn(); ban.DataField = "BANCO"; ban.HeaderText = "Banco";
            val        = new BoundColumn(); val.DataField = "VALOR"; val.DataFormatString = "{0:C}"; val.HeaderText = "Valor";
            prefCons   = new BoundColumn(); prefCons.DataField = "PREFIJO CONSIGNACION"; prefCons.HeaderText = "Prefijo Consignación";
            numCons    = new BoundColumn(); numCons.DataField = "NUMERO CONSIGNACION"; numCons.HeaderText = "Número de Consignación";
            cue        = new BoundColumn(); cue.DataField = "CUENTA"; cue.HeaderText = "Cuenta";
            nit        = new BoundColumn(); nit.DataField = "NIT"; nit.HeaderText = "Nit";
            tablaDatos = new DataTable();
            tablaDatos.Columns.Add("PREFIJO RECIBO CAJA", typeof(string));
            tablaDatos.Columns.Add("NUMERO RECIBO CAJA", typeof(int));
            tablaDatos.Columns.Add("TIPO DE DOCUMENTO", typeof(string));
            tablaDatos.Columns.Add("NUMERO DOCUMENTO", typeof(string));
            tablaDatos.Columns.Add("BANCO", typeof(string));
            tablaDatos.Columns.Add("VALOR", typeof(double));
            tablaDatos.Columns.Add("PREFIJO CONSIGNACION", typeof(string));
            tablaDatos.Columns.Add("NUMERO CONSIGNACION", typeof(int));
            tablaDatos.Columns.Add("CUENTA", typeof(string));
            tablaDatos.Columns.Add("NIT", typeof(string));
            gridDatos.Columns.Add(prefRC); gridDatos.Columns.Add(numRC); gridDatos.Columns.Add(tipDoc);
            gridDatos.Columns.Add(numDoc); gridDatos.Columns.Add(ban); gridDatos.Columns.Add(val);
            gridDatos.Columns.Add(prefCons); gridDatos.Columns.Add(numCons); gridDatos.Columns.Add(cue);
            gridDatos.Columns.Add(nit);
        }
Exemple #8
0
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            dgList.Columns.Clear();
            HyperLinkColumn hlc = new HyperLinkColumn();

            hlc.DataNavigateUrlField        = "QuoteCode";
            hlc.DataNavigateUrlFormatString = lChartPage.Text + "?" + Config.SymbolParameterName + "={0}";
            hlc.DataTextField = "QuoteCode";
            hlc.HeaderText    = "QuoteCode";
            dgList.Columns.Add(hlc);
            string[] ss = Config.AutoPullFormulaData.Split(';');
            for (int i = 0; i < ss.Length; i++)
            {
                BoundColumn bc = new BoundColumn();
                bc.DataField      = Utils.GetName(ss[i]);
                bc.HeaderText     = bc.DataField;
                bc.SortExpression = bc.DataField;
                //bc.DataFormatString = "{0:f2}";
                dgList.Columns.Add(bc);
            }

            InitializeComponent();
            base.OnInit(e);
        }
Exemple #9
0
        /// <summary>
        /// 把DataGrid中当前编辑行中的绑定列的值绑定到业务对象
        /// </summary>
        /// <param name="grid">DataGrid的实例</param>
        /// <param name="e">包含当前编辑行信息的事件参数</param>
        /// <param name="model">业务对象</param>
        public static void BindModelByDataGrid(DataGrid grid, DataGridItem item, object model)
        {
            PropertyInfo[] Properties = model.GetType().GetProperties(BindingFlags.Instance |
                                                                      BindingFlags.Public);


            for (int i = 0; i < grid.Columns.Count; i++)
            {
                if (grid.Columns[i] is BoundColumn)
                {
                    BoundColumn BC = grid.Columns[i] as BoundColumn;
                    foreach (PropertyInfo Property in Properties)
                    {
                        if (Property.Name == BC.DataField)
                        {
                            if (item.Cells[i].HasControls())
                            {
                                Property.SetValue(model,
                                                  Convert.ChangeType((item.Cells[i].Controls[0] as TextBox).Text, Property.PropertyType),
                                                  null);
                            }
                            else
                            {
                                Property.SetValue(model, Convert.ChangeType(item.Cells[i].Text, Property.PropertyType), null);
                            }
                        }
                    }
                }
            }
        }
Exemple #10
0
        public BoundColumnBuilder <T> Bound(Expression <Func <T, object> > expression)
        {
            BoundColumn <T> col = new BoundColumn <T>(expression);

            Grid.Columns.Add(col);
            return(new BoundColumnBuilder <T>(col));
        }
Exemple #11
0
        /// <summary>
        /// Sets up the columns for the Grid
        /// </summary>
        private void SetUpRolesGrid()
        {
            dgRoleSelection.Columns.Clear();
            var textCol = new BoundColumn {
                HeaderText = "&nbsp;", DataField = "RoleName"
            };

            textCol.ItemStyle.Width = Unit.Parse("150px");
            dgRoleSelection.Columns.Add(textCol);
            var idCol = new BoundColumn {
                HeaderText = "", DataField = "roleid", Visible = false
            };

            dgRoleSelection.Columns.Add(idCol);
            var checkCol       = new TemplateColumn();
            var columnTemplate = new CheckBoxColumnTemplate {
                DataField = "Selected"
            };

            checkCol.ItemTemplate = columnTemplate;
            checkCol.HeaderText   = Localization.GetString("SelectedRole");
            checkCol.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
            checkCol.HeaderStyle.Wrap          = true;
            dgRoleSelection.Columns.Add(checkCol);
        }
Exemple #12
0
        private void Synchronize(SynchronizationKey key)
        {
            if (key == null)
            {
                return;
            }

            var collection = this.PairedColumns;

            SynchronizationEntry pair;

            if (!collection.TryGetValue(key, out pair))
            {
                if (key.MasterColumn != null)
                {
                    pair = new BoundColumn(key);
                }
                else
                {
                    pair = new UnboundColumn(key);
                }

                collection.Add(key, pair);
            }

            pair.Synchronize();
        }
        private void CreateTemplateColumns(DataGrid dtg, DataTable dt)
        {
            ReportConfiguration rprt = reportConfigurations[report];

            for (int c = 0; c < dt.Columns.Count; c++)
            {
                string columnName = "";
                columnName = dt.Columns[c].ColumnName;
                ReportConfiguration.ColumnMode columnMode = rprt.ColumnDisplay(columnName);

                if (columnMode == ReportConfiguration.ColumnMode.ShowAsHyperLink)
                {
                    ReportHyperLinkColumn hcol       = rprt.GetHyperLinkColumn(columnName);
                    HyperLinkColumn       linkColumn = createHyperLinkColumn(hcol.DataTextField, hcol.DataTextFormatString, hcol.DataNavigateUrlField, hcol.HeaderText, hcol.GoToReport, hcol.Param);
                    dtg.Columns.Add(linkColumn);
                }
                else if (columnMode == ReportConfiguration.ColumnMode.ShowAsNormal || rbAllColumns.Checked)
                {
                    BoundColumn bc = new BoundColumn();
                    bc.DataField      = columnName;
                    bc.HeaderText     = columnName;
                    bc.SortExpression = columnName;
                    dtg.Columns.Add(bc);
                }
            }
        }
        private void Page_Load(object sender, EventArgs e)
        {
            HtmlForm form1 = (HtmlForm)(HtmlForm)this.FindControl("Form1");

            this.GHTTestBegin(form1);
            base.GHTActiveSubTest = this.GHTSubTest1;
            try
            {
                this.DataGrid1.DataSource = GHTTests.GHDataSources.DSDataTable();
                BoundColumn column2 = new BoundColumn();
                BoundColumn column3 = new BoundColumn();
                BoundColumn column1 = new BoundColumn();
                column2.DataField = "ID";
                column3.DataField = "Name";
                column1.DataField = "Company";
                this.DataGrid1.Columns.Add(column2);
                this.DataGrid1.Columns.Add(column3);
                this.DataGrid1.Columns.Add(column1);
                this.DataGrid1.DataBind();
            }
            catch (Exception exception2)
            {
                // ProjectData.SetProjectError(exception2);
                Exception exception1 = exception2;
                this.GHTSubTestUnexpectedExceptionCaught(exception1);
                // ProjectData.ClearProjectError();
            }
            this.GHTTestEnd();
        }
Exemple #15
0
        private void Page_Init(object sender, System.EventArgs e)
        {
            if ((tmpDataTable = (DataTable)Session[DynamicGridFormIIDataTableSessionSignature]) == null)
            {
                Session[DynamicGridFormIIDataTableSessionSignature] = tmpDataTable = new DataTable();
            }

            if (!IsPostBack)
            {
                FillDataTable(tmpDataTable);
            }

            BoundColumn
                tmpBoundColumn = new BoundColumn();

            tmpBoundColumn.HeaderText = "Name";
            tmpBoundColumn.DataField  = "Name";
            DynamicDataGrid1.Columns.Add(tmpBoundColumn);

            tmpBoundColumn            = new BoundColumn();
            tmpBoundColumn.HeaderText = "Button";
            DynamicDataGrid1.Columns.Add(tmpBoundColumn);

            DynamicDataGrid1.DataSource = tmpDataTable;

            DynamicDataGrid1.ItemCreated += new DataGridItemEventHandler(DynamicDataGrid1_ItemCreated);
        }
Exemple #16
0
    private string GetDataGridCellValue(DataGrid g, int ItemIndex, string dataField)
    {
        bool   isFind      = false;
        string returnValue = "";

        for (int i = 0; i < g.Columns.Count; i++)
        {
            BoundColumn boundColumn = g.Columns[i] as BoundColumn;
            if (boundColumn != null)
            {
                if (boundColumn.DataField.ToLower() == dataField.ToLower())
                {
                    isFind      = true;
                    returnValue = g.Items[ItemIndex].Cells[i].Text;

                    break;
                }
            }
        }
        if (!isFind)
        {
            //Shove._Web.JavaScript.Alert(this.Page, "GetDataGridCellValue 找不到指定的值");
            PF.GoError(-111, "找不到指定的列值,请联系技术员", this.GetType().Name);
        }
        return(returnValue);
    }
Exemple #17
0
        private void CreateGrid(DataGrid GridName, string strSQL)
        {
            SqlDataReader dr = GetDataReader(strSQL);
            DataGrid      DG = new DataGrid();

            DG.BorderWidth         = Unit.Pixel(2);
            DG.CellPadding         = 2;
            DG.GridLines           = GridLines.Both;
            DG.BorderColor         = Color.Black;
            DG.ShowHeader          = true;
            DG.AutoGenerateColumns = false;
            DG.ShowFooter          = true;
            DG.ShowHeader          = true;
            DataTable dt = dr.GetSchemaTable();

            System.Int32 columncount = dr.FieldCount;
            for (System.Int32 iCol = 0; iCol < columncount; iCol++)
            {
                BoundColumn datagridcol = new BoundColumn();
                datagridcol.HeaderText = dr.GetName(iCol).ToString();
                datagridcol.DataField  = dr.GetName(iCol).ToString();
                DG.Columns.Add(datagridcol);
            }
            GridName = DG;
            //Page.Controls[1].Controls.Add(GridName);
            Page.Controls.Add(GridName);
            GridName.DataSource = dr;
        }
            public override void Desynchronize()
            {
                if (m_localValues == null)
                {
                    return;
                }

                var localValues = m_localValues;

                m_localValues = null;

                var masterColumn = this.MasterColumn;

                masterColumn.PropertyChanged      -= new PropertyChangedEventHandler(this.OnMasterColumnPropertyChanged);
                masterColumn.FittedWidthRequested -= new FittedWidthRequestedEventHandler(this.OnMasterColumnFittedWidthRequested);

                var detailColumn = this.DetailColumn;

                BoundColumn.RestoreLocalValue(localValues, detailColumn, ColumnBase.WidthProperty);
                BoundColumn.RestoreLocalValue(localValues, detailColumn, ColumnBase.MinWidthProperty);
                BoundColumn.RestoreLocalValue(localValues, detailColumn, ColumnBase.MaxWidthProperty);
                BoundColumn.RestoreLocalValue(localValues, detailColumn, ColumnBase.DesiredWidthProperty);
                BoundColumn.RestoreLocalValue(localValues, detailColumn, ColumnBase.VisibleProperty);
                BoundColumn.RestoreLocalValue(localValues, detailColumn, ColumnReorderingDragSourceManager.AnimatedColumnReorderingTranslationProperty);
                BoundColumn.RestoreLocalValue(localValues, detailColumn, TableflowView.IsBeingDraggedAnimatedProperty);
                BoundColumn.RestoreLocalValue(localValues, detailColumn, TableflowView.ColumnReorderingDragSourceManagerProperty);

                detailColumn.ClearValue(ColumnBase.VisiblePositionProperty);
            }
Exemple #19
0
        private DataGridColumn c_bounded()
        {
            BoundColumn column1 = new BoundColumn();

            column1.DataField = "ID";
            return(column1);
        }
            private void OnMasterColumnPropertyChanged(object sender, PropertyChangedEventArgs e)
            {
                var masterColumn = sender as ColumnBase;

                if (masterColumn == null)
                {
                    return;
                }

                Debug.Assert(masterColumn == this.MasterColumn);

                var masterColumnManager = this.Owner.MasterColumnManager;

                if ((masterColumnManager == null) || masterColumnManager.IsUpdateDeferred)
                {
                    return;
                }

                var detailColumn = this.DetailColumn;
                var propertyName = e.PropertyName;

                BoundColumn.SetValue(masterColumn, detailColumn, ColumnBase.WidthProperty, propertyName);
                BoundColumn.SetValue(masterColumn, detailColumn, ColumnBase.MinWidthProperty, propertyName);
                BoundColumn.SetValue(masterColumn, detailColumn, ColumnBase.MaxWidthProperty, propertyName);
                BoundColumn.SetValue(masterColumn, detailColumn, ColumnBase.DesiredWidthProperty, propertyName);
                BoundColumn.SetValue(masterColumn, detailColumn, ColumnBase.VisibleProperty, propertyName);
                BoundColumn.SetValue(masterColumn, detailColumn, ColumnReorderingDragSourceManager.AnimatedColumnReorderingTranslationProperty, propertyName);
                BoundColumn.SetValue(masterColumn, detailColumn, TableflowView.IsBeingDraggedAnimatedProperty, propertyName);
                BoundColumn.SetValue(masterColumn, detailColumn, TableflowView.ColumnReorderingDragSourceManagerProperty, propertyName);
            }
            public override void Synchronize()
            {
                var masterColumn = this.MasterColumn;
                var detailColumn = this.DetailColumn;

                if (m_localValues == null)
                {
                    m_localValues = new Dictionary <DependencyProperty, object>(8);

                    masterColumn.PropertyChanged      += new PropertyChangedEventHandler(this.OnMasterColumnPropertyChanged);
                    masterColumn.FittedWidthRequested += new FittedWidthRequestedEventHandler(this.OnMasterColumnFittedWidthRequested);

                    BoundColumn.StoreLocalValue(m_localValues, detailColumn, ColumnBase.WidthProperty);
                    BoundColumn.StoreLocalValue(m_localValues, detailColumn, ColumnBase.MinWidthProperty);
                    BoundColumn.StoreLocalValue(m_localValues, detailColumn, ColumnBase.MaxWidthProperty);
                    BoundColumn.StoreLocalValue(m_localValues, detailColumn, ColumnBase.DesiredWidthProperty);
                    BoundColumn.StoreLocalValue(m_localValues, detailColumn, ColumnBase.VisibleProperty);
                    BoundColumn.StoreLocalValue(m_localValues, detailColumn, ColumnReorderingDragSourceManager.AnimatedColumnReorderingTranslationProperty);
                    BoundColumn.StoreLocalValue(m_localValues, detailColumn, TableflowView.IsBeingDraggedAnimatedProperty);
                    BoundColumn.StoreLocalValue(m_localValues, detailColumn, TableflowView.ColumnReorderingDragSourceManagerProperty);
                }

                BoundColumn.SetValue(masterColumn, detailColumn, ColumnBase.WidthProperty);
                BoundColumn.SetValue(masterColumn, detailColumn, ColumnBase.MinWidthProperty);
                BoundColumn.SetValue(masterColumn, detailColumn, ColumnBase.MaxWidthProperty);
                BoundColumn.SetValue(masterColumn, detailColumn, ColumnBase.DesiredWidthProperty);
                BoundColumn.SetValue(masterColumn, detailColumn, ColumnBase.VisibleProperty);
                BoundColumn.SetValue(masterColumn, detailColumn, ColumnReorderingDragSourceManager.AnimatedColumnReorderingTranslationProperty);
                BoundColumn.SetValue(masterColumn, detailColumn, TableflowView.IsBeingDraggedAnimatedProperty);
                BoundColumn.SetValue(masterColumn, detailColumn, TableflowView.ColumnReorderingDragSourceManagerProperty);

                this.UpdateTargetPosition();
            }
Exemple #22
0
        //---------------------------------------------------------------------------

        private void FormInfo()
        {
            DataTable
                dt = new DataTable();

            try
            {
                if (FillInfo(dt))
                {
                    if (ShowButtonKill)
                    {
                        BoundColumn
                            tmpBoundColumn = new BoundColumn();

                        tmpBoundColumn.HeaderText = "Kill";
                        DynamicDataGrid1.Columns.Add(tmpBoundColumn);
                    }
                    DynamicDataGrid1.DataSource = dt;
                    DynamicDataGrid1.DataBind();
                }
            }
            catch (Exception eException)
            {
                throw(new Exception("Message: " + eException.Message + "\nStackTrace: " + eException.StackTrace));
            }
        }
Exemple #23
0
        /// <summary>
        /// 创建导出excel格式(可重载)
        /// </summary>
        /// <param name="fields"></param>
        /// <returns></returns>
        protected virtual DataGrid GetGridViewForExcel(object[] fields)
        {
            DataGrid GridView1 = new DataGrid();

            GridView1.AutoGenerateColumns = false;
            BoundColumn col = null;

            rowno_col_index = -1;
            foreach (object item in fields)
            {
                string[] arrinfo = (string[])item;

                if (arrinfo[0] == ROWNO_COL_KEY)
                {
                    TemplateColumn templatecol = new TemplateColumn();
                    templatecol.HeaderText = arrinfo[1];
                    GridView1.Columns.Add(templatecol);
                    rowno_col_index = GridView1.Columns.Count - 1;
                }
                else
                {
                    col            = new BoundColumn();
                    col.DataField  = arrinfo[0];
                    col.HeaderText = arrinfo[1];
                    if (arrinfo.Length > 2)
                    {
                        col.DataFormatString = "{0:" + arrinfo[2] + "}";
                    }
                    GridView1.Columns.Add(col);
                }
            }

            return(GridView1);
        }
        } // Done...Tested

        #endregion

        #endregion

        #region Datagrid Events

        #region initGrid(DataGrid dgGrid, string strSQL, string pKey)
        private void initGrid(DataGrid dgGrid, string strSQL, string pKey)
        {
            if (AppMode)
            {
                clsUtility.Connection = enc.SimpleCrypt(ConfigurationManager.AppSettings["remoteConn"]);
            }
            else
            {
                clsUtility.Connection = enc.SimpleCrypt(ConfigurationManager.AppSettings["infiniConn"]);
            }

            SqlDataReader rData = clsUtility.GetDataReader(strSQL);

            // set the grid's visible property to false to initialize the control
            dgGrid.Visible = false;

            int i;

            if (rData.HasRows)
            {
                dgGrid.Visible = true;
                for (i = 0; i < rData.FieldCount; i++)
                {
                    BoundColumn objBC = new BoundColumn();
                    objBC.DataField  = rData.GetName(i).ToString();
                    objBC.HeaderText = rData.GetName(i).ToString();

                    // use this function to make the primary key of the table hidden
                    if (rData.GetName(i).ToString() == pKey)
                    {
                        objBC.Visible = false;
                    }
                    dgGrid.Columns.Add(objBC);
                }
                dgGrid.DataSource = rData;
                dgGrid.DataBind();
                rData.Close();
            }
            else
            {
                if (pKey == "MedicationID")
                {
                    MedHdr.Visible = false;
                }
                if (pKey == "VitalSignID")
                {
                    VitalHdr.Visible = false;
                }
            }

            // if in view mode then remove the Action column
            if (Session["mode"] != null && Session["mode"].ToString() == "view")
            {
                dgGrid.Columns[0].Visible = false;;
            }

            // cleanup
            rData.Close();
        }
        private DataGridColumn c_bounded(string se)
        {
            BoundColumn column1 = new BoundColumn();

            column1.DataField      = "ID";
            column1.SortExpression = se;
            return(column1);
        }
        private void AddRubricColumn(string name, string bind)
        {
            BoundColumn col = new BoundColumn();

            col.HeaderText = name;
            col.DataField  = bind;
            dgAggregate.Columns.Add(col);
        }
        private DataGridColumn c_bounded(bool v)
        {
            BoundColumn column1 = new BoundColumn();

            column1.DataField = "ID";
            column1.Visible   = v;
            return(column1);
        }
Exemple #28
0
        private DataGridColumn c_bounded(string se)
        {
            BoundColumn column1 = new BoundColumn();

            column1.DataField      = "ID";
            column1.HeaderImageUrl = se;
            return(column1);
        }
Exemple #29
0
        private void ShowEventPagination(int currentEventPageIndex)
        {
            try
            {
                HtmlTableRow trEventPagination = FindControl("trEventPagination") as HtmlTableRow;

                //1. Get data
                DataSet  dtbEventIndividual = this.GetEventPaginationData();
                DataView dvwEventPagination = dtbEventIndividual.Tables[0].DefaultView;

                if (dvwEventPagination.Table.Rows.Count == 0)
                {
                    this.lblError.Text     = ResourceManager.GetString("lblError.NoUsers");//"No users found.";
                    this.lblError.CssClass = "FeedbackMessage";
                }

                //2. Set pagination panel
                int intEventPageSize;
                intEventPageSize = ApplicationSettings.PageSize;
                this.SetEventPaginationPanel(intEventPageSize, dvwEventPagination.Count, currentEventPageIndex);

                //3. Bind Data
                // add columns as required for the profiles & points

                int colCount = dtbEventIndividual.Tables[0].Columns.Count;

                for (int i = 11; i < colCount; i++)
                {
                    //string strUserID = UserContext.UserID.ToString();
                    string strUserID = UserId.ToString();
                    //string strUserID = "1381";
                    string strColName = dtbEventIndividual.Tables[0].Columns[i].ToString();

                    BoundColumn test = new BoundColumn();
                    test.DataField  = strColName;
                    test.HeaderText = strColName;

                    if (strColName.Substring(strColName.Length - 3, 3) == "ID~")
                    {
                        test.Visible = false;
                    }
                    test.ItemStyle.CssClass = "tablerow2";
                    dgrEvent.Columns.Add(test);
                }

                dgrEvent.DataKeyField = "EventPeriodID";
                dgrEvent.DataSource   = dvwEventPagination;
                //dgrEvent.PageSize = intEventPageSize;
                //dgrEvent.CurrentPageIndex = currentEventPageIndex;
                dgrEvent.DataBind();
            }
            catch (Exception Ex)
            {
                ErrorHandler.ErrorLog Error = new ErrorHandler.ErrorLog(Ex, ErrorLevel.Medium, "ExportCPDEventReport.aspx.cs", "ShowEventPagination()", "Binding Data to Datagrid");
                throw (Ex);
            }
        }
    protected BoundColumn CreateBoundColumn(DataColumn c, string[] col, int index)
    {
        BoundColumn column = new BoundColumn();
        column.DataField = c.ColumnName;
        column.HeaderText = col[index].ToString();
        column.DataFormatString = setFormating(c);

        return column;
    }
        private DataGridColumn c_bounded(ListItemType tp, string text)
        {
            BoundColumn column1 = new BoundColumn();

            column1.DataField = "ID";
            this.setStyle(column1, tp);
            this.setText(column1, tp, text);
            return(column1);
        }
    protected void gridRxQueue_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        bool successFlag = false;
        if (e.Row.RowIndex != -1)
        {
            int index = e.Row.RowIndex;

            string sCatId = gridRxQueue.DataKeys[index].Values["Clinic_ID"].ToString();
            if (sCatId != "0")
            {
                SqlConnection sqlCon = new SqlConnection(conStr);
                SqlCommand sqlCmd = new SqlCommand("sp_getActivitySummary", sqlCon);
                sqlCmd.CommandType = CommandType.StoredProcedure;
                if (Session["Role"].ToString() == "D")
                {
                    SqlParameter par_UserID = sqlCmd.Parameters.Add("@UserID", SqlDbType.VarChar, 15);
                    par_UserID.Value = (string)Session["User"];
                }
                SqlParameter par_ClinicID = sqlCmd.Parameters.Add("@Clinic_ID", SqlDbType.Int);
                par_ClinicID.Value = sCatId;

                SqlParameter par_Date = sqlCmd.Parameters.Add("@Date", SqlDbType.Date);
                DateTime dt;
                if (ddlMonth.SelectedValue.ToString() == "12")
                    dt = new DateTime(int.Parse(ddlYear.SelectedValue) + 1, 1, 1);
                else
                    dt = new DateTime(int.Parse(ddlYear.SelectedValue), int.Parse(ddlMonth.SelectedValue.ToString()) + 1, 1);
                dt = dt.AddDays(-1);
                par_Date.Value = dt.ToString();

                SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);
                DataSet dsRxQueue = new DataSet();
                try
                {
                    sqlDa.Fill(dsRxQueue, "RxQueue");
                    DataGrid NewDg = new DataGrid();
                    NewDg.AutoGenerateColumns = false;
                    NewDg.HeaderStyle.CssClass = "medication_info_th1";
                    NewDg.ItemStyle.CssClass = "medication_info_tr-odd";
                    NewDg.ItemStyle.Font.Bold = false;
                    NewDg.AlternatingItemStyle.Font.Bold = false;
                    NewDg.AlternatingItemStyle.CssClass = "medication_info_tr-even";
                    NewDg.ShowHeader = false;

                    BoundColumn nameColumn = new BoundColumn();
                    nameColumn.HeaderText = "Location";
                    nameColumn.DataField = "Facility_Name";
                    nameColumn.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
                    nameColumn.ItemStyle.Width = 250;
                    NewDg.Columns.Add(nameColumn);

                    nameColumn = new BoundColumn();
                    nameColumn.HeaderText = "New Patients";
                    nameColumn.DataField = "NewPatients";
                    nameColumn.ItemStyle.Width = 100;
                    NewDg.Columns.Add(nameColumn);

                    nameColumn = new BoundColumn();

                    nameColumn.HeaderText = "New Rx";

                    nameColumn.DataField = "NewRx";
                    nameColumn.ItemStyle.Width = 50;
                    NewDg.Columns.Add(nameColumn);

                    nameColumn = new BoundColumn();

                    nameColumn.HeaderText = "Refills";

                    nameColumn.DataField = "Refills";
                    nameColumn.ItemStyle.Width = 50;
                    NewDg.Columns.Add(nameColumn);

                    nameColumn = new BoundColumn();

                    nameColumn.HeaderText = "Sample";

                    nameColumn.DataField = "Sample";
                    nameColumn.ItemStyle.Width = 100;
                    NewDg.Columns.Add(nameColumn);

                    nameColumn = new BoundColumn();

                    nameColumn.HeaderText = "PAP";

                    nameColumn.DataField = "PAP";
                    nameColumn.ItemStyle.Width = 50;
                    NewDg.Columns.Add(nameColumn);

                    nameColumn = new BoundColumn();

                    nameColumn.HeaderText = "Payments";

                    nameColumn.DataField = "Payments";
                    nameColumn.ItemStyle.Width = 100;
                    NewDg.Columns.Add(nameColumn);

                    nameColumn = new BoundColumn();

                    nameColumn.HeaderText = "S/P Billing";

                    nameColumn.DataField = "SPBilling";
                    nameColumn.ItemStyle.Width = 100;
                    NewDg.Columns.Add(nameColumn);

                    nameColumn = new BoundColumn();
                    nameColumn.HeaderText = "Med Reqs";

                    nameColumn.DataField = "MedRequests";
                    nameColumn.ItemStyle.Width = 61;
                    NewDg.Columns.Add(nameColumn);

                    nameColumn = new BoundColumn();
                    nameColumn.HeaderText = "Other";

                    nameColumn.DataField = "Other";
                    nameColumn.ItemStyle.Width = 50;
                    NewDg.Columns.Add(nameColumn);

                    NewDg.Width = Unit.Percentage(100.00);
                    NewDg.DataSource = dsRxQueue;
                    NewDg.DataBind();

                    System.IO.StringWriter sw = new System.IO.StringWriter();
                    System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
                    NewDg.RenderControl(htw);

                    string DivStart = "<DIV id='uniquename" + e.Row.RowIndex.ToString() + "' style='DISPLAY: none; HEIGHT: 1px;'>";
                    string DivBody = sw.ToString();
                    string DivEnd = "</DIV>";

                    string FullDIV = DivStart + DivBody + DivEnd;

                    int LastCellPosition = e.Row.Cells.Count - 1;
                    int NewCellPosition = e.Row.Cells.Count;

                    e.Row.Cells[0].ID = "CellInfo" + e.Row.RowIndex.ToString();

                     e.Row.Cells[LastCellPosition].Text = e.Row.Cells[LastCellPosition].Text +
                                      "</td><tr><td ></td><td colspan='" +
                                      NewCellPosition + "'>" + FullDIV;

                    e.Row.Cells[0].Text = @"&nbsp;&nbsp;<A onclick=""togglePannelStatus('uniquename" +
                                    e.Row.RowIndex.ToString() + "',this);" + @""" onmouseover=""this.style.cursor='hand'"" onmouseout=""this.style.cursor='hand'"" ><B>+</B></A>&nbsp;";
                    successFlag = true;
                }
                catch (SqlException SqlEx)
                {
                    objNLog.Error("SQLException : " + SqlEx.Message);
                    throw new Exception("Exception re-Raised from DL with SQLError# " + SqlEx.Number + " ", SqlEx);
                }
                catch (Exception ex)
                {
                    objNLog.Error("Exception : " + ex.Message);
                    throw new Exception("**Error occured while  Binding Activity Summary.", ex);
                }
                finally
                {
                    sqlCon.Close();
                    objNLog.Info("Finally Block: " + successFlag);
                }
            }
            else
            {

                e.Row.Cells[0].Text = "";
            }
            Label lb=(Label) e.Row.Cells[7].FindControl("lblPayments");
            if (lb.Text == "")
                lb.Text = "0.00";
            Label lb1 = (Label)e.Row.Cells[8].FindControl("lblBilling");
            if (lb1.Text == "")
                lb1.Text = "0.00";
        }
    }
    private void Synchronize( SynchronizationKey key )
    {
      if( key == null )
        return;

      var collection = this.PairedColumns;

      SynchronizationEntry pair;
      if( !collection.TryGetValue( key, out pair ) )
      {
        if( key.MasterColumn != null )
        {
          pair = new BoundColumn( key );
        }
        else
        {
          pair = new UnboundColumn( key );
        }

        collection.Add( key, pair );
      }

      pair.Synchronize();
    }
    private void LoadData()
    {
        BoundColumn colBound = new BoundColumn();
        colBound.DataField = "Title";
        colBound.HeaderText = GetMessage("generic Title");
        colBound.Initialize();
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        grdData.Columns.Add(colBound);

        colBound = new BoundColumn();
        colBound.DataField = "RequestType";
        colBound.HeaderText = GetMessage("generic Request Type");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.HeaderStyle.Wrap = false;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);

        colBound = new BoundColumn();
        colBound.DataField = "GoLive";
        colBound.HeaderText = GetMessage("generic Go Live");
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
        grdData.Columns.Add(colBound);

        colBound = new BoundColumn();
        colBound.DataField = "Submitted";
        colBound.HeaderText = GetMessage("generic Submitted by");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);

        colBound = new BoundColumn();
        colBound.DataField = "Path";
        colBound.HeaderText = GetMessage("generic Path");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);

        colBound = new BoundColumn();
        colBound.DataField = "Language";
        colBound.HeaderText = GetMessage("generic Language");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);

        grdData.DataSource = GetDataSource();
        grdData.DataBind();
    }
    /// <summary>
    /// Gets information from XML and add it to columns.
    /// </summary>
    /// <param name="mXML">Input XML string</param>
    /// <returns>Return false if params is null or empty or when Xml haven't any node</returns>
    protected bool ColumnSelector(string mXML)
    {
        // Check valid state
        if (String.IsNullOrEmpty(mXML))
        {
            return false;
        }

        if ((mColumnList == null) || (mColumnList.Count == 0))
        {
            return false;
        }

        //Create XML document from string
        XmlDocument mXMLDocument = new XmlDocument();

        mXMLDocument.LoadXml(mXML);

        // Get column list
        XmlNodeList NodeList = mXMLDocument.DocumentElement.GetElementsByTagName("column");

        //If empty, nothing to do
        if (NodeList.Count == 0)
        {
            return false;
        }

        //gridItems.ItemDataBound += gridItems_ItemDataBound;
        gridItems.Columns.Clear();

        foreach (XmlNode node in NodeList)
        {
            // Get attributes values
            string mName = XmlHelper.GetXmlAttributeValue(node.Attributes["name"], "");
            string mHeader = XmlHelper.GetXmlAttributeValue(node.Attributes["header"], "");
            string mType = XmlHelper.GetXmlAttributeValue(node.Attributes["type"], "");

            if (DataHelper.GetNotEmpty(mName, "") != "")
            {
                // Check if column is in the table
                if (IsInTable(mName))
                {
                    // Grid value as link
                    if (mType == "link")
                    {
                        if (mGlobalNameID == null)
                        {
                            mGlobalNameID = new List<string>();
                        }

                        mGlobalNameID.Add(mName);

                        TemplateColumn col = new TemplateColumn();
                        col.ItemTemplate = new LinkItemTemplate(mName);

                        // First try header then name
                        col.HeaderText = DataHelper.GetNotEmpty(mHeader, mName);

                        if (gridItems.AllowSorting)
                        {
                            col.SortExpression = mName;
                        }

                        // Add column to the grid
                        gridItems.Columns.Add(col);
                    }
                    // Not link
                    else
                    {
                        BoundColumn col = new BoundColumn();

                        col.DataField = mName;

                        // First try header then name
                        col.HeaderText = DataHelper.GetNotEmpty(mHeader, mName);

                        if (gridItems.AllowSorting)
                        {
                            col.SortExpression = mName;
                        }

                        gridItems.Columns.Add(col);
                    }
                }
            }
        }

        return true;
    }
Exemple #36
0
    private void LoadData()
    {
        BoundColumn colBound = new BoundColumn();
        colBound.DataField = "Title";
        colBound.HeaderText = GetMessage("generic Title");
        colBound.Initialize();
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        grdData.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "ContentId";
        colBound.HeaderText = GetMessage("generic ID");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "EmailLink";
        colBound.HeaderText = GetMessage("generic Last Editor");
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
        grdData.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "DisplayEndDate";
        colBound.HeaderText = GetMessage("generic end date");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "Path";
        colBound.HeaderText = GetMessage("generic Path");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "Language";
        colBound.HeaderText = GetMessage("generic Language");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);

        grdData.DataSource = GetDataSource();
        grdData.DataBind();
    }
    private void LoadData()
    {
        BoundColumn colBound = new BoundColumn();
        colBound.DataField = "Title";
        colBound.HeaderText = GetMessage("generic Title");
        colBound.Initialize();
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        grdData.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "RequestType";
        colBound.HeaderText = GetMessage("generic ID");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "GoLive";
        colBound.HeaderText = GetMessage("generic Last Editor");
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        grdData.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "Submitted";
        colBound.HeaderText = GetMessage("generic Date Modified");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "Path";
        colBound.HeaderText = GetMessage("generic Path");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "Language";
        colBound.HeaderText = GetMessage("generic Language");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);

        DataView dvData = GetDataSource();

        if (dvData.Count > 0)
        {
            grdData.DataSource = GetDataSource();
            grdData.DataBind();
            pnlData.Visible = true;
        }
        else
        {
            ltrlNoRecords.Text = GetMessage("lbl no records");
            //ltrlNoRecords.Visible = true;
            //pnlData.Visible = false;
        }
    }
    /// <summary>
    /// Bounds grid columns.
    /// </summary>
    /// <param name="columns">Input string with column name separated by semicolon</param>    
    /// <param name="headerNames">Header columns names</param>
    protected void InitColumns(string columns, string headerNames)
    {
        // There are already some bounded columns
        if (BasicDataGrid.Columns.Count > 0)
        {
            return;
        }

        if (String.IsNullOrEmpty(columns))
        {
            BasicDataGrid.AutoGenerateColumns = true;
            return;
        }

        // Custom columns will be used
        BasicDataGrid.AutoGenerateColumns = false;

        string[] cols = columns.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
        string[] headerCols = headerNames.Split(new char[] { ';' });

        int i = 0;
        foreach (string col in cols)
        {
            string currentCol = col.Trim();
            if (!string.IsNullOrEmpty(currentCol))
            {
                BoundColumn column = new BoundColumn();
                column.DataField = currentCol;

                // Set header
                if ((headerCols.Length > i) && !String.IsNullOrEmpty(headerCols[i]))
                {
                    column.HeaderText = ResHelper.LocalizeString(headerCols[i]);
                }
                else
                {
                    // Use dataset column name
                    column.HeaderText = col;
                }

                if (BasicDataGrid.AllowSorting)
                {
                    column.SortExpression = currentCol;
                }

                BasicDataGrid.Columns.Add(column);
                i++;
            }
        }
    }
    /// <summary>
    /// Gets information from XML and add it to columns.
    /// </summary>
    /// <param name="mXML">Input XML string</param>
    /// <returns>Return false if params is null or empty or when Xml haven't any node</returns>
    protected bool InitColumns(string mXML)
    {
        // Check if data are valid
        if (gridElem.Columns.Count > 0)
        {
            return false;
        }

        if (string.IsNullOrEmpty(mXML))
        {
            return false;
        }

        if ((mColumnList == null) || (mColumnList.Length == 0))
        {
            return false;
        }

        // Load XML from string
        XmlDocument mXMLDocument = new XmlDocument();
        mXMLDocument.LoadXml(mXML);

        XmlNodeList NodeList = mXMLDocument.DocumentElement.GetElementsByTagName("column");
        if (NodeList.Count == 0)
        {
            return false;
        }

        gridElem.AutoGenerateColumns = false;
        gridElem.ItemDataBound += gridElem_ItemDataBound;

        // Go through all nodes
        foreach (XmlNode node in NodeList)
        {
            string mName = XmlHelper.GetXmlAttributeValue(node.Attributes["name"], "");
            string mHeader = XmlHelper.GetXmlAttributeValue(node.Attributes["header"], "");
            string mType = XmlHelper.GetXmlAttributeValue(node.Attributes["type"], "");

            // If name is not empty
            if (DataHelper.GetNotEmpty(mName, "") != "")
            {
                // And it is in the table
                if (IsInTable(mName))
                {
                    // Create new column
                    DataGridColumn column = null;
                    if ((mType != null) && (mType == "link"))
                    {
                        if (mGlobalNameID == null)
                        {
                            mGlobalNameID = new string[0];
                        }

                        string[] mHelpGlobal = new string[mGlobalNameID.Length + 1];

                        mHelpGlobal[mGlobalNameID.Length] = mName;

                        for (int i = 0; i < mGlobalNameID.Length; i++)
                        {
                            mHelpGlobal[i] = mGlobalNameID[i];
                        }

                        mGlobalNameID = mHelpGlobal;

                        TemplateColumn col = new TemplateColumn();
                        col.ItemTemplate = new LinkItemTemplate(mName);
                        column = col;
                    }
                    else
                    {
                        BoundColumn col = new BoundColumn();
                        column = col;

                        col.DataField = mName;
                    }

                    // Load header
                    if (DataHelper.GetNotEmpty(mHeader, "") != "")
                    {
                        column.HeaderText = ResHelper.LocalizeString(mHeader);
                    }
                    else
                    {
                        column.HeaderText = mName;
                    }

                    if (gridElem.AllowSorting)
                    {
                        column.SortExpression = mName;
                    }

                    gridElem.Columns.Add(column);
                }
            }
        }

        return true;
    }
    /// <summary>
    /// Prepares the page for display in 'ViewAll' mode.
    /// </summary>
    /// <param name="index">Object type index</param>
    protected void DisplayViewAll(int index)
    {
        EkEnumeration.CustomPropertyObjectType displayObjectType = new EkEnumeration.CustomPropertyObjectType();
        List<CustomPropertyData> customPropertyDataList = new List<CustomPropertyData>();

        PagingInfo pageInfo = new PagingInfo();
        pageInfo.CurrentPage = _currentPage;
        pageInfo.RecordsPerPage = _siteApi.RequestInformationRef.PagingSize;

        if (index > 0)
        {
            index = index - 1;
            displayObjectType = GetCmsObjectType(index);
            customPropertyDataList = _customPropertyApi.GetList(displayObjectType, _language, pageInfo);
        }
        else
        {
            customPropertyDataList = _customPropertyApi.GetList(_language,pageInfo);
        }

        pnlViewAll.Visible = true;
        ViewAllGrid.Visible = true;
        pnlAddEdit.Visible = false;

        BoundColumn colBound = new BoundColumn();

        colBound.DataField = ColumnIDSelect;
        colBound.HeaderText = _messageHelper.GetMessage("generic select");
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.Width = Unit.Percentage(10);
        colBound.ItemStyle.Width = Unit.Percentage(10);
        ViewAllGrid.Columns.Add(colBound);

        colBound = new BoundColumn();
        colBound.DataField = ColumnIDTitle;
        colBound.HeaderText = _messageHelper.GetMessage("generic title");
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.Width = Unit.Percentage(40);
        colBound.ItemStyle.Width = Unit.Percentage(40);
        ViewAllGrid.Columns.Add(colBound);

        colBound = new BoundColumn();
        colBound.DataField = ColumnIDId;
        colBound.HeaderText = _messageHelper.GetMessage("generic id");
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.Width = Unit.Percentage(10);
        colBound.ItemStyle.Width = Unit.Percentage(10);
        ViewAllGrid.Columns.Add(colBound);

        colBound = new BoundColumn();
        colBound.DataField = ColumnIDObjectType;
        colBound.HeaderText = _messageHelper.GetMessage("lbl object type");
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.Width = Unit.Percentage(20);
        colBound.ItemStyle.Width = Unit.Percentage(20);
        ViewAllGrid.Columns.Add(colBound);

        colBound = new BoundColumn();
        colBound.DataField = ColumnIDValue;
        colBound.HeaderText = _messageHelper.GetMessage("lbl value");
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.Width = Unit.Percentage(30);
        colBound.ItemStyle.Width = Unit.Percentage(30);
        ViewAllGrid.Columns.Add(colBound);

        DataTable dt = new DataTable();
        DataRow dr;

        dt.Columns.Add(new DataColumn(ColumnIDSelect, typeof(String)));
        dt.Columns.Add(new DataColumn(ColumnIDTitle, typeof(String)));
        dt.Columns.Add(new DataColumn(ColumnIDId, typeof(String)));
        dt.Columns.Add(new DataColumn(ColumnIDObjectType, typeof(String)));
        dt.Columns.Add(new DataColumn(ColumnIDValue, typeof(String)));

        if (customPropertyDataList != null)
        {
            for (int i = 0; i < customPropertyDataList.Count; i++)
            {
                dr = dt.NewRow();
                dr[0] = "<input class='delete' type='checkbox' id=\"selectCustProp" + i + "\" name=\"selectCustProp" + i + "\" />";
                dr[0] += "<input type='hidden' id=\"hdnSelectCustProp" + i + "\" name=\"hdnSelectCustProp" + i + "\" value=\"" + customPropertyDataList[i].PropertyId + "\" />";
                dr[1] = "<a href='customproperties.aspx?action=editcustomproperty&id=" + customPropertyDataList[i].PropertyId + "&LangType=" + _language + "'>" + EkFunctions.HtmlEncode(customPropertyDataList[i].PropertyName) + "</a>";
                dr[2] = "<a href='customproperties.aspx?action=editcustomproperty&id=" + customPropertyDataList[i].PropertyId + "&LangType=" + _language + "'>" + customPropertyDataList[i].PropertyId + "</a>";
                dr[3] = customPropertyDataList[i].CmsObjectType;
                dr[4] = GetValueUI(customPropertyDataList[i], i);
                dt.Rows.Add(dr);
            }
        }

        ViewAllGrid.DataSource = new DataView(dt);
        ViewAllGrid.DataBind();

        if (pageInfo.TotalPages > 1)
        {
            pnlPaging.Visible = true;

            // Display current and total page information.
            lblPageText.Text = _siteApi.EkMsgRef.GetMessage("page lbl");
            lblOfText.Text = _siteApi.EkMsgRef.GetMessage("lbl of");
            lblPageValue.Text = pageInfo.CurrentPage.ToString();
            lblTotalPagesValue.Text = pageInfo.TotalPages.ToString();

            // Populate paging links and target URLs
            firstPageLink.InnerText = _siteApi.EkMsgRef.GetMessage("lbl first page");
            firstPageLink.HRef = GetPagingUrl(1);

            previousPageLink.InnerText = _siteApi.EkMsgRef.GetMessage("lbl previous page");
            if (pageInfo.CurrentPage > 1)
            {
                previousPageLink.HRef = GetPagingUrl(pageInfo.CurrentPage - 1);
            }
            else
            {
                previousPageLink.HRef = GetPagingUrl(1);
            }

            nextPageLink.InnerText = _siteApi.EkMsgRef.GetMessage("lbl next page");
            if (pageInfo.CurrentPage < pageInfo.TotalPages)
            {
                nextPageLink.HRef = GetPagingUrl(pageInfo.CurrentPage + 1);
            }
            else
            {
                nextPageLink.HRef = GetPagingUrl(pageInfo.TotalPages);
            }

            lastPageLink.InnerText = _siteApi.EkMsgRef.GetMessage("lbl last page");
            lastPageLink.HRef = GetPagingUrl(pageInfo.TotalPages);
        }
        else
        {
            pnlPaging.Visible = false;
        }
    }
Exemple #41
0
    private void LoadData()
    {
        BoundColumn colBound = new BoundColumn();
        colBound = new BoundColumn();
        colBound.DataField = "TITLE";
        colBound.HeaderText = GetMessage("generic Title");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "USERNAME";
        colBound.HeaderText = GetMessage("display name label");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "DATETIME";
        colBound.HeaderText = GetMessage("generic date no colon");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "FLAG";
        colBound.HeaderText = GetMessage("flag label");
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.ItemStyle.Wrap = false;
        grdData.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "COMMENTS";
        colBound.HeaderText = GetMessage("comment text");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.ItemStyle.Wrap = true;
        grdData.Columns.Add(colBound);

        grdData.DataSource = GetDataSource();
        grdData.DataBind();
    }
Exemple #42
0
        /// <summary>
        /// Creates the column.
        /// </summary>
        /// <param name="prop">The prop.</param>
        /// <param name="dataItem">The data item.</param>
        /// <param name="column">The column.</param>
        /// <returns></returns>
        private TableCell CreateColumn(PropertyDescriptor prop, object dataItem, BoundColumn column)
        {
            TableCell cell = new TableCell() { Text = prop.GetValue(dataItem).ToString() };

            if (column.Width.HasValue)
            {
                cell.Width = column.Width.Value;
            }

            return cell;
        }
Exemple #43
0
    private void Display_ViewAllUnApprovedMessages(string val)
    {
        paging.CurrentPage = _currentPageNumber;
        paging.RecordsPerPage = _ContentAPI.RequestInformationRef.PagingSize;

        _MessageBoardData = new System.Collections.ObjectModel.Collection<MessageBoardData>();

        switch (val)
        {
            case "0":
                _MessageBoardData = _MessageBoard.GetUnApprovedList(paging, _ContentAPI.UserId);
                break;
            case "1":
                _MessageBoardData = _MessageBoard.GetUnApprovedList(Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.Content, paging, _ContentAPI.UserId);
                break;
            case "2":
                _MessageBoardData = _MessageBoard.GetUnApprovedList(Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.CommunityGroup, paging, _ContentAPI.UserId);
                break;
            case "3":
                _MessageBoardData = _MessageBoard.GetUnApprovedList(Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.User, paging, _ContentAPI.UserId);
                break;
            case "4":
                _MessageBoardData = _MessageBoard.GetUnApprovedList(Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.MessageReply, paging, _ContentAPI.UserId);
                break;
            default:
                _MessageBoardData = _MessageBoard.GetUnApprovedList(paging, _ContentAPI.UserId);
                break;
        }

        System.Web.UI.WebControls.BoundColumn colBound = new BoundColumn();

        colBound = new BoundColumn();
        colBound.DataField = "SELECT";
        colBound.HeaderText = "<input type='checkbox' name='selectAll' id='selectAll' onclick=' SelectAll(this);' />";
        colBound.HeaderStyle.CssClass = "title-header";
        colBound.HeaderStyle.Width = System.Web.UI.WebControls.Unit.Percentage(5);
        ViewUnApprovedMessages.Columns.Add(colBound);

        colBound = new BoundColumn();
        colBound.DataField = "MESSAGES";
        colBound.HeaderText = _msgRef.GetMessage("lbl subscription message properties");
        colBound.HeaderStyle.CssClass = "title-header";
        ViewUnApprovedMessages.Columns.Add(colBound);

        colBound = new BoundColumn();
        colBound.DataField = "USERNAME";
        colBound.HeaderText = _msgRef.GetMessage("lbl user name");
        colBound.HeaderStyle.CssClass = "title-header";
        ViewUnApprovedMessages.Columns.Add(colBound);

        colBound = new BoundColumn();
        colBound.DataField = "TYPE";
        colBound.HeaderText = _msgRef.GetMessage("generic type");
        colBound.HeaderStyle.CssClass = "title-header";
        ViewUnApprovedMessages.Columns.Add(colBound);

        DataTable dt = new DataTable();
        DataRow dr;
        int i = 0;

        dt.Columns.Add(new DataColumn("SELECT", typeof(string)));
        dt.Columns.Add(new DataColumn("MESSAGES", typeof(string)));
        dt.Columns.Add(new DataColumn("USERNAME", typeof(string)));
        dt.Columns.Add(new DataColumn("TYPE", typeof(string)));

        for (i = 0; i < _MessageBoardData.Count; i++)
        {
            string _Message = String.Empty;
            if (_MessageBoardData[i].MessageText.Length > 50)
            {
                _Message = _MessageBoardData[i].MessageText.Substring(0,50) + "....";
            }
            else
            {
                _Message = _MessageBoardData[i].MessageText;
            }
            dr = dt.NewRow();

            dr[0] = "<input type='checkbox' msgId='" + _MessageBoardData[i].MessageId + "' name='selMessage" + i + "' id='selMessage" + i + "' onclick='VerifySelection();' />";
            dr[1] = "<a href='#' id='message" + i + "' onclick='ShowMessage(this); return false;' msgId='" + _MessageBoardData[i].MessageId + "' objType='" + _MessageBoardData[i].ObjectType + "' objId='" + _MessageBoardData[i].ObjectId + "' title='Click to view entire message'>" + _Message + "</a>";
            dr[2] = "<label id='lblUser" + i + "' name='lblUser" + i + "'>" + _MessageBoardData[i].UserName + "</label>";
            if (_MessageBoardData[i].ObjectType != Ektron.Cms.Common.EkEnumeration.MessageBoardObjectType.MessageReply)
            {
                dr[3] = "<label id='lblType" + i + "' name='lblType" + i + "'>" + _MessageBoardData[i].ObjectType + " " + _msgRef.GetMessage("lbl msg board") + "</label>";
            }
            else
            {
                dr[3] = "<label id='lblType" + i + "' name='lblType" + i + "'>" + _MessageBoardData[i].ObjectType + "</label>";
            }
            dt.Rows.Add(dr);
        }
        DataView dv = new DataView(dt);
        ViewUnApprovedMessages.DataSource = dv;
        ViewUnApprovedMessages.DataBind();

        TotalPagesNumber = paging.TotalPages;

        SetPaging();
    }
Exemple #44
0
    private void LoadData()
    {
        BoundColumn colBound = new BoundColumn();
        colBound = new BoundColumn();
        colBound.DataField = "APPROVE";
        colBound.HeaderText = GetMessage("generic approve title");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
        colBound.ItemStyle.Wrap = false;
        dataGrid.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "DECLINE";
        colBound.HeaderText = GetMessage("btn decline");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
        colBound.ItemStyle.Wrap = false;
        dataGrid.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "TITLE";
        colBound.HeaderText = GetMessage("generic Title");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.Wrap = false;
        dataGrid.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "USERNAME";
        colBound.HeaderText = GetMessage("display name label");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.ItemStyle.Wrap = false;
        dataGrid.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "DATETIME";
        colBound.HeaderText = GetMessage("generic date no colon");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.ItemStyle.Wrap = false;
        dataGrid.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "RATING";
        colBound.HeaderText = GetMessage("rating label");
        colBound.ItemStyle.Wrap = false;
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.ItemStyle.Wrap = false;
        dataGrid.Columns.Add(colBound);
        colBound = new BoundColumn();
        colBound.DataField = "USER_COMMENTS";
        colBound.HeaderText = GetMessage("comment text");
        colBound.ItemStyle.VerticalAlign = VerticalAlign.Top;
        colBound.ItemStyle.HorizontalAlign = HorizontalAlign.Left;
        colBound.ItemStyle.Wrap = true;
        dataGrid.Columns.Add(colBound);

        dataGrid.DataSource = GetDataSource();
        dataGrid.DataBind();
    }
    protected void Filldata(int pat_ID)
    {
        objNLog.Info("Function started with patID as argument...");
        try
        {
            tabContainer.ActiveTabIndex = 0;
            PatientInfoDAL objPat_Info = new PatientInfoDAL();
            DataTable dtPatientDetails = new DataTable();
            string patFulName = txtPatientName1.Text;
            if (patFulName.IndexOf(",") < 0 && pat_ID == 0)
            {
                SetlblVisibility(0);

                string script = @"if(confirm('Patient does not exist. Do you want to add a new Patient?')) { window.location.href='PatientProfile.aspx?patname=" + txtPatientName1.Text + "';}";
                ScriptManager.RegisterStartupScript(this, this.GetType(), "jsCall", script, true);
            }
            else
            {
                tabContainer.Enabled = true;
                if (pat_ID == 0)
                {
                    lblMsg.Text = string.Empty;
                    string[] arInfo = new string[2];
                    char[] splitter = { ',' };
                    arInfo = patFulName.Split(splitter);
                    dtPatientDetails = objPat_Info.get_Patient_Details(arInfo[1], arInfo[0]);
                }
                else
                    dtPatientDetails = objPat_Info.get_Patient_Details(pat_ID.ToString());

                if (dtPatientDetails.Rows.Count > 0)
                {

                    if (dtPatientDetails.Rows[0][1].ToString() != null)
                    {

                        lblPhone1.Text = FormatUSPhone(dtPatientDetails.Rows[0]["Pat_Phone"].ToString());
                    }
                    else
                    {

                    }
                    if (dtPatientDetails.Rows[0]["Pat_Gender"].ToString() == "M")
                    {

                        lblGender1.Text = "Male";
                    }
                    else
                    {
                        lblGender1.Text = "Female";
                    }

                    lblWPhone1.Text = FormatUSPhone(dtPatientDetails.Rows[0]["Pat_WorkPhone"].ToString());
                    lblCell1.Text = FormatUSPhone(dtPatientDetails.Rows[0]["Pat_CellPhone"].ToString());
                    lblDOB1.Text = ((DateTime)dtPatientDetails.Rows[0]["Pat_DOB"]).ToShortDateString();

                    String contRel = "";
                    switch (dtPatientDetails.Rows[0]["econtact_relation"].ToString().Trim())
                    {
                        case "M": contRel = "Mother";
                            break;
                        case "F": contRel = "Father";
                            break;
                        case "B": contRel = "Brother";
                            break;
                        case "S": contRel = "Sister";
                            break;
                        case "P": contRel = "Spouse";
                            break;
                        case "A": contRel = "GrandFather";
                            break;
                        case "G": contRel = "GrandMother";
                            break;
                        case "O": contRel = "Other";
                            break;
                    }

                    lbleContactName.Text = dtPatientDetails.Rows[0]["econtact_fname"].ToString().Trim() +
                                            " " + dtPatientDetails.Rows[0]["econtact_lname"].ToString().Trim();
                    if (contRel != "")
                        lbleContactName.Text = lbleContactName.Text.Trim() + "(" + contRel + ")";

                    if (dtPatientDetails.Rows[0]["econtact_phone"].ToString().Trim() != "")
                        lbleContactName.Text = lbleContactName.Text.Trim() + "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Phone: </B>" + FormatUSPhone(dtPatientDetails.Rows[0]["econtact_phone"].ToString().Trim());

                    if (dtPatientDetails.Rows[0]["Pat_Primary_Ins_ID"].ToString() != "")
                        lblPrimIns1.Text = dtPatientDetails.Rows[0]["Ins_Name"].ToString();
                    else
                        lblPrimIns1.Text = "N/A";

                    lblSSN1.Text = FormatUSSSN(dtPatientDetails.Rows[0]["Pat_SSN"].ToString());

                    if (dtPatientDetails.Rows[0]["Balance"] != DBNull.Value)
                    {
                        lblBalance1.Text = dtPatientDetails.Rows[0]["Balance"].ToString();
                    }
                    string address = "";
                    if (dtPatientDetails.Rows[0]["Pat_Address1"].ToString().Trim() != "")
                    {
                        address = address + dtPatientDetails.Rows[0]["Pat_Address1"].ToString().Trim() + ", ";
                    }
                    if (dtPatientDetails.Rows[0]["Pat_Address2"].ToString().Trim() != "")
                    {

                        address = address + dtPatientDetails.Rows[0]["Pat_Address2"].ToString().Trim() + ", ";
                    }
                    if (dtPatientDetails.Rows[0]["Pat_City"].ToString().Trim() != "")
                    {
                        address = address + dtPatientDetails.Rows[0]["Pat_City"].ToString().Trim() + ",";
                    }
                    string Saddress = "";
                    if (dtPatientDetails.Rows[0]["Pat_Ship_Address1"].ToString().Trim() != "")
                    {
                        Saddress = Saddress + dtPatientDetails.Rows[0]["Pat_Ship_Address1"].ToString().Trim() + ", ";
                    }
                    if (dtPatientDetails.Rows[0]["Pat_Ship_Address2"].ToString().Trim() != "")
                    {

                        Saddress = Saddress + dtPatientDetails.Rows[0]["Pat_Ship_Address2"].ToString().Trim() + ", ";
                    }
                    if (dtPatientDetails.Rows[0]["Pat_Ship_City"].ToString().Trim() != "")
                    {
                        Saddress = Saddress + dtPatientDetails.Rows[0]["Pat_Ship_City"].ToString().Trim() + ",";
                    }

                    lblAddress12.Text = address + dtPatientDetails.Rows[0]["Pat_State"].ToString() + " " + dtPatientDetails.Rows[0]["Pat_Zip"].ToString();
                    lblSAddress12.Text = Saddress + dtPatientDetails.Rows[0]["Pat_Ship_State"].ToString() + " " + dtPatientDetails.Rows[0]["Pat_Ship_Zip"].ToString();

                    lblPatientContact1.Text = dtPatientDetails.Rows[0]["Pat_Address1"].ToString() + "," + dtPatientDetails.Rows[0]["Pat_Address2"].ToString() + ", " + dtPatientDetails.Rows[0]["Pat_City"].ToString() + ", " + dtPatientDetails.Rows[0]["Pat_State"].ToString() + " " + dtPatientDetails.Rows[0]["Pat_Zip"].ToString() + ", " + FormatUSPhone(dtPatientDetails.Rows[0]["Pat_Phone"].ToString());
                    lblPatAccountName.Text = txtPatientName1.Text;
                    patID = (int)(dtPatientDetails.Rows[0]["Pat_ID"]);
                    Session["Pat_ID"] = patID;
                    patFacID = int.Parse(dtPatientDetails.Rows[0]["Facility_ID"].ToString());

                    txtCallLogDoctor.Text = dtPatientDetails.Rows[0]["Pat_PDoc"].ToString();
                    lblDoctor1.Text = dtPatientDetails.Rows[0]["Pat_PDoc"].ToString();

                    lblCliniFacility1.Text = objPat_Info.Get_Facility(patFacID)[0].ToString();
                    string[] Diagn = new string[3];
                    char[] split = { ',' };
                    string Data = dtPatientDetails.Rows[0][18].ToString();
                    lbldcode1.Text = Data;
                    Diagn = Data.Split(',');
                    if (dtPatientDetails.Rows[0][19].ToString() == "Y")

                        lblAutofill1.Text = "Yes";
                    else
                        lblAutofill1.Text = "No";

                    hidPatID.Value = dtPatientDetails.Rows[0]["Pat_ID"].ToString();
                    AutoCompleteExtender3.ContextKey = dtPatientDetails.Rows[0]["Pat_ID"].ToString();
                    ACE_CLOG_Doctor.ContextKey = dtPatientDetails.Rows[0]["Pat_ID"].ToString();
                    if (Session["Role"].ToString() == "D")
                        btnEdit.Visible = false;
                    else
                    {
                        btnEdit.Visible = true;
                        btnAppointments.Visible = true;
                    }

                    if (dtPatientDetails.Rows[0]["HIPPA"].ToString() == "Y")
                    {
                        lblHippa1.Text = "Yes ( " + dtPatientDetails.Rows[0]["HIPPADate"].ToString() + " )";
                    }
                    else
                        lblHippa1.Text = "No";

                    //Hipaa End
                    PatientLastprescription(dtPatientDetails.Rows[0]["Pat_ID"].ToString());
                    PatientLastVisit(dtPatientDetails.Rows[0]["Pat_ID"].ToString());
                    String mname = "";
                    if (dtPatientDetails.Rows[0]["Pat_MName"].ToString().Trim() != mname)
                        mname = " " + dtPatientDetails.Rows[0]["Pat_MName"].ToString().Trim() + ".";

                    txtPatientName1.Text = dtPatientDetails.Rows[0]["Pat_LName"].ToString() + "," + dtPatientDetails.Rows[0]["Pat_FName"].ToString();
                    //Added Patient Appointments - START.
                    DataSet dsAppts = objPat_Info.Get_Appt(patID.ToString());
                    if (dsAppts != null && dsAppts.Tables.Count > 0)
                    {
                        if (dsAppts.Tables[0].Rows.Count > 0)
                        {
                            ContentPlaceHolder mpContentPlaceHolder;
                            mpContentPlaceHolder = (ContentPlaceHolder)Master.FindControl("ContentPlaceHolder1");
                            if (mpContentPlaceHolder != null)
                            {
                                HtmlContainerControl divAppt = (HtmlContainerControl)mpContentPlaceHolder.FindControl("divAppt");
                                if (divAppt != null)
                                {
                                    DataGrid grdAppts = new DataGrid();
                                    grdAppts.AutoGenerateColumns = false;
                                    grdAppts.HeaderStyle.CssClass = "medication_info_th1";
                                    grdAppts.ItemStyle.CssClass = "medication_info_tr-odd";
                                    grdAppts.ItemStyle.Font.Bold = false;
                                    grdAppts.AlternatingItemStyle.Font.Bold = false;
                                    grdAppts.AlternatingItemStyle.CssClass = "medication_info_tr-even";

                                    BoundColumn nameColumn = new BoundColumn();

                                    nameColumn = new BoundColumn();
                                    nameColumn.HeaderText = "Time";
                                    nameColumn.DataField = "APPT_Time";
                                    nameColumn.ItemStyle.Width = 100;
                                    grdAppts.Columns.Add(nameColumn);

                                    nameColumn = new BoundColumn();
                                    nameColumn.HeaderText = "Doctor";
                                    nameColumn.DataField = "Doctor_Name";
                                    nameColumn.ItemStyle.Width = 100;
                                    grdAppts.Columns.Add(nameColumn);

                                    grdAppts.DataSource = dsAppts;
                                    grdAppts.DataBind();
                                    System.IO.StringWriter sw = new System.IO.StringWriter();
                                    System.Web.UI.HtmlTextWriter htw = new System.Web.UI.HtmlTextWriter(sw);
                                    grdAppts.RenderControl(htw);

                                    StringBuilder sb = new StringBuilder();

                                    sb.Append("<a onmouseout=popUp(event,'divPatAppt')  onmouseover=popUp(event,'divPatAppt') style='cursor:hand' title='Appointments'><img src='../Images/pat_appt.gif' width='32px' height='32px' alt=''/></a>");

                                    sb.Append("<div id='divPatAppt' class='tip' style='width:auto;'>");
                                    sb.Append(sw.ToString());
                                    sb.Append("</div>");
                                    divAppt.InnerHtml = sb.ToString();
                                }
                            }
                        }
                    }
                    ShowPatientAllergies(pat_ID);
                    ClearAllPatientTabs();
                    FillgridPriscrition();

                }
                // //Added Patient Appointments - END.
                else
                {
                    SetlblVisibility(0);
                    hidPatID.Value = "";
                    string script = @"if(confirm('Patient does not exist, Do you want to add a new Patient!')) { window.location.href='PatientProfile.aspx?patname=" + txtPatientName1.Text + "';}";
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "jsCall", script, true);
                }
            }
        }
        catch (Exception ex)
        {
            objNLog.Error("Error : " + ex.Message);
        }
        objNLog.Info("Function completed...");
    }