public JsonResult InitDirection(string gdcode) { JsonData d = new JsonData(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { Sys_GlassDirection sal = new Sys_GlassDirection(); if (gdcode != "") { sal = sgdb.Query(" and gdcode='" + gdcode + "'"); } else { sal.gdcode = sgdb.CreateCode().ToString().PadLeft(4, '0'); sal.id = 0; } d.d = js.Serialize(sal); } else { d.d = iv.badstr; } return(Json(d)); }
public JsonResult SaveDirection(string gdid, string gdcode, string gdname) { JsonData d = new JsonData(); Sys_GlassDirection sb = new Sys_GlassDirection(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { sb.gdcode = gdcode; sb.gdname = gdname; sb.maker = iv.u.ename; sb.cdate = DateTime.Now.ToString(); if (gdid == "0") { if (sgdb.Add(sb) > 0) { d.d = "S"; } else { d.d = "F"; } } else { if (sgdb.Update(sb)) { d.d = "S"; } else { d.d = "F"; } } } else { d.d = iv.badstr; } return(Json(d)); }