protected void Button2_Click(object sender, EventArgs e)
 {
     obj.SelectMethod = "SelectInstructorSalary";
     obj.SelectParameters.Clear();
     obj.Select();
     GridView1.DataSource = obj;
     GridView1.DataBind();
 }
Ejemplo n.º 2
0
 protected void Button_SelectAll_Click(object sender, EventArgs e)
 {
     obj.SelectMethod = "SelectAllDepartments";
     obj.SelectParameters.Clear();
     obj.Select();
     GridView1.DataSource = obj;
     GridView1.DataBind();
 }
Ejemplo n.º 3
0
        private void rowForGridService(string gv, string ods, string viewState, string[] col)
        {
            DataTable dt           = new DataTable();
            DataTable dtNew        = new DataTable();
            DataRow   drCurrentRow = null;

            foreach (string oneCol in col)
            {
                dtNew.Columns.Add(new DataColumn(oneCol, typeof(string)));
            }

            GridView         GV  = (GridView)contactDV.FindControl(gv);
            ObjectDataSource ODS = (ObjectDataSource)contactDV.FindControl(ods);

            dt = ((DataView)ODS.Select()).ToTable();

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    drCurrentRow = dtNew.NewRow();
                    foreach (string oneCol in col)
                    {
                        drCurrentRow[oneCol] = dt.Rows[i][oneCol];
                    }
                    dtNew.Rows.Add(drCurrentRow);
                }
            }

            ViewState[viewState] = dt;
            GV.DataSource        = dt;
            GV.DataBind();
        }
Ejemplo n.º 4
0
        public object  FindControl(Page page, string id)
        {
            Control found = page.FindControl(id);

            if (found == null)
            {
                found = FindControlExtend(id, page.Controls);
            }

            if (page.Session[this.DataSourceId + "combo" + GetFileName(page)] == null)
            {
                object s = found as ObjectDataSource;
                if (s == null)
                {
                    s = found as SqlDataSource;
                    SqlDataSource sqlD = (SqlDataSource)s;
                    DataView      dv   = (DataView)sqlD.Select(DataSourceSelectArguments.Empty);
                    page.Session[this.DataSourceId + "combo" + GetFileName(page)] = dv;
                }
                else
                {
                    ObjectDataSource objD = (ObjectDataSource)s;
                    page.Session[this.DataSourceId + "combo" + GetFileName(page)] = objD.Select();
                }
            }
            return(page.Session[this.DataSourceId + "combo" + GetFileName(page)]);
        }
Ejemplo n.º 5
0
    protected void DropDownList_Role_SelectedIndexChanged(object sender, EventArgs e)
    {
        if (DropDownList_Role.SelectedIndex == 0)
        {
            obj              = new ObjectDataSource();
            obj.TypeName     = "StudentLayer";
            obj.SelectMethod = "SelectStudentsIdAndName";
            obj.Select();

            DropDownList_Names.DataSource     = obj;
            DropDownList_Names.DataValueField = "St_Id";
            DropDownList_Names.DataTextField  = "St_Name";
            DropDownList_Names.DataBind();
        }
        else if (DropDownList_Role.SelectedIndex == 1)
        {
            obj              = new ObjectDataSource();
            obj.TypeName     = "InstructorLayer";
            obj.SelectMethod = "SelectInstructorIdAndName";
            obj.Select();

            DropDownList_Names.DataSource     = obj;
            DropDownList_Names.DataValueField = "Ins_Id";
            DropDownList_Names.DataTextField  = "Ins_Name";
            DropDownList_Names.DataBind();
        }
    }
 static object GetSelectQueryResult(ObjectDataSource ds, string method, string param, string value)
 {
     ds.SelectParameters.Clear();
     ds.SelectMethod = method;
     ds.SelectParameters.Add(param, value);
     return(ds.Select());
 }
