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 createList(string SRVNo, string SRVName, string SRVTypeNo1, string SRVTypeNo2, string SRVSPNo, string CANo, string SRVCalType, int page)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder("");

            sb.Append("<table class=\"table table-border table-bordered table-hover table-bg table-sort\" id=\"tablelist\">");
            sb.Append("<thead>");
            sb.Append("<tr class=\"text-c\">");
            sb.Append("<th width=\"5%\">序号</th>");
            sb.Append("<th width='8%'>费用项目编号</th>");
            sb.Append("<th width='10%'>费用项目名称</th>");
            sb.Append("<th width='8%'>所属服务大类</th>");
            sb.Append("<th width='8%'>所属服务子类</th>");
            sb.Append("<th width='8%'>所属服务商</th>");
            sb.Append("<th width='8%'>取整方式</th>");
            sb.Append("<th width='5%'>小数位</th>");
            sb.Append("<th width='10%'>财务收费科目编号</th>");
            sb.Append("<th width='10%'>财务收费科目名称</th>");
            sb.Append("<th width='15%'>备注</th>");
            sb.Append("<th width='5%'>状态</th>");
            sb.Append("</tr>");
            sb.Append("</thead>");

            int r = 1;

            sb.Append("<tbody>");
            Business.Base.BusinessService bc = new project.Business.Base.BusinessService();
            foreach (Entity.Base.EntityService it in bc.GetListQuery(SRVNo, SRVName, SRVTypeNo1, SRVTypeNo2, SRVSPNo, CANo, SRVCalType, page, pageSize))
            {
                sb.Append("<tr class=\"text-c\" id=\"" + it.SRVNo + "\">");
                sb.Append("<td align='center'>" + r.ToString() + "</td>");
                sb.Append("<td>" + it.SRVNo + "</td>");
                sb.Append("<td>" + it.SRVName + "</td>");
                sb.Append("<td>" + it.SRVTypeNo1Name + "</td>");
                sb.Append("<td>" + it.SRVTypeNo2Name + "</td>");
                sb.Append("<td>" + it.SRVSPName + "</td>");
                sb.Append("<td>" + it.SRVRoundTypeName + "</td>");
                sb.Append("<td>" + it.SRVDecimalPoint.ToString() + "</td>");
                sb.Append("<td>" + it.CANo + "</td>");
                sb.Append("<td>" + it.CAName + "</td>");
                sb.Append("<td>" + it.SRVRemark + "</td>");
                sb.Append("<td class=\"td-status\"><span class=\"label " + (it.SRVStatus ? "label-success" : "") + " radius\">" + (it.SRVStatus ? "有效" : "已失效") + "</span></td>");
                sb.Append("</tr>");
                r++;
            }
            sb.Append("</tbody>");
            sb.Append("</table>");
            sb.Append(Paginat(bc.GetListCount(SRVNo, SRVName, SRVTypeNo1, SRVTypeNo2, SRVSPNo, CANo, SRVCalType), pageSize, page, 7));

            return(sb.ToString());
        }
Example #5
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());
        }