public int UpdateWareHouse(OperLog operLog, Entity.Warehouse wh) { using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { string strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString(); DateTime dtSysTime = DateTime.Parse(strSysTime); Entity.Warehouse oldwh = new AMSApp.zhenghua.Entity.Warehouse(); oldwh.cnvcWhCode = wh.cnvcWhCode; oldwh = EntityMapping.Get(oldwh, trans) as AMSApp.zhenghua.Entity.Warehouse; oldwh.cnvcWhName = wh.cnvcWhName; oldwh.cnvcDepCode = wh.cnvcDepCode; oldwh.cnvcWhAddress = wh.cnvcWhAddress; oldwh.cnvcWhPhone = wh.cnvcWhPhone; oldwh.cnvcWhPerson = wh.cnvcWhPerson; oldwh.cnvcWhValueStyle = wh.cnvcWhValueStyle; oldwh.cnbFreeze = wh.cnbFreeze; oldwh.cnnFrequency = wh.cnnFrequency; oldwh.cnvcFrequency = wh.cnvcFrequency; oldwh.cnvcWhProperty = wh.cnvcWhProperty; oldwh.cnbShop = wh.cnbShop; EntityMapping.Update(oldwh, trans); operLog.cndOperDate = dtSysTime; operLog.cnvcComments = "仓库编码:" + oldwh.cnvcWhCode; EntityMapping.Create(operLog, trans); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); LogAdapter.WriteDatabaseException(sex); return(-1); } catch (Exception ex) { trans.Rollback(); LogAdapter.WriteFeaturesException(ex); return(-1); } finally { ConnectionPool.ReturnConnection(conn); } return(1); } }
private void BindWh(Entity.Warehouse wh) { this.txtWhCode.Text = wh.cnvcWhCode; this.txtWhName.Text = wh.cnvcWhName; this.SetDDL(this.ddlDepCode, wh.cnvcDepCode); this.txtWhAddress.Text = wh.cnvcWhAddress; this.txtWhPhone.Text = wh.cnvcWhPhone; this.SetDDL(this.ddlWhPerson, wh.cnvcWhPerson); this.SetDDL(this.ddlWhValueStyle, wh.cnvcWhValueStyle); this.chkFreeze.Checked = wh.cnbFreeze; this.txtFrequency.Text = wh.cnnFrequency.ToString(); this.SetDDL(this.ddlFrequency, wh.cnvcFrequency); this.SetDDL(this.ddlWHProperty, wh.cnvcWhProperty.ToString()); this.chkShop.Checked = wh.cnbShop; }
public int AddWareHouse(OperLog operLog, Entity.Warehouse wh) { using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { string strSysTime = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select getdate()").ToString(); DateTime dtSysTime = DateTime.Parse(strSysTime); EntityMapping.Create(wh, trans); operLog.cndOperDate = dtSysTime; operLog.cnvcComments = "仓库编码:" + wh.cnvcWhCode; EntityMapping.Create(operLog, trans); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); LogAdapter.WriteDatabaseException(sex); return(-1); } catch (Exception ex) { trans.Rollback(); LogAdapter.WriteFeaturesException(ex); return(-1); } finally { ConnectionPool.ReturnConnection(conn); } return(1); } }
private void Button1_Click(object sender, System.EventArgs e) { //确定 Entity.OperLog ol = new AMSApp.zhenghua.Entity.OperLog(); ol.cnvcOperType = "添加存货档案"; ol.cnvcOperID = this.oper.strLoginID; ol.cnvcDeptID = this.oper.strDeptID; Entity.Warehouse wh = this.GetWh(); Business.WareHouseFacade whf = new WareHouseFacade(); if (!this.JudgeIsNum(this.txtFrequency.Text)) { this.Popup("盘点周期请输入数字"); return; } if (this.JudgeIsNull(this.txtWhName.Text)) { this.Popup("请输入仓库名称"); return; } if (this.lblTitle.Text == "添加仓库档案") { //Entity.OperLog ol = new AMSApp.zhenghua.Entity.OperLog(); ol.cnvcOperType = "添加存货档案"; // ol.cnvcOperID = this.oper.strLoginID; // ol.cnvcDeptID = this.oper.strDeptID; // // // Entity.Warehouse wh = this.GetWh(); // Business.WareHouseFacade whf = new WareHouseFacade(); int ret = whf.AddWareHouse(ol, wh); if (ret > 0) { this.Popup("添加仓库档案成功!"); } else { this.Popup("添加仓库档案失败!"); } this.Response.Write("<script type=\"text/javascript\">window.returnValue=true;window.close()</script>"); } if (this.lblTitle.Text == "修改仓库档案") { //Entity.OperLog ol = new AMSApp.zhenghua.Entity.OperLog(); ol.cnvcOperType = "修改仓库档案"; // ol.cnvcOperID = this.oper.strLoginID; // ol.cnvcDeptID = this.oper.strDeptID; // // // Entity.Warehouse wh = GetWh(); // // Business.WareHouseFacade whf = new WareHouseFacade(); int ret = whf.UpdateWareHouse(ol, wh); if (ret > 0) { this.Popup("修改仓库档案成功!"); } else { this.Popup("修改仓库档案失败!"); } this.Response.Write("<script type=\"text/javascript\">window.returnValue=true;window.close()</script>"); } }