Example #1
0
        private string validaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

            try
            {
                Business.Base.BusinessService bc = new project.Business.Base.BusinessService();
                bc.load(jp.getValue("id"));
                bc.Entity.SRVStatus = !bc.Entity.SRVStatus;

                int r = bc.valid();
                if (r <= 0)
                {
                    flag = "2";
                }
                if (bc.Entity.SRVStatus)
                {
                    collection.Add(new JsonStringValue("stat", "<span class=\"label label-success radius\">有效</span>"));
                }
                else
                {
                    collection.Add(new JsonStringValue("stat", "<span class=\"label radius\">已失效</span>"));
                }
                collection.Add(new JsonStringValue("id", jp.getValue("id")));
            }
            catch { flag = "2"; }

            collection.Add(new JsonStringValue("type", "valid"));
            collection.Add(new JsonStringValue("flag", flag));
            return(collection.ToString());
        }
Example #2
0
        private string deleteaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

                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("SRVNoS"), jp.getValue("SRVNameS"), jp.getValue("SRVTypeNo1S"), jp.getValue("SRVTypeNo2S"),
                                                                     jp.getValue("SRVSPNoS"), jp.getValue("CANoS"), jp.getValue("SRVCalTypeS"), ParseIntForString(jp.getValue("page")))));

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

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

                collection.Add(new JsonStringValue("SRVNo", bc.Entity.SRVNo));
                collection.Add(new JsonStringValue("SRVName", bc.Entity.SRVName));
                collection.Add(new JsonStringValue("SRVTypeNo1", bc.Entity.SRVTypeNo1));
                collection.Add(new JsonStringValue("SRVTypeNo1Name", bc.Entity.SRVTypeNo1Name));
                collection.Add(new JsonStringValue("SRVTypeNo2", bc.Entity.SRVTypeNo2));
                collection.Add(new JsonStringValue("SRVTypeNo2Name", bc.Entity.SRVTypeNo2Name));
                collection.Add(new JsonStringValue("SRVSPNo", bc.Entity.SRVSPNo));
                collection.Add(new JsonStringValue("SRVSPName", bc.Entity.SRVSPName));
                collection.Add(new JsonStringValue("CANo", bc.Entity.CANo));
                collection.Add(new JsonStringValue("CAName", bc.Entity.CAName));
                collection.Add(new JsonStringValue("SRVCalType", bc.Entity.SRVCalType));
                collection.Add(new JsonStringValue("SRVRoundType", bc.Entity.SRVRoundType));
                collection.Add(new JsonStringValue("SRVDecimalPoint", bc.Entity.SRVDecimalPoint.ToString()));
                collection.Add(new JsonStringValue("SRVRate", bc.Entity.SRVRate.ToString("0.####")));
                collection.Add(new JsonStringValue("SRVTaxRate", bc.Entity.SRVTaxRate.ToString("0.####")));
                collection.Add(new JsonStringValue("SRVRemark", bc.Entity.SRVRemark));

                string subtype = "";
                int    row     = 0;
                Business.Base.BusinessServiceType bs = new Business.Base.BusinessServiceType();
                foreach (Entity.Base.EntityServiceType it in bs.GetListQuery(string.Empty, string.Empty, bc.Entity.SRVTypeNo1, string.Empty, true))
                {
                    subtype += it.SRVTypeNo + ":" + it.SRVTypeName + ";";
                    row++;
                }
                collection.Add(new JsonNumericValue("row", row));
                collection.Add(new JsonStringValue("subtype", subtype));

                string subtype1 = "";
                int    row1     = 0;
                Business.Base.BusinessChargeAccount ba = new Business.Base.BusinessChargeAccount();
                foreach (Entity.Base.EntityChargeAccount it in ba.GetListQuery(string.Empty, string.Empty, bc.Entity.SRVSPNo))
                {
                    subtype1 += it.CANo + ":" + it.CAName + " - " + it.CASPName + ";";
                    row1++;
                }
                collection.Add(new JsonNumericValue("row1", row1));
                collection.Add(new JsonStringValue("subtype1", subtype1));
            }
            catch
            { flag = "2"; }

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

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

            try
            {
                Business.Base.BusinessService bc = new project.Business.Base.BusinessService();
                if (jp.getValue("tp") == "update")
                {
                    bc.load(jp.getValue("id"));
                    bc.Entity.SRVName         = jp.getValue("SRVName");
                    bc.Entity.SRVTypeNo1      = jp.getValue("SRVTypeNo1");
                    bc.Entity.SRVTypeNo2      = jp.getValue("SRVTypeNo2");
                    bc.Entity.SRVSPNo         = jp.getValue("SRVSPNo");
                    bc.Entity.CANo            = jp.getValue("CANo");
                    bc.Entity.SRVCalType      = jp.getValue("SRVCalType");
                    bc.Entity.SRVRoundType    = jp.getValue("SRVRoundType");
                    bc.Entity.SRVDecimalPoint = ParseIntForString(jp.getValue("SRVDecimalPoint"));
                    bc.Entity.SRVRate         = ParseDecimalForString(jp.getValue("SRVRate"));
                    bc.Entity.SRVTaxRate      = ParseDecimalForString(jp.getValue("SRVTaxRate"));
                    bc.Entity.SRVRemark       = jp.getValue("SRVRemark");
                    int r = bc.Save("update");

                    if (r <= 0)
                    {
                        flag = "2";
                    }
                }
                else
                {
                    Data      obj = new Data();
                    DataTable dt  = obj.PopulateDataSet("select cnt=COUNT(*) from Mstr_Service where SRVNo='" + jp.getValue("SRVNo") + "'").Tables[0];
                    if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0)
                    {
                        flag = "3";
                    }
                    else
                    {
                        bc.Entity.SRVNo           = jp.getValue("SRVNo");
                        bc.Entity.SRVName         = jp.getValue("SRVName");
                        bc.Entity.SRVTypeNo1      = jp.getValue("SRVTypeNo1");;
                        bc.Entity.SRVTypeNo2      = jp.getValue("SRVTypeNo2");
                        bc.Entity.SRVSPNo         = jp.getValue("SRVSPNo");
                        bc.Entity.CANo            = jp.getValue("CANo");
                        bc.Entity.SRVCalType      = jp.getValue("SRVCalType");
                        bc.Entity.SRVRoundType    = jp.getValue("SRVRoundType");
                        bc.Entity.SRVDecimalPoint = ParseIntForString(jp.getValue("SRVDecimalPoint"));
                        bc.Entity.SRVRate         = ParseDecimalForString(jp.getValue("SRVRate"));
                        bc.Entity.SRVTaxRate      = ParseDecimalForString(jp.getValue("SRVTaxRate"));
                        bc.Entity.SRVRemark       = jp.getValue("SRVRemark");

                        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("SRVNoS"), jp.getValue("SRVNameS"), jp.getValue("SRVTypeNo1S"), jp.getValue("SRVTypeNo2S"),
                                                                     jp.getValue("SRVSPNoS"), jp.getValue("CANoS"), jp.getValue("SRVCalTypeS"), ParseIntForString(jp.getValue("page")))));

            return(collection.ToString());
        }