public static string InitPartType(string pcode) { string r = ""; Sys_PartType sr = new Sys_PartType(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { Sys_PartType csr = srb.Query(" and pcode='" + pcode + "'"); if (csr != null) { r = js.Serialize(csr); } else { sr.pname = ""; sr.pcode = srb.CreateCode().ToString().PadLeft(4, '0'); sr.id = 0; r = js.Serialize(sr); } } else { r = iv.badstr; } return(r); }
public static string SavePartType(string pabc, string pcname, string pcode, string pctype, string pid, string pname) { string r = ""; Sys_PartTypeBll srb = new Sys_PartTypeBll(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { Sys_PartType sr = new Sys_PartType(); sr.pcode = pcode; sr.pname = pname; sr.ptype = pabc; sr.pcname = pcname; sr.pctype = pctype; sr.cdate = DateTime.Now.ToString(); sr.maker = iv.u.ename; if (pid == "0") { if (!srb.Exists(" and ptype='" + pabc + "'")) { if (srb.Add(sr) > 0) { r = "S"; } else { r = "F"; } } else { r = "T"; } } else { if (!srb.Exists(" and ptype='" + pabc + "'")) { if (srb.Update(sr)) { r = "S"; } else { r = "F"; } } else { r = "T"; } } } else { r = iv.badstr; } return(r); }