Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: Kindly help me i tried to do it for 3 days but i could not solve it. Pin
OriginalGriff26-Jul-23 23:47
mveOriginalGriff26-Jul-23 23:47 
Questionc# Pin
Impana D patel24-Jul-23 0:54
Impana D patel24-Jul-23 0:54 
AnswerRe: c# Pin
Richard Deeming24-Jul-23 1:08
mveRichard Deeming24-Jul-23 1:08 
AnswerRe: c# Pin
Richard MacCutchan24-Jul-23 1:33
mveRichard MacCutchan24-Jul-23 1:33 
AnswerRe: c# Pin
OriginalGriff24-Jul-23 1:55
mveOriginalGriff24-Jul-23 1:55 
Questionc# Pin
Impana D patel23-Jul-23 23:46
Impana D patel23-Jul-23 23:46 
AnswerRe: c# Pin
Richard MacCutchan24-Jul-23 0:03
mveRichard MacCutchan24-Jul-23 0:03 
QuestionWhat should be the principles of multilayer software design? Pin
farshad valizade 202323-Jul-23 22:00
farshad valizade 202323-Jul-23 22:00 
hi every body.I am coding with c# .net core and my first app is a multilayer database project.
this app get datat from user input control and add/del/edit on it.
I have made 3 project in my solution:
1 : Datalayer 2:Business Layer 3:View

in my forms I should Join three or four or more table with each other and show in a datagridview to the user.so I have coded all sql query in datalayer with ado.net bcoz it is easy to join table instead of EF.
I put my code here and you please see it and notice me about each layers.(I think in BLL layer I just didn't do anything special)

and In the UI I put all of my code that I think it is not very interesting.

so see it :
DAL :

C#
public static DataTable GetAll()
{
    using DataTable dt = new();
    try
    {
        string query = "
                        select
                            l.LineID,
                            s.SheetID,
                            z.ZoneID,
                            j.JointTypeID,
                            j.JointClassID ,
                            j.PipeClassID ,
                            j.HoldID,
                            l.[LineNo] ,
                            s.Sheet,
                            s.Rev ,
                            s.RevIndex ,
                            z.Unit,
                            z.Area,
                            s.SheetStatus as LineStatus,
                            j.JointID,
                            j.JointNo ,
                            j.JointIndex ,
                            j.JointStatus ,
                            cast(CAST(j.JointSize as decimal(18,2)) as float) as JointSize,
                            j.[Location],
                            j.Spool,
                            jt.JointType,
                            jc.JointClassName as Class,
                            pc.PipeClass,
                            m.MaterialName as Mat,
                            j.Thk
                        from
                        Joint  as j
                        inner join Sheet as s on s.SheetID = j.SheetID and s.VoidDate is null
                        inner join  Line as l on l.LineID=s.LineID
                        left join Zone as z on z.ZoneID = j.ZoneID
                        left join JointType as jt on jt.JointTypeID = j.JointTypeID
                        left join JointClass as jc on jc.JointClassID = j.JointClassID
                        left join PipingClass as pc on pc.PipeClassID = j.PipeClassID
                        left join Material as m on m.MaterialID = pc.MaterialID
                        left join MTO as m1 on m1.SheetID = j.SheetID AND m1.PTNo = Mat1
                        left join MTO as m2 on m2.SheetID = j.SheetID AND m2.PTNo = Mat2
                        ";
        using SqlCommand cmd = new SqlCommand(query, Connection.Conn);
        Connection.Open();
        using SqlDataReader rd = cmd.ExecuteReader();
        dt.Load(rd);

    }
    catch (SqlException ex)
    {
        Error = ex.Message;
    }
    finally
    {
        Connection.Close();
    }
    return dt;
}


BLL:
C#
public static DataTable GetAll()
      {
          return JointDAL.GetAll();
      }


UI:
C#
DG_Joint.DataSource = JointBLL.GetAll();


I put code in dgv contentclick() for show selected rows into textbox above it.
(There is another way like bindingsource for do it but it use only that table but my query joined many tables and it doesn't work.
I don't know if I wrote it explicitly or not, but what I mean by creating this topic is to review the multi-layer program, what codes should be written in each layer.

AnswerRe: What should be the principles of multilayer software design? Pin
Richard Deeming23-Jul-23 23:11
mveRichard Deeming23-Jul-23 23:11 
QuestionMulti-threading Pin
MAW3017-Jul-23 9:52
MAW3017-Jul-23 9:52 
AnswerRe: Multi-threading Pin
Gerry Schmitz17-Jul-23 15:32
mveGerry Schmitz17-Jul-23 15:32 
AnswerRe: Multi-threading Pin
Dave Kreskowiak17-Jul-23 15:53
mveDave Kreskowiak17-Jul-23 15:53 
QuestionParameterized Query Pin
Richard Andrew x6416-Jul-23 8:47
professionalRichard Andrew x6416-Jul-23 8:47 
AnswerRe: Parameterized Query Pin
Dave Kreskowiak16-Jul-23 10:44
mveDave Kreskowiak16-Jul-23 10:44 
GeneralRe: Parameterized Query Pin
Richard Andrew x6416-Jul-23 11:39
professionalRichard Andrew x6416-Jul-23 11:39 
AnswerRe: Parameterized Query Pin
OriginalGriff16-Jul-23 11:24
mveOriginalGriff16-Jul-23 11:24 
GeneralRe: Parameterized Query Pin
Richard Andrew x6416-Jul-23 11:42
professionalRichard Andrew x6416-Jul-23 11:42 
GeneralRe: Parameterized Query Pin
OriginalGriff16-Jul-23 18:34
mveOriginalGriff16-Jul-23 18:34 
GeneralRe: Parameterized Query Pin
Richard Andrew x6417-Jul-23 5:35
professionalRichard Andrew x6417-Jul-23 5:35 
AnswerRe: Parameterized Query Pin
Gerry Schmitz16-Jul-23 19:32
mveGerry Schmitz16-Jul-23 19:32 
GeneralRe: Parameterized Query Pin
Richard Andrew x6417-Jul-23 5:33
professionalRichard Andrew x6417-Jul-23 5:33 
QuestionGetting a VST3 effect name and vendor Pin
spice3d8-Jul-23 9:19
spice3d8-Jul-23 9:19 
AnswerRe: Getting a VST3 effect name and vendor Pin
Pete O'Hanlon8-Jul-23 10:09
mvePete O'Hanlon8-Jul-23 10:09 
GeneralRe: Getting a VST3 effect name and vendor Pin
spice3d8-Jul-23 11:18
spice3d8-Jul-23 11:18 
QuestionAdvices for my learning path Pin
coco2437-Jul-23 21:10
coco2437-Jul-23 21:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.