Академический Документы
Профессиональный Документы
Культура Документы
C# OOP
C# Tutorial C#.Net
W n ows So tw r
Create Project
1
FILE >> N w >> Proj ct…
2
Visual C# >> Windows Forms Application Select
2 Windows Software Development in C#
3
Name : CoffeeShop
Location: project File
Solution name :
OK
Project
႔ Project ႔
႔ database
႔ project database ႔ ႔ database ႔
Project
Program.cs
Application.Run(new Form1());
Form Form1
4 Windows Software Development in C#
၁ Form
CoffeeShop Right Click
A >> W n ows Form …
Run Form1
MainForm
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CoffeeShoop
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Form1 ႔ ႔
Products ႔ Form
Label
Textbox
utton
8 Windows Software Development in C#
DataGridView
အေပၚေဘ့ေတျမြာ
ေလ့ေထာငးံအကျကးေတျ ေပၚေနတဲံ
ေနရာမြာ ်မြာ့ေလ့တငးၿပီ့ေတာံ ဆျဲလုိ႔
ရပါတယး။
9 Windows Software Development in C#
D t s >> N w D t s ….
CoffeeShop ႔ OK
10 Windows Software Development in C#
Database Table
T l s >> N w >> T l …
က္ေတား
ေရ့်ပထာ့တဲံအတုိငး့
column name,
data type,
llow nulls ေတျကုိ
ေသခ္ာ ်ဖညးံေပ့ပါ။
ၿပီ့ရငး Save
11 Windows Software Development in C#
(၂)
Id Primary Key
(၁)
productid right click >> Set Primary Key
12 Windows Software Development in C#
product
user product
product
id id
႔ pro r mm r ႕
(၂)
productid user ႔ program auto
product productid ၁
product productid ၂ ႔၁ ၁
productid s l ct
13 Windows Software Development in C#
Identity Increment = 1 id ၁
Identity Seed =1 ႔ ၁ id ၁
14 Windows Software Development in C#
Database ႔
႔ C# UI
Mssql server Database ႔ Table
႔ ႕ ႔ Database ႔
Software version
1. Standalone Version
2. Server Version/ Network Version
Standalone Version Database
install
install
႔ ႔
Database
Server ႔ S rv r V rs on N twork V rs on
16 Windows Software Development in C#
Developer ႔
Basic ႔
႔
? Developer
Developer ?
Project database ႔ database
႔ ႔
Error
Developer ႔ Error ႔
႔
Error Program.cs ႔
App.config ႔ Button Form Double click
Error
Error
Error Provider SaYarChit
Error ႕
17 Windows Software Development in C#
Database ႔
Xsd
Xs Right Click
A >> T l A pt r…
႔ ႔
N w Conn ct on…
18 Windows Software Development in C#
Server Name ႔
၂
Database
20 Windows Software Development in C#
database name
r Test Connection
21 Windows Software Development in C#
Database ႔ ( )
Ok Ok
22 Windows Software Development in C#
႔
S rv r n m D t s n m
Connection String ႔
႔
Next
23 Windows Software Development in C#
႔ Next
Next
(Sql st t m nt ႔ )
24 Windows Software Development in C#
Qu ry u l r…
Add ( )
All Column Ok
26 Windows Software Development in C#
OK ႔ Finish
Database ႔
27 Windows Software Development in C#
Database ႔
App.config File ႔
Database ႔ ?
28 Windows Software Development in C#
<connectionStrings>
<add name="CoffeeShoop.Properties.Settings.CoffeeShopConnectionString"
connectionString="Data Source=HANNI-PC;Initial
Catalog=CoffeeShop;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
Database ႔
add name="CoffeeShoop.Properties.Settings.CoffeeShopConnectionString"
connectionString="Data Source=HANNI-PC;Initial Catalog=CoffeeShop;Integrated
Security=True"
connectionString="Data Source=HANNI-PC;Initial Catalog=CoffeeShop;Integrated
Security=True"
Database ႔
D t Sourc =”HANNI-PC”
Initial Catalog=CoffeeShop
Int r t S cur ty=Tru ”
D t Sourc =”HANNI-PC” D t s S rv r N m
Initial Catalog=CoffeeShop Server D t s N m
Int r t S cur ty=Tru ” Database Server User Name, Password ႔
Tru
add name="CoffeeShoop.Properties.Settings.CoffeeShopConnectionString"
Database ႔
႔ “” ႔
add name="dbConnection" ႔ Error
29 Windows Software Development in C#
add name="CoffeeShoop.Properties.Settings.CoffeeShopConnectionString"
CoffeeShopConnectionString Settings
Settings Properties
Properties CoffeeShoop
CoffeeShoop.Properties.Settings.CoffeeShopConnectionString ႔ . (dot) ႔
Table C# ႔
30 Windows Software Development in C#
C# Database table
႔
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CoffeeShoop
{
public partial class Products : Form
{
public Products()
{
InitializeComponent();
}
private void btnSave_Click(object sender, EventArgs e)
{
}
}
}
ဒီထမ
ဲ ြာ
Database table ႔
၁ using System.Data.SqlClient;
System.Data.SqlClient; using
၂ SqlConnection o j ct
SqlConnection o j ct
႔
SqlConnection() ႕ ()
SqlConnection(string connectionString)
33 Windows Software Development in C#
? ႕ connectionString
connectionString App.config
copy
SqlConnection() ႕ ()
၃ Database ႔
o j ct SqlConnection
SqlCommand object Column
Execute
SqlConnection
34 Windows Software Development in C#
SqlConnection ႔ SqlCommand o j ct ( )
SqlCommand()
႔
column textbox
command.Parameters.AddWithValue("@productname", txtProductName.Text);
command.Parameters.AddWithValue("@price", double.Parse(txtPrice.Text));
command Execute
command.ExecuteNonQuery();
connection
connection.Close();
database C#
35 Windows Software Development in C#
႔ program run
Run Program
႕ Run Form ႔
Program.cs
36 Windows Software Development in C#
Porgram.cs file
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
Application.Run(new MainForm());
statement Form
Products Form ႔
႔ Products
Application.Run(new Products());
Run
37 Windows Software Development in C#
Data
Run Textbox
Save
႔ Mssql server
tblProducts >> (Right click) Edit Top 200 Rows
38 Windows Software Development in C#
Select
Database Select ႔ Retrieve
႔ ႔ ႔ CRUD
Project
CRUD Insert, Update , Delete, Select
Create, Retrieve, Update, Delete ႔ Select
>>
D t Gr V w Right click
Properties
39 Windows Software Development in C#
Select Gr v w
C#.Net Gr V w ႔
Co
Code ၂
႔ database ႔
႔ ႔ ႔
40 Windows Software Development in C#
Select ႔
Database
႔
41 Windows Software Development in C#
tblProducts
႔ Program Run
Result ႔
Program Gr V w
႔
this.tblProductsTableAdapter.Fill(this.myDataSet.tblProducts);
// ႔ program Run
45 Windows Software Development in C#
Update
Database Form
႔
Save textbox
command.Parameters.AddWithValue("@productname", txtProductName.Text);
command.Parameters.AddWithValue("@price", double.Parse(txtPrice.Text));
command.ExecuteNonQuery();
connection.Close();
TextClear();
ေအာကးက TextClear() Method ကုိ ေခၚလုိကးတာပါ။
}
private void TextClear()
Textbox ထဲက စာသာ့ေတျကုိ ရြငး့ေပ့တဲံ
{
ကုဒးကုိ Method တစးခု ဖနးတီ့ၿပီ့
txtProductName.Text = "";
ေရ့ထာ့တာပါ။
txtPrice.Text = "";
}
46 Windows Software Development in C#
Events GridView ႕
GridView ႕ Row Double Click
Row Textbox
႕
dataGridView ႕ Cell Double Click ႔ productid productid
cell
txtProductName productname ႕ cell
command.Parameters.AddWithValue("@productid", productid);
command.Parameters.AddWithValue("@productname",txtProductName.Text);
command.Parameters.AddWithValue("@price", double.Parse(txtPrice.Text));
command.ExecuteNonQuery();
TextClear();
MessageBox.Show("Data Updated");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
connection.Close();
}
}
႔ if statement
program s ႔ productid update User
႔ try catch finally
50 Windows Software Development in C#
Delete
Update Delete ႔
connection.Open();
command.Parameters.AddWithValue("@productid", productid);
command.ExecuteNonQuery();
connection.Close();
this.tblProductsTableAdapter.Fill(this.myDataSet.tblProducts);
TextClear();
Error
႔
51 Windows Software Development in C#
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace CoffeeShoop
{
public partial class Products : Form
{
SqlConnection connection; SqlConnection, SqlCommand ကုိ class level နဲ႔
SqlCommand command; declare လုပးလုိကးပါတယး။
public Products()
{
InitializeComponent();
}
Database connection အတျကး Method တစးခု
private void dbConnection()
တညးေဆာကးလုိကးပါတယး။
{
SqlConnection connection = new SqlConnection("Data Source=HANNI-PC;Initial
Catalog=CoffeeShop;Integrated Security=True");
}
private void btnSave_Click(object sender, EventArgs e)
{
dbConnection(); Database connection method ကုိ ေခၚလုိကးတာပါ။
connection.Open();
command.Parameters.AddWithValue("@productname", txtProductName.Text);
command.Parameters.AddWithValue("@price", double.Parse(txtPrice.Text));
command.ExecuteNonQuery();
connection.Close();
TextClear();
}
private void TextClear()
{
txtProductName.Text = "";
txtPrice.Text = "";
}
private void Products_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'myDataSet.tblProducts' table. You can
move, or remove it, as needed.
this.tblProductsTableAdapter.Fill(this.myDataSet.tblProducts);
}
private int productid;
private void dgvProducts_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
{
productid =
Convert.ToInt16(dgvProducts.Rows[e.RowIndex].Cells[0].Value.ToString());
txtProductName.Text = dgvProducts.Rows[e.RowIndex].Cells[1].Value.ToString();
txtPrice.Text = dgvProducts.Rows[e.RowIndex].Cells[2].Value.ToString();
}
command.Parameters.AddWithValue("@productid", productid);
command.Parameters.AddWithValue("@productname",txtProductName.Text);
command.Parameters.AddWithValue("@price", double.Parse(txtPrice.Text));
command.ExecuteNonQuery();
TextClear();
MessageBox.Show("Data Updated");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
connection.Close();
}
}
connection.Open();
command.Parameters.AddWithValue("@productid", productid);
command.ExecuteNonQuery();
connection.Close();
this.tblProductsTableAdapter.Fill(this.myDataSet.tblProducts);
TextClear();
႔ ppl c t on ..
- Programming Language ..
- Database ..
- UI/UX Design ..
.. ႔ ..
႕ ...
..
..
Program Establish
***************
႔ Industry
.. ႔
႔ .. .. ??? ႔
.. ..
႔ SDLC ႔ ..
What is SDLC?
************
SDLC (Software Development Life Cycle ) ႔ ႕
..
- H h Qu l ty Appl c t on ႔
- Us r xp ct t on ႔
- ႔
..
SDLC h h qu l ty
Process .. ႔ software development
process ႔ .. ႔ ႕ International Standard ISO/IEC 12207
..
56 Windows Software Development in C#
SDLC Software
႔
Plan ..
SDLC Stage ႔6 ..
- Planning
- Defining
- Designing
- Building
- Testing
- Development
..
..
R qu r m nt
႔ ႔
႔ ..
2- Defining Requrements
********************
Define ... ...
.. Define Clearly Define
.. R qu r m nt ႔ Docum nt ..
customer market analyst ႔ Approve .. ႔
.. .. .. .. ႔
.. .. SRS(Software Requirement Specification)
႔ ႔ ..
*******
SDLC ႕ .. ႔ DEL
.. ႔ .. SDLC
..
.. ႔ ..
SAD(System Analysis & Design) ႔ ..
SAD
59 Windows Software Development in C#
.. ႔
႔ ...
Stage 3: Design
Stage 5: Testing
gaps or defects within the system and also to verify that the
software works as expected according to the requirements. It
includes Unit testing, Integration testing, and System testing.
Stage 6: Deployment
Stage 7: Maintenance
When the customers start using the developed system, the actual
problems comes up and needs to be solved from time to time.
This process where the care is taken for the developed product is
known as Maintenance. The software is maintained timely by
updating the code according to the changes taking place in user
end environment or technology.