private string submitaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessWorkPlaceType bc = new project.Business.Base.BusinessWorkPlaceType(); if (jp.getValue("tp") == "update") { bc.load(jp.getValue("id")); bc.Entity.WPTypeName = jp.getValue("WPTypeName"); bc.Entity.WPTypeSeat = ParseIntForString(jp.getValue("WPTypeSeat")); int r = bc.Save("update"); if (r <= 0) { flag = "2"; } } else { Data obj = new Data(); DataTable dt = obj.PopulateDataSet("select cnt=COUNT(*) from Mstr_WorkPlaceType where WPTypeNo='" + jp.getValue("WPTypeNo") + "'").Tables[0]; if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0) { flag = "3"; } else { bc.Entity.WPTypeNo = jp.getValue("WPTypeNo"); bc.Entity.WPTypeName = jp.getValue("WPTypeName"); bc.Entity.WPTypeSeat = ParseIntForString(jp.getValue("WPTypeSeat")); 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("WPTypeNameS")))); return(collection.ToString()); }