/// <summary>
        /// Check ValidationProvider初始化
        /// </summary>
        private void Check_Init()
        {
            this.vdpG1                    = new ValidationProvider(this.components);
            this.vdpG1.BlinkStyle         = System.Windows.Forms.ErrorBlinkStyle.BlinkIfDifferentError;
            this.vdpBusinessG2            = new ValidationProvider(this.components);
            this.vdpBusinessG2.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.BlinkIfDifferentError;
            this.vdpBusinessG3            = new ValidationProvider(this.components);
            this.vdpBusinessG3.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.BlinkIfDifferentError;


            ValidationRule ruleFactory = new ValidationRule();

            ruleFactory.IsRequired = true;
            ruleFactory.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.caplblFactory.Text);
            this.vdpG1.SetValidationRule(this.atxtFactoryCd, ruleFactory);


            ValidationRule ruleFactoryExist = new ValidationRule();

            ruleFactoryExist.IsCustomError           = true;
            ruleFactoryExist.CustomValidationMethod += new CustomValidationEventHandler(ruleFactoryExist_CustomValidationMethod);
            ruleFactoryExist.CustomErrorMessage      = MessageUtils.GetMessage("W0004", this.caplblFactory.Text);
            this.vdpG1.SetValidationRule(this.atxtFactoryCd, ruleFactoryExist);

            ValidationRule ruleCustomerExist = new ValidationRule();

            ruleCustomerExist.IsCustomError           = true;
            ruleCustomerExist.CustomValidationMethod += new CustomValidationEventHandler(ruleCustomerExist_CustomValidationMethod);
            ruleCustomerExist.CustomErrorMessage      = MessageUtils.GetMessage("W0004", this.caplblCustomer.Text);
            this.vdpBusinessG2.SetValidationRule(this.atxtCustomerCd, ruleCustomerExist);

            ValidationRule ruleItemTypeExist = new ValidationRule();

            ruleItemTypeExist.IsCustomError           = true;
            ruleItemTypeExist.CustomValidationMethod += new CustomValidationEventHandler(ruleItemTypeExist_CustomValidationMethod);
            ruleItemTypeExist.CustomErrorMessage      = MessageUtils.GetMessage("W0004", this.caplblItemType.Text);
            this.vdpBusinessG2.SetValidationRule(this.atxtItemType, ruleItemTypeExist);

            ValidationRule ruleMakerExist = new ValidationRule();

            ruleMakerExist.IsCustomError           = true;
            ruleMakerExist.CustomValidationMethod += new CustomValidationEventHandler(ruleMakerExist_CustomValidationMethod);
            ruleMakerExist.CustomErrorMessage      = MessageUtils.GetMessage("W0004", this.caplblMaker.Text);
            this.vdpBusinessG2.SetValidationRule(this.atxtMakerCd, ruleMakerExist);

            ValidationRule ruleInquiry = new ValidationRule();

            ruleInquiry.IsCustomError           = true;
            ruleInquiry.CustomValidationMethod += new CustomValidationEventHandler(ruleInquiry_CustomValidationMethod);
            ruleInquiry.CustomErrorMessage      = MessageUtils.GetMessage("W0005");
            this.vdpBusinessG3.SetValidationRule(this.FrmMaterialSearch_pagerGridView1, ruleInquiry);
        }
