public void ChangeMode(string Mode)
 {
     ActiveMode = Mode;
     if (ActiveMode == Modes.ADD)
     {
         SpecsTransfer = new Transfer();
         DateL = DateTime.Now;
         SpecsTransfer = null;
     }
     if (ActiveMode == Modes.DEFAULT)
         SelectedIndex = -1;
 }
 public void SpecsPropertiesToObject()
 {
     SpecsTransfer = new Transfer
     {
         Id = this.Id,
         Wording = this.Wording,
         Description = this.Description,
         DateL = this.DateL,
         Price = this.Price,
         Way = this.Way,
         B_CodeBeneficiary = this.B_CodeBeneficiary,
         Beneficiary = this.Beneficiary,
         F_Code = this.SelectedFrequency.Code,
         C_Id = this.SelectedCategory.Id,
         B_Code = Global.BankAccountCode,
         Category = this.SelectedCategory,
         Frequency = this.SelectedFrequency
     };
 }
 public static void Update(Transfer L)
 {
     using (var myCnn = Cnn.GetOpenConnection())
     {
         myCnn.Update(L);
     }
 }
        public static void Save(Transfer T)
        {
            using (var myCnn = Cnn.GetOpenConnection())
            {
                if(T.Beneficiary != null ||T.Beneficiary != string.Empty)
                {
                    T.B_CodeBeneficiary = 0;
                }

                if (T.Beneficiary == null)
                    T.Beneficiary = string.Empty;

                //If the register is Immediat
                if(T.F_Code == "IMM")
                {
                    //Only register but no Add to Transfer

                    //If The destination is a Exist Account
                    if(T.B_CodeBeneficiary != 0)
                    {
                        CreateRegistration(T.DateL);
                        CreateRegistrationForReicever(T.DateL);
                    }
                    else //The destination is Other
                    {
                        CreateRegistration(T.DateL);
                    }

                }

                myCnn.Execute("INSERT INTO Transfer (Wording, Description, F_Code,C_Id,DateL,B_Code,Price,Way,B_CodeBeneficiary,Beneficiary) VALUES(@Wording, @Description, @F_Code,@C_Id,@DateL,@B_Code,@Price,@Way,@B_CodeBeneficiary,@Beneficiary)", new
                {
                    T.Wording,
                    T.Description,
                    T.F_Code,
                    T.C_Id,
                    T.DateL,
                    T.Way,
                    T.B_Code,
                    T.Price,
                    T.B_CodeBeneficiary,
                    T.Beneficiary
                });
            }
        }