Example #1
0
        private void cmdadd_Click(object sender, EventArgs e)
        {
            newvilairahniform nnf = new newvilairahniform(0);

            nnf.ShowDialog();
            BindData();
        }
Example #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;
                newvilairahniform nnf = new newvilairahniform(1);

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

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

                BindData();
            }
        }