示例#2
0
        /// <summary>
        /// Check ValidationProvider初始化
        /// </summary>
        private void Check_Init()
        {
            this.vdpG3            = new ValidationProvider(this.components);
            this.vdpG3.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.BlinkIfDifferentError;

            this.vdpBusinessG3            = new ValidationProvider(this.components);
            this.vdpBusinessG3.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.BlinkIfDifferentError;

            this.vdpG2            = new ValidationProvider(this.components);
            this.vdpG2.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.BlinkIfDifferentError;

            ValidationRule ruleRate = new ValidationRule();

            ruleRate.IsRequired = true;
            ruleRate.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.ntxtRate.Text);
            this.vdpG3.SetValidationRule(this.ntxtRate, ruleRate);

            ValidationRule rule9A_G3 = new ValidationRule();

            rule9A_G3.IsRequired = true;
            rule9A_G3.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.clsddl_9A_G3.Text);
            this.vdpG3.SetValidationRule(this.clsddl_9A_G3, rule9A_G3);

            ValidationRule ruleCurr = new ValidationRule();

            ruleCurr.IsRequired = true;
            ruleCurr.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.tddlCurr_G3.Text);
            this.vdpG3.SetValidationRule(this.tddlCurr_G3, ruleCurr);

            ValidationRule ruleEffEedDate = new ValidationRule();

            ruleEffEedDate.IsRequired = true;
            ruleEffEedDate.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.xdtpEffEedDate.Text);
            this.vdpG3.SetValidationRule(this.xdtpEffEedDate, ruleEffEedDate);

            ValidationRule ruleCalcMode = new ValidationRule();

            ruleCalcMode.IsRequired = true;
            ruleCalcMode.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.cndCalcMode.Text);
            this.vdpG3.SetValidationRule(this.cndCalcMode, ruleCalcMode);

            ValidationRule rulePgvRate = new ValidationRule();

            rulePgvRate.IsCustomError           = true;
            rulePgvRate.CustomValidationMethod += new CustomValidationEventHandler(CheckG2);
            rulePgvRate.CustomErrorMessage      = MessageUtils.GetMessage("W0006");
            this.vdpG2.SetValidationRule(this.pgvRateMs, rulePgvRate);
        }
示例#3
0
        public CompanyConditionVo GetCompanyCondition(string companyCd)
        {
            ITCompanyConditionMsDao dao = ComponentLocator.Instance().Resolve <ITCompanyConditionMsDao>();
            TCompanyConditionMs     companyconditionms = dao.getCompanyCondition(companyCd);

            if (companyconditionms == null)
            {
                throw new ApplicationException(MessageUtils.GetMessage("E0001"));
            }
            else
            {
                CompanyConditionVo companyconditonvo = new CompanyConditionVo();
                PropertiesCopier.CopyProperties(companyconditionms, companyconditonvo);
                return(companyconditonvo);
            }
        }
示例#4
0
        public FactoryVo GetFactoryByCd(string FacCd)
        {
            ITFactoryMsDao dao       = ComponentLocator.Instance().Resolve <ITFactoryMsDao>();
            TFactoryMs     factoryms = dao.getFactoryByCd(FacCd);

            if (factoryms == null)
            {
                throw new ApplicationException(MessageUtils.GetMessage("E0001"));
            }
            else
            {
                FactoryVo factoryvo = new FactoryVo();
                PropertiesCopier.CopyProperties(factoryms, factoryvo);
                return(factoryvo);
            }
        }
示例#5
0
 public void SetPanelVisible()
 {
     if ("0".Equals(this.functioncatalogindex))
     {
         this.tlpFuncCatalog1.Visible = true;
         this.tlpFuncCatalog1.Dock    = DockStyle.Fill;
         this.tlpFuncCatalog2.Visible = false;
         this.label1.Text             = MessageUtils.GetMessage("I0101");
     }
     if ("1".Equals(this.functioncatalogindex))
     {
         this.tlpFuncCatalog1.Visible = false;
         this.tlpFuncCatalog2.Visible = true;
         this.tlpFuncCatalog2.Dock    = DockStyle.Fill;
         this.label1.Text             = MessageUtils.GetMessage("I0102");
     }
 }
示例#6
0
        public FrmCompany(DockPanel _parentdockpanel)
            : base(_parentdockpanel)
        {
            log.Info("FrmCompany init start");
            InitializeComponent();

            ValidationRule rule1 = new ValidationRule();

            rule1.IsRequired = true;
            rule1.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", "aaaaaa");
            validationProvider1.SetValidationRule(this.textBox1, rule1);

            this.dateTimePicker1.Format       = DateTimePickerFormat.Custom;
            this.dateTimePicker1.CustomFormat = "       ";

            log.Info("FrmCompany init end");
        }
