private string getRMaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; Business.Base.BusinessLocation bc = new Business.Base.BusinessLocation(); bc.load(jp.getValue("RMLOCNo3")); string building = ""; Business.Base.BusinessLocation loc2 = new Business.Base.BusinessLocation(); foreach (Entity.Base.EntityLocation it in loc2.GetListQuery(string.Empty, string.Empty, bc.Entity.ParentLOCNo)) { if (it.LOCNo == jp.getValue("RMLOCNo3")) { building += "<span class=\"btn btn-primary radius\" id=\"" + it.LOCNo + "\">" + it.LOCName + "</span>"; } else { building += "<span class=\"btn btn-default radius\" id=\"" + it.LOCNo + "\" onclick=\"getRM('" + it.LOCNo + "')\">" + it.LOCName + "</span>"; } } collection.Add(new JsonStringValue("building", building)); collection.Add(new JsonStringValue("rmlist", getRMList(jp.getValue("RMLOCNo1"), jp.getValue("RMLOCNo2"), jp.getValue("RMLOCNo3"), jp.getValue("RMID"), jp.getValue("CustName"), jp.getValue("RMStatus")))); collection.Add(new JsonStringValue("type", "select")); collection.Add(new JsonStringValue("flag", flag)); return(collection.ToString()); }
private string submitaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessLocation bc = new project.Business.Base.BusinessLocation(); if (jp.getValue("tp") == "update") { bc.load(jp.getValue("id")); bc.Entity.LOCName = jp.getValue("LOCName"); bc.Entity.ParentLOCNo = jp.getValue("ParentLOCNo"); if (bc.Entity.ParentLOCNo == "") { bc.Entity.LOCLevel = 1; } else { Business.Base.BusinessLocation loc = new Business.Base.BusinessLocation(); loc.load(bc.Entity.ParentLOCNo); bc.Entity.LOCLevel = loc.Entity.LOCLevel + 1; } int r = bc.Save("update"); if (r <= 0) { flag = "2"; } } else { Data obj = new Data(); DataTable dt = obj.PopulateDataSet("select cnt=COUNT(*) from Mstr_Location where LOCNo='" + jp.getValue("LOCNo") + "'").Tables[0]; if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0) { flag = "3"; } else { bc.Entity.LOCNo = jp.getValue("LOCNo"); bc.Entity.LOCName = jp.getValue("LOCName"); bc.Entity.ParentLOCNo = jp.getValue("ParentLOCNo"); if (bc.Entity.ParentLOCNo == "") { bc.Entity.LOCLevel = 1; } else { Business.Base.BusinessLocation loc = new Business.Base.BusinessLocation(); loc.load(bc.Entity.ParentLOCNo); bc.Entity.LOCLevel = loc.Entity.LOCLevel + 1; } 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())); return(collection.ToString()); }