private void OpenPurchaseLineDialog(BOPurchaseLine lineModel) { if (lineModel is BOItemPurchaseLine) { FrmItemPurchaseLine frm = new FrmItemPurchaseLine(); frm.Model = (BOItemPurchaseLine)lineModel; frm.ShowDialog(); } else if (lineModel is BOServicePurchaseLine) { FrmServicePurchaseLine frm = new FrmServicePurchaseLine(); frm.Model = (BOServicePurchaseLine)lineModel; frm.ShowDialog(); } else if (lineModel is BOProfessionalPurchaseLine) { FrmProfessionalPurchaseLine frm = new FrmProfessionalPurchaseLine(); frm.Model = (BOProfessionalPurchaseLine)lineModel; frm.ShowDialog(); } else if (lineModel is BOTimeBillingPurchaseLine) { FrmTimeBillingPurchaseLine frm = new FrmTimeBillingPurchaseLine(); frm.Model = (BOTimeBillingPurchaseLine)lineModel; frm.ShowDialog(); } else if (lineModel is BOMiscPurchaseLine) { FrmMiscPurchaseLine frm = new FrmMiscPurchaseLine(); frm.Model = (BOMiscPurchaseLine)lineModel; frm.ShowDialog(); } else { MessageBox.Show("Please select a valid purchase layout first!", "Current Sale Layout: No Default"); } }
public bool ShowPurchaseLine(BOPurchaseLine model) { BaseView frm = null; if (model != null) { if (model is BOItemPurchaseLine) { if (IsInvalid(mFrmItemPurchaseLine)) { mFrmItemPurchaseLine = new FrmItemPurchaseLine(mApplicationController, model as BOItemPurchaseLine); } else { mFrmItemPurchaseLine.Model = model as BOItemPurchaseLine; mFrmItemPurchaseLine.UpdateView(); } frm = mFrmItemPurchaseLine; } else if (model is BOServicePurchaseLine) { if (IsInvalid(mFrmServicePurchaseLine)) { mFrmServicePurchaseLine = new FrmServicePurchaseLine(mApplicationController, model as BOServicePurchaseLine); } else { mFrmServicePurchaseLine.Model = model as BOServicePurchaseLine; mFrmServicePurchaseLine.UpdateView(); } frm = mFrmServicePurchaseLine; } else if (model is BOProfessionalPurchaseLine) { if (IsInvalid(mFrmProfessionalPurchaseLine)) { mFrmProfessionalPurchaseLine = new FrmProfessionalPurchaseLine(mApplicationController, model as BOProfessionalPurchaseLine); } else { mFrmProfessionalPurchaseLine.Model = model as BOProfessionalPurchaseLine; mFrmProfessionalPurchaseLine.UpdateView(); } frm = mFrmProfessionalPurchaseLine; } else if (model is BOTimeBillingPurchaseLine) { if (IsInvalid(mFrmTimeBillingPurchaseLine)) { mFrmTimeBillingPurchaseLine = new FrmTimeBillingPurchaseLine(mApplicationController, model as BOTimeBillingPurchaseLine); } else { mFrmTimeBillingPurchaseLine.Model = model as BOTimeBillingPurchaseLine; mFrmTimeBillingPurchaseLine.UpdateView(); } frm = mFrmTimeBillingPurchaseLine; } else if (model is BOMiscPurchaseLine) { if (IsInvalid(mFrmMiscPurchaseLine)) { mFrmMiscPurchaseLine = new FrmMiscPurchaseLine(mApplicationController, model as BOMiscPurchaseLine); } else { mFrmMiscPurchaseLine.Model = model as BOMiscPurchaseLine; mFrmMiscPurchaseLine.UpdateView(); } frm = mFrmMiscPurchaseLine; } } if (frm != null) { return(SetCurrentDlg(frm)); } else { System.Windows.Forms.MessageBox.Show("Please select a valid purchase layout first!", "Current Purchase Layout: No Default"); return(false); } }