示例#7
0
        public PersonVo GetPersonByUserId(string userId)
        {
            ITPersonMsDao dao      = ComponentLocator.Instance().Resolve <ITPersonMsDao>();
            TPersonMs     personms = dao.getPersonByUserId(userId);

            if (personms == null)
            {
                throw new ApplicationException(MessageUtils.GetMessage("E0001"));
            }
            else
            {
                PersonVo personvo = new PersonVo();
                PropertiesCopier.CopyProperties(personms, personvo);
                personvo.ICompanyCd = personms.Id.ICompanyCd;
                personvo.IPersonCd  = personms.Id.IPersonCd;

                return(personvo);
            }
        }
示例#8
0
        public void TestDeserialiseHPPResponse()
        {
            string filename;

            filename = "response-enc4.json";
            string      json = File.ReadAllText(Path.Combine(Environment.CurrentDirectory, @"Data", filename));
            HPPResponse resp = JsonConvert.DeserializeObject <HPPResponse>(json);

            resp.IsEncoded = true;

            resp.Decode();

            Console.WriteLine("====================");
            Console.WriteLine();
            Console.WriteLine("====================");


            RealexHPP hpp = new RealexHPP()
            {
                Secret = "secret"
            };

            filename = "response-fail-enc.json";
            string json2 = File.ReadAllText(Path.Combine(Environment.CurrentDirectory, @"Data", filename));

            HPPResponse resp2 = hpp.ResponseFromJson(json2);

            Assert.Equal(resp2.Result, "101");

            ResourceManager rm = global.cloudis.RealexHPP.HPPMessages.ResourceManager;

            Console.WriteLine(rm.GetString("hppResponse_message_unknown"));

            Assert.Null(MessageUtils.GetMessage("No message"));

            Assert.NotNull(MessageUtils.GetMessageForResult("101"));

            Assert.NotNull(MessageUtils.GetMessageForResult("508"));

            Console.WriteLine(MessageUtils.GetMessageForResult("508"));
        }
