public int Delete(PHA_Accounts obj) { using (Conn) { string query = @"DELETE FROM PHA_Accounts WHERE PhaCode=@PhaCode AND OrginID = @OrginID"; return(Conn.Execute(query, obj)); } }
public ActionResult AcceptClick(PSS_ExWarehouse obj) { string key = Request["key"]; int old_isew = default(int); int.TryParse(Request["old_isew"], out old_isew); int isOk = default(int); //key表示是否编辑的标识,1表示处于编辑状态 0表示增加状态 if (key == "1") { //由于出库状态是不可逆的,所以由未出库到出库时,会减少库存事务 if (obj.IsEW == 1 && old_isew == 0) { //添加出库时间 obj.EWDate = DateTime.Now.ToString("G"); //通过记录获得对应的出库药品信息 Hashtable ht = new Hashtable(); ht.Add("EWID", obj.EWID); IList list = ipss_exwarehousedetailbll.GetList(ht); //减少对应的库存 foreach (Dto_ExWarehouseDetail item in list) { PHA_Accounts a = ipha_accountsbll.GetEntity(item.PhaCode, item.OrginID.ToString()); a.Stock -= item.ExWarehouseNum; ipha_accountsbll.Update(a); } } isOk = ipss_exwarehousebll.Update(obj); } else { PSS_ExWarehouse temp = ipss_exwarehousebll.GetEntity(obj.EWID.ToString()); if (temp == null) { HttpCookie cookie = Request.Cookies["user"]; obj.OperateNo = cookie.Values["Code"]; obj.OperateDate = DateTime.Now.ToString("G"); isOk = ipss_exwarehousebll.Insert(obj); } else { isOk = -1; } } return(Content(isOk.ToString())); }
public int Insert(PHA_Accounts obj) { using (Conn) { string query = @"INSERT INTO PHA_Accounts VALUES( @PhaCode, @OrginID, @CompanyID, @Stock, @InWarehousePrice, @RetailPrice, @WholesalePrice, @RetailSum, @WholesaleSum, @InWarehouseSum )"; return(Conn.Execute(query, obj)); } }
public int Update(PHA_Accounts obj) { using (Conn) { string query = @"UPDATE PHA_Accounts SET PhaCode = @PhaCode, OrginID = @OrginID, CompanyID = @CompanyID, Stock = @Stock, InWarehousePrice = @InWarehousePrice, RetailPrice = @RetailPrice, WholesalePrice = @WholesalePrice, InWarehouseSum = @InWarehouseSum, RetailSum = @RetailSum, WholesaleSum = @WholesaleSum WHERE PhaCode = @PhaCode AND OrginID = @OrginID"; return(Conn.Execute(query, obj)); } }
public ActionResult AcceptClick(PHA_Accounts obj) { string key = Request["key"]; int isOk = default(int); //key表示是否编辑的标识,1表示处于编辑状态 0表示增加状态 if (key == "1") { isOk = ipha_accountsbll.Update(obj); } else { PHA_Accounts temp = ipha_accountsbll.GetEntity(obj.PhaCode, obj.OrginID.ToString()); if (temp == null) { isOk = ipha_accountsbll.Insert(obj); } else { isOk = -1; //存在相同的记录,出错。 } } return(Content(isOk.ToString())); }
public int Insert(PHA_Accounts obj) { return(dal.Insert(obj)); }
public int Delete(PHA_Accounts obj) { return(dal.Delete(obj)); }
public int Update(PHA_Accounts obj) { return(dal.Update(obj)); }