예제 #1
0
        private void cmdadd_Click(object sender, EventArgs e)
        {
            newstoreforoshiform ggf = new newstoreforoshiform(0);

            ggf.ShowDialog();
            BindData();
        }
예제 #2
0
        private void cmdedit_Click(object sender, EventArgs e)
        {
            if (grid1.SelectedRows.Count == 0)
            {
                MessageBox.Show("یک سطر را انتخاب کنید");
            }
            else
            {
                DataRowView         drv = (DataRowView)grid1.SelectedRows[0].DataBoundItem;
                newstoreforoshiform ggf = new newstoreforoshiform(1);

                ggf.id     = (int)drv.Row["id"];
                ggf.adress = (drv.Row["adress"] != System.DBNull.Value ? (string)drv.Row["adress"] : "");

                ggf.gheymat  = (drv.Row["gheymat"] != System.DBNull.Value ? (string)drv.Row["gheymat"] : "");
                ggf.kharidar = (drv.Row["namekharidar"] != System.DBNull.Value ? (string)drv.Row["namekharidar"] : "");
                ggf.saheb    = (drv.Row["namesaheb"] != System.DBNull.Value ? (string)drv.Row["namesaheb"] : "");
                ggf.tarikh   = (drv.Row["tarikh"] != System.DBNull.Value ? (string)drv.Row["tarikh"] : "");
                ggf.ShowDialog();

                BindData();
            }
        }