예제 #1
0
        private string deleteaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

                if (obj.PopulateDataSet("select 1 from Mstr_Service where CANo='" + bc.Entity.CANo + "' and SRVSPNo='" + bc.Entity.CASPNo + "'").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("CANoS"), jp.getValue("CANameS"), jp.getValue("CASPNoS"), int.Parse(jp.getValue("page")))));

            return(collection.ToString());
        }
예제 #2
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

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

                        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("CANoS"), jp.getValue("CANameS"), jp.getValue("CASPNoS"), int.Parse(jp.getValue("page")))));

            return(collection.ToString());
        }
예제 #3
0
        private string updateaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

                collection.Add(new JsonStringValue("CANo", bc.Entity.CANo));
                collection.Add(new JsonStringValue("CAName", bc.Entity.CAName));
                collection.Add(new JsonStringValue("CASPNo", bc.Entity.CASPNo));
                collection.Add(new JsonStringValue("APNo", bc.Entity.APNo));
            }
            catch
            { flag = "2"; }

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

            return(collection.ToString());
        }