Ejemplo n.º 7
0
        /// <summary>
        ///     Chooses uses DataSource type and set items style
        /// </summary>
        void SetItemsStyleFromODS(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.DataCheckField) && string.IsNullOrEmpty(this.ForeColorField) && string.IsNullOrEmpty(this.ToolTipField))
            {
                return;
            }

            // Независимо от IsPostBack надо сделать Select - DataBind может быть и на IsPostBack

            object dataSource = FindDataSource;

            if (dataSource == null)
            {
                return;
            }

            Dictionary <int, string[]> itemsStates = new Dictionary <int, string[]>();

            if (dataSource is SqlDataSource)
            {
                SqlDataSource sqlDa = dataSource as SqlDataSource;

                DataView dataItems = sqlDa.Select(new DataSourceSelectArguments(base.DataValueField)) as DataView;
                if (dataItems == null)
                {
                    return;
                }

                SetItemsStyleFromODS_Internal(itemsStates, dataItems, (di, i) => ((DataView)di).Table.Rows[i], (di, name) => ((DataRow)di)[name]);
            }
            else if (dataSource is ObjectDataSource)
            {
                ObjectDataSource ods       = dataSource as ObjectDataSource;
                object[]         dataItems = ods.Select().Cast <object>().ToArray();

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

                SetItemsStyleFromODS_Internal(itemsStates, dataItems, (di, i) => ((object[])di)[i], (di, name) => di.GetType().InvokeMember(name, BindingFlags.GetProperty, null, di, null));
            }
            else if (dataSource is IEnumerable)
            {
                dataSource = ((IEnumerable)dataSource).Cast <object>().ToList();
                SetItemsStyleFromODS_Internal(itemsStates, dataSource, (di, i) => ((IList <object>)di)[i], (di, name) => di.GetType().InvokeMember(name, BindingFlags.GetProperty, null, di, null));
            }
            else
            {
                throw new Exception(string.Format("CheckBoxListEx: such dataSource is not supported, {0}", dataSource));
            }

            if (itemsStates != null && itemsStates.Count > 0)
            {
                ViewState[ViewStateStateName] = itemsStates;
            }
        }
Ejemplo n.º 8
0
    public static bool IsPagerVisible(DataPager dPager, ObjectDataSource objDataSrc)
    {
        bool     isVisible = false;
        DataView dv        = (DataView)objDataSrc.Select();

        isVisible = (dv.Count > dPager.PageSize);
        //  dPager.Visible = isPagerVisible;
        return(isVisible);
    }
Ejemplo n.º 9
0
        private void SetDdlStateDataSource()
        {
            var ods = new ObjectDataSource("FlyerMe.StatesBLL", "GetStates")
            {
                OldValuesParameterFormatString = "original_{0}"
            };

            ddlState.DataSource = ods.Select();
            ddlState.DataBind();
        }
Ejemplo n.º 10
0
        private DataSet GetODS_DS(ObjectDataSource ods)
        {
            dynamic ds = new DataSet();
            dynamic dv = (DataView)ods.Select();

            if (dv != null && dv.Count > 0)
            {
                dynamic dt = dv.ToTable();
                ds.Tables.Add(dt);
            }
            return(ds);
        }
Ejemplo n.º 11
0
        void cbo_DataBinding(object sender, EventArgs e)
        {
            cbo.Items.Clear();
            IList <iSabaya.NameAffix> listAffix = (IList <iSabaya.NameAffix>)ods.Select();

            for (int i = 0; i < listAffix.Count; i++)
            {
                cbo.Items.Add(listAffix[i].Affix.ToString(base.LanguageCode), listAffix[i].AffixID);
            }
            cbo.Items.Add("อื่นๆ", 0);
            cbo.SelectedIndex = 0;
        }
Ejemplo n.º 12
0
    private void SetPricesListDataSource()
    {
        var key = String.Format("PricesListDataSource_{0}&{1}&{2}", filter.State, filter.Market, filter.Flyer);

        pricesListDataSource = cache[key] as DataView;

        if (pricesListDataSource == null)
        {
            marketObjectDataSource    = new ObjectDataSource();
            marketObjectDataSource.ID = "MarketObjectDataSource";
            marketObjectDataSource.OldValuesParameterFormatString = "original_{0}";
            marketObjectDataSource.SelectMethod = "GetMarketList";
            marketObjectDataSource.TypeName     = "FlyerMe.FlyerBLL";

            var hfState = new HiddenField()
            {
                ID      = "hfState",
                Value   = view.State,
                Visible = false
            };

            var hfMarket = new HiddenField()
            {
                ID      = "hfMarket",
                Value   = filter.GetSelectedMarket(filter.Market),
                Visible = false
            };

            var hfFlyer = new HiddenField()
            {
                ID      = "hfFlyer",
                Value   = filter.GetSelectedFlyer(filter.Flyer),
                Visible = false
            };

            var p1 = new ControlParameter("stateID", "hfState", "Value");
            var p2 = new ControlParameter("markettype", "hfMarket", "Value");
            var p3 = new ControlParameter("flyerType", "hfFlyer", "Value");

            marketObjectDataSource.SelectParameters.Add(p1);
            marketObjectDataSource.SelectParameters.Add(p2);
            marketObjectDataSource.SelectParameters.Add(p3);

            view.AddControl(marketObjectDataSource);
            view.AddControl(hfState);
            view.AddControl(hfMarket);
            view.AddControl(hfFlyer);

            pricesListDataSource = marketObjectDataSource.Select() as DataView;

            cache.Add(key, pricesListDataSource, null, DateTime.Now.Add(new TimeSpan(0, 5, 0)), default(TimeSpan), CacheItemPriority.Normal, null);
        }
    }
