public JsonResult InitHy(string hycode) { JsonData d = new JsonData(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { Sys_HyType sal = new Sys_HyType(); if (hycode != "") { sal = sltb.Query(" and hycode='" + hycode + "'"); } else { sal.hycode = sltb.CreateCode().ToString().PadLeft(4, '0'); sal.id = 0; } d.d = js.Serialize(sal); } else { d.d = iv.badstr; } return(Json(d)); }
public JsonResult SaveHy(string hycode, string hyje, string hyname, string id) { JsonData d = new JsonData(); Sys_HyType sb = new Sys_HyType(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { sb.hyname = hyname; sb.hycode = hycode; sb.hyprice = Convert.ToDecimal(hyje); sb.maker = iv.u.ename; sb.cdate = DateTime.Now.ToString(); if (iv.u.rcode != "xtgl") { sb.bdcode = iv.u.dcode.Substring(0, 8); } else { sb.bdcode = "00010001"; } 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)); }