如何在UI层中编写代码 [英] How to write a code in UI layer

查看:91
本文介绍了如何在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层中编写代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