protected void Button1_Click(object sender, EventArgs e) { string SuperVisor = TextBox2.Text,Salary=TextBox3.Text; int n; bool isNumeric = int.TryParse(SuperVisor, out n); bool isNumericc = int.TryParse(Salary, out n); if (isNumeric && isNumericc) { obj = (ObjectDataSource)Session["obj"]; obj.InsertMethod = "insert"; obj.InsertParameters.Clear(); obj.InsertParameters.Add("ins_name", TextBox1.Text); obj.InsertParameters.Add("Supins", TextBox2.Text); obj.InsertParameters.Add("salary", TextBox3.Text); obj.InsertParameters.Add("password", TextBox4.Text); obj.Insert(); TextBox1.Text = TextBox2.Text = TextBox3.Text = TextBox4.Text = ""; Label1.Text = "instructor Added Successfully :)"; Label1.Visible = true; GridView1.DataSource = obj; GridView1.DataBind(); Session["obj"] = obj; } else { Label1.Text = "Salary and SuperVisor Must be Numbers"; Label1.Visible = true; } }
protected void Button1_Click(object sender, EventArgs e) { string Leader = TextBox5.Text; int n; bool isNumeric = int.TryParse(Leader, out n); if (isNumeric) { obj = (ObjectDataSource)Session["obj"]; obj.TypeName = "Student"; obj.InsertMethod = "InsertStudent"; obj.InsertParameters.Clear(); obj.InsertParameters.Add("F_Name", TextBox1.Text); obj.InsertParameters.Add("L_Name", TextBox2.Text); obj.InsertParameters.Add("Address", TextBox3.Text); obj.InsertParameters.Add("Age", TextBox4.Text); obj.InsertParameters.Add("Dept_No", DropDownList1.SelectedValue); obj.InsertParameters.Add("Leader", TextBox5.Text); obj.InsertParameters.Add("password", TextBox6.Text); obj.InsertParameters.Add("UserName", TextBox7.Text); obj.Insert(); TextBox1.Text = TextBox2.Text = TextBox3.Text = TextBox4.Text = TextBox5.Text = TextBox6.Text = TextBox7.Text = ""; Label1.Text = "student Added Successfully :)"; Label1.Visible = true; GridView1.DataSource = obj; GridView1.DataBind(); Session["obj"] = obj; } else { Label1.Text = "Please enter Id of Leader"; Label1.Visible = true; } }
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e) { obj = (ObjectDataSource)Session["obj"]; GridView1.EditIndex = -1; GridView1.DataSource = obj; GridView1.DataBind(); }
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { obj = (ObjectDataSource)Session["obj"]; GridView1.EditIndex = e.NewEditIndex; GridView1.DataSource = obj; GridView1.DataBind(); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { obj = (ObjectDataSource)Session["obj"]; obj.UpdateMethod = "UpdateStudent"; obj.UpdateParameters.Clear(); Label id = (Label)GridView1.Rows[e.RowIndex].FindControl("EditID"); TextBox F_name = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_F_Name"); TextBox L_Name = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_L_Name"); TextBox Address = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_Address"); TextBox Age = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_Age"); DropDownList Dept = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("Edit_Dept"); DropDownList Leader = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("Edit_Leader"); TextBox password = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_Password"); TextBox UserName = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_UserName"); obj.UpdateParameters.Add("St_ID", id.Text); obj.UpdateParameters.Add("F_Name", F_name.Text); obj.UpdateParameters.Add("L_Name", L_Name.Text); obj.UpdateParameters.Add("Address", Address.Text); obj.UpdateParameters.Add("Age", Age.Text); obj.UpdateParameters.Add("Dept_No", Dept.SelectedValue); obj.UpdateParameters.Add("Leader", Leader.SelectedValue); obj.UpdateParameters.Add("password", password.Text); obj.UpdateParameters.Add("UserName", UserName.Text); obj.Update(); GridView1.EditIndex = -1; GridView1.DataSource = obj; GridView1.DataBind(); Session["obj"] = obj; }
protected void Page_Load(object sender, EventArgs e) { ObjectDataSource ds = new ObjectDataSource(); ds.TypeName = "Test"; ds.SelectMethod = "GetDataTable"; GridView1.DataSource = ds; GridView1.DataBind(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { obj = (ObjectDataSource)Session["obj"]; obj.DeleteMethod = "DeleteStudent"; obj.DeleteParameters.Clear(); Label id = (Label)GridView1.Rows[e.RowIndex].FindControl("ID"); obj.DeleteParameters.Add("St_ID", id.Text); obj.Delete(); GridView1.DataSource = obj; GridView1.DataBind(); Session["obj"] = obj; }
private void PerformSearch() { datasource = new ObjectDataSource(); datasource.EnablePaging = true; datasource.TypeName = typeof(GalleriesResult).FullName; datasource.ObjectCreating += new ObjectDataSourceObjectEventHandler(datasource_ObjectCreating); datasource.SelectMethod = "GetProjects"; datasource.SelectCountMethod = "TotalCount"; ProjectGridView.DataSource = datasource; ProjectGridView.PageIndex = pageIndex; }
protected void Button1_Click(object sender, EventArgs e) { obj = (ObjectDataSource)Session["obj"]; obj.InsertMethod = "InsertCourse"; obj.InsertParameters.Clear(); obj.InsertParameters.Add("C_Name", TextBox1.Text); obj.Insert(); TextBox1.Text = ""; Label1.Text = "Departement Added Successfully :)"; Label1.Visible = true; GridView1.DataSource = obj; GridView1.DataBind(); Session["obj"] = obj; }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { obj = new ObjectDataSource(); obj.TypeName = "DepartemantBL"; obj.SelectMethod = "SelectAllDept"; obj.Select(); GridView1.DataSource = obj; GridView1.DataBind(); Session.Add("obj", obj); } }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { obj = (ObjectDataSource)Session["obj"]; obj.UpdateMethod = "UpdateCourse"; obj.UpdateParameters.Clear(); Label id = (Label)GridView1.Rows[e.RowIndex].FindControl("ID_Lbl_Edit"); TextBox name = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Name_txtbox"); obj.UpdateParameters.Add("C_ID", id.Text); obj.UpdateParameters.Add("C_Name", name.Text); obj.Update(); GridView1.EditIndex = -1; GridView1.DataSource = obj; GridView1.DataBind(); Session["obj"] = obj; }
public void Reset_AfterFirstIteration_MakesSourceIterableAgain() { ObjectDataSource<int> objds = new ObjectDataSource<int>(new int []{1,2,3,4,9}); int count = 0; int count1 = 0; while( objds.MoveNext()) count++; Assert.IsFalse(objds.MoveNext()); objds.Reset(); while( objds.MoveNext()) count1++; Assert.AreEqual(count,count1); }
protected void gvRoleSettings_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { ObjectDataSource ctrl = e.Row.FindControl("odsRoleSettings") as ObjectDataSource; if (ctrl != null && e.Row.DataItem != null) { if ((_selectedModule != null) && (_selectedModule != "")) { CheckAllState(_selectedModule); } ctrl.SelectParameters["RoleID"].DefaultValue = ddlRole.SelectedValue.ToString(); ctrl.SelectParameters["ModuleName"].DefaultValue = ((DataRowView)e.Row.DataItem)["ModuleName"].ToString(); _selectedModule = ((DataRowView)e.Row.DataItem)["ModuleName"].ToString(); } } }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { // Load JObject from stream var jObject = JObject.Load(reader); // Create target request object based on "type" property if (jObject.Value <string>("type") == "object") { jObject.Remove("type"); var target = new ObjectDataSource(); serializer.Populate(jObject.CreateReader(), target); return(target); } else { var target = new KeyValueDataSource(); serializer.Populate(jObject.CreateReader(), target); return(target); } }
public ObjectDataSource SetObjectDataSource(string dataSourceId, string selectMethod, string selectCountMethod, SPGridView2DataSource dataSource, ViewMetadata view) { this.view = view; ObjectDataSource gridDS = new ObjectDataSource(); gridDS.ID = dataSourceId; gridDS.SelectMethod = selectMethod; gridDS.TypeName = dataSource.GetType().AssemblyQualifiedName; gridDS.EnableViewState = false; gridDS.SelectCountMethod = selectCountMethod; gridDS.MaximumRowsParameterName = "iMaximumRows"; gridDS.StartRowIndexParameterName = "iBeginRowIndex"; gridDS.SortParameterName = "SortExpression"; gridDS.EnablePaging = true; gridDS.ObjectCreating += gridDS_ObjectCreating; this.GridDataSource = gridDS; return(gridDS); }
public void SetObjectDataSource(Grid grid) { ObjectDataSource ds = new ObjectDataSource(); ds.ID = "EmployeesObjectDataSource"; ds.TypeName = "WebGridUnitTest.ObjectDataSource.NorthwindEmployeeData"; ds.EnablePaging = true; ds.StartRowIndexParameterName = "StartRecord"; ds.MaximumRowsParameterName = "MaxRecords"; ds.SelectMethod = "GetAllEmployees"; ds.DataObjectTypeName = "WebGridUnitTest.ObjectDataSource.NorthwindEmployee"; ds.DeleteMethod = "DeleteEmployee"; ds.InsertMethod = "InsertEmployee"; ds.UpdateMethod = "UpdateEmployee"; Testpage.Controls.Add(ds); grid.DataSourceId = ds.ID; grid["EmployeeID"].Primarykey = true; grid["EmployeeID"].Identity = true; }
public rptStokDurumu() { InitializeComponent(); MGsTOKContex conetext = new MGsTOKContex(); StokDal stokdal = new StokDal(); ObjectDataSource stokDatasource = new ObjectDataSource { DataSource = stokdal.GetAlljoin(conetext) }; this.DataSource = stokDatasource; // colStokGrubu.DataBindings.Add("Text", this.DataSource, "StokKodu"); colBarkod.DataBindings.Add("Text", this.DataSource, "Barkod"); colStokAdi.DataBindings.Add("Text", this.DataSource, "StokAdi"); colBirimi.DataBindings.Add("Text", this.DataSource, "StokBirimi"); colStokGrubu.DataBindings.Add("Text", this.DataSource, "StokGrubu"); colSatisKdv.DataBindings.Add("Text", this.DataSource, "SatisKdv"); colStokGiris.DataBindings.Add("Text", this.DataSource, "StokGiris"); colStokCikis.DataBindings.Add("Text", this.DataSource, "StokCikis"); }
protected void Page_Load(object sender, EventArgs e) { foreach (StructControl ctrl in m_controls) { ObjectDataSource ods = new ObjectDataSource(ctrl.DataSource, ctrl.SelectMethod); ods.DataObjectTypeName = "System.Guid"; DropDownList dd = new DropDownList(); dd.DataTextField = ctrl.TextField; dd.DataValueField = ctrl.ValueField; dd.ID = ctrl.Title.Replace(' ', '_'); dd.DataSource = ods; dd.DataBind(); dd.SelectedIndexChanged += new EventHandler(dd_SelectedIndexChanged); dd.PreRender += new EventHandler(dd_PreRender); dd.AutoPostBack = true; Panel1.Controls.Add(new LiteralControl(string.Format("<div><label class='{0}'>{1}</label><br/>", ctrl.Required, ctrl.Title))); Panel1.Controls.Add(dd); Panel1.Controls.Add(new LiteralControl("</div>")); } }
protected void Button1_Click(object sender, EventArgs e) { obj = new ObjectDataSource(); obj.TypeName = "instructor"; obj.UpdateMethod = "Edit"; obj.UpdateParameters.Clear(); int id =int.Parse(ds.Tables[0].Rows[0][0].ToString()); string name = ds.Tables[0].Rows[0][1].ToString(); string userName = ds.Tables[0].Rows[0][3].ToString(); string Password= ds.Tables[0].Rows[0][4].ToString(); obj.UpdateParameters.Add("id", id.ToString()); obj.UpdateParameters.Add("ins_name", name); obj.UpdateParameters.Add("UserName", userName); obj.UpdateParameters.Add("password", Password); obj.Update(); Session["obj"] = obj; Response.Redirect("Instructor.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //Check if User is logged in if (string.IsNullOrEmpty(Session["UserID"] as string)) { //if user not logged in, redirect to Login page Response.Redirect("Login.aspx"); } ObjectDataSource labsDataSource = new ObjectDataSource(); labsDataSource.TypeName = "ARMS_Project.LabLogic"; labsDataSource.SelectMethod = "GetLabs"; ddlLabID.DataSource = labsDataSource; ddlLabID.DataTextField = "name"; ddlLabID.DataValueField = "id"; ddlLabID.DataBind(); } }
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()]); }
protected void contactODS_Updated(object sender, ObjectDataSourceStatusEventArgs e) { int idContact = int.Parse(Request.QueryString["id"]); using (EntityExeEntities context = new EntityExeEntities()) { try { Contact_Service contact_Service = context.Contact_Service.FirstOrDefault(cs => cs.ContactsId == idContact); if (contact_Service != null) { context.Contact_Service.Remove(contact_Service); } //Ajouter les données dans la table contact_service setRowDataForGridCS(); DataTable csTable = (DataTable)ViewState["currentTableService"]; for (int i = 0; i < csTable.Rows.Count; i++) { Contact_Service cs = new Contact_Service(); cs.ContactsId = idContact; cs.Tag_servicesId = Int32.Parse(csTable.Rows[i][0].ToString()); cs.ContactTypeId = Int32.Parse(csTable.Rows[i][1].ToString()); context.Contact_Service.Add(cs); } context.SaveChanges(); GridView gv = (GridView)contactDV.FindControl("serviceGV"); ObjectDataSource ods = (ObjectDataSource)contactDV.FindControl("serviceODS"); //gv.DataSource = csTable; //gv.DataBind(); } catch (Exception ex) { } } }
protected override void OnInit(EventArgs e) { base.OnInit(e); if (FilterFields != null) { phFilterFields.Controls.Add(FilterFields); } if (!string.IsNullOrEmpty(ObjectDataSourceID)) { var control = this.Parent.FindControl(ObjectDataSourceID); if (control != null && control is ObjectDataSource) { ObjectDataSource ods = control as ObjectDataSource; ods.Selecting += new ObjectDataSourceSelectingEventHandler(ods_Selecting); } } }
public RptStokDurumu() { InitializeComponent(); YemekYemekContext context = new YemekYemekContext(); StokDAL stokdal = new StokDAL(); ObjectDataSource stokdataSource = new ObjectDataSource { DataSource = stokdal.StokListele(context) }; this.DataSource = stokdataSource; colStokAdi.DataBindings.Add("Text", this.DataSource, "StokAdi"); colStokKodu.DataBindings.Add("Text", this.DataSource, "StokKodu"); colBarkod.DataBindings.Add("Text", this.DataSource, "Barkod"); colBirimi.DataBindings.Add("Text", this.DataSource, "Birimi"); colStokGrubu.DataBindings.Add("Text", this.DataSource, "StokGrubu"); colStokAltGrubu.DataBindings.Add("Text", this.DataSource, "StokAltGrubu"); colStokGiris.DataBindings.Add("Text", this.DataSource, "StokGiris"); colStokCikis.DataBindings.Add("Text", this.DataSource, "StokCikis"); colMevcutStok.DataBindings.Add("Text", this.DataSource, "MevcutStok"); colSatisKdv.DataBindings.Add("Text", this.DataSource, "SatisKdv"); }
public rptFatura(string fiskodu) { InitializeComponent(); MGsTOKContex conetext = new MGsTOKContex(); StokDal stokdal = new StokDal(); FisDal fisdal = new FisDal(); ObjectDataSource fisDatasource = new ObjectDataSource { DataSource = fisdal.GetAll(conetext, c => c.FisKodu == fiskodu) }; ObjectDataSource stokDatasource = new ObjectDataSource { DataSource = stokdal.GetAlljoin(conetext) }; this.DataSource = stokDatasource; lblCariAdi.DataBindings.Add("Text", fisDatasource, "CariAdi"); lblAdres.DataBindings.Add("Text", fisDatasource, "Adres"); colStokAdi.DataBindings.Add("Text", this.DataSource, "StokAdi"); colMiktar.DataBindings.Add("Text", this.DataSource, "Miktar"); colBirimFiyat.DataBindings.Add("Text", this.DataSource, "BirimFiyat"); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> protected override void Page_Load(object sender, EventArgs e) { FormView pageFormView = PageFormView; if (pageFormView != null) { // Used for rendering the validators pageFormView.PreRender += new EventHandler(pageFormView_PreRender); } if (!IsPostBack) { if (pageFormView != null) { int result; if (AllowAutoInsertMode() && (Request.QueryString["Id"] == null || (Int32.TryParse(Server.UrlDecode(Request.QueryString["Id"].ToString()), out result) && result == -1))) { // Force insert mode pageFormView.ChangeMode(FormViewMode.Insert); } } } //set up some event handlers for inserting, updating and deleteing ObjectDataSource dataSource = PageDataSource; if (dataSource != null) { dataSource.Inserted += new ObjectDataSourceStatusEventHandler(DataSource_Inserted); dataSource.Updated += new ObjectDataSourceStatusEventHandler(DataSource_Updated); pageFormView.ItemUpdated += new FormViewUpdatedEventHandler(pageFormView_ItemUpdated); pageFormView.ItemInserted += new FormViewInsertedEventHandler(pageFormView_ItemInserted); pageFormView.ItemDeleted += new FormViewDeletedEventHandler(PageFormView_ItemDeleted); } // Call base base.Page_Load(sender, e); }
public rptStokDurumu() { InitializeComponent(); FaysConceptContext context = new FaysConceptContext(); StokDAL stokDAL = new StokDAL(); //linq sorguları yapmak için ObjectDataSource stokDataSource = new ObjectDataSource { DataSource = stokDAL.StokListele(context) }; this.DataSource = stokDataSource; colStokKodu.DataBindings.Add("Text", this.DataSource, "StokKodu"); colBarkodNo.DataBindings.Add("Text", this.DataSource, "BarkodNo"); colStokAdi.DataBindings.Add("Text", this.DataSource, "StokAdi"); colBirimi.DataBindings.Add("Text", this.DataSource, "Birimi"); colStokGrubu.DataBindings.Add("Text", this.DataSource, "StokGrubu"); colStokAltGrubu.DataBindings.Add("Text", this.DataSource, "StokAltGrubu"); colStokGiris.DataBindings.Add("Text", this.DataSource, "StokGiris"); colStokCikis.DataBindings.Add("Text", this.DataSource, "StokCikis"); colMevcutStok.DataBindings.Add("Text", this.DataSource, "MevcutStok"); }
protected void GV_Carrito_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.FindControl("L_Total") != null) { Carrito carro = (Carrito)e.Row.DataItem; double total = carro.Precio * carro.Cantidad.Value; ((Label)e.Row.FindControl("L_Precio")).Text = total.ToString(); GridView compras = (GridView)e.Row.FindControl("Gv_Compras"); ObjectDataSource ods = (ObjectDataSource)e.Row.FindControl("ODS_Compras"); ods.SelectParameters["productoId"] = new Parameter("productoId", DbType.Int32, carro.ProductoId.ToString()); compras.DataBind(); //compras.DataSource = new DaoProducto().obtenerComprasxProducto(carro.ProductoId); //compras.DataBind(); } else if (e.Row.RowType.ToString().Equals("Footer")) { ((Label)e.Row.FindControl("L_TFinal")).Text = string.Format("{0:C}", new DaoProducto().obtenerProductosCarrito(int.Parse(Session["userId"].ToString())).Sum(x => x.Total)); } }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { obj = (ObjectDataSource)Session["obj"]; obj.UpdateMethod = "update"; obj.UpdateParameters.Clear(); Label id = (Label)GridView1.Rows[e.RowIndex].FindControl("Edit_ID"); TextBox name = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_Name"); DropDownList Super = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("Edit_Super"); TextBox Salary = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_Salary"); TextBox Password = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Edit_Password"); obj.UpdateParameters.Add("id", id.Text); obj.UpdateParameters.Add("ins_name", name.Text); obj.UpdateParameters.Add("Supins", Super.Text); obj.UpdateParameters.Add("salary", Salary.Text); obj.UpdateParameters.Add("password", Password.Text); obj.Update(); GridView1.EditIndex = -1; GridView1.DataSource = obj; GridView1.DataBind(); Session["obj"] = obj; }
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowIndex > -1) { ObjectDataSource accessDS = e.Row.FindControl("ObjectDataSource2") as ObjectDataSource; accessDS.SelectParameters["midx"].DefaultValue = (e.Row.DataItem as Tab_QA_Type).Idx.ToString(); } if (e.Row.RowType == DataControlRowType.DataRow) { //if (e.Row.RowState == DataControlRowState.Normal || e.Row.RowState == DataControlRowState.Alternate) //{ // var lkn = (e.Row.Cells[3].Controls[0]) as LinkButton; // if (null != lkn) // lkn.Attributes.Add("onclick", "javascript:return confirm('你确认要删除吗?')"); //} //当鼠标停留时更改背景色 e.Row.Attributes.Add("onmouseover", "c=this.style.backgroundColor;this.style.backgroundColor='#C0C0C0'"); //当鼠标移开时还原背景色 e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=c"); } }
public void fnd_Click(object sender, EventArgs e) { Components_HeaderCell hc; string sb = ""; string sbt = ""; int j = 0; if (GridView1.HeaderRow != null) { foreach (TableCell tc in GridView1.HeaderRow.Cells) { for (int i = 0; i < tc.Controls.Count; i++) { if (tc.Controls[i] is Components_HeaderCell) { hc = (Components_HeaderCell)tc.Controls[i]; if (string.IsNullOrWhiteSpace(hc.SearchTextValue)) { continue; } sb = Utils.CreateFilter(sb, GridView1.Columns[j].SortExpression, hc.SearchTextValue.ToUpper()); sbt = Utils.CreateFilterText(sbt, GridView1.Columns[j].HeaderText, hc.SearchTextValue.ToUpper()); } } j++; } } ObjectDataSource os = GridView1.DataSourceObject as ObjectDataSource; if (os != null) { os.FilterExpression = sb; Filtering(sbt); } if (string.IsNullOrWhiteSpace(sbt)) { ClearAll(); } }
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(); } }
/// <summary> /// Fills the specified gridview with a page of data. /// </summary> /// <param name="gv">The gridview.</param> /// <param name="list">The single page of data.</param> /// <param name="count">The total count (to work out number of pages).</param> /// <param name="pageSize">Size of the page.</param> public static void Fill(System.Web.UI.WebControls.GridView gv, IList <object> list, int count, int pageSize) { //create an ObjectDateSource object programmatically ObjectDataSource ods = new ObjectDataSource(); ods.ID = "ods" + gv.ID; ods.EnablePaging = gv.AllowPaging; ods.TypeName = "ObjectAdaptor"; //can be a common base class ods.SelectMethod = "Select"; ods.SelectCountMethod = "Count"; ods.StartRowIndexParameterName = "startRowIndex"; ods.MaximumRowsParameterName = "maximumRows"; ods.EnableViewState = false; //when creating, inject the data into the table adaptor ods.ObjectCreating += delegate(object sender, ObjectDataSourceEventArgs e) { e.ObjectInstance = new ObjectAdaptor(list, count); }; ods.DataBind(); gv.PageSize = pageSize; gv.DataSource = ods; gv.DataBind(); }
/// <summary> /// n the Page_Load event we are declaring the GridView Object, its event and Datasource /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { try { const string DATASOURCEID = "gridDS"; gridDS = new ObjectDataSource(); gridDS.ID = DATASOURCEID; gridDS.SelectMethod = "SelectData"; gridDS.TypeName = this.GetType().AssemblyQualifiedName; gridDS.ObjectCreating += new ObjectDataSourceObjectEventHandler(gridDS_ObjectCreating); this.Controls.Add(gridDS); BindDocuments(); } catch (Exception ex) { SPDiagnosticsService diagnosticsService = SPDiagnosticsService.Local; SPDiagnosticsCategory cat = diagnosticsService.Areas["SharePoint Foundation"].Categories["Unknown"]; diagnosticsService.WriteTrace(1, cat, TraceSeverity.Medium, ex.StackTrace, cat.Name, cat.Area.Name); SPUtility.TransferToErrorPage("Some Error occured, Please try after some time. <br/> If problem persists, contact your adminstrator"); } }
private void SetReportDataSource(Graph report) { if (objectDataSource == null) { objectDataSource = new Telerik.Reporting.ObjectDataSource(); //EntityListViewDTO listView = CreateListView(); //CheckSubReportRelationshipColumnExistsInSelect(ChartReportReportDTO.EntityListView); objectDataSource.DataSource = searchRequestManager.GetDataTableBySearchDataItems(Request.Requester, ChartReportReportDTO.TableDrivedEntityID, Request.SearchDataItems, ChartReportReportDTO.EntityListView, 0).Item3; } report.DataSource = objectDataSource; //var sqlDataSource1 = new Telerik.Reporting.SqlDataSource(); //sqlDataSource1.ConnectionString = "Data Source=.;Initial Catalog=SampleDB;Integrated Security=True"; //sqlDataSource1.Name = "sqlDataSource1"; //var query = searchRequestManager.GetQuery(request.Requester, reportDTO.EntityChartReport.TableDrivedEntityID, request.SearchDataItems, reportDTO.EntityChartReport.EntityListView); //sqlDataSource1.SelectCommand = query; //resultReport.DataSource = sqlDataSource1; // // sqlDataSource1.SelectCommand = @"SELECT Employee_Project.EmployeeSSN, Employee_Project.ProjectNumber, Project.Name, Employee_Project.Hours //FROM Employee_Project INNER JOIN // Project ON Employee_Project.ProjectNumber = Project.Number"; }
public XtraReport GenerateReport(NameValueCollection parameters) { long?supplierId = null; if (parameters.AllKeys.Contains("supplierId") && !string.IsNullOrEmpty(parameters["supplierId"])) { supplierId = long.Parse(parameters["supplierId"]); } var itemWiseReOrderLevel = new ItemWiseReOrderLevelReport(); var itemWiseReOrderLevelData = AsyncContext.Run(() => _reportService.GetReOrderLevelReport(supplierId)); var itemWiseReOrderLevelobjectDataSource = new ObjectDataSource { DataSource = itemWiseReOrderLevelData, Name = "itemWiseReOrderLevelDataSource" }; itemWiseReOrderLevel.DataSource = itemWiseReOrderLevelobjectDataSource; return(itemWiseReOrderLevel); }
protected void btnClientEMBGSearch_Click(object sender, EventArgs e) { Panel pnlClient = PoliciesDetailsView.FindControl("pnlClient") as Panel; DetailsView clientDetailsView = pnlClient.FindControl("ClientDetailsView") as DetailsView; ObjectDataSource clientdvDataSource = pnlClient.FindControl("ClientdvDataSource") as ObjectDataSource; if (PoliciesDetailsView.SelectedValue != null) { int policyItemID = Convert.ToInt32(PoliciesDetailsView.SelectedValue); PolicyItem policyItem = PolicyItem.Get(policyItemID); string clientEMBG = policyItem.Policy.Client.EMBG; pnlClient.Visible = true; clientdvDataSource.SelectParameters.Clear(); clientdvDataSource.SelectParameters.Add("embg", clientEMBG); clientDetailsView.DataBind(); } else { pnlClient.Visible = false; clientdvDataSource.SelectParameters.Clear(); clientDetailsView.DataBind(); } }
public void Reset_AfterFirstIteration_MakesSourceIterableAgain() { ObjectDataSource <int> objds = new ObjectDataSource <int>(new int [] { 1, 2, 3, 4, 9 }); int count = 0; int count1 = 0; while (objds.MoveNext()) { count++; } Assert.IsFalse(objds.MoveNext()); objds.Reset(); while (objds.MoveNext()) { count1++; } Assert.AreEqual(count, count1); }
protected override void CreateChildControls() { base.CreateChildControls(); InitializeComponent(); ObjectDataSource child = new ObjectDataSource(); child.ID = "ContentDataSource"; child.TypeName = "Telerik.Libraries.LibraryManager"; child.SelectMethod = "GetContent"; child.SelectCountMethod = "ContentCount"; child.MaximumRowsParameterName = "max"; child.StartRowIndexParameterName = "from"; child.SortParameterName = "sortExp"; child.EnablePaging = true; child.Selecting += new ObjectDataSourceSelectingEventHandler(this.dataSource_Selecting); child.ObjectCreating += new ObjectDataSourceObjectEventHandler(this.dataSource_ObjectCreating); this.Controls.Add(child); //bind to the list of items IList libraries = this.Manager.GetAllLibraries("Image", true); this.LibraryDropDown.DataSource = libraries; this.LibraryDropDown.SelectedIndexChanged += new EventHandler(LibraryDropDown_SelectedIndexChanged); this.LibraryDropDown.AutoPostBack = true; this.LibraryDropDown.DataBind(); //bind the repeater this.ImagesRepeater.ItemDataBound += new RepeaterItemEventHandler(ImagesRepeater_ItemDataBound); this.ImagesRepeater.DataSource = child; this.ImagesRepeater.DataBind(); //output the iD ScriptManager.RegisterStartupScript(this, typeof(ImageRotatorControlDesigner), "clientID", "var m_hiddenSelection = '" + this.SelectedItems.ClientID + "';", true); }
protected override void InitDialogContent(Control container) { base.InitDialogContent(container); this.serverConfirmButton = (Button)this.FindControlByID("serverConfirmButton", true); ddlEnabled = (DropDownList)this.FindControlByID("ddlEnabled", true); dropdownExtender = (TextBoxDropdownExtender)this.FindControlByID("dropdownExtender", true); btnSearch = (Button)this.FindControlByID("btnSearch", true); this.processGrid = (DeluxeGrid)this.FindControlByID("ProcessDescInfoDeluxeGrid", true); txtApplicationName = (TextBox)this.FindControlByID("txtApplicationName", true); txtProgramName = (TextBox)this.FindControlByID("txtProgramName", true); txtProcessKey = (TextBox)this.FindControlByID("txtProcessKey", true); txtProcessName = (TextBox)this.FindControlByID("txtProcessName", true); btnSearch.Click += new EventHandler(btnSearch_Click); this.serverConfirmButton.Click += new EventHandler(serverConfirmButton_Click); ObjectDataSource objectDataSource = container.FindControl <ObjectDataSource>(true); objectDataSource.Selecting += new ObjectDataSourceSelectingEventHandler(objectDataSource_Selecting); objectDataSource.Selected += new ObjectDataSourceStatusEventHandler(objectDataSource_Selected); if (!Page.IsPostBack) { dropdownExtender.DataSource = WfProcessDescriptionCategoryAdapter.Instance.Load(p => p.AppendItem("ID", "", "<>")); dropdownExtender.DataValueField = "Name"; dropdownExtender.DataTextField = "Name"; dropdownExtender.DataBind(); this.processGrid.MultiSelect = this.MultiSelect; //ddlEnabled.Items.Add(new ListItem("请选择", "")); //ddlEnabled.Items.Add(new ListItem("是", "1")); //ddlEnabled.Items.Add(new ListItem("否", "0")); ExecuteQuery(); } }
private async Task AddEventDisplay(ResponseBody response, Group groupData) { var eventData = new ObjectDataSource { Properties = new Dictionary <string, object>(), TopLevelData = new Dictionary <string, object> { { "backgroundUrl", groupData.GroupPhoto?.HighRes ?? groupData.KeyPhoto?.HighRes }, { "groupName", groupData.Name } }, Transformers = new List <APLTransformer>() }; var document = await S3Helper.GetDocument(System.Environment.GetEnvironmentVariable("bucket"), "assets/EventDetail.json"); var directive = new RenderDocumentDirective { Document = document, DataSources = new Dictionary <string, APLDataSource> { { "eventData", eventData } }, Token = groupData.Id.ToString() }; var initialText = groupData.ExtraFields[Consts.DataPlainTextDescription].ToString() .Replace("https://", string.Empty); eventData.Properties.Add("text", initialText); var speech = new Speech(initialText.Split("\n\n") .SelectMany(t => new ISsml[] { new Paragraph(new Sentence(new PlainText(t))), new PlainText("\n\n") }).ToArray()); response.Directives.Add(directive); }
public void AalmadaTest() { var response = ResponseBuilder .Ask("Welcome to my skill. How can I help", new Reprompt()); var json = JObject.FromObject(new APLDocument(APLDocumentVersion.V1_2)); var launchTemplateApl = JObject.FromObject(json); var launchTemplateData = new ObjectDataSource { ObjectId = "launchScreen", Properties = new Dictionary <string, object>(), TopLevelData = new Dictionary <string, object>(), }; launchTemplateData.Properties.Add("textContent", "My Skill"); launchTemplateData.Properties.Add("hintText", "Try, \"What can you do?\""); var directive = CreateAplDirective(launchTemplateApl, ("launchTemplateData", launchTemplateData)); response.Response.Directives.Add(directive); var output = JsonConvert.SerializeObject(response); }
protected override void OnInit(EventArgs e) { objectdatasourceList = (ObjectDataSource)this.FindControl("objectdatasourceList"); gvList = (GridView)this.FindControl("gvList"); lblMessage = (Label)this.FindControl("lblMessage"); lblCount = (Label)this.FindControl("lblCount"); objectdatasourceList.SelectMethod = ucDataSourceSelectMethod; gvList.DataSourceID = "objectdatasourceList"; gvList.AutoGenerateColumns = false; gvList.AllowSorting = _allowSort; gvList.AllowPaging = true; gvList.EmptyDataText = "No records found"; gvList.CssClass = "GridView"; gvList.HeaderStyle.CssClass = "GridViewHeader"; gvList.PagerStyle.CssClass = "GridViewPager"; gvList.CellPadding = 5; gvList.EnableSortingAndPagingCallbacks = false; gvList.Width = Unit.Percentage(100); gvList.PageSize = UCENTRIK.AppSettings.UcConfParameters.UcGridViewPageRows; //gvList.RowCreated += GridView_RowCreated; gvList.RowDataBound += GridView_RowDataBound; //gvList.RowDeleting += GridView_RowDeleting; //gvList.RowDeleted += GridView_RowDeleted; gvList.Sorting += GridView_Sorting; //------------------- base.OnInit(e); }
protected void Page_Load(object sender, EventArgs e) { foreach (StructControl ctrl in m_controls) { ObjectDataSource ods = new ObjectDataSource(ctrl.DataSource, ctrl.SelectMethod); ods.DataObjectTypeName = "System.Guid"; DropDownList dd = new DropDownList(); dd.DataTextField = ctrl.TextField; dd.DataValueField = ctrl.ValueField; dd.ID = ctrl.Title.Replace(' ', '_'); dd.DataSource = ods; dd.SelectedIndexChanged += new EventHandler(dd_SelectedIndexChanged); dd.PreRender += new EventHandler(dd_PreRender); dd.DataBind(); dd.AutoPostBack = true; Panel1.Controls.Add(new LiteralControl(string.Format("<div><label class='{0}'>{1}</label><br/>", ctrl.Required, ctrl.Title))); Panel1.Controls.Add(dd); Panel1.Controls.Add(new LiteralControl("</div>")); } if (!IsPostBack) { MembershipUser User = Membership.GetUser(new Guid(Request["Id"])); Guid UserGUID = (Guid)User.ProviderUserKey; ResourcesTableAdapter ta = new ResourcesTableAdapter(); Tracker.ResourcesDataTable dt = ta.GetResource(UserGUID); SetValue("Dept", dt[0].DeptId); SetValue("Group", dt[0].GroupId); SetValue("Team", dt[0].TeamId); Active.Checked = dt[0].Active; Active.Enabled = !Utility.IsAssigned(UserGUID); Active.Text = Active.Enabled ? "Active" : "Active - <small>Currently assigned to In Progress SSRs</small>"; } }
public static void ExportObjDataSetToExcel(ObjectDataSource ds, string filename) { HttpResponse response = HttpContext.Current.Response; response.Clear(); response.Charset = ""; response.ContentType = "application/vnd.ms-excel"; response.AddHeader("Content-Disposition", "attachment;filename=\"" + filename + "\""); using (StringWriter sw = new StringWriter()) { using (HtmlTextWriter htw = new HtmlTextWriter(sw)) { GridView dg = new GridView(); dg.DataSource = ds; dg.CssClass = "DataWebControlStyle"; dg.AlternatingRowStyle.CssClass = "AlternatingRowStyle"; dg.HeaderStyle.CssClass = "HeaderStyle"; dg.DataBind(); dg.RenderControl(htw); response.Write(sw.ToString()); response.End(); } } }
public rptStokHareketleri(DateTime baslangic, DateTime bitis) { InitializeComponent(); IsbaSatisContext context = new IsbaSatisContext(); StokHareketDAL stokHareketDAL = new StokHareketDAL(); ObjectDataSource dataSource = new ObjectDataSource { DataSource = stokHareketDAL.StokHareketTarihAraligi(context, baslangic, bitis) }; this.DataSource = dataSource; colHareketi.DataBindings.Add("Text", this.DataSource, "Hareket"); colTarih.DataBindings.Add("Text", this.DataSource, "Tarih"); colBarkod.DataBindings.Add("Text", this.DataSource, "Barkod"); colStokAdi.DataBindings.Add("Text", this.DataSource, "StokAdi"); colBirimi.DataBindings.Add("Text", this.DataSource, "Birimi"); colKdv.DataBindings.Add("Text", this.DataSource, "Kdv", "{0:'%'0}"); colMiktar.DataBindings.Add("Text", this.DataSource, "Miktar"); colBirimFiyat.DataBindings.Add("Text", this.DataSource, "BirimFiyati", "{0:C2}"); colIndirimOrani.DataBindings.Add("Text", this.DataSource, "IndirimOrani", "{0:'%'0}"); colIndirimTutar.DataBindings.Add("Text", null, "indirimTutar", "{0:C2}"); colTutar.DataBindings.Add("Text", this.DataSource, "ToplamTutar", "{0:C2}"); lblToplamTutar.DataBindings.Add("Text", this.DataSource, "genelTutar", "{0:C2}"); lblIndirimTutar.DataBindings.Add("Text", null, "stokIndToplam", "{0:C2}"); }
private void PerformSearch() { datasource = new ObjectDataSource(); datasource.EnablePaging = true; //datasource.TypeName = typeof(ItemsResult).FullName; datasource.ObjectCreating += new ObjectDataSourceObjectEventHandler(datasource_ObjectCreating); datasource.SelectMethod = "GetResults"; datasource.SelectCountMethod = "TotalCount"; ResultsGridView.DataSource = datasource; //ResultsGridView.PageIndex = input.PageIndex; }
public static void Main(string[] args) { Report r = new Report (); //---------------------- // report header section //---------------------- var invTextTb = new TextBlock (){ Text = "Invoice", Width = r.Width, FontWeight = FontWeight.Bold, FontSize = 14, HorizontalAlignment = HorizontalAlignment.Center, }; r.ReportHeaderSection.Controls.Add (invTextTb); var invNumberTb = new TextBlock (){ FieldName ="invoice.Number", FieldKind = FieldKind.Parameter, Text = "Invoice", Width = r.Width, FontSize = 14, Top = 5.mm(), HorizontalAlignment = HorizontalAlignment.Center, FontColor = Color.White }; r.ReportHeaderSection.Height = 30.mm (); r.ReportHeaderSection.Controls.Add (invNumberTb); r.ReportHeaderSection.BackgroundColor = Color.Silver; //------------------- //page header section //------------------- var phLine = new Line (){ Location = new Point(0,10.mm()), End = new Point(r.Width,10.mm()), ExtendToBottom = true}; r.PageHeaderSection.Controls.Add (phLine); //index label var indhTb = new TextBlock () {FontWeight = FontWeight.Bold, Text = "Ind", Width = 10.mm()}; r.PageHeaderSection.Controls.Add (indhTb); // description label var deschTb = new TextBlock () {FontWeight = FontWeight.Bold,Text = "Description", Left = 12.mm(), Width = 20.mm()}; r.PageHeaderSection.Controls.Add (deschTb); // quantity label var qnthTb = new TextBlock () {FontWeight = FontWeight.Bold, Text = "Quantity", Left = 42.mm()}; r.PageHeaderSection.Controls.Add (qnthTb); // price field var prthTb = new TextBlock () {FontWeight = FontWeight.Bold,Text = "Price", Left = 60.mm(),Width = 30.mm()}; r.PageHeaderSection.Controls.Add (prthTb); //--------------- //details section //--------------- //do not allow break detail section across page r.DetailSection.KeepTogether = true; r.DetailSection.Height = 6.mm (); //index field var indTb = new TextBlock () { FieldName = "Index", FieldKind = FieldKind.Data, Text = "00", Left = 1.2.mm(), Width = 10.mm()}; r.DetailSection.Controls.Add (indTb); // description field var descTb = new TextBlock () { FieldName = "Description", FieldKind = FieldKind.Data, Text = "Desc", Left = 12.mm(), Width = 35.mm()}; r.DetailSection.Controls.Add (descTb); // quantity field var qntTb = new TextBlock () { FieldName = "Quantity", FieldKind = FieldKind.Data, Text = "0", Left = 47.mm(), Width = 5.mm(), }; r.DetailSection.Controls.Add (qntTb); // price field var prtTb = new TextBlock () { FieldName = "PricePerUnitGross", FieldTextFormat = "{0:C}", FieldKind = FieldKind.Data, Text = "0", Left = 62.mm(),Width = 20.mm()}; r.DetailSection.Controls.Add (prtTb); var line = new Line (){ Location = new Point(0,2.mm()), End = new Point(r.Width,2.mm()), ExtendToBottom = true}; r.DetailSection.Controls.Add (line); //just before processing we can change section properties r.DetailSection.OnBeforeControlProcessing += delegate(ReportContext rc, Control c) { if (rc.RowIndex % 2 == 0) { c.BackgroundColor = Color.LightGray; } else { ((TextBlock)(c as Section).Controls [1]).FontColor = Color.PaleVioletRed; } }; var lv0 = new Line (){ Location = new Point(1,0), End = new Point(1,2.mm()), ExtendToBottom = true}; r.DetailSection.Controls.Add (lv0); var lineV = new Line (){ Location = new Point(r.Width,2.mm()), End = new Point(r.Width,2.mm()), LineType = LineType.Dash, ExtendToBottom = true}; r.DetailSection.Controls.Add (lineV); //--------------- //Report footer //--------------- // price field var prtTotalLabelTb = new TextBlock () { FontWeight = FontWeight.Bold, HorizontalAlignment = HorizontalAlignment.Right, FontSize = 12, FieldKind = FieldKind.Parameter, Text = "Total: ", Left = 50.mm(), Width = 10.mm() }; r.ReportFooterSection.Controls.Add (prtTotalLabelTb); var prtTotalTb = new TextBlock () { FontWeight = FontWeight.Bold, FieldName = "invoice.TotalGross", FieldTextFormat = "{0:C}", FontSize = 12, FieldKind = FieldKind.Parameter, Text = "0", Left = 62.mm(), Width = 40.mm() }; r.ReportFooterSection.Controls.Add (prtTotalTb); //--------------- //Page footer //--------------- var fl = new Line (){ Location = new Point(0,1), End = new Point(r.Width,1)}; r.PageFooterSection.Controls.Add (fl); var pnTb = new TextBlock () { FieldName = "#PageNumber", FieldTextFormat = "{0:C}", FieldKind = FieldKind.Expression, Text = "0", Left = (r.Width-30).mm(), Width = 10.mm(), HorizontalAlignment = HorizontalAlignment.Right, Top = 2.mm()}; r.PageFooterSection.Controls.Add (pnTb); r.PageFooterSection.BackgroundColor = Color.LightBlue; #region example invoice datasource //example invoice class... Invoice invoice = new Invoice () { Number = "01/12/2010", CreationDate = DateTime.Now, Positions = new List<InvoicePosition>() }; for (int i = 0; i < 82; i++) { invoice.Positions.Add ( new InvoicePosition () { Index = i+1, Quantity = 1, Description = "Reporting services " + (i + 1).ToString(), PricePerUnitGross = ((i * 50) / (i + 1)) + 1 } ); } invoice.Positions [4].Description = "here comes longer position text to see if position will extend section height"; invoice.Positions [11].Description = "another longer position text to see if position will extend section height"; //Total gross ... invoice.TotalGross = invoice.Positions.Sum (p => p.PricePerUnitGross * p.Quantity); #endregion ObjectDataSource<InvoicePosition> objectDataSource = new ObjectDataSource<InvoicePosition>(invoice.Positions); objectDataSource.AddField ("Index",x=>x.Index); objectDataSource.AddField ("Description",x=>x.Description); objectDataSource.AddField ("Quantity",x=>x.Quantity); objectDataSource.AddField ("PricePerUnitGross",x=>x.PricePerUnitGross); r.DataSource = objectDataSource; //we can get cairo context before and after rendering each page //to draw custom shapes, texts (e.g watermarks etc) //here modified example from http://www.mono-project.com/Mono.Cairo r.OnAfterPageRender += delegate(ReportContext rc, Page p) { if (rc.CurrentPageIndex % 2 > 0) { Cairo.Context gr = rc.RendererContext as Cairo.Context; gr.MoveTo (50.mm (), 100.mm ()); gr.CurveTo (50.mm (), 50.mm (), 50.mm (), 50.mm (), 100.mm (), 50.mm ()); gr.CurveTo (100.mm (), 100.mm (), 100.mm (), 100.mm (), 50.mm (), 100.mm ()); gr.ClosePath (); // Save the state to restore it later. That will NOT save the path gr.Save (); Cairo.Gradient pat = new Cairo.LinearGradient (50.mm (),100.mm (), 100.mm (),50.mm ()); pat.AddColorStop (0, new Cairo.Color (0,0,0,0.3)); pat.AddColorStop (1, new Cairo.Color (1,0,0,0.2)); gr.Pattern = pat; // Fill the path with pattern gr.FillPreserve (); // We "undo" the pattern setting here gr.Restore (); // Color for the stroke gr.Color = new Cairo.Color (0,0,0); gr.LineWidth = 1.px (); gr.Stroke (); } }; var parameters = new Dictionary<string,object>{ {"invoice.Number",invoice.Number}, {"invoice.CreationDate",invoice.CreationDate}, {"invoice.TotalGross",invoice.TotalGross}, }; r.ExportToPdf ("invoice.pdf", parameters); r.Save ("report.mrp"); }
// assign default user name letter public static void AssignDefaultUserNameLetter(Literal categoryID, ObjectDataSource ObjectDataSource1, GridView GridView1, Boolean IsPostBack) { // if not a postback if (IsPostBack) return; // declare variable for filter query string string userFirstLetter = HttpContext.Current.Request.QueryString["az"]; // check for category ID if (String.IsNullOrEmpty(userFirstLetter)) { // display default category userFirstLetter = "%"; } // display requested category categoryID.Text = string.Format(" ... ({0})", userFirstLetter); // specify filter for db search ObjectDataSource1.SelectParameters["UserName"].DefaultValue = userFirstLetter + "%"; // call RefreshGridView method from above in global methods RefreshGridView(GridView1); }
// Constructors public ObjectDataSourceView(ObjectDataSource owner, string name, System.Web.HttpContext context) {}
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); } } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { // create controls from above array... foreach (StructControl ctrl in m_controls) { ObjectDataSource ods = new ObjectDataSource(ctrl.DataSource, ctrl.SelectMethod); ods.DataObjectTypeName = "System.Guid"; DropDownList dd = new DropDownList(); dd.DataTextField = ctrl.TextField; dd.DataValueField = ctrl.ValueField; dd.ID = ctrl.Title.Replace(' ', '_'); dd.DataSource = ods; dd.DataBind(); dd.SelectedIndexChanged += new EventHandler(dd_SelectedIndexChanged); dd.PreRender += new EventHandler(dd_PreRender); dd.AutoPostBack = true; Panel1.Controls.Add(new LiteralControl(string.Format("<div class='field'><label class='{0}'>{1}</label><br/>", ctrl.Required, ctrl.Title))); Panel1.Controls.Add(dd); Panel1.Controls.Add(new LiteralControl("</div>")); } if (!IsPostBack) { SetText("Created_By", User.Identity.Name, false); string Id = Request.QueryString["Id"]; if (Id == null) { SetText("Status", "Pending", false); SetText("Group", "S&P", true); DropDownList ddd = Panel1.FindControl("Product") as DropDownList; ddd.Items.Insert(0, ""); SetText("Product", "", true); } else { TicketsTableAdapter ta = new TicketsTableAdapter(); Tracker.TicketsDataTable dt = ta.GetTicket(new Guid(Id)); SetValue("Dept", dt[0].DeptId); SetValue("Group", dt[0].GroupId); SetValue("Team", dt[0].TeamId); SetValue("Product", dt[0].ProjectId); SetValue("Status", dt[0].StatusId); SetValue("Priority", dt[0].PriorityId); SetValue("Created_By", dt[0].CreatedBy); SetValue("Requested_By", dt[0].RequestedBy); try { SetValue("Business_Unit_Rep", dt[0].BusinessUnitRep); } catch { } Summary.Text = dt[0].Summary; Description.Text = dt[0].Description; Actual_Hours.Text = dt[0].ActualHours.ToString(); Actual_Cost.Text = dt[0].ActualCost.ToString(); TicketId.Text = dt[0].Id.ToString(); Create.Text = "Assign"; CreateAndAssign.Text = "Update"; CreateAndAssign.OnClientClick = "Update_Click"; NeedsQA.Checked = dt[0].QARequired; try { ReceivedDate.Text = dt[0].ReceivedOn.ToShortDateString(); } catch { ReceivedDate.Text = ""; } try { DueToQADate.Text = dt[0].QAStartDate.ToShortDateString(); } catch {DueToQADate.Text = "";} try { QACompleteDate.Text = dt[0].QACompletedDate.ToShortDateString(); } catch { QACompleteDate.Text = ""; } try { ImplementationDate.Text = dt[0].PlannedImplementationDate.ToShortDateString(); } catch { ImplementationDate.Text = ""; } try { UserCompleteDate.Text = dt[0].UserTestCompleteDate.ToShortDateString(); } catch { UserCompleteDate.Text = ""; } try { UserTestDueDate.Text = dt[0].UserTestDueDate.ToShortDateString(); } catch { UserTestDueDate.Text = ""; } } QAPanel.Visible = (((DropDownList)Panel1.FindControl("Status")).SelectedItem.Text == "Pending") || (((DropDownList)Panel1.FindControl("Status")).SelectedItem.Text == "In Progress"); InProgressPanel.Visible = (((DropDownList)Panel1.FindControl("Status")).SelectedItem.Text == "In Progress"); } }
protected void Button3_Click(object sender, EventArgs e) { ReportDataSource rds = new ReportDataSource(); rds.DataSourceId = "_SearchByDiseaseName"; rds.Name = "SearchByDiseaseName"; ObjectDataSource _SearchByDiseaseName = new ObjectDataSource("PaombongDataSetTableAdapters.SearchByDiseaseNameTableAdapter", "GetData"); rds.Value = _SearchByDiseaseName; ReportPaombong.LocalReport.ReportPath = Server.MapPath("Report_SearchByDiseaseName.rdlc"); ReportPaombong.LocalReport.DisplayName = "PaombongPatientsConsultation"; ReportPaombong.LocalReport.DataSources.Clear(); ReportPaombong.LocalReport.DataSources.Add(rds); ReportPaombong.LocalReport.Refresh(); }
protected void rdbtn_Inventory_CheckedChanged(object sender, EventArgs e) { if (rdbtn_Inventory.Checked) { MultiView1.Visible = false; MultiView3.Visible = false; MultiView2.Visible = true; MultiView2.SetActiveView(InventoryView); ReportDataSource rds_Inventory = new ReportDataSource(); rds_Inventory.DataSourceId = "_MedicineLog_"; rds_Inventory.Name = "MedicineLog"; ObjectDataSource _MedicineLog_ = new ObjectDataSource("PaombongDataSetTableAdapters.MedicineLogTableAdapter", "GetData"); rds_Inventory.Value = _MedicineLog_; ReportPaombong.LocalReport.ReportPath = Server.MapPath("Report_MedicineLog.rdlc"); ReportPaombong.LocalReport.DisplayName = "PaombongMedicineLog"; ReportPaombong.LocalReport.DataSources.Clear(); ReportPaombong.LocalReport.DataSources.Add(rds_Inventory); ReportPaombong.LocalReport.Refresh(); ReportPaombong.Visible = true; Label4.Visible = true; Label5.Visible = true; ddlLogType.Visible = true; //From Other Type Of Reports //Reports Label1.Visible = false; Label2.Visible = false; Label3.Visible = false; DropDownList1.Visible = false; ddlQuarter.Visible = false; //Consultation Label6.Visible = false; rdbtn_Age.Visible = false; rdbtn_Barangay.Visible = false; rdbtn_Disease.Visible = false; rdbtn_Month.Visible = false; rdbtn_Year.Visible = false; Label7.Visible = false; DropDownList2.Visible = false; Label8.Visible = false; ddlDisease.Visible = false; Label9.Visible = false; ddlAge.Visible = false; Label10.Visible = false; ddlMonth.Visible = false; Label11.Visible = false; ddlYear.Visible = false; } }
protected void rdbtn_Year_CheckedChanged(object sender, EventArgs e) { if (rdbtn_Year.Checked) { MultiView1.Visible = true; MultiView1.SetActiveView(YearView); txtFilterby.Text = "Year"; ReportDataSource rds_Year = new ReportDataSource(); rds_Year.DataSourceId = "_YearConsult"; rds_Year.Name = "SearchByYear"; ObjectDataSource _YearConsult = new ObjectDataSource("PaombongDataSetTableAdapters.SearchByYearTableAdapter", "GetData"); rds_Year.Value = _YearConsult; ReportPaombong.LocalReport.ReportPath = Server.MapPath("Report_SearchByYear.rdlc"); ReportPaombong.LocalReport.DisplayName = "PaombongPatientsConsultation_YearSearch"; ReportPaombong.LocalReport.DataSources.Clear(); ReportPaombong.LocalReport.DataSources.Add(rds_Year); ReportPaombong.LocalReport.Refresh(); ReportPaombong.Visible = true; Label11.Visible = true; ddlYear.Visible = true; //Age Label9.Visible = false; ddlAge.Visible = false; Label14.Visible = false; DropDownList5.Visible = false; //Barangay Label7.Visible = false; Label12.Visible = false; DropDownList3.Visible = false; DropDownList2.Visible = false; Label16.Visible = false; DropDownList7.Visible = false; //Disease Label8.Visible = false; Label13.Visible = false; DropDownList4.Visible = false; ddlDisease.Visible = false; DropDownList6.Visible = false; Label15.Visible = false; //Month Label10.Visible = false; ddlMonth.Visible = false; DropDownList8.Visible = false; Label17.Visible = false; } }
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { var divControl = e.Item.FindControl("SessionPageBreakId"); // make better later, but for now, admin gets page break. divControl.Visible = Utils.CheckUserIsAdmin(); int sessionID = ((SessionsODS.DataObjectSessions) e.Item.DataItem).Id; var dropDownListTracks = (DropDownList) e.Item.FindControl("DropDownListTracks"); dropDownListTracks.Items.Add(new ListItem("--Choose Track", "-1")); dropDownListTracks.Items.Add(new ListItem("--Remove From Track", sessionID.ToString())); foreach (var trackResult in TrackResults) { var listItem = new ListItem(trackResult.Named, trackResult.Id.ToString(), true); dropDownListTracks.Items.Add(listItem); } // select currently assigned track if any List<int> tracks = (from myData in TrackSessionResults where myData.SessionId == sessionID select myData.TrackId).ToList(); if (tracks != null && tracks.Count > 0) { int trackId = tracks[0]; int cntx = 0; foreach (ListItem ddlINdex in dropDownListTracks.Items) { if (ddlINdex.Value.Equals(trackId.ToString())) { dropDownListTracks.SelectedIndex = cntx; } cntx++; } } var categoryRepeater = (Repeater) e.Item.FindControl("RepeaterTagNamesBySession"); //DataRowView drv = (DataRowView)e.Item.DataItem; //int sessionID = (int)drv.Row.ItemArray[0]; // SELECT SessionTags.tagid, Tags.TagName // FROM SessionTags INNER JOIN // Tags ON SessionTags.tagid = Tags.id // WHERE (SessionTags.sessionId = @sessionId) //ObjectDataSource ods = new ObjectDataSource("SessionTagsByNameTableAdapters.DataTableSessionTagsByNameTableAdapter", // "GetData"); //// $$$ THIS SHOULD REALLY BE A CACHE THAT WE CAN CLEAR. //ods.CacheDuration = 15; //ods.EnableCaching = true; //ods.SelectParameters.Add("sessionID", sessionID.ToString()); //categoryRepeater.DataSource = ods; //categoryRepeater.DataBind(); var ods = new ObjectDataSource { DataObjectTypeName = "DataObjectTags", TypeName = "CodeCampSV.SessionsODS", SelectMethod = "GetTagsBySession", CacheDuration = Utils.RetrieveSecondsForSessionCacheTimeout(), EnableCaching = true }; ods.SelectParameters.Add("sessionID", sessionID.ToString()); ods.SelectParameters.Add("maxReturn", Utils.MaxSessionTagsToShow.ToString()); categoryRepeater.DataSource = ods; categoryRepeater.DataBind(); //int cnt = categoryRepeater.Items.Count; string userName = Context.User.Identity.IsAuthenticated ? Context.User.Identity.Name : "NotLoggedIn"; SessionsODS.DataObjectSessions frame = e.Item.DataItem as SessionsODS.DataObjectSessions; List<string> labels = new List<string> {"Not Interested", "Interested", "Plan On Attending"}; int cnt = 0; foreach (string rbName in labels) { RadioButton rbClick = (RadioButton) e.Item.FindControl(string.Format("rbClick{0}", (cnt + 1))); string str = string.Format("javascript:return MakeExclusiveCheck('{0}',{1},'{2}','{3}',{4})", rbClick.ClientID, frame.Id, userName, labels[cnt], cnt); rbClick.Attributes.Add("onclick", str); //rbClick.Attributes.Add("time", frame.Sessiontimesid.ToString()); rbClick.CssClass = string.Format("SessionTime{0}", frame.Sessiontimesid); cnt++; } } }
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(); }
/// <summary> /// bind to current cartons objectdatasource in code /// </summary> protected void currentcartons_DataBind() { string _titleid = this.dxhforder.Contains("titleid") ? this.dxhforder.Get("titleid").ToString() : "-1"; if (!string.IsNullOrEmpty(_titleid)) { ObjectDataSource _ds = new ObjectDataSource(); _ds.TypeName = "DAL.Logistics.PublishipAdvanceCartonTableCustomcontroller"; //select _ds.SelectMethod = "CartonsFetchByPATitleID"; _ds.SelectParameters.Add("PATitleID", DbType.Int32, _titleid); //delete _ds.DeleteMethod = "CartonDelete"; _ds.DeleteParameters.Add("PubAdvCartonID", DbType.Int32, "-1"); //update _ds.UpdateMethod = "CartonUpdate"; _ds.UpdateParameters.Add("PubAdvCartonID", DbType.Int32, "-1"); _ds.UpdateParameters.Add("PATitleID", DbType.Int32, "-1"); _ds.UpdateParameters.Add("CartonLength", DbType.Decimal, "-1"); _ds.UpdateParameters.Add("CartonWidth", DbType.Decimal, "-1"); _ds.UpdateParameters.Add("CartonHeight", DbType.Decimal, "-1"); _ds.UpdateParameters.Add("CartonWeight", DbType.Decimal, "-1"); this.dxgrdcurrentcartons.DataSource = _ds; this.dxgrdcurrentcartons.KeyFieldName = "PubAdvCartonID"; this.dxgrdcurrentcartons.DataBind(); } else { this.dxgrdcurrentcartons.DataSource = null; this.dxgrdcurrentcartons.KeyFieldName = ""; this.dxgrdcurrentcartons.DataBind(); } }