private void Init() { if (IsFirstLaunch()) { formLogin login = new formLogin(DataAccess.Model.TNTPlan.TNTPlanType.HospitalTarget, ExcelName, Version); login.ShowDialog(); if (login.DialogResult == DialogResult.OK) { LoginUser = login.LoginUser; ExcelUtils.AddProperty(CUSTOM_PROPERTY_USER_ID, LoginUser.UserId.ToString(), this); ExcelUtils.AddProperty(CUSTOM_PROPERTY_USER_NAME, LoginUser.UserName, this); ExcelUtils.AddProperty(CUSTOM_PROPERTY_ROLE_CODE, LoginUser.RoleCode.ToString(), this); //AddProperty(CUSTOM_PROPERTY_POSITION_CODE, LoginUser.PositionCode); ExcelUtils.AddProperty(CUSTOM_PROPERTY_IS_LOGIN_AS, LoginUser.IsLoginAs.ToString(), this); //AddProperty(CUSTOM_PROPERTY_SU_CODE, LoginUser.PositionCode); ExcelUtils.AddProperty(CUSTOM_PROPERTY_IS_FIRST_LAUNCH, "NO", this); if (!CheckTNTPlan()) { SelectSU(); } bll.AddDBLog(LoginUser.PositionCode, LoginUser.UserId, "SFA指标核查", "登录"); Globals.Ribbons.RibbonTnt.SetRibbonButtonEnable(true); Globals.Ribbons.RibbonTnt.InitInfor(); LoadAllData(); } else { //doesn't login Globals.Ribbons.RibbonTnt.SetRibbonButtonEnable(false); Globals.Ribbons.RibbonTnt.InitInfor(); } } else { //not the first launch, read from cache Guid userId = Guid.Parse(ExcelUtils.GetPropertyValue(CUSTOM_PROPERTY_USER_ID, this)); String userName = ExcelUtils.GetPropertyValue(CUSTOM_PROPERTY_USER_NAME, this); Int32 roleCode = Int32.Parse(ExcelUtils.GetPropertyValue(CUSTOM_PROPERTY_ROLE_CODE, this)); String positionCode = ExcelUtils.GetPropertyValue(CUSTOM_PROPERTY_POSITION_CODE, this); bool isLoginAs = Boolean.Parse(ExcelUtils.GetPropertyValue(CUSTOM_PROPERTY_IS_LOGIN_AS, this)); //String selectedProductCode = GetPropertyValue(CUSTOM_PROPERTY_PRODUCT_CODE); LoginUser = new UserInfo { UserId = userId, UserName = userName, RoleCode = roleCode, PositionCode = positionCode, IsLoginAs = isLoginAs }; //SelectSU(); Globals.Ribbons.RibbonTnt.InitInfor(); //Globals.Ribbons.RibbonTnt.SetVisble(); Globals.Ribbons.RibbonTnt.SetRibbonButtonEnable(true); } // //Globals.Ribbons.RibbonTnt.SetRibbonButtonEnable(true); }