public TSectionMs getSectionByCd(string companyCd, string secCd) { TSectionMs section = null; ISession ss = holder.CreateSession(typeof(TSectionMsDaoOracleImp)); ITransaction tran = ss.BeginTransaction(); try { ScalarQuery <TSectionMs> q = new ScalarQuery <TSectionMs>(typeof(TSectionMs), @" from TSectionMs where Id.ICompanyCd=:ICompanyCd and Id.ISectionCd=:ISectionCd "); q.SetParameter("ICompanyCd", companyCd); q.SetParameter("ISectionCd", secCd); section = q.Execute(); } catch (Castle.ActiveRecord.Framework.ActiveRecordException ex) { tran.Rollback(); throw new ApplicationException(ex.Message, ex); } catch (DbException ex) { tran.Rollback(); throw new ApplicationException(ex.Message, ex); } finally { tran.Dispose(); holder.ReleaseSession(ss); } return(section); }
/// <summary> /// 根据部门代码,检查数据表中是否存在 /// <param name="companyCd">公司代码</param> /// <param name="secCd">部门代码</param> /// <returns>Boolean</returns> /// </summary> public Boolean Check01Bool(String companyCd, String secCd) { Boolean rtnVal = false; TSectionMs vo = Check01Vo(companyCd, secCd); if (vo != null && !String.IsNullOrEmpty(vo.Id.ISectionCd)) { rtnVal = true; } return(rtnVal); }
/// <summary> /// 根据部门代码,检查数据表中是否存在 /// <param name="companyCd">公司代码</param> /// <param name="secCd">部门代码</param> /// <returns>TSectionMs</returns> /// </summary> public TSectionMs Check01Vo(String companyCd, String secCd) { TSectionMs vo = new TSectionMs(); try { if (!String.IsNullOrEmpty(secCd)) { ITSectionMsDao d = ComponentLocator.Instance().Resolve <ITSectionMsDao>(); vo = d.getSectionByCd(companyCd, secCd); } } catch (Exception ex) { throw new ApplicationException(ex.Message, ex); } return(vo); }
/// <summary> /// 部门代码存在Check /// </summary> private void ruleDepartExit_CustomValidationMethod(object sender, CustomValidationEventArgs e) { CheckSection check = new CheckSection(); e.IsValid = false; this.lblDepartNM.Text = ""; if (!String.IsNullOrEmpty(this.txtDepart.Text)) { TSectionMs vo = check.Check01Vo(this.txtCompany.Text, this.txtDepart.Text); if (vo != null && !String.IsNullOrEmpty(vo.Id.ISectionCd)) { e.IsValid = true; this.lblDepartNM.Text = vo.ISectionDesc; } } else { e.IsValid = true; } }
/// <summary> /// 根据EntityVo的值给画面上的控件赋值 /// </summary> private void SetVoToForm(TFactoryMs facVo) { #region this.txtAbbreviation.Text = facVo.IFacArgDesc; this.txtName.Text = facVo.IFacDesc; this.txtPinyin.Text = facVo.IFacDescKana; this.txtZipCD.Text = facVo.IMailNo; this.cbbCountry.Selectedvalue = facVo.ICountryCd; this.txtAddress1.Text = facVo.IAddress1; this.txtAddress2.Text = facVo.IAddress2; this.txtAddress3.Text = facVo.IAddress3; this.txtTel.Text = facVo.ITel; this.txtFax.Text = facVo.IFaxNo; this.cbbLanguage.Selectedvalue = facVo.ILanguageCd; this.cbbTimezone.Selectedvalue = facVo.ITimezoneCd; this.txtBase.Text = facVo.IBaseCd; this.txtDepart.Text = facVo.ISectionCd; CheckSection secCheck = new CheckSection(); TSectionMs secVo = secCheck.Check01Vo(this.txtCompany.Text, facVo.ISectionCd); if (secVo != null && !String.IsNullOrEmpty(secVo.Id.ISectionCd)) { this.lblDepartNM.Text = secVo.ISectionDesc; } else { this.lblDepartNM.Text = ""; } this.cbbChange.Selectedvalue = facVo.IEgChgCls; this.txtAutoPeriod.Text = facVo.IMrpPeriod.ToString(); this.txtStockPeriod.Text = facVo.IAlcPeriod.ToString(); this.txtArrange.Text = facVo.IPoCreatePeriod.ToString(); this.cbbSafe.Selectedvalue = facVo.ISafeStockCls; this.cbbRate.Selectedvalue = facVo.IRateCls; this.cbbPlan.Selectedvalue = facVo.IPlanCrtCls; this.cbbCost.Selectedvalue = facVo.IRsltCstCalcCls; this.cbbDecide.Selectedvalue = facVo.IPoCreateCls; #endregion }