public JsonResult InitRepairPtype(string apcode) { JsonData d = new JsonData(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { Sys_RepairProductionType sal = new Sys_RepairProductionType(); if (apcode != "") { sal = sltb.Query(" and apcode='" + apcode + "'"); } else { sal.apcode = sltb.CreateCode().ToString().PadLeft(4, '0'); sal.id = 0; } d.d = js.Serialize(sal); } else { d.d = iv.badstr; } return(Json(d)); }
public JsonResult SaveRepairPtype(string id, string apcode, string apname) { JsonData d = new JsonData(); Sys_RepairProductionType sb = new Sys_RepairProductionType(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { sb.apname = apname; sb.apcode = apcode; sb.maker = iv.u.ename; sb.cdate = DateTime.Now.ToString(); if (id == "0") { if (sltb.Add(sb) > 0) { d.d = "S"; } else { d.d = "F"; } } else { if (sltb.Update(sb)) { d.d = "S"; } else { d.d = "F"; } } } else { d.d = iv.badstr; } return(Json(d)); }