如何使用 silverlight 和域上下文进行联接查询

发布于 2024-11-03 02:40:08 字数 1887 浏览 1 评论 0原文

在 ASP.Net 中,我们会为此编写一个联接查询,但在 silverlight 中不支持联接查询。

在 SilverlightApplication.Xaml.cs

   private void btnreject_Click(object sender, RoutedEventArgs e)

        {

            DomainContext objectcontext=new DomainContext();    
            EMPLOYEE emp = new EMPLOYEE();    //EMPLOYEE is a Table name    
            string from = emp.EMPEMAIL;    
            string to = emp.EMP_EMPEMAIL;  //How To Get a To Address Here That is The Email id is  Based on Subcode in leave Table 

            if (DataGrid1.SelectedItem != null)    
            {   
                objectcontext.Load(this.objectcontext.GetLeaveCancellationQuery(Int32.Parse(WebContext.Current.User.Name))).Completed += new            EventHandler(LeaveApprovCancelApplication_Completed);    
                objectcontext.SubmitChanges();   
                objectcontext.sendemail(From,To);

            }

        }

表结构:

我有一个数据网格,如下所示:

CheckBoxField,EmployeeName, EmployeeId,LeaveStatus,SubCode    
* , XX , 1 , Pending ,2

我有 2 个表,它们是 Employee 表和 Leave 表...

Employee 表有以下数据字段:

Employee Id, EmployeeName,Email    
1 , XX ,[email protected]    
2 ,YY ,[email protected] 

Leave 表有以下字段:

EmployeeId, EmployeeName, LeaveStatus, SubCode    
1 ,XX ,Pending ,2 

我的 DataGrid ItemSource = Leavetable 我正在使用 DomainServiceClass 和 Ado.NetDataEntityModel。

当用户选中 DataGrid 中的复选框并单击“取消”按钮时, 休假状态将更新为“已取消”,并且邮件将自动发送给该员工

,其中邮件发件人地址将由 EmployeeTable 获取 通过LeaveTable SubCode=EmployeeTable EmployeeID加入。然后等于SubCode的电子邮件地址将被视为收件人地址

我该如何制作

In ASP.Net we would write a join query for this but in silverlight join query are not supported.

In SilverlightApplication.Xaml.cs

   private void btnreject_Click(object sender, RoutedEventArgs e)

        {

            DomainContext objectcontext=new DomainContext();    
            EMPLOYEE emp = new EMPLOYEE();    //EMPLOYEE is a Table name    
            string from = emp.EMPEMAIL;    
            string to = emp.EMP_EMPEMAIL;  //How To Get a To Address Here That is The Email id is  Based on Subcode in leave Table 

            if (DataGrid1.SelectedItem != null)    
            {   
                objectcontext.Load(this.objectcontext.GetLeaveCancellationQuery(Int32.Parse(WebContext.Current.User.Name))).Completed += new            EventHandler(LeaveApprovCancelApplication_Completed);    
                objectcontext.SubmitChanges();   
                objectcontext.sendemail(From,To);

            }

        }

Table Structure:

I have a Data Grid as follows:

CheckBoxField,EmployeeName, EmployeeId,LeaveStatus,SubCode    
* , XX , 1 , Pending ,2

and I have 2 tables They Are Employee table, and Leave Table...

Employee Table Have Following datafields:

Employee Id, EmployeeName,Email    
1 , XX ,[email protected]    
2 ,YY ,[email protected] 

Leave Table Have The Following Fields :

EmployeeId, EmployeeName, LeaveStatus, SubCode    
1 ,XX ,Pending ,2 

And My DataGrid ItemSource = Leavetable
Am Using DomainServiceClass and Ado.NetDataEntityModel

When User Check The CheckBox In DataGrid And Click The Cancel Button. The Leavestatus Will Be UpDated As "Cancelled" And Mail Would Be Automatically Send To The Employee

In This The Mail FromAddress Would Be TakenBy EmployeeTable
join by LeaveTable SubCode=EmployeeTable EmployeeID.Then The Email Address Of Equal To SubCode Will Be taken as To Address

How can i make it

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文