Esempio n. 1
0
        private Boolean ValidateData()
        {
            Boolean result = false;

            result = CHelper.ValidateTextBox(lblItemCategoryName, txtItemCategoryName, false);
            if (!result)
            {
                return(result);
            }

            CTable        ug = new CTable("ITEM_CATEGORY");
            MItemCategory uv = new MItemCategory(ug);

            if (vw != null)
            {
                uv.ItemCategoryID = (vw as MItemCategory).ItemCategoryID;
                uv.CategoryName   = (vw as MItemCategory).CategoryName;
            }

            if (OnixWebServiceAPI.IsItemCategoryExist(uv.GetDbObject()))
            {
                CHelper.ShowKeyExist(lblItemCategoryName, txtItemCategoryName);
                return(false);
            }

            return(result);
        }
        private void updateObject()
        {
            MPackagePrice v = (MPackagePrice)ProductSelected;

            if (v == null)
            {
                return;
            }

            v.ServiceObj      = null;
            v.ItemObj         = null;
            v.ItemCategoryObj = null;

            if (lkupItem.SelectedObject != null)
            {
                if (lkupItem.Lookup == LookupSearchType2.ServiceLookup)
                {
                    MService svc = (MService)lkupItem.SelectedObject;

                    v.ServiceObj    = svc;
                    v.SelectionType = "1";
                    v.Code          = svc.ServiceCode;
                    v.Name          = svc.ServiceName;
                }
                else if (lkupItem.Lookup == LookupSearchType2.InventoryItemLookup)
                {
                    MInventoryItem itm = (MInventoryItem)lkupItem.SelectedObject;

                    v.ItemObj       = itm;
                    v.SelectionType = "2";
                    v.Code          = itm.ItemCode;
                    v.Name          = itm.ItemNameThai;
                }
                else if (lkupItem.Lookup == LookupSearchType2.ItemCategoryLookup)
                {
                    MItemCategory cat = (MItemCategory)lkupItem.SelectedObject;

                    v.ItemCategoryObj = cat;
                    v.SelectionType   = "3";
                    v.Code            = cat.ItemCategoryID;
                    v.Name            = cat.CategoryName;
                }
                else if (lkupItem.Lookup == LookupSearchType2.ServiceTypeLookup)
                {
                    MMasterRef svt = (MMasterRef)lkupItem.SelectedObject;

                    v.ServiceTypeObj = svt;
                    v.SelectionType  = "4";
                    v.Code           = svt.Code;
                    v.Name           = svt.Description;
                }
            }
        }
Esempio n. 3
0
        private void mnuHeadAdd_Click(object sender, RoutedEventArgs e)
        {
            if (!CHelper.VerifyAccessRight("ITEM_CATEGORY_ADD"))
            {
                return;
            }

            MenuItem      mnu = (sender as MenuItem);
            MItemCategory currentViewHeadObj = new MItemCategory(new CTable("ITEM_CATEGORY"));

            WinAddEditItemCategory w = new WinAddEditItemCategory();

            w.Caption  = (String)mnu.Header;
            w.ViewData = currentViewHeadObj;
            w.Mode     = "A";
            w.ShowDialog();
        }
Esempio n. 4
0
        private void LoadData()
        {
            string CapOpt = string.Empty;

            txtItemCategoryName.Focus();

            CTable t = new CTable("ITEM_CATEGORY");

            vw = new MItemCategory(t);
            vw.CreateDefaultValue();

            DataContext = vw;

            CUtil.EnableForm(false, this);

            if (actualView != null)
            {
                if (Mode.Equals("A"))
                {
                    vw.ParentID  = actualView.ItemCategoryID.ToString();
                    vw.ItemCount = "0".ToString();

                    CTable MItemCategory = new CTable("ITEM_CATEGORY");
                    MItemCategory.SetFieldValue("ITEM_CATEGORY_ID", actualView.ItemCategoryID.ToString());
                    ArrayList arr = OnixWebServiceAPI.GetItemCategoryList(MItemCategory);

                    foreach (CTable a in arr)
                    {
                        vw.TempNameParentID = a.GetFieldValue("CATEGORY_NAME");
                        vw.ChildCount       = a.GetFieldValue("CHILD_COUNT");
                    }
                    CapOpt = "(" + vw.TempNameParentID + ")";
                }
                else
                {
                    vw.ItemCategoryID = actualView.ItemCategoryID.ToString();
                    vw.ItemCount      = actualView.ItemCount.ToString();
                    vw.CategoryName   = actualView.CategoryName.ToString();
                }
            }
            this.Title = Caption + CapOpt;

            isModified = false;

            CUtil.EnableForm(true, this);
        }
Esempio n. 5
0
        public override Tuple <CTable, ObservableCollection <MBaseModel> > QueryData()
        {
            items = OnixWebServiceAPI.GetItemCategoryPathList(model.GetDbObject());
            lastObjectReturned = OnixWebServiceAPI.GetLastObjectReturned();

            itemSources.Clear();
            int idx = 0;

            foreach (CTable o in items)
            {
                MItemCategory v = new MItemCategory(o);

                v.RowIndex = idx;
                itemSources.Add(v);
                idx++;
            }

            Tuple <CTable, ObservableCollection <MBaseModel> > tuple = new Tuple <CTable, ObservableCollection <MBaseModel> >(lastObjectReturned, itemSources);

            return(tuple);
        }
Esempio n. 6
0
        private void trvMain_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            cvItemObj = (MItemCategory)trvMain.SelectedItem;
            if (cvItemObj == null)
            {
                return;
            }

            param.ItemCategory = cvItemObj.ItemCategoryID;

            int ccnt = CUtil.StringToInt(cvItemObj.ChildCount);

            if (provider != null)
            {
                (provider as UInventoryItem).SetCategoryItem(cvItemObj);
                CUtil.EnableForm(false, this);
                param.ChunkNo = "";
                if (ccnt <= 0)
                {
                    (provider as UInventoryItem).QueryData(param.GetDbObject());
                }
                CUtil.EnableForm(true, this);
            }
        }
 public void SetCategoryItem(MItemCategory ci)
 {
     cit = ci;
 }