Medical Store Management System Part 2 ( Hindi / Urdu ) Csharp Visual Studio 2012 Free Source Code




Namaskar Dosto ,

Me Aap Sabhi ka Khub Khub Swagat Karta hu Mere Channel me Jiska Nam He " AMIN SATI "

Dosto is Video me . Mene AApko Medical Store Management Software kese banate he C# Visual Studio 2012 Uske Bareme Samjaya He. Me Ek Ek Topics ke Bareme AApko Samjata Rahunga . Iss Video me mene AApko Customer Master Ke Record Kese Display or view Karte he Datagridview Control me Uske bare me Step by Step Samjaya he.

Vo bhi Bahot Easily AAp Samaj Sakenge Kyunki Mene Hindi me Pura Video Banaya he.

Ye Hamara Medical Store Maangement System ka Dusra Video He .

Next video me.
Me AApko Customer Master Form me Kese Delete Karte He
Kese Update Karte He


To Bane Rahiye Mere Sath Or Dekhte Rahi.

Dosto Agar AApko meri Ye Video Usefule Lage to Please Like and Share Jarur kijiyega me AAp Sabhi ke Liye Esehi Video Banata Rahunga

Dosto Channel ko Subscribe Karna Na Bhule...


Thank You for Watching my Video.


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.OleDb;

namespace Medical_Store_Managment_System
{
    public partial class Form1 : Form
    {
        //for id
        string ff_code = "";
        //for record selection id
        int r, r_id;
        String scon="Provider=Microsoft.ACE.OLEDB.12.0;Data Source="+Application.StartupPath+"\\DB_Medical.accdb;Persist Security Info=True";
        OleDbConnection con;
        OleDbCommand cmd = new OleDbCommand();

        public Form1()
        {
            InitializeComponent();
        }
        private void cleartext()
        {
            txt_name.Text = "";
            txt_address.Text = "";
            txt_city.Text = "";
            txt_mobile.Text = "";
            txt_phone.Text = "";
            txt_name.Focus();
        }
        private void savedata()
        {
            string strquery="";
            con = new OleDbConnection(scon);
            con.Open();
            cmd.Connection = con;

            if (btn_save.Text == "&Update")
            {
                strquery = "UPDATE tbl_customer set Cust_Name='"+txt_name.Text +"' , Cust_Address='"+txt_address .Text +"' , Cust_City='"+txt_city .Text +"' , Cust_Mobile='"+txt_mobile.Text +"' , Cust_Phone='"+txt_phone.Text +"' where Cust_ID="+ff_code +"";
                cmd.CommandText = strquery;
               //this method use for delete edit and save
                cmd.ExecuteNonQuery();
                MessageBox.Show("Record Has been Updated Successfully", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
                btn_save.Text = "&Save";
            }
                //not equal the fired else part
            else
            {
                strquery = "insert into tbl_customer (Cust_Name , Cust_Address , Cust_City , Cust_Mobile , Cust_Phone ) Values ('" + txt_name.Text.ToUpper() + "','" + txt_address.Text + "','" + txt_city.Text + "','" + txt_mobile.Text + "','" + txt_phone.Text + "')";
                cmd.CommandText = strquery;
                cmd.ExecuteNonQuery();
                MessageBox.Show("Record Has been Saved Successfully", "Save", MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
           
            cleartext();
            string str = "select * from tbl_customer";
            datarecord(str);
       
        }
     
        private void button7_Click(object sender, EventArgs e)
        {
            savedata();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void panel2_Paint(object sender, PaintEventArgs e)
        {

        }
        //for gridview record adjustment
        private void viewadjust()
        {
            dgw_view.Columns[0].Width = 60;
            dgw_view.Columns[0].HeaderText = "ID";
            dgw_view.Columns[1].HeaderText = "Name";
            dgw_view.Columns[2].HeaderText = "Address";
            dgw_view.Columns[3].HeaderText = "City";
            dgw_view.Columns[4].HeaderText = "Mobile";
            dgw_view.Columns[5].HeaderText = "Phone";
     
        }
        //for data view
        private void datarecord(string q1)
        {
            con = new OleDbConnection();
         //   con.Open();
            //cmd.Connection = con;
            OleDbDataAdapter adapter = new OleDbDataAdapter(q1, scon);
            DataSet s1 = new DataSet();
            adapter.Fill(s1);
            dgw_view.DataSource = s1.Tables[0];
            viewadjust();
            con.Close();
       
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            string q1 = "select * from tbl_customer";
            datarecord(q1);
        }

        private void btn_update_Click(object sender, EventArgs e)
        {
            try
            {
                Int32 rc = dgw_view.ColumnCount;
                r_id = int.Parse(dgw_view.Rows[r].Cells[0].Value.ToString());

                ff_code = dgw_view.Rows[r].Cells[0].Value.ToString();
                txt_name.Text = dgw_view.Rows[r].Cells[1].Value.ToString();
                txt_address.Text = dgw_view.Rows[r].Cells[2].Value.ToString();
                txt_city.Text = dgw_view.Rows[r].Cells[3].Value.ToString();
                txt_mobile.Text = dgw_view.Rows[r].Cells[4].Value.ToString();
                txt_phone.Text = dgw_view.Rows[r].Cells[5].Value.ToString();


                btn_save.Text = "&Update";
                txt_name.Focus();
            }
            catch (Exception)
            {
                MessageBox.Show("Please Select Record First", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txt_name.Focus();

            }
        }

        private void dgw_view_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            r = e.RowIndex;
        }

        private void btn_delete_Click(object sender, EventArgs e)
        {
            deletedata();
         
        }
        private void deletedata()
        {
            con = new OleDbConnection(scon);
            con.Open();
            cmd.Connection = con;

       
            try
            {
                int v1 = int.Parse(dgw_view.Rows[r].Cells[0].Value.ToString());
                string na = dgw_view.Rows[r].Cells[1].Value.ToString();
                string delq = "Delete from tbl_customer where Cust_ID=" + v1 + "";
                cmd.CommandText = delq;
                cmd.ExecuteNonQuery();

                MessageBox.Show("Record Has been Deleted Successfully(  " + na.ToUpper() + "  )", "Deleted", MessageBoxButtons.OK, MessageBoxIcon.Information);

                cleartext();
            }
            catch (Exception er)
            {
                MessageBox.Show("Please Select Record First", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                txt_name.Focus();


            }
            string str = "select * from tbl_customer";
            datarecord(str);
       
        }

        private void btn_exit_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}

Post a Comment

3 Comments