Ejemplo n.º 1
0
        private string deleteaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessFlow bc = new project.Business.Base.BusinessFlow();
                bc.load(jp.getValue("id"), user.Entity.AccID);
                if (obj.ExecuteDataSet("select 1 from Base_Order_Type where FlowNo='" + bc.Entity.FlowNo + "' and AccID='" + user.Entity.AccID + "'").Tables[0].Rows.Count > 0)
                {
                    flag = "3";
                }
                else
                {
                    int r = bc.delete();
                    if (r <= 0)
                    {
                        flag = "2";
                    }
                    else
                    {
                        obj.ExecuteNonQuery("delete from Base_Flow_Detail where FlowNo='" + bc.Entity.FlowNo + "' and AccID='" + user.Entity.AccID + "'");
                    }
                }
            }
            catch { flag = "2"; }

            collection.Add(new JsonStringValue("type", "delete"));
            collection.Add(new JsonStringValue("flag", flag));
            collection.Add(new JsonStringValue("liststr", createList()));

            return(collection.ToString());
        }
Ejemplo n.º 2
0
        private string updateaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag   = "1";
            string result = "";;

            try
            {
                Business.Base.BusinessFlow bc = new project.Business.Base.BusinessFlow();
                bc.load(jp.getValue("id"), user.Entity.AccID);

                collection.Add(new JsonStringValue("FlowNo", bc.Entity.FlowNo));
                collection.Add(new JsonStringValue("FlowName", bc.Entity.FlowName));
                collection.Add(new JsonStringValue("Remark", bc.Entity.Remark));
            }
            catch
            { flag = "2"; }

            collection.Add(new JsonStringValue("type", "update"));
            collection.Add(new JsonStringValue("flag", flag));

            result = collection.ToString();

            return(result);
        }
Ejemplo n.º 3
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessFlow bc = new project.Business.Base.BusinessFlow();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"), user.Entity.AccID);
                    bc.Entity.FlowName = jp.getValue("FlowName");
                    bc.Entity.Remark   = jp.getValue("Remark");
                    int r = bc.Save("update");
                    if (r <= 0)
                    {
                        flag = "2";
                    }
                }
                else
                {
                    Data      obj = new Data();
                    DataTable dt  = obj.ExecuteDataSet("select 1 from Base_Flow where FlowNo=N'" + jp.getValue("FlowNo") + "' and AccID='" + user.Entity.AccID + "'").Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.Entity.FlowNo   = jp.getValue("FlowNo");
                        bc.Entity.FlowName = jp.getValue("FlowName");
                        bc.Entity.Remark   = jp.getValue("Remark");
                        bc.Entity.AccID    = user.Entity.AccID;
                        int r = bc.Save("insert");
                        if (r <= 0)
                        {
                            flag = "2";
                        }
                    }
                }
            }
            catch { flag = "2"; }

            collection.Add(new JsonStringValue("type", "submit"));
            collection.Add(new JsonStringValue("flag", flag));
            collection.Add(new JsonStringValue("liststr", createList()));

            return(collection.ToString());
        }