public void AddFee(FillFee fee, BusiLog busiLog) { using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { SqlHelper.ExecuteNonQuery(trans, CommandType.Text, "update tbMebCompanyPrepay set cnnPrepayFee = cnnPrepayFee+" + fee.cnnFillFee.ToString() + " where cnvcCompanyID='" + fee.cnvcCompanyID.ToString() + "'"); FillFeeAccess.AddFee(trans, fee); BusiLogAccess.AddBusiLog(trans, busiLog); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); throw sex; } catch (Exception ex) { trans.Rollback(); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } }
private void btnOperName_Click(object sender, System.Web.UI.ImageClickEventArgs e) { //修改用户名称 Oper oper = (Oper)Session[ConstValue.LOGIN_USER_SESSION]; try { oper.cnvcOperName = txtOperName.Text; Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "修改操作员名称:" + oper.cnvcOperName; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS006"; busiLog.cnvcSource = "网站"; OperFacade.UpdatePwd(oper, busiLog); CommonStatic.LoadOperDictionary(); Session[ConstValue.LOGIN_USER_SESSION] = oper; Popup("用户名称已修改!"); } catch (BusinessException bex) { Popup(bex.Message); return; } }
public int DeleteSpecialOilDept(SpecialOilDept specialOilDept, BusiLog busiLog) { //SqlConnection conn = ConnectionPool.BorrowConnection(); int iRet = 0; using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { iRet = SpecialOilDeptAccess.DeleteSpecialOilDept(trans, specialOilDept); BusiLogAccess.AddBusiLog(trans, busiLog); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); throw sex; } catch (Exception ex) { trans.Rollback(); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } return(iRet); }
public int AddOilPrice(OilPrice price, BusiLog busiLog) { //SqlConnection conn = ConnectionPool.BorrowConnection(); int iRet = 0; using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { BusiLogAccess.AddBusiLog(trans, busiLog); iRet = (int)OilPriceAccess.AddOilPrice(trans, price); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); throw sex; } catch (Exception ex) { trans.Rollback(); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } return(iRet); }
private void btnOK_Click(object sender, System.EventArgs e) { try { if (!this.BOSValidate()) { return; } BillOfOutStorage bos = GetBOS(); Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; ReportQueryFacade.UpdateBOS(bos, busiLog); this.Popup("调拨单修改成功"); } catch (Exception ex) { this.Popup(ex.Message); } }
public void AddDept(Dept dept, BusiLog busiLog) { using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { DeptAccess.AddDept(trans, dept); BusiLogAccess.AddBusiLog(trans, busiLog); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); throw sex; } catch (Exception ex) { trans.Rollback(); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } }
public int UpdatePwd(Oper oper, BusiLog busiLog) { //SqlConnection conn = ConnectionPool.BorrowConnection(); int iRet = 0; using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { iRet = OperAccess.UpdatePwd(trans, oper); BusiLogAccess.AddBusiLog(trans, busiLog); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); throw sex; } catch (Exception ex) { trans.Rollback(); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } return(iRet); }
public void UpdateCompany(MebCompanyPrepay company, BusiLog busiLog) { using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { MebCompanyPrepayAccess.UpdateCompany(trans, company); //FillFeeAccess.AddFee(trans,fee); MemberAccess.UpdateMemberCompany(trans, company); BusiLogAccess.AddBusiLog(trans, busiLog); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); throw sex; } catch (Exception ex) { trans.Rollback(); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } }
bool AddDept() { string strDeptID = ""; if (txtDeptName.Text.Length == 0) { alertControl.Enable = true; alertControl.Msg = "请输入部门名称"; return(false); } try { //Dept getDept = new Dept(); //getDept.cnvcDeptID = this.hidParentID.Value; //Dept deptParent = DeptFacade.GetDept(getDept);//BaseSqlMapDao.ExecuteQueryForObject("Dept.Select",this.hidParentID.Value) as ynhnOilManage.Common.Dept; DataTable dtCount = ReportQueryFacade.CommonQuery("select * from tbDept where cnvcDeptName = '" + this.txtDeptName.Text + "'"); if (dtCount.Rows.Count > 0) { throw new Exception("同名部门已存在,请添加新部门!"); } strDeptID = DeptFacade.GetDeptID(this.hidParentID.Value); Dept dept = new Dept(); dept.cnvcDeptID = strDeptID; dept.cnvcParentDeptID = this.hidParentID.Value; dept.cnbValidate = this.chkValidate.Checked; dept.cnvcDeptName = this.txtDeptName.Text; Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "添加部门:" + this.txtDeptName.Text; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS001"; busiLog.cnvcSource = "网站"; DeptFacade.AddDept(dept, busiLog); } catch (Exception ex) { alertControl.Enable = true; alertControl.Msg = ex.Message; return(false); } //成功添加部门 alertControl.Action = AlertControl.ACTION.Script; alertControl.Enable = true; alertControl.Msg = "成功添加部门"; alertControl.Script = string.Format("window.parent.OnAddNodeResult('{0}','{1}','{2}');", "dept_" + hidParentID.Value, "dept_" + strDeptID, txtDeptName.Text); return(true); }
public static void AddProject(Project project, Oper oper) { 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); project.cnvcOperID = oper.cnvcOperID; project.cndOperDate = dtSysTime; //project.cndCreateDate = dtSysTime; project.cnnProjectID = Helper.GetSerialNo(trans); project.cnvcIsSucess = "0"; if (project.cnvcMgr == oper.cnvcOperID || project.cnvcTradeMgr == oper.cnvcOperID) { project.cnvcProjectState = "P002"; } else { project.cnvcProjectState = "P001"; } EntityMapping.Create(project, trans); BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = dtSysTime; busiLog.cnnBusiSerialNo = Helper.GetSerialNo(trans); busiLog.cnvcComments = project.cnvcProjectName; busiLog.cnvcFuncCode = " 添加商机"; busiLog.cnvcOperID = oper.cnvcOperID; busiLog.cnvcIPAddress = ""; EntityMapping.Create(busiLog, trans); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); LogAdapter.WriteDatabaseException(sex); throw sex; } catch (Exception ex) { trans.Rollback(); LogAdapter.WriteFeaturesException(ex); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } }
public static void BatchCustInfo(DataTable dt, Oper oper) { 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); foreach (DataRow dr in dt.Rows) { Cust cu = new Cust(dr); cu.cnvcOperID = oper.cnvcOperID; cu.cndOperDate = dtSysTime; //newOper.cndCreateDate = dtSysTime; string strCount = SqlHelper.ExecuteScalar(trans, CommandType.Text, "select count(*) from tbCust where cnnCustID = " + cu.cnnCustID + " or cnvcName='" + cu.cnvcName + "'").ToString(); if (Convert.ToInt32(strCount) > 0) { throw new Exception(cu.cnvcName + "已存在"); } EntityMapping.Create(cu, trans); BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = dtSysTime; busiLog.cnnBusiSerialNo = Helper.GetSerialNo(trans); busiLog.cnvcComments = cu.cnvcName; busiLog.cnvcFuncCode = " 批量添加客户档案"; busiLog.cnvcOperID = oper.cnvcOperID; busiLog.cnvcIPAddress = ""; EntityMapping.Create(busiLog, trans); } trans.Commit(); } catch (SqlException sex) { trans.Rollback(); LogAdapter.WriteDatabaseException(sex); throw sex; } catch (Exception ex) { trans.Rollback(); LogAdapter.WriteFeaturesException(ex); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } }
private void dgCompany_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e) { try { string strFillFee = ((TextBox)e.Item.Cells[7].Controls[0]).Text; if (strFillFee.Trim().Length == 0) { Popup("请输入正确充值金额,如:22"); return; } if (!IsNumeric(strFillFee)) { Popup("请输入正确充值金额,如:22"); return; } Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "充值:" + e.Item.Cells[1].Text + "|" + strFillFee; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS012"; busiLog.cnvcSource = "网站"; FillFee fee = new FillFee(); fee.cndOperDate = busiLog.cndOperDate; fee.cnnFillFee = Decimal.Parse(strFillFee); fee.cnnSerial = busiLog.cnnSerial; Guid guidAcctID = new Guid(e.Item.Cells[2].Text); fee.cnvcAcctID = guidAcctID; Guid guidCompanyID = new Guid(e.Item.Cells[0].Text); fee.cnvcCompanyID = guidCompanyID; fee.cnvcCompanyName = e.Item.Cells[1].Text; fee.cnvcDeptID = e.Item.Cells[5].Text; fee.cnvcDeptName = e.Item.Cells[6].Text; fee.cnvcOperName = busiLog.cnvcOperName; PrepayFeeFacade.AddFee(fee, busiLog); this.dgCompany.EditItemIndex = -1; this.BindCompany(); Popup("充值成功!"); } catch (System.Exception ex) { Popup(ex.Message); } }
bool UpdateOper() { if (txtOperName.Text.Length == 0) { alertControl.Enable = true; alertControl.Msg = "请输入操作员姓名"; return(false); } try { DataTable dtCount = ReportQueryFacade.CommonQuery("select * from tbOper where cnvcOperName = '" + this.txtOperName.Text + "'"); if (dtCount.Rows.Count > 1) { throw new Exception("同名操作员已存在,请修改操作员名称!"); } dtCount = ReportQueryFacade.CommonQuery("select * from tbOper where cnnOperID = " + this.txtOperID.Text); if (dtCount.Rows.Count == 0) { throw new Exception("操作员信息获取错误!"); } Oper oper = new Oper(dtCount); //oper.cnnOperID = int.Parse(this.txtOperID.Text); oper.cnvcOperName = this.txtOperName.Text; oper.cnbValidate = this.chkValidate.Checked; Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "修改操作员名称:" + this.txtOperName.Text; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS006"; busiLog.cnvcSource = "网站"; OperFacade.UpdatePwd(oper, busiLog); } catch (Exception ex) { alertControl.Enable = true; alertControl.Msg = ex.Message; return(false); } alertControl.Enable = true; alertControl.Action = AlertControl.ACTION.Script; alertControl.Msg = "成功更新操作员属性"; alertControl.Script = string.Format("window.parent.OnChangeNodeResult('{0}','{1}');", "oper_" + txtOperID.Text, txtOperName.Text); return(true); }
bool UpdatePwd() { if (txtPwd.Value.Length == 0) { alertControl.Enable = true; alertControl.Msg = "请输入操作员初始化密码"; return(false); } if (!txtPwd.Value.Equals(txtConfirmPwd.Value)) { alertControl.Enable = true; alertControl.Msg = "密码和确认密码不同,请重新输入"; return(false); } try { // dtCount = ReportQueryFacade.CommonQuery("select * from tbOper where cnnOperID = "+this.txtOperID.Text); // if(dtCount.Rows.Count == 0 ) throw new Exception("操作员信息获取错误!"); // Oper oper = new Oper(dtCount); Oper oper = new Oper(); oper.cnnOperID = int.Parse(this.txtOperID.Text); oper.cnvcPwd = DataSecurity.Encrypt(this.txtPwd.Value); Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "修改密码:" + this.txtOperName.Text; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS006"; busiLog.cnvcSource = "网站"; OperFacade.UpdatePwd(oper, busiLog); } catch (Exception ex) { alertControl.Enable = true; alertControl.Msg = ex.Message; return(false); } alertControl.Enable = true; alertControl.Action = AlertControl.ACTION.Script; alertControl.Msg = "成功更新操作员密码"; alertControl.Script = string.Format("window.parent.OnChangeNodeResult('{0}','{1}');", "oper_" + txtOperID.Text, txtOperName.Text); return(true); }
private void btnOK_Click(object sender, System.EventArgs e) { //添加 if (txtContactNo.Text.Trim().Length == 0) { Popup("请输入合同编号!"); return; } if (txtDeliveryCompany.Text.Trim().Length == 0) { Popup("请输入单位名称!"); return; } string strContractSql = "select * from tbSpecialOilDept where cnvcContractNo='" + txtContactNo.Text + "' "; string strDeliveryCompany = "select * from tbSpecialOilDept where cnvcDeliveryCompany = '" + txtDeliveryCompany.Text + "'"; DataTable dtContract = ReportQueryFacade.CommonQuery(strContractSql); DataTable dtDeliveryCompany = ReportQueryFacade.CommonQuery(strDeliveryCompany); if (dtContract.Rows.Count > 0) { Popup("相同的合同编号已存在!"); return; } if (dtDeliveryCompany.Rows.Count > 0) { Popup("相同的单位名称已存在!"); return; } SpecialOilDept specialOilDept = new SpecialOilDept(); specialOilDept.cnvcContractNo = txtContactNo.Text; specialOilDept.cnvcDeliveryCompany = txtDeliveryCompany.Text; Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "添加领用单位:" + txtContactNo.Text + "|" + txtDeliveryCompany.Text; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS013"; busiLog.cnvcSource = "网站"; SpecialOilFacade.AddSpecialOilDept(specialOilDept, busiLog); Popup("领用单位添加成功"); }
public static void UpdatePwd(Oper oper) { 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); Oper oldOper = new Oper(); oldOper.cnvcOperID = oper.cnvcOperID; oldOper = EntityMapping.Get(oldOper, trans) as Oper; if (null == oldOper) { throw new Exception("无此用户"); } oldOper.cnvcOperPwd = oper.cnvcOperPwd; //DataSecurity.Encrypt(oper.cnvcOperPwd); EntityMapping.Update(oldOper, trans); BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = dtSysTime; busiLog.cnnBusiSerialNo = Helper.GetSerialNo(trans); busiLog.cnvcComments = "修改密码"; busiLog.cnvcFuncCode = "修改密码"; busiLog.cnvcOperID = oper.cnvcOperID; busiLog.cnvcIPAddress = ""; EntityMapping.Create(busiLog, trans); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); LogAdapter.WriteDatabaseException(sex); throw sex; } catch (Exception ex) { trans.Rollback(); LogAdapter.WriteFeaturesException(ex); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } }
bool UpdateDept() { if (txtDeptName.Text.Length == 0) { alertControl.Enable = true; alertControl.Msg = "请输入部门名称"; return(false); } try { DataTable dtCount = ReportQueryFacade.CommonQuery("select * from tbDept where cnvcDeptName = '" + this.txtDeptName.Text + "'"); if (dtCount.Rows.Count > 1) { throw new Exception("同名部门已存在,请添加新部门!"); } Dept dept = new Dept(); dept.cnvcDeptID = this.txtDeptID.Text; dept.cnvcDeptName = this.txtDeptName.Text; dept.cnvcParentDeptID = this.hidParentID.Value; dept.cnbValidate = this.chkValidate.Checked; Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "修改部门名称为:" + this.txtDeptName.Text; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS002"; busiLog.cnvcSource = "网站"; DeptFacade.UpdateDept(dept, busiLog); } catch (Exception ex) { alertControl.Enable = true; alertControl.Msg = ex.Message; return(false); } //成功更新部门 alertControl.Action = AlertControl.ACTION.Script; alertControl.Enable = true; alertControl.Msg = "成功更新部门信息"; alertControl.Script = string.Format("window.parent.OnChangeNodeResult('{0}','{1}');", "dept_" + txtDeptID.Text, txtDeptName.Text); return(true); }
private void btnOK_Click(object sender, System.Web.UI.ImageClickEventArgs e) { //确定修改密码 try { if (txtOldPwd.Text.Length == 0 || txtNewPwd.Text.Length == 0 || txtConfirmPwd.Text.Length == 0) { throw new BusinessException("UpdatePwd", "不能为空!"); } if (txtOldPwd.Text.Equals(txtNewPwd.Text)) { throw new BusinessException("UpdatePwd", "新老密码一样!"); } if (!txtNewPwd.Text.Equals(txtConfirmPwd.Text)) { throw new BusinessException("UpdatePwd", "确认密码和新密码不一致!"); } if (Session[ConstValue.LOGIN_USER_SESSION] == null) { throw new BusinessException("UpdatePwd", "请先登录!"); } Oper oper = (Oper)Session[ConstValue.LOGIN_USER_SESSION]; if (!txtOldPwd.Text.Equals(DataSecurity.Decrypt(oper.cnvcPwd))) { throw new BusinessException("UpdatePwd", "输入的旧密码错误!"); } oper.cnvcPwd = DataSecurity.Encrypt(txtNewPwd.Text); Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "修改密码:" + oper.cnvcOperName; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS006"; busiLog.cnvcSource = "网站"; OperFacade.UpdatePwd(oper, busiLog); Session[ConstValue.LOGIN_USER_SESSION] = oper; Popup("密码修改成功!"); } catch (Exception ex) { Popup(ex.Message); } }
private void Button1_Click(object sender, System.EventArgs e) { try { //根据新油价重算 if (this.txtBeginDate.Text.Trim().Length == 0) { this.Popup("请输入开始日期!"); return; } if (this.txtEndDate.Text.Trim().Length == 0) { this.Popup("请输入结束日期!"); return; } DataTable dtPrice = ReportQueryFacade.CommonQuery("select count(*) from tbOilPrice where convert(varchar(10),cndpricedate,121) between '" + this.txtBeginDate.Text + "' and '" + this.txtEndDate.Text + "'"); int icount = Convert.ToInt32(dtPrice.Rows[0][0].ToString()); if (icount == 0) { this.Popup("选定的时间段油价未变动!"); return; } Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "重算:" + this.txtBeginDate.Text + "-" + this.txtEndDate.Text; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS016"; busiLog.cnvcSource = "网站"; ReportQueryFacade.AgainComp(this.txtBeginDate.Text, this.txtEndDate.Text, busiLog); this.Popup("重算成功"); } catch (Exception ex) { this.Popup(ex.Message); } }
public static void AddDept(Dept dept, BusiLog busiLog) { try { BusinessRules.SysManage.Authorization auth = new BusinessRules.SysManage.Authorization(); auth.AddDept(dept, busiLog); } catch (SqlException sex) { LogAdapter.WriteDatabaseException(sex); throw new Exception("数据库访问异常。"); } catch (Exception ex) { LogAdapter.WriteFeaturesException(ex); throw new Exception("业务规则层异常。"); } }
public static void DeleteSpecialOilDept(SpecialOilDept specialOilDept, BusiLog busiLog) { try { BusinessRules.SysManage.SpecialOil specialOil = new BusinessRules.SysManage.SpecialOil(); specialOil.DeleteSpecialOilDept(specialOilDept, busiLog); } catch (SqlException sex) { LogAdapter.WriteDatabaseException(sex); throw new Exception("数据库访问异常。"); } catch (Exception ex) { LogAdapter.WriteFeaturesException(ex); throw new Exception("业务规则层异常。"); } }
public static void UpdateCompany(MebCompanyPrepay company, BusiLog busiLog) { try { BusinessRules.Prepay.PrepayFee prepay = new BusinessRules.Prepay.PrepayFee(); prepay.UpdateCompany(company, busiLog); } catch (SqlException sex) { LogAdapter.WriteDatabaseException(sex); throw new Exception("数据库访问异常。"); } catch (Exception ex) { LogAdapter.WriteFeaturesException(ex); throw new Exception("业务规则层异常。"); } }
public static void AddFee(FillFee fee, BusiLog busiLog) { try { BusinessRules.Prepay.PrepayFee prepay = new BusinessRules.Prepay.PrepayFee(); prepay.AddFee(fee, busiLog); } catch (SqlException sex) { LogAdapter.WriteDatabaseException(sex); throw new Exception("数据库访问异常。"); } catch (Exception ex) { LogAdapter.WriteFeaturesException(ex); throw new Exception("业务规则层异常。"); } }
public static void InitPwd(Oper oldOper, Oper oper) { 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.Delete(oldOper,trans); SqlHelper.ExecuteNonQuery(trans, CommandType.Text, "update tbOper set cnvcOperPwd='" + DataSecurity.Encrypt("123456") + "' where cnvcOperID='" + oldOper.cnvcOperID + "'"); BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = dtSysTime; busiLog.cnnBusiSerialNo = Helper.GetSerialNo(trans); //busiLog.cnvcComments = oldOper.cnvcOperName; busiLog.cnvcFuncCode = "初始密码"; busiLog.cnvcOperID = oper.cnvcOperID; busiLog.cnvcIPAddress = ""; EntityMapping.Create(busiLog, trans); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); LogAdapter.WriteDatabaseException(sex); throw sex; } catch (Exception ex) { trans.Rollback(); LogAdapter.WriteFeaturesException(ex); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } }
public static void DeleteOperFunc(OperFunc operFunc, Oper oper) { 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.Delete(operFunc, trans); BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = dtSysTime; busiLog.cnnBusiSerialNo = Helper.GetSerialNo(trans); busiLog.cnvcComments = operFunc.cnvcFuncCode; busiLog.cnvcFuncCode = "删除权限"; busiLog.cnvcOperID = oper.cnvcOperID; busiLog.cnvcIPAddress = ""; EntityMapping.Create(busiLog, trans); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); LogAdapter.WriteDatabaseException(sex); throw sex; } catch (Exception ex) { trans.Rollback(); LogAdapter.WriteFeaturesException(ex); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } }
private void btnAdd_Click(object sender, System.EventArgs e) { try { decimal.Parse(txtOilPrice.Text); } catch (System.Exception) { this.Popup("请输入正确油价!"); } if (txtOilPrice.Text == "") { this.Popup("请填写参数"); return; } OilPrice price = new OilPrice(); price.cnnSerialNo = Guid.NewGuid(); price.cndPriceDate = DateTime.Now; price.cnnOilPrice = decimal.Parse(txtOilPrice.Text); price.cnvcDeptName = ddlDept.SelectedItem.Text; price.cnvcGoodsName = ddlGoodsName.SelectedItem.Text; price.cnvcGoodsType = ddlGoodsType.SelectedItem.Text; price.cnvcUnit = ddlUnit.SelectedItem.Text; price.cndPriceDate = DateTime.Parse(txtPriceDate.Text + " " + DateTime.Now.ToLongTimeString()); Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "添加油价:" + price.cnvcDeptName + "|" + price.cnnOilPrice.ToString(); busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS004"; busiLog.cnvcSource = "网站"; DeptFacade.AddOilPrice(price, busiLog); Popup("油价添加成功"); ddlDept_SelectedIndexChanged(null, null); }
private void AddCompany() { MebCompanyPrepay company = new MebCompanyPrepay(); company.cnnPrepayFee = Decimal.Parse(txtPrepayFee.Text); company.cnvcAcctID = Guid.NewGuid(); company.cnvcCompanyID = Guid.NewGuid(); company.cnvcCompanyName = txtCompanyName.Text; company.cnvcDeptID = ddlDept.SelectedValue; company.cnvcDeptName = ddlDept.SelectedItem.Text; company.cnbValidate = chkValidate.Checked; Dept curDept = Session[ConstValue.LOGIN_DEPT_SESSION] as Dept; Oper curOper = Session[ConstValue.LOGIN_USER_SESSION] as Oper; BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = DateTime.Now; busiLog.cnnSerial = Guid.NewGuid(); busiLog.cnvcOperName = curOper.cnvcOperName; busiLog.cnvcComments = "添加单位:" + txtCompanyName.Text; busiLog.cnvcDeptID = curDept.cnvcDeptID; busiLog.cnvcDeptName = curDept.cnvcDeptName; busiLog.cnvcOperType = "BS011"; busiLog.cnvcSource = "网站"; FillFee fee = new FillFee(); fee.cndOperDate = busiLog.cndOperDate; fee.cnnFillFee = company.cnnPrepayFee; fee.cnvcAcctID = company.cnvcAcctID; fee.cnvcCompanyID = company.cnvcCompanyID; fee.cnvcCompanyName = company.cnvcCompanyName; fee.cnvcDeptID = company.cnvcDeptID; fee.cnvcDeptName = company.cnvcDeptName; fee.cnnSerial = busiLog.cnnSerial; fee.cnvcOperName = busiLog.cnvcOperName; PrepayFeeFacade.AddCompany(company, fee, busiLog); }
public static Oper IsUser(string strOperID, string strOperPwd) { SqlConnection conn = ConnectionPool.BorrowConnection(); Oper oper = null; try { oper = new Oper(); oper.cnvcOperID = strOperID; oper = EntityMapping.Get(oper, conn) as Oper; if (null == oper) { throw new Exception("无此用户"); } if (oper.cndInvalidDate <= DateTime.MinValue) { throw new Exception("用户已失效"); } if (oper.cnvcOperPwd != DataSecurity.Encrypt(strOperPwd)) { throw new Exception("密码无效"); } //写登录日志 BusiLog loginLog = new BusiLog(); loginLog.cndOperDate = Helper.GetSysTime(conn); loginLog.cnnBusiSerialNo = Helper.GetSerialNo(conn); loginLog.cnvcFuncCode = "登录"; loginLog.cnvcOperID = oper.cnvcOperID; loginLog.cnvcComments = "登录"; EntityMapping.Create(loginLog, conn); } catch (Exception ex) { LogAdapter.WriteFeaturesException(ex); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } return(oper); }
public static void UpdateVCust(Cust newcust, Oper oper) { using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { DateTime dtSysTime = Helper.GetSysTime(trans); newcust.cndCreateDate = dtSysTime; newcust.cndOperDate = dtSysTime; EntityMapping.Update(newcust, trans); BusiLog busiLog = new BusiLog(); busiLog.cndOperDate = dtSysTime; busiLog.cnnBusiSerialNo = Helper.GetSerialNo(trans); busiLog.cnvcComments = "修改大客户信息"; busiLog.cnvcFuncCode = " 客户档案管理"; busiLog.cnvcOperID = oper.cnvcOperID; busiLog.cnvcIPAddress = ""; EntityMapping.Create(busiLog, trans); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); LogAdapter.WriteDatabaseException(sex); throw sex; } catch (Exception ex) { trans.Rollback(); LogAdapter.WriteFeaturesException(ex); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } }
public int UpdateDept(Dept dept, BusiLog busiLog) { //SqlConnection conn = ConnectionPool.BorrowConnection(); int iRet = 0; using (SqlConnection conn = ConnectionPool.BorrowConnection()) { //conn.Open(); SqlTransaction trans = conn.BeginTransaction(); try { BusiLogAccess.AddBusiLog(trans, busiLog); Dept olddept = new Dept(); olddept.cnvcDeptID = dept.cnvcDeptID; olddept = EntityMapping.Get(olddept, trans) as Dept; olddept.cnbValidate = dept.cnbValidate; olddept.cnvcDeptName = dept.cnvcDeptName; olddept.cnvcParentDeptID = dept.cnvcParentDeptID; iRet = DeptAccess.UpdateDept(trans, olddept); trans.Commit(); } catch (SqlException sex) { trans.Rollback(); throw sex; } catch (Exception ex) { trans.Rollback(); throw ex; } finally { ConnectionPool.ReturnConnection(conn); } } return(iRet); }