/// <summary> /// 新增库存 /// </summary> /// <param name="context"></param> private void add(HttpContext context) { string json = ""; TBL_DEPARTMENT_STOCK model = new TBL_DEPARTMENT_STOCK(); model.department_stockid = System.Guid.NewGuid().ToString().ToUpper(); model.materialid = context.Request["materialid"]; model.organizationid = context.Request["organizationid"]; model.num = Convert.ToInt32(context.Request["num"]); try { Bll.Add(model); json = "{IsSuccess:'true',Message:'保存成功!'}"; } catch { json = "{IsSuccess:'false',Message:'保存失败!'}"; } context.Response.Write(json); context.Response.End(); }
/// <summary> /// 修改库存 /// </summary> /// <param name="context"></param> private void update(HttpContext context) { string json = ""; TBL_DEPARTMENT_STOCK model = new TBL_DEPARTMENT_STOCK(); model.department_stockid = context.Request["department_stockid"]; model.materialid = context.Request["materialid"]; model.organizationid = context.Request["organizationid"]; model.num = Convert.ToInt32(context.Request["num"]); try { Bll.Update(model); json = "{IsSuccess:'true',Message:'保存成功!'}"; } catch { json = "{IsSuccess:'false',Message:'保存失败!'}"; } // context.Response.ContentType = "application/json"; //返回JSON结果 context.Response.Write(json); context.Response.End(); }