public JsonResult InitPrice(string ppicode, string ptcode) { JsonData d = new JsonData(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { Sys_ProductionPriceTemp sal = new Sys_ProductionPriceTemp(); if (ptcode != "") { sal = sptb.Query(" and ptcode='" + ptcode + "'"); } else { Sys_ProductionPriceTempCate psal = new Sys_ProductionPriceTempCate(); psal = sptcb.Query(" and ppicode='" + ppicode + "'"); if (psal != null) { sal.ppcode = psal.ppicode; sal.ppname = psal.ppiname; } sal.ptcode = sptb.CreateCode().ToString().PadLeft(4, '0'); sal.id = 0; } d.d = js.Serialize(sal); } else { d.d = iv.badstr; } return(Json(d)); }
public JsonResult SavePrice(string ptcode, string ptemp, string ptid, string ptname, string ptpcode, string ptpname) { JsonData d = new JsonData(); Sys_ProductionPriceTemp sb = new Sys_ProductionPriceTemp(); SessionUserValidate iv = SysValidateBll.ValidateSession(); if (iv.f) { sb.ppcode = ptpcode; sb.ppname = ptpname; sb.ptcode = ptcode; sb.ptname = ptname; sb.ptemp = ptemp; sb.maker = iv.u.ename; sb.cdate = DateTime.Now.ToString(); if (ptid == "0") { if (sptb.Add(sb) > 0) { d.d = "S"; } else { d.d = "F"; } } else { if (sptb.Update(sb)) { d.d = "S"; } else { d.d = "F"; } } } else { d.d = iv.badstr; } return(Json(d)); }