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

            uf.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;
                newvilamelkform uf  = new newvilamelkform(1);

                uf.id      = (int)drv.Row["id"];
                uf.adress  = (drv.Row["adress"] != System.DBNull.Value ? (string)drv.Row["adress"] : "");
                uf.metraj  = (drv.Row["metraj"] != System.DBNull.Value ? (string)drv.Row["metraj"] : "");
                uf.gheymat = (drv.Row["pish"] != System.DBNull.Value ? (string)drv.Row["pish"] : "");
                uf.keraye  = (drv.Row["keraye"] != System.DBNull.Value ? (string)drv.Row["keraye"] : "");
                uf.forosh  = (drv.Row["forosh"] != System.DBNull.Value ? (string)drv.Row["forosh"] : "");
                uf.rahni   = (drv.Row["rahn"] != System.DBNull.Value ? (string)drv.Row["rahn"] : "");
                uf.ShowDialog();

                BindData();
            }
        }