Exemplo n.º 1
0
        private void LoadData()
        {
            txtCycleCode.Focus();

            CTable t = new CTable("CYCLE");

            vw = new MCycle(t);
            (vw as MCycle).CreateDefaultValue();

            DataContext = vw;

            if (Mode.Equals("A"))
            {
            }
            else if (Mode.Equals("E"))
            {
                CTable m = OnixWebServiceAPI.GetCycleInfo(actualView.GetDbObject());
                if (m != null)
                {
                    vw.SetDbObject(m);
                    (vw as MCycle).NotifyAllPropertiesChanged();
                }
            }
            CUtil.LoadCycleType(cboCycleType, false, (vw as MCycle).CycleType);
            CUtil.LoadCycleDayWeekly(cboCycleWeekly, false, (vw as MCycle).DayOfWeek);
            CUtil.LoadCycleDayMonthly(cboCycleMonthly, false, (vw as MCycle).DayOfMonth);
            vw.IsModified = false;

            CUtil.EnableForm(true, this);
        }
Exemplo n.º 2
0
        public WinFormConfigParam(String rptGroup, MBaseModel model)
        {
            temp.CopyValues((MReportConfig)model);

            DataContext = temp;
            InitializeComponent();
        }
Exemplo n.º 3
0
        private void cboGeneric_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox cbo = (sender as ComboBox);

            this.selectedObject = (MBaseModel)cbo.SelectedItem;
            updateGui(this);
        }
Exemplo n.º 4
0
        private static MBaseModel findObject(MBaseModel m, IList colls, String fldName)
        {
            if (m == null)
            {
                return(null);
            }

            if (fldName == null)
            {
                return(null);
            }

            if (colls == null)
            {
                return(null);
            }

            String id = (String)m.GetType().GetProperty(fldName).GetValue(m, null);

            foreach (MBaseModel o in colls)
            {
                String searchID = (String)o.GetType().GetProperty(fldName).GetValue(o, null);

                if (id.Equals(searchID))
                {
                    return(o);
                }
            }

            return(null);
        }
Exemplo n.º 5
0
        private static void updateGui(UComboBox control)
        {
            if (control.ItemSources == null)
            {
                return;
            }

            if (control.selectedObject == null)
            {
                return;
            }

            if ((control.IDFieldName == null) || (control.IDFieldName.Equals("")))
            {
                return;
            }

            control.internalFlag = true;
            MBaseModel n = findObject(control.selectedObject, control.ItemSources, control.IDFieldName);

            if (n == null)
            {
                return;
            }

            if (!n.Equals(control.SelectedObject))
            {
                //WinAddEditInventoryItem , please regression test with this Window
                control.SelectedObjectChanged(control, null);
            }

            control.SelectedObject          = n;
            control.cboGeneric.SelectedItem = n;
            control.internalFlag            = false;
        }
Exemplo n.º 6
0
        private MBaseModel createObject(Range row)
        {
            int       colCnt = row.Columns.Count;
            Hashtable hash   = new Hashtable();

            for (int column = 1; column <= colCnt; column++)
            {
                Range  cell = row.Columns[column];
                String data = "";
                if (cell.Value2 != null)
                {
                    data = cell.Value2.ToString();
                }

                String propertyName = (String)colNames[column - 1];
                hash[propertyName] = data.Trim();
            }

            MBaseModel en = createModel();

            foreach (PropertyInfo prop in en.GetType().GetProperties())
            {
                String propertyName = prop.Name;
                if (hash.ContainsKey(propertyName))
                {
                    String value = (String)hash[propertyName];
                    prop.SetValue(en, value, null);
                }
            }

            return(en);
        }
        public UFormEmployeeLeave(MBaseModel model, int page, int totalPage, MReportConfig cfg, CReportPageParam param)
        {
            if (model == null)
            {
                model = new MEmployeeLeave(new Wis.WsClientAPI.CTable(""));
            }

            dataSource = model;
            leaveDoc   = (MEmployeeLeave)model;

            pageNo    = page;
            pageCount = totalPage;
            pageParam = param;
            rptConfig = cfg;

            init();

            int idx = pageNo - 1;

            //item = payrollDoc.LeaveRecords(idx);
            //if (item == null)
            //{
            //    item = new MLeaveRecord(new Wis.WsClientAPI.CTable(""));
            //}

            //item.InitializeAfterLoaded();
            //PopulateDummyRecords(leaveDoc);

            DataContext = leaveDoc;
            InitializeComponent();
        }
