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 mnuDelete_Click(object sender, RoutedEventArgs e) { if (!CHelper.VerifyAccessRight("ITEM_CATEGORY_DELETE")) { return; } if (cvItemObj.ChildCount.ToString().Equals("0") && cvItemObj.ItemCount.ToString().Equals("0")) { if (CHelper.AskConfirmDeleteItem(cvItemObj.CategoryName.ToString())) { CUtil.EnableForm(false, this); OnixWebServiceAPI.DeleteItemCategory(cvItemObj.GetDbObject()); CUtil.EnableForm(true, this); CMasterReference.Instance.DeleteCategoryFromTree(cvItemObj); } } else { CHelper.ShowErorMessage(cvItemObj.CategoryName, "ERROR_ITEM_DELETE", null); } }
private Boolean SaveData() { if (!CHelper.VerifyAccessRight("ITEM_CATEGORY_EDIT")) { return(false); } if (Mode.Equals("A")) { if (SaveToView()) { CUtil.EnableForm(false, this); CTable newobj = OnixWebServiceAPI.CreateItemCategory(vw.GetDbObject()); if (newobj != null) { vw.SetDbObject(newobj); vw.ChildCount = "0"; //Always CMasterReference.Instance.AddCategoryToTree(vw); CMasterReference.LoadItemCategoryPathList(true, null); CUtil.EnableForm(true, this); return(true); } //Error here CUtil.EnableForm(true, this); CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_ADD", null); return(false); } } else if (Mode.Equals("E")) { if (isModified) { Boolean result = SaveToView(); if (result) { CUtil.EnableForm(false, this); actualView.CategoryName = vw.CategoryName.ToString(); CTable t = OnixWebServiceAPI.UpdateItemCategory(actualView.GetDbObject()); if (t != null) { actualView.SetDbObject(t); CMasterReference.Instance.EditCategoryInTree(actualView); CMasterReference.LoadItemCategoryPathList(true, null); CUtil.EnableForm(true, this); return(true); } CUtil.EnableForm(true, this); CHelper.ShowErorMessage(OnixWebServiceAPI.GetLastErrorDescription(), "ERROR_USER_EDIT", null); } return(false); } return(true); } return(false); }