internal static bool HasChequePageInUsed(ChequePayment chequePayment) { EntityModelContainer context = chequePayment.Context; if (context.ObjectStateManager.GetObjectStateEntries ((EntityState.Added | EntityState.Modified | EntityState.Unchanged)) .Select(e => e.Entity).OfType<ChequePayment>() .Any(cp => cp.ChequePage.IsUsed && (cp != chequePayment))) return true; return false; }
public static bool Validate(ChequePayment chequePayment) { if (chequePayment.ChequePageId == 0) { Methods.ShowStandardMsgBox (FormMessageType.Error, RscError.ValidationTitle, "لطفا حساب بانکی و سریال چک را به درستی و به دقت مشخص بفرمایید."); return false; } if (DataLayer.HasChequePageInUsed(chequePayment)) { Methods.ShowStandardMsgBox (FormMessageType.Error, RscError.ValidationTitle, "از برگه چک مشخص شده، پیش تر استفاده شده است."); return false; } if (string.IsNullOrEmpty(chequePayment.Value.ToString())) { Methods.ShowStandardMsgBox (FormMessageType.Error, RscError.ValidationTitle, "لطفا مبلغ چک را مشخص بفرمایید."); return false; } if (chequePayment.DueDate.Year > 2020 || chequePayment.DueDate.Year < 2000) { Methods.ShowStandardMsgBox (FormMessageType.Error, RscError.ValidationTitle, "لطفا تاریخ وصول را به دقت مشخص بفرمایید."); return false; } if (chequePayment.PayDate.Year > 2020 || chequePayment.PayDate.Year < 2000) { Methods.ShowStandardMsgBox (FormMessageType.Error, RscError.ValidationTitle, "لطفا تاریخ صحیحی را برای پرداخت چک مشخص بفرمایید."); return false; } if (chequePayment.Status == -1) { Methods.ShowStandardMsgBox (FormMessageType.Error, RscError.ValidationTitle, "لطفا وضعیت چک را مشخص بفرمایید."); return false; } return true; }
/// <summary> /// Deprecated Method for adding a new object to the ChequePayments EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToChequePayments(ChequePayment chequePayment) { base.AddObject("ChequePayments", chequePayment); }
private void ClearPage() { grvItems.CurrentRow = null; dpDocumentDate.SelectedDateTime = DateTime.Now; dpPayDate.SelectedDateTime = DateTime.Now; dpDueDate.SelectedDateTime = DateTime.Now; PaymentDocument paymentDocument = new PaymentDocument(); paymentDocument.Context = DataLayer.GetContext(); paymentDocument.Type = (int)DocumentType.ChequePayment; srcDocument.DataSource = paymentDocument; ChequePayment chequePayment = new ChequePayment(); chequePayment.Context = DataLayer.GetContext(); srcCheque.DataSource = chequePayment; paymentDocument.ChequePayments.Add(chequePayment); cmbPayer.SelectedItem = null; cmbReciever.SelectedItem = null; cmbChequeStatus.SelectedIndex = -1; cmbPayer.Enabled = true; dpPayDate.Enabled = true; dpDocumentDate.Enabled = true; btnNewPage.Enabled = false; btnAddPage.Enabled = true; }
/// <summary> /// Create a new ChequePayment object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="dueDate">Initial value of the DueDate property.</param> /// <param name="value">Initial value of the Value property.</param> /// <param name="description">Initial value of the Description property.</param> /// <param name="chequePageId">Initial value of the ChequePageId property.</param> /// <param name="status">Initial value of the Status property.</param> /// <param name="paymentDocumentId">Initial value of the PaymentDocumentId property.</param> /// <param name="recieverId">Initial value of the RecieverId property.</param> /// <param name="payDate">Initial value of the PayDate property.</param> public static ChequePayment CreateChequePayment(global::System.Int32 id, global::System.DateTime dueDate, global::System.String value, global::System.String description, global::System.Int32 chequePageId, global::System.Int32 status, global::System.Int32 paymentDocumentId, global::System.Int32 recieverId, global::System.DateTime payDate) { ChequePayment chequePayment = new ChequePayment(); chequePayment.Id = id; chequePayment.DueDate = dueDate; chequePayment.Value = value; chequePayment.Description = description; chequePayment.ChequePageId = chequePageId; chequePayment.Status = status; chequePayment.PaymentDocumentId = paymentDocumentId; chequePayment.RecieverId = recieverId; chequePayment.PayDate = payDate; return chequePayment; }