Ejemplo n.º 1
0
        private void AddChequeBunchToList(ChequeBunch chequeBunch)
        {
            DataLayer.Insert(chequeBunch);

            CreateAndInsertChequePages(chequeBunch);

            grvItems.DataSource = DataLayer.GetChequeBunches(false);
        }
Ejemplo n.º 2
0
        public static void Insert(ChequeBunch item)
        {
            EntityModelContainer context = GetContext();

            if (item.EntityState != EntityState.Added)
                context.ChequeBunches.AddObject(item);
        }
Ejemplo n.º 3
0
        public static bool Validate(ChequeBunch chequeBunch)
        {
            if (chequeBunch.AccountantEntity == null)
            {
                Methods.ShowStandardMsgBox
                    (FormMessageType.Error, RscError.ValidationTitle, "لطفا حساب بانکی را مشخص بفرمایید.");
                return false;
            }

            if (string.IsNullOrEmpty(chequeBunch.Serial))
            {
                Methods.ShowStandardMsgBox
                    (FormMessageType.Error, RscError.ValidationTitle, "لطفا سریال را مشخص بفرمایید.");
                return false;
            }

            if (chequeBunch.NumberOfPages <= 0)
            {
                Methods.ShowStandardMsgBox
                    (FormMessageType.Error, RscError.ValidationTitle, "لطفا تعداد برگه های دسته چک را مشخص بفرمایید.");
                return false;
            }

            return true;
        }
Ejemplo n.º 4
0
        private void CreateAndInsertChequePages(ChequeBunch chequeBunch)
        {
            int chequeSerial = int.Parse(chequeBunch.Serial);

            for (int i = 0; i < chequeBunch.NumberOfPages; i++)
            {
                ChequePage chequePage = new ChequePage();
                chequePage.ChequeBunch = chequeBunch;
                chequePage.IsUsed = false;
                chequePage.Serial = (chequeSerial + i).ToString();
                DataLayer.Insert(chequePage);
            }
        }
Ejemplo n.º 5
0
        private void ClearPage()
        {
            grvItems.CurrentRow = null;
            grvChequePages.DataSource = null;

            ChequeBunch chequeBunch = new ChequeBunch();
            chequeBunch.Context = DataLayer.GetContext();
            srcChequeBunch.DataSource = chequeBunch;

            btnNew.Enabled = false;
            btnAdd.Enabled = true;

            cmbAccounts.Focus();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Deprecated Method for adding a new object to the ChequeBunches EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToChequeBunches(ChequeBunch chequeBunch)
 {
     base.AddObject("ChequeBunches", chequeBunch);
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Create a new ChequeBunch object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="chequeId">Initial value of the ChequeId property.</param>
 /// <param name="numberOfPages">Initial value of the NumberOfPages property.</param>
 /// <param name="bankId">Initial value of the BankId property.</param>
 public static ChequeBunch CreateChequeBunch(global::System.Int32 id, global::System.String chequeId, global::System.String numberOfPages, global::System.Int32 bankId)
 {
     ChequeBunch chequeBunch = new ChequeBunch();
     chequeBunch.Id = id;
     chequeBunch.ChequeId = chequeId;
     chequeBunch.NumberOfPages = numberOfPages;
     chequeBunch.BankId = bankId;
     return chequeBunch;
 }