コード例 #1
0
ファイル: Formula.cs プロジェクト: luowenyuyu/NewDorllyOrder
        private string ModifyAction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            int flag = 1;

            try
            {
                BusinessFormula bc = new BusinessFormula();
                bc.GetByID(jp.getValue("id"));
                bc.Entity.Name        = jp.getValue("name");
                bc.Entity.Explanation = jp.getValue("explanation");
                bc.Entity.Remark      = jp.getValue("remark");
                if (bc.Update() > 0)
                {
                    flag = 0;
                    collection.Add(new JsonStringValue("list", createList("", "", "", 1)));
                }
            }
            catch (Exception ex)
            {
                flag = 2;
                collection.Add(new JsonStringValue("ex", ex.Message));
            }
            collection.Add(new JsonStringValue("type", "modify"));
            collection.Add(new JsonNumericValue("flag", flag));
            return(collection.ToString());
        }
コード例 #2
0
ファイル: Formula.cs プロジェクト: luowenyuyu/NewDorllyOrder
        private string FindAction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            int flag = 0;

            try
            {
                BusinessFormula bc = new BusinessFormula();
                bc.GetByID(jp.getValue("id"));
                if (!string.IsNullOrEmpty(bc.Entity.ID))
                {
                    collection.Add(new JsonStringValue("data", JsonConvert.SerializeObject(bc.Entity)));
                }
                else
                {
                    flag = 1;
                    collection.Add(new JsonStringValue("msg", "该数据不存在!"));
                }
            }
            catch (Exception ex)
            {
                flag = 2;
                collection.Add(new JsonStringValue("ex", ex.Message));
            }
            collection.Add(new JsonStringValue("type", "find"));
            collection.Add(new JsonNumericValue("flag", flag));
            return(collection.ToString());
        }
コード例 #3
0
ファイル: Formula.cs プロジェクト: luowenyuyu/NewDorllyOrder
        private string DeleteAction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            int flag = 1;

            try
            {
                BusinessFormula bc = new BusinessFormula();
                bc.GetByID(jp.getValue("id"));
                if (bc.Delete() > 0)
                {
                    flag = 0;
                    collection.Add(new JsonStringValue("list", createList("", "", "", 1)));
                }
            }
            catch (Exception ex)
            {
                flag = 2;
                collection.Add(new JsonStringValue("ex", ex.Message));
            }
            collection.Add(new JsonStringValue("type", "delete"));
            collection.Add(new JsonNumericValue("flag", flag));
            return(collection.ToString());
        }