Exemplo n.º 8
0
 public CBasketItem(String k, MBaseModel item, double quantity)
 {
     key     = k;
     v       = item;
     qty     = quantity;
     leftQty = qty;
 }
        public WinTextIntellisense(String position, TextBox source, Window win, TextSearchNameSpace ns, MasterRefEnum mrt, Boolean showDetail, UTextBox caller, MBaseModel extParam)
        {
            int offset = 10;

            parentCaller = caller;
            nameSpace    = ns;
            mrType       = mrt;
            isShowDetail = showDetail;
            extraParam   = extParam;

            //https://social.msdn.microsoft.com/Forums/vstudio/en-US/281a8cdd-69a9-4a4a-9fc3-c039119af8ed/absolute-screen-coordinates-of-wpf-user-control?forum=wpf
            Point locationFromScreen = source.PointToScreen(new Point(0, 0));
            PresentationSource s     = PresentationSource.FromVisual(win);
            Point targetPoints       = s.CompositionTarget.TransformFromDevice.Transform(locationFromScreen);

            if (position.Equals("R"))
            {
                tp = targetPoints.Y;
                lf = targetPoints.X + source.ActualWidth + offset;
            }
            else if (position.Equals("B"))
            {
                tp = targetPoints.Y + source.ActualHeight + offset;
                lf = targetPoints.X;
            }

            InitializeComponent();
        }
Exemplo n.º 10
0
        private void mnuSubMenu_Click(object sender, EventArgs e)
        {
            MenuItem mnu  = (sender as MenuItem);
            string   name = mnu.Name;

            if (name.Equals("mnuItemEdit"))
            {
                showEditWindow();
            }
            else if (name.Equals("mnuItemBalanceCheck"))
            {
                if (!CHelper.VerifyAccessRight("INVENTORY_BALANCE_VIEW"))
                {
                    return;
                }

                MBaseModel v = currentViewObj;

                WinItemBalanceInfo w = new WinItemBalanceInfo();
                w.ViewData = (MInventoryItem)v;
                w.Caption  = (String)mnu.Header;
                w.Mode     = "E";
                //w.ParentItemSource = grdViewInventoryItems.GridItemsSource;
                w.ShowDialog();
            }
        }
        public UFormPurchaseOrderService(MBaseModel model, int page, int totalPage, MReportConfig cfg, CReportPageParam param)
        {
            if (model == null)
            {
                model = new MAuxilaryDoc(new Wis.WsClientAPI.CTable(""));
            }

            dataSource = model;
            pageNo     = page;
            pageCount  = totalPage;
            pageParam  = param;
            rptConfig  = cfg;


            init();

            MAuxilaryDoc ad = (dataSource as MAuxilaryDoc);

            numberTextAmount = ad.ArApAmtFmt;

            primaryColumns.Clear();

            primaryColumns.Add(new GridLength(31, GridUnitType.Star));
            primaryColumns.Add(new GridLength(9, GridUnitType.Star));
            primaryColumns.Add(new GridLength(9, GridUnitType.Star));
            primaryColumns.Add(new GridLength(9, GridUnitType.Star));
            primaryColumns.Add(new GridLength(9, GridUnitType.Star));
            primaryColumns.Add(new GridLength(9, GridUnitType.Star));
            primaryColumns.Add(new GridLength(8, GridUnitType.Star));
            primaryColumns.Add(new GridLength(8, GridUnitType.Star));
            primaryColumns.Add(new GridLength(8, GridUnitType.Star));

            DataContext = model;
            InitializeComponent();
        }
Exemplo n.º 12
0
        private static void OnSelectedObjectPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            ULookupSearch2 control = sender as ULookupSearch2;
            MBaseModel     v       = (MBaseModel)e.NewValue;

            if (v != null)
            {
                CTable obj = v.GetDbObject();

                CLookupConfig cfg = (CLookupConfig)control.lookupTypeConfigs[control.Lookup];
                control.txtCode.Text = obj.GetFieldValue(cfg.CodeFieldName);
                control.txtName.Text = obj.GetFieldValue(cfg.NameFieldName);
            }
            else
            {
                control.txtCode.Text = "";
                control.txtName.Text = "";
            }

            control.isEmpty = control.txtCode.Text.Equals("");

            if (control.SelectedObjectChanged != null)
            {
                control.SelectedObjectChanged(control, null);
            }
        }
Exemplo n.º 13
0
        private void cmdAction_Click(object sender, RoutedEventArgs e)
        {
            Button btn = sender as Button;

            currentViewObj         = (MBaseModel)btn.Tag;
            btn.ContextMenu.IsOpen = true;
        }
