private void btnSubmit_Click(object sender, RoutedEventArgs e)
        {
            if (FormIsValid())
            {
                if (id != Guid.Empty)
                {
                    MoeinStructure.Code       = string.Format("{0}{1}", txtGurohKol.Text, txtMoeinCode.Text);
                    MoeinStructure.Name       = txtMoeinName.Text;
                    MoeinStructure.Latin_Name = txtMoeinLatinName.Text;
                    MoeinStructure.LastEdit   = System.DateTime.Now;
                    MoeinCodes.MNature        = (Guid)cmbMoeinNature.SelectedValue;
                    MoeinCodes.MType          = (Guid)cmbMoeinType.SelectedValue;
                }
                else
                {
                    MoeinStructure = Business.GetMoeinStructureDefineBusiness().
                                     GetStructure(Constants.CodeTitle.Moein, txtMoeinName.Text, txtMoeinLatinName.Text, ParentID, string.Format("{0}{1}", txtGurohKol.Text, txtMoeinCode.Text));
                    MoeinCodes = Business.GetMoeinCodesBusiness().GetMoeinCode(MoeinStructure.ID, (Guid)cmbMoeinType.SelectedValue, (Guid)cmbMoeinNature.SelectedValue);
                }
                using (var scope = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions()
                {
                    IsolationLevel = System.Transactions.IsolationLevel.ReadUncommitted,
                    Timeout = new TimeSpan(2, 0, 0)
                }))
                {
                    Business.GetMoeinStructureDefineBusiness().SaveWithID(MoeinStructure);
                    Business.GetMoeinCodesBusiness().Save(MoeinCodes);
                    scope.Complete();
                }

                this.Close();
            }
        }
Esempio n. 2
0
 public void Delete(Data.AccountingMoeinCode deletedItem)
 {
     try
     {
         Table.Remove(deletedItem);
         this.SubmitChanges();
     }
     catch
     {
         throw;
     }
 }
        public MoeinAdd(Guid id)
            : this()
        {
            this.id = id;

            MoeinStructure         = Business.GetMoeinStructureDefineBusiness().GetByID(id).FirstOrDefault();
            txtMoeinCode.Text      = MoeinStructure.Code.Substring(Gurohlen + Kollen);
            txtGurohKol.Text       = MoeinStructure.Code.Substring(0, Gurohlen + Kollen);
            txtMoeinLatinName.Text = MoeinStructure.Latin_Name;
            txtMoeinName.Text      = MoeinStructure.Name;

            MoeinCodes = Business.GetMoeinCodesBusiness().GetByStructureDefine_ID(id).FirstOrDefault();
            cmbMoeinType.SelectedValue   = MoeinCodes.MType;
            cmbMoeinNature.SelectedValue = MoeinCodes.MNature;
        }
Esempio n. 4
0
 public Data.AccountingMoeinCode GetMoeinCode(Guid StructureID, Guid MoeinType, Guid MoeinNature)
 {
     Data.AccountingMoeinCode _entity = new Data.AccountingMoeinCode();
     try
     {
         _entity.StructureDefine_ID = StructureID;
         _entity.MType   = MoeinType;
         _entity.MNature = MoeinNature;
     }
     catch
     {
         throw;
     }
     return(_entity);
 }
Esempio n. 5
0
 private void Insert(Data.AccountingMoeinCode MoeinCodes)
 {
     try
     {
         if (MoeinCodes.ID == Guid.Empty)
         {
             MoeinCodes.ID = Guid.NewGuid();
         }
         this.Table.Add(MoeinCodes);
         this.SubmitChanges();
     }
     catch
     {
         throw;
     }
 }
Esempio n. 6
0
 public void Save(Data.AccountingMoeinCode MoeinCodes)
 {
     try
     {
         if (MoeinCodes.ID == Guid.Empty)
         {
             this.Insert(MoeinCodes);
         }
         else
         {
             this.SubmitChanges();
         }
     }
     catch
     {
         throw;
     }
 }