Example #1
0
        public CategoryActions GetCategoryActions(string id)
        {
            CategoryActions cat      = new CategoryActions();
            DataSet         dataset  = new DataSet();
            string          queryStr = string.Format("SELECT * FROM  categoryactions WHERE  CategoryActionID = '{0}'", id);

            Program.destopService.DataQuery(Program.Username, Program.Password, queryStr, ref dataset, "x", ref errorString);

            if (!string.IsNullOrEmpty(errorString))
            {
                return(null);
            }

            if (dataset.Tables["x"].Rows.Count > 0)
            {
                cat.CategoryActionID    = dataset.Tables["x"].Rows[0]["CategoryActionID"].ToString();
                cat.CategoryActionName  = dataset.Tables["x"].Rows[0]["CategoryActionName"].ToString();
                cat.CategoryActionName2 = dataset.Tables["x"].Rows[0]["CategoryActionName2"].ToString();
                cat.CategoryActionName3 = dataset.Tables["x"].Rows[0]["CategoryActionName3"].ToString();
            }
            else
            {
                cat = null;
            }

            return(cat);
        }
Example #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                CategoryActions classifi = new CategoryActions();
                classifi.CategoryActionID = currentClassifiId;
                if (!string.IsNullOrEmpty(txtClassificationName.Text.Trim()) || !string.IsNullOrEmpty(txtClassificationName2.Text.Trim()) || !string.IsNullOrEmpty(txtClassificationName3.Text.Trim()))
                {
                    classifi.CategoryActionName  = txtClassificationName.Text;
                    classifi.CategoryActionName2 = txtClassificationName2.Text;
                    classifi.CategoryActionName3 = txtClassificationName3.Text;
                    DialogResult r = CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CRM227"), Common.clsLanguages.GetResource("CRM11"), Common.Config.CUSTOM_MESSAGEBOX_ICON.Information, Common.Config.CUSTOM_MESSAGEBOX_BUTTON.YESNO);
                    if (r == DialogResult.Yes)
                    {
                        if (!string.IsNullOrEmpty(currentClassifiId))
                        {// update
                            classifications.Edit(classifi);
                        }
                        else
                        {
                            classifications.Add(classifi);
                        }
                        GetLists_InGridClassification();

                        if (!string.IsNullOrEmpty(classifications.ErrorString))
                        {
                            CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CRM219"),
                                                                             Common.clsLanguages.GetResource("CRM11"),
                                                                             Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                             Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
                            return;
                        }
                    }
                }
                else
                {
                    CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CRMErrEmpCusType"),
                                                                     Common.clsLanguages.GetResource("CRM11"),
                                                                     Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                     Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
                    return;
                }
            }
            catch (Exception)
            {
                string code = System.Runtime.InteropServices.Marshal.GetExceptionCode().ToString();
                if (code == "-532462766")
                {
                    CustomMessageBox.MessageBox.ShowCustomMessageBox(Common.clsLanguages.GetResource("CRM292"),
                                                                     Common.clsLanguages.GetResource("CRM11"),
                                                                     Common.Config.CUSTOM_MESSAGEBOX_ICON.Information,
                                                                     Common.Config.CUSTOM_MESSAGEBOX_BUTTON.OK);
                }
                return;
            }
        }
Example #3
0
        public void testApiDeleteCategoryRestResponse()
        {
            Category category = new Category("Category" + RandomStringUtil.RandomAlphaNumericString(5));

            DoApiLogin();
            CategoryActions.CreateCategoryViaApi(category);

            Assert.AreEqual(HttpStatusCode.OK, RestAdapter.DELETE(String.Format("/Category/Delete/{0}", category.categoryId)).StatusCode,
                            "Category deletion failed");
        }
Example #4
0
        public void testApiDeletedCategoryIsNotInCategoriesList()
        {
            Category category = new Category("Category" + RandomStringUtil.RandomAlphaNumericString(5));

            DoApiLogin();
            CategoryActions.CreateCategoryViaApi(category);
            category.stock = 0;
            RestAdapter.DELETE(String.Format("/Category/Delete/{0}", category.categoryId));
            List <Category> categories = jsonDeserializer.Deserialize <List <Category> >(RestAdapter.GET("/Category/Index"));

            CollectionAssert.DoesNotContain(categories, category, "Deleted category is in categories list");
        }
Example #5
0
        public void testApiCreatedCategoryIsInTheCategoriesList()
        {
            Category category = new Category("Category" + RandomStringUtil.RandomAlphaNumericString(5));

            DoApiLogin();
            CategoryActions.CreateCategoryViaApi(category);
            category.stock = 0;

            List <Category> categories = jsonDeserializer.Deserialize <List <Category> >(RestAdapter.GET("/Category/Index"));

            CollectionAssert.Contains(categories, category, "Created category is not in categories list");
        }
 public async Task <List <Category> > GetCategories(int pageSize, int page)
 {
     return(await CategoryActions.GetCategoriesAsync(_context, pageSize, page));
 }