コード例 #1
0
        private string createList(string BBTypeName)
        {
            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='35%'>广告位类型编号</th>");
            sb.Append("<th width='60%'>广告位类型名称</th>");
            sb.Append("</tr>");
            sb.Append("</thead>");

            int r = 1;

            sb.Append("<tbody>");
            Business.Base.BusinessBillboardType bc = new project.Business.Base.BusinessBillboardType();
            foreach (Entity.Base.EntityBillboardType it in bc.GetListQuery(string.Empty, BBTypeName))
            {
                sb.Append("<tr class=\"text-c\" id=\"" + it.BBTypeNo + "\">");
                sb.Append("<td style=\"text-align:center;\">" + r.ToString() + "</td>");
                sb.Append("<td style=\"text-align:left;\">" + it.BBTypeNo + "</td>");
                sb.Append("<td style=\"text-align:left;\">" + it.BBTypeName + "</td>");
                sb.Append("</tr>");
                r++;
            }
            sb.Append("</tbody>");
            sb.Append("</table>");

            return(sb.ToString());
        }
コード例 #2
0
        private string deleteaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

                if (obj.PopulateDataSet("select 1 from Mstr_Billboard where BBType='" + bc.Entity.BBTypeNo + "'").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("BBTypeNameS"))));

            return(collection.ToString());
        }
コード例 #3
0
        private string submitaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

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

                        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("BBTypeNameS"))));

            return(collection.ToString());
        }
コード例 #4
0
        private string updateaction(JsonArrayParse jp)
        {
            JsonObjectCollection collection = new JsonObjectCollection();
            string flag = "1";

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

                collection.Add(new JsonStringValue("BBTypeNo", bc.Entity.BBTypeNo));
                collection.Add(new JsonStringValue("BBTypeName", bc.Entity.BBTypeName));
            }
            catch
            { flag = "2"; }

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

            return(collection.ToString());
        }