private void AddChequeBunchToList(ChequeBunch chequeBunch)
        {
            DataLayer.Insert(chequeBunch);

            CreateAndInsertChequePages(chequeBunch);

            grvItems.DataSource = DataLayer.GetChequeBunches(false);
        }
示例#2
0
        public static void Insert(ChequeBunch item)
        {
            EntityModelContainer context = GetContext();

            if (item.EntityState != EntityState.Added)
                context.ChequeBunches.AddObject(item);
        }
示例#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;
        }
        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);
            }
        }
        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();
        }
示例#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);
 }
示例#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;
 }