Ejemplo n.º 13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            obj = new ObjectDataSource();
            obj.TypeName = "CourseBL";
            obj.SelectMethod = "SelectAllCourses";
            obj.Select();
            GridView1.DataSource = obj;
            GridView1.DataBind();
            Session.Add("obj", obj);

        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Session["Role"].ToString() != "Admin")
     {
         Response.Redirect("../Anonymous/ErrorPage.aspx");
     }
     obj              = new ObjectDataSource();
     obj.TypeName     = "InstructorLayer";
     obj.SelectMethod = "SelectInstructorSalary";
     obj.SelectParameters.Clear();
     obj.Select();
     GridView1.DataSource = obj;
     GridView1.DataBind();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         obj              = new ObjectDataSource();
         obj.TypeName     = "ReportsBusinessLayer";
         obj.SelectMethod = "selectAllDepartments";
         obj.Select();
         DropDownList1.DataSource     = obj;
         DropDownList1.DataTextField  = "Dept_name";
         DropDownList1.DataValueField = "Dept_id";
         DropDownList1.DataBind();
     }
 }
Ejemplo n.º 16
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            OrdenCompra orden = new OrdenCompra();

            ObjectDataSource    grid1  = ObjectDataSource1;
            IEnumerable <Disco> lista1 = (IEnumerable <Disco>)grid1.Select();

            for (int i = 0; i < GridView1.Rows.Count; i++)
            {
                GridViewRow row   = GridView1.Rows[i];
                CheckBox    check = row.FindControl("Select") as CheckBox;

                if (check.Checked)
                {
                    Disco aux = lista1.ElementAt(i);
                    orden.AgregarDisaco(aux);
                }
            }


            ObjectDataSource      grid2  = ObjectDataSource2;
            IEnumerable <Cancion> lista2 = (IEnumerable <Cancion>)grid2.Select();

            for (int i = 0; i < GridView2.Rows.Count; i++)
            {
                GridViewRow row   = GridView2.Rows[i];
                CheckBox    check = row.FindControl("Select") as CheckBox;

                if (check.Checked)
                {
                    Cancion aux = lista2.ElementAt(i);
                    orden.AgregarDisaco(aux);
                }
            }

            if (user != null)
            {
                Session["orden"] = orden;
                Server.Transfer("/Pagos.aspx");
            }
            else
            {
                Session["orden"] = orden;
                Server.Transfer("Account/Login.aspx");
            }
        }
Ejemplo n.º 17
0
        public override void DataBind()
        {
            if (_dsCtrl != null)
            {
                System.Collections.IEnumerator ie = null;

                if (_dsCtrl is SqlDataSource)
                {
                    SqlDataSource sqlDs = (SqlDataSource)_dsCtrl;

                    ie = sqlDs.Select(new DataSourceSelectArguments()).GetEnumerator();
                }
                if (_dsCtrl is ObjectDataSource)
                {
                    ObjectDataSource objDs = (ObjectDataSource)_dsCtrl;

                    ie = objDs.Select().GetEnumerator();
                }

                if (ie != null && _tblUploadedFiles != null && _params != null)
                {
                    while (ie.MoveNext())
                    {
                        if (ie.Current is System.Data.DataRowView)
                        {
                            System.Data.DataRow aDr = ((System.Data.DataRowView)ie.Current).Row;

                            TableRow aTblRow = new TableRow();

                            foreach (Parameter aParam in _params)
                            {
                                TableCell aTblCell = new TableCell();

                                aTblCell.Text = aDr[aParam.Name].ToString();

                                aTblRow.Cells.Add(aTblCell);
                            }

                            _tblUploadedFiles.Rows.Add(aTblRow);
                        }
                    }
                }
            }
        }
