Beispiel #1
0
        public void Save(AccountingTafsillevelsDetail entity)
        {
            try
            {
                if (entity.Id == Guid.Empty)
                {
                    entity.Id       = Guid.NewGuid();
                    entity.LastEdit = DateTime.Now;
                    this.Table.Add(entity);
                }
                else
                {
                    var view = this.GetViewById(entity.Id);
                    if (view.IdIn != entity.IdIn)
                    {
                        entity.LastEdit = DateTime.Now;
                    }
                }

                this.SubmitChanges();
            }
            catch
            {
                throw;
            }
        }
Beispiel #2
0
 private void PrepareGroup(AccountingTafsillevelsDetail goruh)
 {
     try
     {
         goruh.IdIn      = txt_grouh_code.Text;
         goruh.ATLName   = txt_grouh_tafsili.Text;
         goruh.ATLNameEn = txt_grouh_eng_name.Text;
     }
     catch
     {
         throw;
     }
 }
Beispiel #3
0
 private void PrepareHesab(AccountingTafsillevelsDetail hesab)
 {
     try
     {
         hesab.IdIn      = txt_hesab_code.Text;
         hesab.ATLName   = txt_onvane_hesab1.Text;
         hesab.ATLNameEn = txt_hesab_eng_name.Text;
     }
     catch
     {
         throw;
     }
 }
        private void btn_sabteTafsili_Click(object sender, RoutedEventArgs e)
        {
            Guid get = Guid.Parse(Class.Variable.Variables.idAccountingMoien);


            var  v           = ak.AccountingMoeinTafsilLevels.Where(i => i.IdAccountingMoein == get).ToList();
            bool can_process = true;

            for (int i = 0; i < grd_tafsil.Items.Count; i++)
            {
                grd_tafsil.SelectedIndex = i;

                CheckBox Check = this.grd_tafsil.Columns[0].GetCellContent(grd_tafsil.SelectedItem) as CheckBox;

                if (Check != null && Check.IsChecked == true)
                {
                    AccountingTafsillevelsDetail f = grd_tafsil.Items[i] as AccountingTafsillevelsDetail;
                    foreach (var item in v)
                    {
                        if (f.IdAccountingTafsilLevels == item.IdAccountingTafsilLevels)
                        {
                            can_process = false;
                        }
                    }
                }
            }

            // check for all checkes
            if (can_process)
            {
                int count_checkBox = 0;

                bool even_once = false;
                for (int i = 0; i < grd_tafsil.Items.Count; i++)
                {
                    grd_tafsil.SelectedIndex = i;
                    CheckBox Check = this.grd_tafsil.Columns[0].GetCellContent(grd_tafsil.SelectedItem) as CheckBox;
                    if (Check != null && Check.IsChecked == true)
                    {
                        even_once = true;
                        count_checkBox++;
                    }
                }

                if (even_once == false)
                {
                    MessageBox.Show("انتخاب یک گزینه الزامی میباشد");
                }
                //

                else
                {
                    List <CodeTitle> ct         = ak.CodeTitles.Where(i => i.CodeName == Class.Variable.Variables.AccountingTafsilLevels).ToList();
                    Guid             code_title = ct[0].Id;
                    //////////////////////////////////////////
                    Guid a = Guid.Parse(Class.Variable.Variables.idAccountingMoien);
                    // Guid idmatl = Guid.Parse(ID_accounting_tafsil_levels);
                    AccountingMoeinTafsilLevel amtl_ = new AccountingMoeinTafsilLevel();
                    //
                    int  r = 0;
                    Guid get_idAccountingTaf = Guid.Empty;

                    for (int i = 0; i < grd_tafsil.Items.Count; i++)
                    {
                        grd_tafsil.SelectedIndex = i;

                        CheckBox Check = this.grd_tafsil.Columns[0].GetCellContent(grd_tafsil.SelectedItem) as CheckBox;

                        if (Check != null && Check.IsChecked == true)
                        {
                            AccountingTafsillevelsDetail f = grd_tafsil.Items[i] as AccountingTafsillevelsDetail;
                            get_idAccountingTaf = (Guid)f.IdAccountingTafsilLevels;

                            amtl_ = new AccountingMoeinTafsilLevel();

                            amtl_.ID = Guid.NewGuid();            // sss
                            amtl_.IdAccountingMoein = a;          /// sss
                            amtl_.IdTafsilGroup     = code_title; // sss

                            amtl_.IdAccountingTafsilLevels = get_idAccountingTaf;

                            ak.AccountingMoeinTafsilLevels.Add(amtl_);

                            r += ak.SaveChanges();

                            if (r == count_checkBox)
                            {
                                MessageBox.Show("باموفقیت ثبت گردید");
                                this.Hide();
                            }
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("یکی از موارد در گروه دیگر ثبت گردیده است");
            }
        }