Ejemplo n.º 1
0
        private void filter_Click(object sender, EventArgs e)
        {
            string bakhshID = GlobalVariable.bakhshID;

            using (var dbcontext = new Model.Context())
            {
                bakhsh bakh = dbcontext.bakhshes.SingleOrDefault(x => x.ID == bakhshID);

                if (bakh.final != 1)
                {
                    string parentID = bakh.parent;
                    bakh.title    = title.Text;
                    bakh.masoul   = masool.Text;
                    bakh.janeshin = janeshin.Text;


                    List <bakhsh> lst = dbcontext.bakhshes.Where(x => x.parent == parentID).ToList();
                    foreach (bakhsh item in lst)
                    {
                        item.master = "0";
                    }
                    ;
                    bakh.isDone = true;
                    bakh.master = "1";
                    bakh.final  = 1;
                    dbcontext.SaveChanges();
                }
                GlobalVariable.bakhshID = bakh.parent;
            }

            this.Hide();
            Bakhsh_List form5 = new Bakhsh_List();

            form5.Show();
        }
Ejemplo n.º 2
0
        private void bakhshList_Click(object sender, EventArgs e)
        {
            Bakhsh_List form = new Bakhsh_List();

            form.Show();
            this.Hide();
        }
Ejemplo n.º 3
0
        private void DeleteItem(object sender, EventArgs e)
        {
            try
            {
                var    element = sender as Label;
                string id      = element.Name.Substring(1, element.Name.Length - 1);
                GlobalVariable.bakhshID = id;



                List <markaz> markazlist = dbcontext.markazs.Where(x => x.BakhshID == id).ToList();
                if (markazlist.Count == 0)
                {
                    bakhsh delitem = dbcontext.bakhshes.SingleOrDefault(x => x.ID == GlobalVariable.bakhshID);
                    dbcontext.bakhshes.Remove(delitem);
                    dbcontext.SaveChanges();



                    Bakhsh_List form2 = new Bakhsh_List();
                    this.Hide();
                    //form2.Show();
                }
            }
            catch (Exception errror)
            {
                message.Text = errror.InnerException.Message;
            }
        }