public static void Update(Registration R)
 {
     using (var myCnn = Cnn.GetOpenConnection())
     {
         myCnn.Update(R);
     }
 }
 public void ChangeMode(string Mode)
 {
     ActiveMode = Mode;
     SelectedIndex = -1;
     if (ActiveMode == Modes.ADD)
     {
         SpecsRegistration = new Registration();
         DateR = DateTime.Now;
     }
 }
        public static void Save(Registration R)
        {
            using (var myCnn = Cnn.GetOpenConnection())
            {

                DBNull NullValue = DBNull.Value;

              //  myCnn.Insert<Registration>(R);
                myCnn.Execute("INSERT INTO Registration (Wording, Description,DateR,Way,Price,B_Code,C_Id,T_Id) VALUES(@Wording, @Description,@DateR,@Way,@Price,@B_Code,@C_Id,@T_Id)", new
                {
                    R.Wording,
                    R.Description,
                    R.DateR,
                    R.Price,
                    R.Way,
                    R.B_Code,
                    R.C_Id,
                    R.T_Id
                });
            }
        }
        public void SpecsPropertiesToObject()
        {
            if (SelectedCategory == null)
                SelectedCategory = new Category();

            SpecsRegistration = new Registration
            {
                Id = this.Id,
                Wording = this.Wording,
                Description = this.Description,
                DateR = this.DateR,
                Way = this.Way,
                Price = this.Price,
                B_Code = Global.BankAccountCode,
                C_Id = this.SelectedCategory.Id,
                T_Id = this.T_Id,
                Category = this.SelectedCategory
            };
        }