private string updateaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessLateFee bc = new project.Business.Base.BusinessLateFee(); bc.load(jp.getValue("id")); collection.Add(new JsonStringValue("SPNo", bc.Entity.SPNo)); collection.Add(new JsonStringValue("SRVNo", bc.Entity.SRVNo)); collection.Add(new JsonStringValue("LateFeeSRVNo", bc.Entity.LateFeeSRVNo)); StringBuilder sb = new StringBuilder("SELECT SRVNo,SRVName FROM Mstr_Service WHERE SRVStatus=1 "); sb.AppendFormat("AND SRVSPNo='{0}' ", bc.Entity.SPNo); string fee = JsonConvert.SerializeObject(obj.PopulateDataSet(sb.ToString() + "AND SRVTypeNo1!='FWLB-007'").Tables[0]); string lateFee = JsonConvert.SerializeObject(obj.PopulateDataSet(sb.ToString() + "AND SRVTypeNo1='FWLB-007'").Tables[0]); collection.Add(new JsonStringValue("FeeList", fee)); collection.Add(new JsonStringValue("LateFeeList", lateFee)); } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "update")); collection.Add(new JsonStringValue("flag", flag)); return(collection.ToString()); }
private string submitaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessLateFee bc = new project.Business.Base.BusinessLateFee(); if (jp.getValue("tp") == "update") { bc.load(jp.getValue("id")); bc.Entity.SPNo = jp.getValue("SPNo"); bc.Entity.SRVNo = jp.getValue("SRVNo"); bc.Entity.LateFeeSRVNo = jp.getValue("LateFeeSRVNo"); bc.Entity.UpdateUser = user.Entity.UserName; bc.Entity.UpdateDate = GetDate(); int r = bc.Save(); if (r <= 0) { flag = "2"; } } else { Data obj = new Data(); DataTable dt = obj.PopulateDataSet("select cnt=COUNT(*) from Mstr_LateFee where SRVNo='" + jp.getValue("SRVNo") + "'").Tables[0]; if (int.Parse(dt.Rows[0]["cnt"].ToString()) > 0) { flag = "3"; } else { bc.Entity.SPNo = jp.getValue("SPNo"); bc.Entity.SRVNo = jp.getValue("SRVNo"); bc.Entity.LateFeeSRVNo = jp.getValue("LateFeeSRVNo"); bc.Entity.CreateUser = user.Entity.UserName; bc.Entity.CreateDate = GetDate(); bc.Entity.UpdateUser = user.Entity.UserName; bc.Entity.UpdateDate = GetDate(); int r = bc.Save(); if (r <= 0) { flag = "2"; } } } } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "submit")); collection.Add(new JsonStringValue("flag", flag)); return(collection.ToString()); }
private string updateaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessLateFee bc = new project.Business.Base.BusinessLateFee(); bc.load(jp.getValue("id")); collection.Add(new JsonStringValue("SRVNo", bc.Entity.SRVNo)); collection.Add(new JsonStringValue("LateFeeSRVNo", bc.Entity.LateFeeSRVNo)); } catch { flag = "2"; } collection.Add(new JsonStringValue("type", "update")); collection.Add(new JsonStringValue("flag", flag)); return(collection.ToString()); }
private string deleteaction(JsonArrayParse jp) { JsonObjectCollection collection = new JsonObjectCollection(); string flag = "1"; try { Business.Base.BusinessLateFee bc = new project.Business.Base.BusinessLateFee(); 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)); return(collection.ToString()); }