示例#9
0
        public void Check_Init()
        {
            ValidationRule ruleUserId = new ValidationRule();

            ruleUserId.IsRequired = true;

            ruleUserId.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblUserId.Text);
            validationProvider1.SetValidationRule(this.txtUserId, ruleUserId);

            ValidationRule rulePassword = new ValidationRule();

            rulePassword.IsRequired = true;
            rulePassword.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblPassword.Text);
            validationProvider1.SetValidationRule(this.txtPassword, rulePassword);

            Noogen.Validation.ValidationRule ruleLoginCheck = new Noogen.Validation.ValidationRule();
            ruleLoginCheck.CustomValidationMethod +=
                new Noogen.Validation.CustomValidationEventHandler(vr_CustomLoginValidationMethod);
            ruleLoginCheck.CustomErrorMessage = MessageUtils.GetMessage("W0003");
            validationProvider2.SetValidationRule(this.txtUserId, ruleLoginCheck);
        }
        private void OnMessage(object data)
        {
            Debug.WriteLine("Message");

            string packedMessage = data as string;

            if (packedMessage != null)
            {
                try
                {
                    bool    handled = false;
                    Message message = MessageUtils.GetMessage(packedMessage);

                    MessageKey messageKey = MessageUtils.GetMessageKey(packedMessage);
                    if (messageKey != null)
                    {
                        lock (this.handlersLock)
                        {
                            EventHandler <MessageEventArgs> handler;
                            if (this.handlers.TryGetValue(messageKey, out handler))
                            {
                                handler(this, new MessageEventArgs((Message)message.Clone()));
                                handled = true;
                            }
                        }
                    }

                    if (!handled)
                    {
                        this.OnNonHandledMessage(new MessageEventArgs((Message)message.Clone()));
                        Debug.WriteLine(message);
                    }
                }
                catch (MalformedMessageException ex)
                {
                    Debug.WriteLine(ex);
                }
            }
        }
        /// <summary>
        /// 根据ClsCd取得DetailList
        /// </summary>
        /// <param name="langId"></param>
        /// <param name="clsCd"></param>
        /// <returns></returns>
        public IList <CClsDetailNoAR> GetClsDetailList(string langId, string clsCd)
        {
            IList <CClsDetailNoAR> result = new List <CClsDetailNoAR>();

            ISession     ss   = holder.CreateSession(typeof(CClsDetailNoARDaoOracleImp));
            ITransaction tran = ss.BeginTransaction();

            try
            {
                //IList<TClsMs> clsmslist = new List<TClsMs>();
                TClsMs clsms = null;
                //get role by userid
                ScalarQuery <TClsMs> queryclsms = new ScalarQuery <TClsMs>(typeof(TClsMs), @"
                                                from TClsMs where IClsCd=:clsCd");
                queryclsms.SetParameter("clsCd", clsCd);

                clsms = queryclsms.Execute();

                if (clsms == null)
                {
                    throw new ApplicationException(MessageUtils.GetMessage("E0001"));
                }



                StringBuilder sb = new StringBuilder();
                //select f.catalogid,f.functionid,f.functionimage,f.functionindex,f.functionname,f.functionpath,f.langid,c.catalogimage,c.catalogname from (M_FUNCTION f inner join (select functionid from m_role_function
                //where roleid=1 group by functionid) r on (f.functionid=r.functionid)) left join
                //m_functioncatalog c on (f.catalogid=c.catalogid and f.langid=c.langid)
                //where f.langid='zh-CN'
                //order by f.catalogid,f.functionindex

                if ("1".Equals(clsms.IClsCls))
                {
                    sb.Append(" select d.i_cls_cd as iClsCd,");
                    sb.Append(" d.i_language_cd as iLanguageCd,");
                    sb.Append(" d.i_cls_detail_cd as iClsDetailCd,");
                    sb.Append(" d.i_cls_detail_desc as iClsDetailDesc,");
                    sb.Append(" d.i_inq_item as iInqItem,");
                    sb.Append(" '' as iClsNameDesc");
                    sb.Append(" from t_cls_detail_ms d");
                    sb.Append(" where d.i_cls_cd=:clsCd");
                    sb.Append(" and d.i_language_cd=:langId");
                }
                else if ("2".Equals(clsms.IClsCls))
                {
                    sb.Append(" select d.i_cls_cd as iClsCd ,");
                    sb.Append(" d.i_language_cd as iLanguageCd ,");
                    sb.Append(" d.i_name_cd as iClsDetailCd,");
                    sb.Append(" d.i_name_desc as iClsDetailDesc,");
                    sb.Append(" d.i_inq_item as iInqItem,");
                    sb.Append(" d.i_name_kana as iClsNameDesc");
                    sb.Append(" from t_desc_ms d");
                    sb.Append(" where d.i_cls_cd=:clsCd");
                    sb.Append(" and d.i_language_cd=:langId");
                }


                ISQLQuery querycatalogfunction = ss.CreateSQLQuery(sb.ToString());
                querycatalogfunction.AddScalar("iClsCd", NHibernateUtil.String);
                querycatalogfunction.AddScalar("iLanguageCd", NHibernateUtil.String);
                querycatalogfunction.AddScalar("iClsDetailCd", NHibernateUtil.String);
                querycatalogfunction.AddScalar("iClsDetailDesc", NHibernateUtil.String);
                querycatalogfunction.AddScalar("iInqItem", NHibernateUtil.String);
                querycatalogfunction.AddScalar("iClsNameDesc", NHibernateUtil.String);


                querycatalogfunction.SetParameter("langId", langId);
                querycatalogfunction.SetParameter("clsCd", clsms.IClsCd);

                result = querycatalogfunction.SetResultTransformer(Transformers.AliasToBean <CClsDetailNoAR>()).List <CClsDetailNoAR>();


                tran.Commit();
            }
            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(result);
        }
示例#12
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            try
            {
                SplashScreen.UdpateStatusText(MessageUtils.GetMessage("I0001"));
                ToolStripManager.Renderer = new Office2007Renderer();

                //get all condition
                String d = LangUtils.GetDefaultLanguage();
                ConditionUtils.GetAllConditionsList(d);
                Thread.CurrentThread.CurrentUICulture = (System.Globalization.CultureInfo) new System.Globalization.CultureInfo(d);
                rm = new System.Resources.ResourceManager(typeof(MainForm));

                init_ToolStripComboBox();

                //castle windsor initial
                ComponentLocator.Instance();


                LoginUserInfoVo  uservo = (LoginUserInfoVo)SessionUtils.GetSession(SessionUtils.COMMON_LOGIN_USER_INFO);
                IAction_MainForm af     = ComponentLocator.Instance().Resolve <IAction_MainForm>();

                //display status strip
                this.toolStripStatusLabelTime.Text = rm.GetString("Status.Time") + DateTime.Now.GetDateTimeFormats('D')[3].ToString();

                this.toolStripStatusLabelLoginUser.Text = rm.GetString("Status.LoginUser") + uservo.Username;


                SplashScreen.UdpateStatusText(MessageUtils.GetMessage("I0004"));

                //IList<FunctionAllVo> flist = af.GetFunctionDataList();
                //加载用户权限。
                IList <FunctionAllVo> flist = af.GetCatalogFunctionByUserId(uservo.Userid);

                //加载工厂
                TermVo termvo = af.GetTermInfo(uservo.Userid);
                uservo.Term = termvo;
                if (termvo == null)
                {
                    uservo.Factory = null;
                }
                else
                {
                    FactoryVo factory = af.GetFactoryByCd(termvo.IFacCd);
                    uservo.Factory = factory;
                }
                //加载person
                PersonVo person = af.GetPersonByUserId(uservo.Userid);
                uservo.Person = person;

                CompanyConditionVo companycondition = af.GetCompanyCondition(person.ICompanyCd);
                uservo.CompanyCondition = companycondition;

                this.toolStripStatusLabelCompany.Text = companycondition.ICompanyArgDesc;

                //SessionUtils.RemoveSession(SessionUtils.COMMON_LOGIN_USER_INFO);
                //SessionUtils.SetSession(SessionUtils.COMMON_LOGIN_USER_INFO, uservo);



                SplashScreen.UdpateStatusText(MessageUtils.GetMessage("I0002"));
                init_MenuStrip(flist);
                init_MenuWindow(flist);

                //Thread.Sleep(1000);
                //SplashScreen.UdpateStatusTextWithStatus("Success Message", TypeOfMessage.Success);

                SplashScreen.UdpateStatusText(MessageUtils.GetMessage("I0003"));

                this.Show();
                SplashScreen.CloseSplashScreen();
                this.Activate();
            }
            catch (ApplicationException ex)
            {
                MessageBox.Show(ex.Message, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
                this.Dispose();
            }
        }
示例#13
0
        /// <summary>
        /// 各种Check用Validation初期化
        /// </summary>
        private void Check_Init()
        {
            #region Init
            this.vdpRequireG1            = new ValidationProvider(this.components);
            this.vdpRequireG1.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.BlinkIfDifferentError;
            this.vdpRequireG2            = new ValidationProvider(this.components);
            this.vdpRequireG2.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.BlinkIfDifferentError;
            this.vdpExistG1             = new ValidationProvider(this.components);
            this.vdpExistG1.BlinkStyle  = System.Windows.Forms.ErrorBlinkStyle.BlinkIfDifferentError;
            this.vdpExistG2             = new ValidationProvider(this.components);
            this.vdpExistG2.BlinkStyle  = System.Windows.Forms.ErrorBlinkStyle.BlinkIfDifferentError;
            this.vdpCustomG1            = new ValidationProvider(this.components);
            this.vdpCustomG1.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.BlinkIfDifferentError;
            this.vdpCustomG2            = new ValidationProvider(this.components);
            this.vdpCustomG2.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.BlinkIfDifferentError;
            #endregion

            #region vdpRequireG1
            ValidationRule ruleCompany = new ValidationRule();
            ruleCompany.IsRequired = true;
            ruleCompany.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblCompany.Text);
            this.vdpRequireG1.SetValidationRule(this.txtCompany, ruleCompany);

            ValidationRule ruleFactory = new ValidationRule();
            ruleFactory.IsRequired = true;
            ruleFactory.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblFactory.Text);
            this.vdpRequireG1.SetValidationRule(this.txtFactory, ruleFactory);
            #endregion

            #region vdpRequireG2
            ValidationRule ruleAbbreviation = new ValidationRule();
            ruleAbbreviation.IsRequired = true;
            ruleAbbreviation.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblAbbreviation.Text);
            this.vdpRequireG2.SetValidationRule(this.txtAbbreviation, ruleAbbreviation);

            ValidationRule ruleName = new ValidationRule();
            ruleName.IsRequired = true;
            ruleName.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblName.Text);
            this.vdpRequireG2.SetValidationRule(this.txtName, ruleName);

            ValidationRule ruleZip = new ValidationRule();
            ruleZip.IsRequired = true;
            ruleZip.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblZipCD.Text);
            this.vdpRequireG2.SetValidationRule(this.txtZipCD, ruleZip);

            ValidationRule ruleCountry = new ValidationRule();
            ruleCountry.IsRequired = true;
            ruleCountry.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblCountry.Text);
            this.vdpRequireG2.SetValidationRule(this.cbbCountry, ruleCountry);

            ValidationRule ruleAddress = new ValidationRule();
            ruleAddress.IsRequired = true;
            ruleAddress.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblAddress1.Text);
            this.vdpRequireG2.SetValidationRule(this.txtAddress1, ruleAddress);

            ValidationRule ruleTel = new ValidationRule();
            ruleTel.IsRequired = true;
            ruleTel.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblTel.Text);
            this.vdpRequireG2.SetValidationRule(this.txtTel, ruleTel);

            ValidationRule ruleLanguage = new ValidationRule();
            ruleLanguage.IsRequired = true;
            ruleLanguage.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblLanguage.Text);
            this.vdpRequireG2.SetValidationRule(this.cbbLanguage, ruleLanguage);

            ValidationRule ruleTimeZone = new ValidationRule();
            ruleTimeZone.IsRequired = true;
            ruleTimeZone.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblTimezone.Text);
            this.vdpRequireG2.SetValidationRule(this.cbbTimezone, ruleTimeZone);

            ValidationRule ruleChange = new ValidationRule();
            ruleChange.IsRequired = true;
            ruleChange.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblChange.Text);
            this.vdpRequireG2.SetValidationRule(this.cbbChange, ruleChange);

            ValidationRule ruleAutoPeriod = new ValidationRule();
            ruleAutoPeriod.IsRequired = true;
            ruleAutoPeriod.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblAutoPeriod.Text);
            this.vdpRequireG2.SetValidationRule(this.txtAutoPeriod, ruleAutoPeriod);

            ValidationRule ruleStockPeriod = new ValidationRule();
            ruleStockPeriod.IsRequired = true;
            ruleStockPeriod.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblStockPeriod.Text);
            this.vdpRequireG2.SetValidationRule(this.txtStockPeriod, ruleStockPeriod);

            ValidationRule ruleArrange = new ValidationRule();
            ruleArrange.IsRequired = true;
            ruleArrange.RequiredFieldErroMessage = MessageUtils.GetMessage("W0001", this.lblArrange.Text);
            this.vdpRequireG2.SetValidationRule(this.txtArrange, ruleArrange);
            #endregion

            #region vdpExistG1
            ValidationRule ruleCompanyExit = new ValidationRule();
            ruleCompanyExit.IsCustomError           = true;
            ruleCompanyExit.CustomValidationMethod += new CustomValidationEventHandler(ruleCompanyExit_CustomValidationMethod);
            ruleCompanyExit.CustomErrorMessage      = MessageUtils.GetMessage("W0004", this.lblCompany.Text);
            this.vdpExistG1.SetValidationRule(this.txtCompany, ruleCompanyExit);

            ValidationRule ruleFactoryExit = new ValidationRule();
            ruleFactoryExit.IsCustomError           = true;
            ruleFactoryExit.CustomValidationMethod += new CustomValidationEventHandler(ruleFactoryExit_CustomValidationMethod);
            ruleFactoryExit.CustomErrorMessage      = MessageUtils.GetMessage("W0004", this.lblFactory.Text);
            this.vdpExistG1.SetValidationRule(this.txtFactory, ruleFactoryExit);
            #endregion

            #region vdpExistG2
            ValidationRule ruleDepartExit = new ValidationRule();
            ruleDepartExit.IsCustomError           = true;
            ruleDepartExit.CustomValidationMethod += new CustomValidationEventHandler(ruleDepartExit_CustomValidationMethod);
            ruleDepartExit.CustomErrorMessage      = MessageUtils.GetMessage("W0004", this.lblDepart.Text);
            this.vdpExistG2.SetValidationRule(this.txtDepart, ruleDepartExit);
            #endregion

            #region vdpCustomG1
            #endregion

            #region vdpCustomG2
            #endregion
        }
        public IList <CCatalogFunctionNoAR> GetCatalogFunctionByUserId(string langid, string userid)
        {
            IList <CCatalogFunctionNoAR> result = new List <CCatalogFunctionNoAR>();

            ISession     ss   = holder.CreateSession(typeof(CCatalogFunctionNoARDaoOracleImp));
            ITransaction tran = ss.BeginTransaction();

            try
            {
                IList <MRoleUser> mroleuserlist = new List <MRoleUser>();
                //get role by userid
                SimpleQuery <MRoleUser> queryroleuser = new SimpleQuery <MRoleUser>(typeof(MRoleUser), @"
                                                from MRoleUser where Id.Userid=:userid");
                queryroleuser.SetParameter("userid", userid);

                mroleuserlist = queryroleuser.Execute();

                if (mroleuserlist.Count <= 0)
                {
                    throw new ApplicationException(MessageUtils.GetMessage("E0001"));
                }

                StringBuilder sb = new StringBuilder();
                //select f.catalogid,f.functionid,f.functionimage,f.functionindex,f.functionname,f.functionpath,f.langid,c.catalogimage,c.catalogname from (M_FUNCTION f inner join (select functionid from m_role_function
                //where roleid=1 group by functionid) r on (f.functionid=r.functionid)) left join
                //m_functioncatalog c on (f.catalogid=c.catalogid and f.langid=c.langid)
                //where f.langid='zh-CN'
                //order by f.catalogid,f.functionindex
                sb.Append(" select f.catalogid,");
                sb.Append(" f.functionid,");
                sb.Append(" f.functionimage,");
                sb.Append(" f.functionindex,");
                sb.Append(" f.functionname,");
                sb.Append(" f.functionpath,");
                sb.Append(" f.langid,");
                sb.Append(" c.catalogimage,");
                sb.Append(" c.catalogname ");
                sb.Append(" from (m_function f ");
                sb.Append(" inner join ");
                sb.Append(" (select functionid from m_role_function ");
                sb.Append(" where ");
                int cnt = 0;
                foreach (MRoleUser mroleuservo in mroleuserlist)
                {
                    if (cnt == 0)
                    {
                        sb.Append("roleid = :roleid" + cnt);
                    }
                    else
                    {
                        sb.Append("or roleid = :roleid" + cnt);
                    }
                    cnt++;
                }

                sb.Append(" group by functionid) r ");
                sb.Append(" on (f.functionid=r.functionid)) ");
                sb.Append(" left join");
                sb.Append(" m_functioncatalog c ");
                sb.Append(" on (f.catalogid=c.catalogid and f.langid=c.langid)");
                sb.Append(" where f.langid=:langid");
                sb.Append(" order by f.catalogid,f.functionindex");


                ISQLQuery querycatalogfunction = ss.CreateSQLQuery(sb.ToString());
                querycatalogfunction.AddScalar("langid", NHibernateUtil.String);
                querycatalogfunction.AddScalar("functionid", NHibernateUtil.Int32);
                querycatalogfunction.AddScalar("functionname", NHibernateUtil.String);
                querycatalogfunction.AddScalar("functionpath", NHibernateUtil.String);
                querycatalogfunction.AddScalar("catalogid", NHibernateUtil.Int32);
                querycatalogfunction.AddScalar("functionindex", NHibernateUtil.Int32);
                querycatalogfunction.AddScalar("functionimage", NHibernateUtil.String);
                querycatalogfunction.AddScalar("catalogimage", NHibernateUtil.String);
                querycatalogfunction.AddScalar("catalogname", NHibernateUtil.String);

                cnt = 0;
                foreach (MRoleUser mroleuservo in mroleuserlist)
                {
                    querycatalogfunction.SetParameter("roleid" + cnt, mroleuservo.Id.Roleid);
                    cnt++;
                }
                querycatalogfunction.SetParameter("langid", langid);

                result = querycatalogfunction.SetResultTransformer(Transformers.AliasToBean <CCatalogFunctionNoAR>()).List <CCatalogFunctionNoAR>();


                tran.Commit();
            }
            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(result);
        }