如何在UI层中编写代码

编程入门 行业动态 更新时间:2024-10-27 03:43:08
本文介绍了如何在UI层中编写代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

这是 数据访问(DA)层

This is the Data Access (DA) layer

public class TutorRegistratonDAL { SqlConnection con = new SqlConnection(); SqlTransaction tr = new SqlTransaction(); public DataSet Inserttutor(DataSet ds_sub,DataSet ds_lang,DataSet ds_time) { con.ConnectionString = StrCon; try { con.Open(); SqlBulkCopy sub_copy = new SqlBulkCopy(con); sub_copy.DestinationTableName = "tutor_subjects"; DataTable sub_dt = new DataTable(); sub_dt= ds_sub.Tables[0]; sub_copy.WriteToServer(sub_dt); SqlBulkCopy lang_copy = new SqlBulkCopy(con); lang_copy.DestinationTableName = "tutor_languages"; DataTable lang_dt = new DataTable(); lang_dt = ds_lang.Tables[0]; lang_copy.WriteToServer(lang_dt); tr.Commit(); return true; } catch (Exception ex) { tr.Rollback(); return false; } finally { con.Close(); } }

这是 业务层

This is the Business layer

public class TutorRegistratonBAL { public DataSet Inserttutor( DataSet ds_sub,DataSet ds_lang) { TutorRegistratonDAL DALobj = new TutorRegistratonDAL(); return DALobj.Inserttutor(ds_sub,ds_lang); } }

UI层的代码将如何?

How would the code for the UI layer be?

推荐答案

好吧,通常UI会在其中抓取您需要的数据,并在将其发送到数据库之前对其进行验证.业务逻辑层.它也可以作为用户的信息源,既可以是系统的反馈,也可以是应该返回结果的某些操作的结果. 话虽这么说,您如何期望我们知道您想要在UI上显示什么? Well, usually the UI is there to grab the data that you need, validating it prior to sending it to the Business Logic Layer. It also acts as a source of information for the user, either as feedback from the system or the result of some action that has been performed that is supposed to return a result. Having said that, how do you expect us to know what it is you want on the UI?

sankarbrr写道: sankarbrr wrote:

UI层的代码将如何?

How would the code for the UI layer be?

嗯,你的意思不是哪里吗? 如果是这样,可能是您从中复制其他代码的位置.

Hmm, dont you mean where? If so, probably the same place you copied the other code from.

需要更多信息. 您希望UI如何显示或处理数据,或需要向其输出什么? 没有通用的UI解释. 给我们一个线索. More information required. How do you want the UI to look, or handle data, or what outputs to it will be required. There is no Generic UI interpretation. Give us a clue.

更多推荐

如何在UI层中编写代码

本文发布于:2023-07-22 10:27:32,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1186695.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:层中   代码   如何在   UI

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!