示例#1
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int    iSelectedGridIndex = dataGridView1.CurrentCell.ColumnIndex;
            int    rowindex           = dataGridView1.CurrentCell.RowIndex;
            string rowID = dataGridView1.Rows[rowindex].Cells[1].Value.ToString();

            if (iSelectedGridIndex == 0)
            {
                using (Context dbcontext = new Context())
                {
                    GlobalVariable.markazID = rowID;
                    Markaz_add form2 = new Markaz_add();
                    form2.Show();
                }
            }
            else if (iSelectedGridIndex == 0)
            {
                GlobalVariable.bakhshID = rowID;
                Bakhsh_add form2 = new Bakhsh_add();
                form2.Show();
            }
            else
            {
                return;
            }
        }
示例#2
0
        private void viewDetail(object sender, EventArgs e)
        {
            var    element = sender as Label;
            string id      = element.Name;

            GlobalVariable.bakhshID = id;
            Bakhsh_add form2 = new Bakhsh_add();

            form2.Show();
        }
示例#3
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int    iSelectedGridIndex = dataGridView1.CurrentCell.ColumnIndex;
            int    rowindex           = dataGridView1.CurrentCell.RowIndex;
            string rowID = dataGridView1.Rows[rowindex].Cells[2].Value.ToString();

            if (iSelectedGridIndex == 1)
            {
                using (Context dbcontext = new Context())
                {
                    bakhsh selecteditem = dbcontext.bakhshes.SingleOrDefault(x => x.ID == rowID);
                    if (selecteditem.master != "1")
                    {
                        return;
                    }
                    DateTime date = DateTime.Now;
                    TimeSpan time = DateTime.Now.TimeOfDay;

                    string ID    = RandomString(10);
                    bakhsh model = new bakhsh()
                    {
                        masoul   = selecteditem.masoul,
                        changer  = selecteditem.changer,
                        date     = date,
                        time     = time,
                        ID       = ID,
                        parent   = selecteditem.parent,
                        final    = 0,
                        isDone   = false,
                        janeshin = selecteditem.janeshin,
                        master   = "0",
                        title    = selecteditem.title
                    };

                    dbcontext.bakhshes.Add(model);
                    dbcontext.SaveChanges();
                    GlobalVariable.bakhshID = ID;
                    Bakhsh_add form2 = new Bakhsh_add();
                    form2.Show();
                }
            }
            else if (iSelectedGridIndex == 0)
            {
                GlobalVariable.bakhshID = rowID;
                Bakhsh_add form2 = new Bakhsh_add();
                form2.Show();
            }
            else
            {
                return;
            }
        }
示例#4
0
        private void bakhshAdd_Click(object sender, EventArgs e)
        {
            using (Context dbcontext = new Context())
            {
                string   id          = RandomString(10);
                bakhsh   model       = new bakhsh();
                DateTime nowdatetime = DateTime.Now;
                model.master  = "1";
                model.ID      = id;
                model.parent  = id;
                model.date    = nowdatetime;
                model.time    = nowdatetime.TimeOfDay;
                model.changer = "admin";
                dbcontext.bakhshes.Add(model);
                dbcontext.SaveChanges();
                GlobalVariable.bakhshID = id;

                Bakhsh_add form = new Bakhsh_add();

                form.Show();
            }
            this.Hide();
        }