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

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

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

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

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

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

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

            result = collection.ToString();

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

            try
            {
                Business.Base.BusinessOrderType bc = new project.Business.Base.BusinessOrderType();
                bc.load(jp.getValue("id"));

                //if (obj.PopulateDataSet("select 1 from Mstr_Billboard where OrderType='" + bc.Entity.OrderTypeNo + "'").Tables[0].Rows.Count > 0)
                //{
                //    flag = "3";
                //}
                //else
                //{
                int r = bc.delete();
                if (r <= 0)
                {
                    flag = "2";
                }
                //}
            }
            catch { flag = "2"; }

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

            return(collection.ToString());
        }
Esempio n. 4
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessOrderType bc = new project.Business.Base.BusinessOrderType();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"), user.Entity.AccID);
                    bc.Entity.OrderTypeName = jp.getValue("OrderTypeName");
                    bc.Entity.FlowNo        = jp.getValue("FlowNo");
                    int r = bc.Save("update");
                    if (r <= 0)
                    {
                        flag = "2";
                    }
                }
                else
                {
                    Data      obj = new Data();
                    DataTable dt  = obj.ExecuteDataSet("select 1 from Base_Order_Type where OrderTypeNo=N'" + jp.getValue("OrderTypeNo") + "' and AccID='" + user.Entity.AccID + "'").Tables[0];
                    if (dt.Rows.Count > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.Entity.OrderTypeNo   = jp.getValue("OrderTypeNo");
                        bc.Entity.OrderTypeName = jp.getValue("OrderTypeName");
                        bc.Entity.FlowNo        = jp.getValue("FlowNo");
                        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());
        }
Esempio n. 5
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessOrderType bc = new project.Business.Base.BusinessOrderType();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"));
                    bc.Entity.OrderTypeName = jp.getValue("OrderTypeName");
                    int r = bc.Save("update");

                    if (r <= 0)
                    {
                        flag = "2";
                    }
                }
                else
                {
                    Data      obj = new Data();
                    DataTable dt  = obj.PopulateDataSet("select cnt=COUNT(*) from Mstr_OrderType where OrderTypeNo='" + jp.getValue("OrderTypeNo") + "'").Tables[0];
                    if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.Entity.OrderTypeNo   = jp.getValue("OrderTypeNo");
                        bc.Entity.OrderTypeName = jp.getValue("OrderTypeName");

                        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(jp.getValue("OrderTypeNameS"))));

            return(collection.ToString());
        }