Exemplo n.º 14
0
        public UFormPayrollSlip(MBaseModel model, int page, int totalPage, MReportConfig cfg, CReportPageParam param)
        {
            if (model == null)
            {
                model = new MVPayrollDocument(new Wis.WsClientAPI.CTable(""));
            }

            dataSource = model;
            payrollDoc = (MVPayrollDocument)model;

            pageNo    = page;
            pageCount = totalPage;
            pageParam = param;
            rptConfig = cfg;

            init();

            int idx = pageNo - 1;

            item = payrollDoc.GetItemByIndex(idx);
            if (item == null)
            {
                item = new MVPayrollDocumentItem(new Wis.WsClientAPI.CTable(""));
            }

            item.InitializeAfterLoaded();

            DataContext = model;
            InitializeComponent();
        }
Exemplo n.º 15
0
        public UFormQuotationComplex(MBaseModel model, int page, int totalPage, MReportConfig cfg, CReportPageParam param)
        {
            if (model == null)
            {
                model = new MAuxilaryDoc(new Wis.WsClientAPI.CTable(""));
            }

            dataSource = model;
            pageNo     = page;
            pageCount  = totalPage;
            pageParam  = param;
            rptConfig  = cfg;

            init();

            MAuxilaryDoc ad = (dataSource as MAuxilaryDoc);

            numberTextAmount = ad.ArApAmtFmt;
            amountFmt        = ad.ArApAmtFmt;

            primaryColumns.Clear();

            primaryColumns.Add(new GridLength(10, GridUnitType.Star));
            primaryColumns.Add(new GridLength(60, GridUnitType.Star));
            primaryColumns.Add(new GridLength(30, GridUnitType.Star));

            DataContext = model;
            InitializeComponent();

            //These 2 lines are important to place here after InitializeComponent();
            headerPanel = grdBody;
            tablePanel  = dckBody;

            descriptionColumnIndex = 1;
        }
Exemplo n.º 16
0
        protected void loadDataItem()
        {
            CTable t = new CTable("");

            vw = createObject();

            DataContext = vw;

            CUtil.EnableForm(false, this);

            if (loadParam.Mode.Equals("E"))
            {
                CTable newDB = loadParam.ActualView.GetDbObject().Clone();
                vw.SetDbObject(newDB);
                vw.InitializeAfterLoaded();
                vw.NotifyAllPropertiesChanged();
            }
            else
            {
            }

            vw.IsModified = false;
            isInLoad      = false;

            CUtil.EnableForm(true, this);
        }
Exemplo n.º 17
0
 public WinAddEditCycle(String _mode, MBaseModel _actualView, ObservableCollection <MBaseModel> _parents)
 {
     Mode       = _mode;
     actualView = _actualView;
     parents    = _parents;
     InitializeComponent();
 }
Exemplo n.º 18
0
        protected void loadData()
        {
            CTable t = new CTable("");

            vw = createObject();

            DataContext = vw;

            CUtil.EnableForm(false, this);

            if (loadParam.Mode.Equals("E"))
            {
                CTable m = OnixWebServiceAPI.SubmitObjectAPI(getInfoAPIName, loadParam.ActualView.GetDbObject());
                if (m != null)
                {
                    vw.SetDbObject(m);
                    vw.InitializeAfterLoaded();
                    vw.NotifyAllPropertiesChanged();
                    vw.InitializeAfterNotified();
                }
            }

            vw.IsModified = false;
            isInLoad      = false;

            CUtil.EnableForm(true, this);
        }
Exemplo n.º 19
0
        public UFormNoResidentWithholdingTax(MBaseModel model, int page, int issue, int totalPage, MReportConfig cfg, CReportPageParam param)
        {
            if (model == null)
            {
                model = new MAccountDoc(new Wis.WsClientAPI.CTable(""));
            }

            dataSource = model;
            pageNo     = page;
            pageCount  = totalPage;
            pageParam  = param;
            rptConfig  = cfg;
            issueCout  = issue;

            init();

            MAccountDoc ad = (dataSource as MAccountDoc);

            numberTextAmount = ad.CashReceiptAmtFmt;

            primaryColumns.Clear();

            primaryColumns.Add(new GridLength(70, GridUnitType.Star));
            primaryColumns.Add(new GridLength(14, GridUnitType.Star));
            primaryColumns.Add(new GridLength(13, GridUnitType.Star));
            primaryColumns.Add(new GridLength(13, GridUnitType.Star));

            DataContext = model;
            InitializeComponent();
        }
Exemplo n.º 20
0
 private void lsvPayment_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (lsvPayment.SelectedItems.Count == 1)
     {
         currentViewObj = (MPaymentCriteria)lsvPayment.SelectedItems[0];
         ShowPaymentEditWindow();
     }
 }