Ejemplo n.º 18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Session["Role"].ToString() != "Admin")
        {
            Response.Redirect("../Anonymous/ErrorPage.aspx");
        }
        if (!IsPostBack)
        {
            obj              = new ObjectDataSource();
            obj.TypeName     = "StudentLayer";
            obj.SelectMethod = "SelectStudentsIdAndName";
            obj.Select();

            DropDownList_Names.DataSource     = obj;
            DropDownList_Names.DataValueField = "St_Id";
            DropDownList_Names.DataTextField  = "St_Name";
            DropDownList_Names.DataBind();
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         obj              = new ObjectDataSource();
         obj.TypeName     = "ReportsBusinessLayer";
         obj.SelectMethod = "selectAllExamIds";
         obj.Select();
         DropDownList1.DataSource     = obj;
         DropDownList1.DataTextField  = "Ex_id";
         DropDownList1.DataValueField = "Ex_id";
         DropDownList1.DataBind();
         obj1              = new ObjectDataSource();
         obj1.TypeName     = "ReportsBusinessLayer";
         obj1.SelectMethod = "selectAllstudentsIds";
         obj1.Select();
         DropDownList2.DataSource     = obj1;
         DropDownList2.DataTextField  = "StFullname";
         DropDownList2.DataValueField = "St_id";
         DropDownList2.DataBind();
     }
 }
Ejemplo n.º 20
0
    protected void Page_PreRender(object sender, EventArgs e)
    {
        //Here we have the possiblity to check for certain postbacks and change the date to show
        if (this.Context.Request["__EVENTTARGET"] == "BookingInfo")
        {
            if (this.Context.Request["__EVENTARGUMENT"] == "Selected")
            {
                //Now we want to select a certain date to show
                //This is useful when e.g. showing future bookings for a patient.
                string key = "BookingInfo_Result";

                int bookingid = -1;
                try
                {
                    bookingid = (int)Session[key];
                }
                catch (Exception exception)
                {
                    throw new ApplicationException("Kan ej visa den valda bokningen, ej giltigt bokningsid");
                }

                //Lookup the BookingId that was queryed
                ObjectDataSource selectedBookingObjectDataSource = new ObjectDataSource("BookingsBLL", "GetBookingsByBookingID");
                selectedBookingObjectDataSource.SelectParameters.Add("bookingid", bookingid.ToString());
                DataView selectedBookingDataView = (DataView)selectedBookingObjectDataSource.Select();
                Rehab.BookingsRow selectedBookingDataRow = (Rehab.BookingsRow)selectedBookingDataView[0].Row;
                DateTime selectedBookingStartdatetime = selectedBookingDataRow.startdatetime;

                currentDate.CurrentDate = selectedBookingStartdatetime;

            }
            if (this.Context.Request["__EVENTARGUMENT"] == "Updated")
            {

            }
        }
        if (this.Context.Request["__EVENTTARGET"] == "NewBooking" &&
                this.Context.Request["__EVENTARGUMENT"] == "Selected")
        {

        }

        if (this.Context.Request["__EVENTTARGET"] == "DateTimePicker")
        {

            DateTime date = DateTime.Parse(this.Context.Request["__EVENTARGUMENT"]);
            currentDate.CurrentDate = date;

        }

        DayPilotCalendar1.StartDate = currentDate.CurrentDate;

        DayPilotCalendar1.DataBind();

        LookupPrintBookings.DialogNavigateUrl = "~/Bookings_print.aspx?Date=" + currentDate.CurrentDate.ToShortDateString();

        DailyinfoFormView.DataBind();

        showNextWeekLinkButton.Text = "Vecka " + currentDate.GetNextWeek().ToString() + " >>";
        showPreviousWeekLinkButton.Text = "<< Vecka " + currentDate.GetPreviousWeek().ToString();

        showNextMonthLinkButton.Text = currentDate.GetNextMonth() + " >>>";
        showPreviousMonthLinkButton.Text = "<<< " + currentDate.GetPreviousMonth();
    }
Ejemplo n.º 21
0
 protected object GetObjectByDataSource(string dataSourceId)
 {
     if (HttpContext.Current.Session[dataSourceId + "combo" + GetFileName()] == null)
     {
         object s = this.GetControl(dataSourceId) as ObjectDataSource;
         if (s == null)
         {
             s = this.GetControl(dataSourceId) as SqlDataSource;
             SqlDataSource sqlD = (SqlDataSource)s;
             DataView      dv   = (DataView)sqlD.Select(DataSourceSelectArguments.Empty);
             HttpContext.Current.Session[dataSourceId + "combo" + GetFileName()] = dv;
         }
         else
         {
             ObjectDataSource objD = (ObjectDataSource)s;
             HttpContext.Current.Session[dataSourceId + "combo" + GetFileName()] = objD.Select();
         }
     }
     return(HttpContext.Current.Session[dataSourceId + "combo" + GetFileName()]);
 }
