void dropdownElmnt() { using (var datacontext = new LinqDataSource()) { var datas = from x in context.elementservicestbls select x.elementCode; DDElement.DataSource = datas.ToList(); DDElement.DataTextField = "elementCode"; DDElement.DataValueField = "elementCode"; DDElement.DataBind(); } }
void dropdowncmd() { using (var datacontext = new LinqDataSource()) { var datas = from x in context.comoditytbls orderby x.comodityName select new { x.comodityNo, x.comodityName }; DDComodity.DataSource = datas.ToList(); DDComodity.DataTextField = "comodityName"; DDComodity.DataValueField = "comodityNo"; DDComodity.DataBind(); } }
void dropdownId() { using (var datacontext = new LinqDataSource()) { var datas = from x in context.standardtbls join y in context.comoditytbls on x.comodityNo equals y.comodityNo where x.comodityNo == y.comodityNo select y.comodityName; DDStdId.DataSource = datas.ToList(); DDStdId.DataTextField = "comodityName"; DDStdId.DataValueField = "comodityNo"; DDStdId.DataBind(); } }
protected void Presupuesto_Montos_LinqDataSource_Selecting(object sender, LinqDataSourceSelectEventArgs e) { LinqDataSource myLinqDataSource = this.Presupuesto_Montos_LinqDataSource; dbContabDataContext dbContab = new dbContabDataContext(); var query = dbContab.Presupuesto_Montos.Select(m => m); if (Anos_DropDownList.SelectedIndex != -1) { query = query.Where(m => m.Ano == Convert.ToInt16(this.Anos_DropDownList.SelectedValue)); } if (Monedas_DropDownList.SelectedIndex != -1) { query = query.Where(m => m.Moneda == Convert.ToInt32(Monedas_DropDownList.SelectedValue)); } if (CiasContab_DropDownList.SelectedIndex != -1) { query = query.Where(m => m.CiaContab == Convert.ToInt32(this.CiasContab_DropDownList.SelectedValue)); } if (!string.IsNullOrEmpty(this.CodigoCuentaPresupuesto_TextBox.Text)) { if (this.CodigoCuentaPresupuesto_TextBox.Text.Contains("*")) { if (this.CodigoCuentaPresupuesto_TextBox.Text.StartsWith("*")) { query = query.Where(m => m.CodigoPresupuesto.EndsWith(this.CodigoCuentaPresupuesto_TextBox.Text.Replace("*", ""))); } else if (this.CodigoCuentaPresupuesto_TextBox.Text.EndsWith("*")) { query = query.Where(m => m.CodigoPresupuesto.StartsWith(this.CodigoCuentaPresupuesto_TextBox.Text.Replace("*", ""))); } else { query = query.Where(m => m.CodigoPresupuesto.Contains(this.CodigoCuentaPresupuesto_TextBox.Text)); } } else { query = query.Where(m => m.CodigoPresupuesto.Contains(this.CodigoCuentaPresupuesto_TextBox.Text)); } } e.Result = query; }
protected void Page_Load(object sender, EventArgs e) { //if (Request["__EVENTTARGET"] == "btnNew" && //Request["__EVENTARGUMENT"] == "MyArgument") //{ // //do something //} // Refund_R InvoiceItemGrid1.SetTypeOfInvoiceCoaItem(2); RefundId = Convert.ToInt32(Request["id"]); // find user control _sqlDataSourceInvoiceItems = InvoiceItemGrid1.GetSqlDataSourceInvoiceItems(); _radGridInvoiceItems = InvoiceItemGrid1.GetRadGridInvoiceItems(); // connect event of invoice Items. _radGridInvoiceItems.PreRender += _radGridInvoiceItems_PreRender; //_radGridInvoiceItems.MasterTableView.CommandItemSettings.ShowSaveChangesButton = false; FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.Refund); CreditMemoPayout1.SetReadonly(false); if (!IsPostBack) { //// new //if (Request["type"] == "0") //{ // // nothing //} //else //{ var cRefund = new CRefund(); var refund = cRefund.Get(RefundId); FileDownloadList1.GetFileDownload(refund.RefundId); InvoiceItemGrid1.InvoiceId = refund.InvoiceId; InvoiceItemGrid1.SetEditMode(true); CreditMemoPayout1.SetCreditVisible(true); var cCreditMemoPayout = new CCreditMemoPayout(); var creditMemoPayout = cCreditMemoPayout.Get(refund.CreditMemoPayoutId); CreditMemoPayout1.SetData(creditMemoPayout); //} } }
protected void Page_Load(object sender, EventArgs e) { // find user control _sqlDataSourceInvoiceItemsNew = InvoiceItemGridNew.GetSqlDataSourceInvoiceItems(); _radGridInvoiceItemsNew = InvoiceItemGridNew.GetRadGridInvoiceItems(); _radGridInvoiceItemsNew.PreRender += _radGridInvoiceItemsNew_PreRender; InvoiceItemGridNew.SetEditMode(false); // init FileDownloadList1.InitFileDownloadList((int)CConstValue.Upload.Refund); FileDownloadList1.SetVisibieUploadControls(false); if (!IsPostBack) { } SearchRefund(); }
private void SetApprovalList() { LinqDataSource LinqDataSourceApprovalList = ApprovalLine1.GetSqlDataSourceApprovalList(); if (LinqDataSourceApprovalList != null) { LinqDataSourceApprovalList.WhereParameters.Clear(); if (RadGridAgency.SelectedValue != null) { LinqDataSourceApprovalList.WhereParameters.Add("MenuSeqId", DbType.Int32, RadGridAgency.SelectedValue.ToString()); } else { LinqDataSourceApprovalList.WhereParameters.Add("MenuSeqId", DbType.Int32, "0"); } LinqDataSourceApprovalList.WhereParameters.Add("ApproveType", DbType.Int32, ((int)CConstValue.Approval.Agency).ToString()); LinqDataSourceApprovalList.Where = "ApproveType == @ApproveType and MenuSeqId == @MenuSeqId"; } }
private void RefreshApprovalList() { LinqDataSource LinqDataSourceApprovalList = ApprovalLine1.GetSqlDataSourceApprovalList(); if (LinqDataSourceApprovalList != null) { LinqDataSourceApprovalList.WhereParameters.Clear(); if (RadGridRefund.SelectedValue == null) { LinqDataSourceApprovalList.WhereParameters.Add("MenuSeqId", DbType.Int32, "0"); } else { LinqDataSourceApprovalList.WhereParameters.Add("MenuSeqId", DbType.Int32, RadGridRefund.SelectedValue.ToString()); } LinqDataSourceApprovalList.WhereParameters.Add("ApproveType", DbType.Int32, ((int)CConstValue.Approval.Refund).ToString()); LinqDataSourceApprovalList.Where = "MenuSeqId == @MenuSeqId AND ApproveType == @ApproveType"; } }
protected void Page_Load(object sender, EventArgs e) { // find user control _sqlDataSourceInvoiceItems = InvoiceItemGrid1.GetSqlDataSourceInvoiceItems(); _radGridInvoiceItems = InvoiceItemGrid1.GetRadGridInvoiceItems(); _radGridInvoiceItems.MasterTableView.CommandItemSettings.ShowSaveChangesButton = false; // Simple InvoiceItemGrid1.SetTypeOfInvoiceCoaItem(1); if (!IsPostBack) { InvoiceItemGrid1.SetEditMode(true); var cStudent = new CStudent(); var student = cStudent.GetStudentList(CurrentSiteLocationId); foreach (var stu in student) { RadComboBoxMenu.Items.Add(new RadComboBoxItem(cStudent.GetStudentName(stu) + "(" + stu.StudentNo + ")", stu.StudentId.ToString())); } } }
/// <summary> /// Creates a new instance of <see cref="LinqDataSource"/> with the same properties as the /// given <see cref="LinqDataSource"/>. /// </summary> /// <param name="source"></param> /// <returns></returns> public static LinqDataSource Clone(this LinqDataSource source) { Contract.Requires <ArgumentNullException>(source != null, "source is null."); var result = new LinqDataSource { ContextTypeName = source.ContextTypeName, TableName = source.TableName, EnableDelete = source.EnableDelete, EnableInsert = source.EnableInsert, EnableUpdate = source.EnableUpdate, Where = source.Where }; foreach (Parameter parameter in source.WhereParameters) { result.WhereParameters.Add(parameter); } return(result); } // TODO: Unit Test
public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //var scriptManager = (RadScriptManager)Page.Master.FindControl("RadScriptManager1"); //scriptManager.RegisterPostBackControl(RadToolBar1.FindItemByText("Excel")); if (CurrentGroupId == (int)CConstValue.UserGroupForAccountExcelExport.Accounting || CurrentGroupId == (int)CConstValue.UserGroupForAccountExcelExport.IT) { RadToolBar1.FindItemByText("Excel").Visible = true; RadToolBar1.FindItemByText("ExcelDetail").Visible = true; } } // find user control _sqlDataSourceInvoiceItems = InvoiceItemGrid1.GetSqlDataSourceInvoiceItems(); _radGridInvoiceItems = InvoiceItemGrid1.GetRadGridInvoiceItems(); // connect event of invoice Items. _radGridInvoiceItems.PreRender += _radGridInvoiceItems_PreRender; InvoiceListSearch(); }
/// <summary> /// Set the DataLoadOptions on a Linq To Sql datasource to force all the FK entities /// to be directly loaded. /// </summary> /// <param name="dataSource">The data source for which we want to preload FKs</param> /// <param name="rowType">The type of the entities returned by the data source</param> public static void LoadWithForeignKeys(this LinqDataSource dataSource, Type rowType) { dataSource.ContextCreated += delegate(object sender, LinqDataSourceStatusEventArgs e) { // This only applies to a DLinq data context var context = e.Result as DataContext; if (context == null) { return; } DataLoadOptions loadOptions = null; ParameterExpression tableParameter = null; System.Data.Linq.Mapping.MetaTable metaTable = context.Mapping.GetTable(rowType); foreach (System.Data.Linq.Mapping.MetaDataMember member in metaTable.RowType.DataMembers) { if (member.IsAssociation && !member.Association.IsMany) { if (member.Type.Equals(rowType)) { continue; } if (loadOptions == null) { loadOptions = new DataLoadOptions(); tableParameter = Expression.Parameter(rowType, "e"); } var memberExpression = Expression.Property(tableParameter, member.Name); loadOptions.LoadWith(Expression.Lambda(memberExpression, tableParameter)); } } if (loadOptions != null) { context.LoadOptions = loadOptions; } }; }
public static void RegisterListDefaults(LinqDataSource dataSource, HyperLink hyperLink) { hyperLink.PreRender += delegate(object sender, EventArgs e) { hyperLink.NavigateUrl = BuildInsertWithDefaultsUrl(dataSource); }; }
private static void RedirectToInsertWithDefaults(LinqDataSource datasource) { HttpContext.Current.Response.Redirect(BuildInsertWithDefaultsUrl(datasource)); }
public static void LoadWith <TEntity>(this LinqDataSource dataSource) { LoadWithForeignKeys(dataSource, typeof(TEntity)); }
public static void InitLinqDataSources(LinqDataSource lds) { Parameter InstanceIdParam = new Parameter("InstanceId", System.Data.DbType.Guid, MetricTrac.Bll.LinqMicajahDataContext.InstanceId.ToString()); lds.WhereParameters.Add(InstanceIdParam); }
public LinqDataSourceViewExt(LinqDataSource owner, string name, HttpContext context) : base(owner, name, context) { }
public static void LoadWithForeignKeys(this LinqDataSource dataSource, Type rowType) { throw new NotImplementedException(); }
/// <summary> /// Initializes a new instance of the <see cref="DataSourceView"/> class. /// </summary> /// <param name="owner">DataSource Instance</param> /// <param name="name">Data View Name</param> /// <param name="context">Http Context Instance</param> public DataSourceView(LinqDataSource owner, string name, HttpContext context) : base(owner, name, context) { this.owner = (DataSource)owner; }
public void SetViewType(LinqDataSource linqDataSource, RadGrid radGrid) { string whereString = string.Empty; object selectedText = ViewState["SelectedTextView"]; if (selectedText == null) { selectedText = "All"; } linqDataSource.TableName = GetTableNameForViewType(selectedText.ToString()); var approvalUserNameColumn = radGrid.Columns.FindByUniqueNameSafe("ApprovalUserName"); switch (selectedText.ToString()) { // All case "All": linqDataSource.OrderBy = "CreatedDate Desc"; if (approvalUserNameColumn != null) { approvalUserNameColumn.Visible = false; } break; // My Request case "My Request": linqDataSource.WhereParameters.Add("CreatedId", DbType.Int32, CurrentUserId.ToString()); whereString = "CreatedId == @CreatedId"; if (linqDataSource.Where.Length > 0) { whereString += " && "; } linqDataSource.Where = linqDataSource.Where.Insert(0, whereString); linqDataSource.OrderBy = "CreatedDate Desc"; if (approvalUserNameColumn != null) { approvalUserNameColumn.Visible = false; } break; // My Approval case "My Approval": linqDataSource.WhereParameters.Add("ApprovalUser", DbType.Int32, CurrentUserId.ToString()); linqDataSource.WhereParameters.Add("IsApprovalRequest", DbType.Boolean, bool.TrueString); linqDataSource.WhereParameters.Add("CreatedId", DbType.Int32, CurrentUserId.ToString()); whereString = "(ApprovalUser == @ApprovalUser && IsApprovalRequest == @IsApprovalRequest && CreatedId != @CreatedId)"; if (linqDataSource.Where.Length > 0) { whereString += " && "; } linqDataSource.Where = linqDataSource.Where.Insert(0, whereString); linqDataSource.OrderBy = "ApprovalStatus, CreatedDate Desc"; if (approvalUserNameColumn != null) { approvalUserNameColumn.Visible = true; } break; } }