Exemplo n.º 21
0
 private void lsvAccoutItem_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (lsvPoItem.SelectedItems.Count == 1)
     {
         currentViewObj = (MAuxilaryDocItem)lsvPoItem.SelectedItems[0];
         ShowEditWindow();
     }
 }
 private void lsvFilter_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     if (lsvFilter.SelectedItems.Count == 1)
     {
         MBaseModel m = (MBaseModel)lsvFilter.SelectedItems[0];
         parentCaller.CloseIntellisense();
     }
 }
Exemplo n.º 23
0
 private void lsvMain_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     if (lsvMain.SelectedItems.Count == 1)
     {
         MBaseModel m = (MBaseModel)lsvMain.SelectedItems[0];
         criteria.DoubleClickData(m);
     }
 }
Exemplo n.º 24
0
 private void lsvMain_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
 {
     if (lsvMain.SelectedItems.Count == 1)
     {
         currentViewObj = (MBaseModel)lsvMain.SelectedItems[0];
         showEditWindow();
     }
 }
        private String CashAccountToIndex(MBaseModel obj)
        {
            if (obj == null)
            {
                return("");
            }

            return((obj as MCashAccount).CashAccountID);
        }
Exemplo n.º 26
0
        private void showEditWindow()
        {
            if (!CHelper.VerifyAccessRight("PROMOTION_BILLSIM_VIEW"))
            {
                return;
            }

            MBaseModel v = currentObj;
        }
Exemplo n.º 27
0
        protected MBaseModel createModel()
        {
            //Be careful Model or Models
            String clssName = "Onix.Client.Model." + modelName + ",OnixClient";
            Type   t        = Type.GetType(clssName);

            MBaseModel obj = (MBaseModel)Activator.CreateInstance(t, new CTable(""));

            return(obj);
        }
        public WinAddEditFormVariable(String md, MBaseModel parent, MBaseModel actObj)
        {
            actualView = (MFormConfigVariable)actObj;
            parentObj  = (MFormConfig)parent;
            mode       = md;

            DataContext = vw;

            InitializeComponent();
        }
Exemplo n.º 29
0
        private static CPromotionProcessor getPromotionProcessor(MPackage pkg, MBaseModel bill)
        {
            String pkgType        = pkg.PackageType;
            CPromotionProcessor o = null;

            if (pkgType.Equals("1"))
            {
                o = new CPromotionProcessorPricing(pkg, CLanguage.getValue("pkg_group_pricing"), bill);
            }
            else if (pkgType.Equals("2"))
            {
                o = new CPromotionProcessorBonus(pkg, CLanguage.getValue("pkg_group_grouping"), bill);
            }
            else if (pkgType.Equals("3"))
            {
                o = new CPromotionProcessorItemDiscount(pkg, CLanguage.getValue("pkg_group_discount"), bill);
            }
            else if (pkgType.Equals("4"))
            {
                //Voucher/Gift
                o = new CPromotionProcessorGift(pkg, CLanguage.getValue("pkg_group_grouping"), bill);
            }
            else if (pkgType.Equals("5"))
            {
                //Bundle
                o = new CPromotionProcessorBundle(pkg, CLanguage.getValue("pkg_group_grouping"), bill);
            }
            else if (pkgType.Equals("6"))
            {
                //Final Discount
                o = new CPromotionProcessorFinalDiscount(pkg, CLanguage.getValue("pkg_group_final_discount"), bill);
            }
            else if (pkgType.Equals("7"))
            {
                //Post Gift
                o = new CPromotionProcessorPostGift(pkg, CLanguage.getValue("pkg_group_post_gift"), bill);
            }
            else if (pkgType.Equals("8"))
            {
                //Tray Price/Discount
                o = new CPromotionProcessorTrayPricing(pkg, CLanguage.getValue("tray_package_price"), bill);
            }
            else if (pkgType.Equals("9"))
            {
                //Tray Bonus
                o = new CPromotionProcessorTrayBonus(pkg, CLanguage.getValue("tray_package_group"), bill);
            }
            else if (pkgType.Equals("10"))
            {
                //Tray Bundle
                o = new CPromotionProcessorTrayBundle(pkg, CLanguage.getValue("tray_package_group"), bill);
            }

            return(o);
        }
Exemplo n.º 30
0
        protected String ObjectToIndex(MBaseModel obj)
        {
            if (obj == null)
            {
                return("");
            }

            MMasterRef mr = (MMasterRef)obj;

            return(mr.MasterID);
        }