コード例 #1
0
ファイル: Zfdx_InstocksDAL.cs プロジェクト: zkg642/JXXZ
 /// <summary>
 /// 添加设备入库
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int AddInstocks(Zfdx_InstocksModel model)
 {
     using (Entities db = new Entities()){
         zfdx_instocks newmodel = new zfdx_instocks();
         newmodel.intstockid    = model.intstockid;
         newmodel.storagetype   = model.storagetype;
         newmodel.deviceid      = model.deviceid;
         newmodel.number        = model.number;
         newmodel.price         = model.price;
         newmodel.producedate   = model.producedate;
         newmodel.unitid        = model.unitid;
         newmodel.processuserid = model.processuserid;
         newmodel.shuserid      = model.shuserid;
         newmodel.remark        = model.remark;
         newmodel.createtime    = DateTime.Now;
         newmodel.createuserid  = model.createuserid;
         db.zfdx_instocks.Add(newmodel);
         db.SaveChanges();
         return(newmodel.intstockid);
     }
 }
コード例 #2
0
        public HttpResponseMessage AddInstocks(Zfdx_InstocksModel model)
        {
            int success        = bll.AddInstocks(model);
            Zfdx_StocksModel z = new Zfdx_StocksModel();

            //HttpRequestBase request = ((HttpContextWrapper)this.Request.Properties["MS_HttpContext"]).Request;
            string type = model.storagetype;

            z.deviceid = (int)model.deviceid;
            if (type == "3")
            {
                if (model.number != null)
                {
                    z.stocknum = (int)model.number;
                }
            }
            else
            {
                if (model.number != null)
                {
                    z.devicesum = (int)model.number;
                    z.stocknum  = (int)model.number;
                }
            }

            s.EditZfdxStocks(z);
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);

            if (success > 0)
            {
                response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            }
            else
            {
                response.Content = new StringContent("{\"success\":false}", Encoding.GetEncoding("UTF-8"), "text/html");
            }
            return(response);
        }
コード例 #3
0
 /// <summary>
 /// 添加设备入库
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int AddInstocks(Zfdx_InstocksModel model)
 {
     return(dal.AddInstocks(model));
 }