Ejemplo n.º 22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Button insertButton = (Button)NewBookingFormView.FindControl("InsertButton");
        //KMobile.Web.UI.WebControls.Lookup lookup = (KMobile.Web.UI.WebControls.Lookup)NewBookingFormView.FindControl("LookupChoosePatient");

        string scriptString = "";

        scriptString += "<script language=JavaScript> ";
        scriptString += "function init_shortcuts() {";
        scriptString += "shortcut.add('b',function() { document.getElementById('NewBookingFormView_InsertButton').click();},{'disable_in_input':true});";
        scriptString += "shortcut.add('v',function() { document.getElementById('NewBookingFormView_LookupChoosePatient').click();},{'disable_in_input':true});";
        scriptString += "shortcut.add('n',function() { document.getElementById('NewBookingFormView_LookupNewPatient').click();},{'disable_in_input':true});";
        scriptString += "shortcut.add('ESC',function() {window.opener='x';window.close();},{'disable_in_input':false});";
        scriptString += "}";
        scriptString += " </script>";
        RegisterStartupScript("BodyLoadScript", scriptString);

        Page.RegisterStartupScript("Shortcut",
           "<script language=javascript src='shortcut.js'></script>");

        RegisterStartupScript("Shortcut",
           "<script language=javascript src='NewBooking.aspx.js'></script>");

        if (!Page.IsPostBack)
        {
            KMobile.Web.UI.WebControls.DateTimePicker dateTimePicker = (KMobile.Web.UI.WebControls.DateTimePicker)NewBookingFormView.Row.FindControl("DateTimePicker1");
            if (Page.Request.QueryString["Date"] != null)
                dateTimePicker.Value = DateTime.Parse(Page.Request.QueryString["Date"]);
            else
                dateTimePicker.Value = DateTime.Now.AddDays(1.0);

            TextBox starttimeTextBox = (TextBox)NewBookingFormView.Row.FindControl("starttimeTextBox");

            if ((Page.Request.QueryString["Hour"] != null) && (Page.Request.QueryString["Minute"] != null))
                starttimeTextBox.Text = Page.Request.QueryString["Hour"] + ":" + Page.Request.QueryString["Minute"];
            else
                starttimeTextBox.Text += "8:30";

            if (User.IsInRole("Admin"))
            {
                TextBox endtimeTextBox = (TextBox)NewBookingFormView.Row.FindControl("endtimeTextBox");
                endtimeTextBox.Enabled = true;
                endtimeTextBox.Visible = true;
                try
                {
                    endtimeTextBox.Text = ((DateTime.Parse(starttimeTextBox.Text)).AddMinutes(30.0)).ToShortTimeString();
                }
                catch (Exception exception) { }

            }
            else
            {
                RegularExpressionValidator endtimeRegularExpressionValidator = (RegularExpressionValidator)NewBookingFormView.Row.FindControl("EndtimeRegularExpressionValidator");

                endtimeRegularExpressionValidator.Enabled = false;
            }

            //Handle the case when a patient already is selected (query string)
            //also disbale the possible to choose another patient
            if (Page.Request.QueryString["Patientid"] != null)
            {
                int selectedPatientId = Convert.ToInt32(Page.Request.QueryString["Patientid"]);

                //These control are not suppose to be visible if the patient already is given in by the query string
                KMobile.Web.UI.WebControls.Lookup lookupChoosePatient = (KMobile.Web.UI.WebControls.Lookup)NewBookingFormView.Row.FindControl("LookupChoosePatient");
                lookupChoosePatient.Visible = false;
                lookupChoosePatient.Enabled = false;
                KMobile.Web.UI.WebControls.Lookup lookupNewPatient = (KMobile.Web.UI.WebControls.Lookup)NewBookingFormView.Row.FindControl("LookupNewPatient");
                lookupNewPatient.Visible = false;
                lookupNewPatient.Enabled = false;

                IsRefreshParentOnCancel = true;

                //Get patient data
                ObjectDataSource selectedPatientObjectDataSource = new ObjectDataSource("PatientsBLL", "GetPatientsByID");
                selectedPatientObjectDataSource.SelectParameters.Add("patientid", selectedPatientId.ToString());
                DataView dv = (DataView)selectedPatientObjectDataSource.Select();
                Rehab.PatientsDataTable patients = (Rehab.PatientsDataTable)dv.Table;
                Rehab.PatientsRow patientsRow = (Rehab.PatientsRow)patients.Rows[0];
                Patient selectedPatient = new Patient(patientsRow);

                //Fill textboxes with patient info
                FillPatientData(selectedPatient);
            }
        }
    }