我需要使用连接的体系结构的3层代码. ado.net [C#,windows] [英] i need 3-tier code using connected architecture. ado.net [C#,windows]

查看:63
本文介绍了我需要使用连接的体系结构的3层代码. ado.net [C#,windows]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

1)您必须进行符合规定的注册.
符合标准(CompliantID,Comp.Date,IpAdress,ProblemDesc,Resp)
合规ID将自动生成为...如果是响应.是从M001开始的管理方式.
如果Network Person负责,则以N001开头;如果Others负责,则以O001开头.
任务2:
______
创建一个表作为已解决.并采取自己的领域.一旦合规性得到解决,该记录便会从投诉移至解决".
任务3:
制作一个表单作为仪表板,并在数据网格中显示所有投诉.
如果7天之内未解决任何合规问题,则该记录将以红色显示.
编码标准
1)所有脚本文件
2)要使用存储过程.
3)前端代码必须在业务对象中,而不是事件中.
4)严格执行命名标准.

1) You have to make a compliant register.
Compliants(CompliantID,Comp.Date,IpAdress,ProblemDesc,Resp)
Compliant ID to be generated automatically as… If Resp. is Management Start with M001 like that..
If Network Person is responsible start with N001 if Others are responsible start with O001 like that.
Task 2 :
______
Create a table as Resolved. And take ur own fields. Once the compliant get resolved, the the record to be moved from Complaints to Resolve.
Task 3:
Make a form as dashboard, and display all complaints in the data grid.
If any compliant not resolved in 7days time, that record to be displayed in Red color.
Coding Standards
1) All Script Files
2) To be used stored procedures.
3) Front-end code must be in business object, not in the events.
4) Naming Standards to be implemented strictly.

/*this is class file  */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Text;

namespace compliants
{

    #region class compliants

    class compliants
    {
        #region variables
        SqlConnection connection;
         SqlCommand command;
        SqlDataReader dr;
      
        #endregion variables

        #region properties
        public int ID
        { get;
          set; 
        }
        public string compliantID
        {
            get;
            set;
        }
        public DateTime compliantDate
        {
            get;
            set;
        }
        public string IpAddress
        {
            get;
            set;
        }
        public string ProblemDescription
        {
            get;
            set;
        }
       
        public string Responsibility
        {
            get;
            set;

        }
       
       
        #endregion properties


        #region methods
        public void Savecompliants(compliants objcompliants)
        {
            
            compliantID = objcompliants.compliantID;
           compliantDate = objcompliants.compliantDate;
            IpAddress = objcompliants.IpAddress;
            ProblemDescription = objcompliants.ProblemDescription;
            Responsibility = objcompliants.Responsibility;
        }
      
     /*   public string GenerateID(String compliantID)
        {

            connection = connectionHelper.GetConnection();
            SqlCommand cmd = new SqlCommand("select top 1 CompliantID from Compliants where CompliantID like ''" + compliantID + "%'' order by ID DESC",connection);
            connection.Open();
            string c = compliantID;

            object b = command.ExecuteScalar();
            string num = "";
            if (b == null)
            {
                num = c + "001";
            }
            else
            {

               num = b.ToString();
                int n=Convert.ToInt32(num.Substring(1,num.Length-1));
                n++;
                if (n >= 1 && n <= 9)
                   num = c+"00"+n;
                if (n >= 10 && n <= 99)
                    num = c+"0"+n;
                if (n >= 100 && n <= 999)
                   num = c+n;
               }
            connection.Close();
            return compliantID;
        }*/
        public string Insertcompliants()
        { 
          
            connection = connectionHelper.GetConnection();
             command = new SqlCommand("proccomplaint", connection);
             connection.Open();
            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.AddWithValue("@compliantID",compliantID);
            command.Parameters.AddWithValue("@CompliantDate",compliantDate);
            command.Parameters.AddWithValue("@IpAddress",IpAddress);
            command.Parameters.AddWithValue("@ProblemDescription",ProblemDescription);
            command.Parameters.AddWithValue("@Responsibility",Responsibility);
           
            command.ExecuteNonQuery();
           
            string compliantid =Convert.ToString(command.Parameters["@CompliantID"].Value);
            return compliantid;
        }
        #endregion methods
    }

    #endregion class compliants

}


/*presentation layer */

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace compliants
{
    public partial class Form1 : Form
    {
        
        public Form1()
        {
            InitializeComponent();
        }

        
        private void btnRegister_Click(object sender, EventArgs e)
        {
            compliants objcompliants = new compliants();

            objcompliants.compliantID = txtCompliantID.Text;
            objcompliants.compliantDate = dtpCompliantDate.Value;
            objcompliants.IpAddress = txtIpAddress.Text;
            objcompliants.ProblemDescription = txtDescription.Text;
            objcompliants.Responsibility = cmbResponsibility.Text;


            compliants obj = new compliants();
            obj.Savecompliants(objcompliants);
            string compliantid = obj.Insertcompliants();
            txtCompliantID.Text = compliantid;
            MessageBox.Show("success");

        

        }
  
      /*  public void cmbResponsibility_SelectedIndexChanged(object sender, EventArgs e)
        {

              compliants objcompliants = new compliants();

              compliants obj = new compliants();
          
           
                         
           
            if (cmbResponsibility.Text == "Select UserType")
            {
                MessageBox.Show("Please select user !");
            }
            else if (cmbResponsibility.SelectedIndex == 0)
            {
               txtCompliantID.Text= "M";
            }
            else if (cmbResponsibility.SelectedIndex == 1)
            {
                txtCompliantID.Text ="N";
            }
            else
            {
                txtCompliantID.Text ="O";
            }

            obj.GenerateID(txtCompliantID.Text);
        }*/
               
    }
}

推荐答案

很抱歉,但此论坛不在这里,因此您可以找其他人为您做家庭作业或上课.自行尝试,如果遇到特定的技术问题,请返回此处.
Sorry, but this forum is not here so you can get someone else to do your home or course work for you. Go and try on your own, and come back here when you have a specific technical question.


我们不做家庭作业-这是有原因的-还请注意您的讲师可能是这里的成员.

如果您对某些特定的内容感到困惑,请发布代码等,然后人们会很乐意为您提供帮助.
We don''t do home work - it is set for a reason - also please note that your lecturer may be a member here.

If you get stuck with something in particular post your code etc and people will be happy to help.


嘿,至少尝试一下您自己的事情,这样我们才能帮助您继续前进.是不可接受的,尝试点什么,如果您需要帮助,那么我们会在这里为您提供帮助.
一切顺利.
Hey at least try something your self, so we can help you to move on..this is not acceptable, try something and if you need help in that, then we are here to help you..
All the best.


这篇关于我需要使用连接的体系结构的3层代码. ado.net [C#,windows]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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