private void Save() { MeanEvent(form, new EventArgs());//先获取meaning的设置 if (_userbll == null) { _userbll = new UserInfoBLL(); } UserMeaning um = dic[WizardName.CreateMean] as UserMeaning; if (_userbll.InsertUserWizard(user, policy, (dic[WizardName.CreateRight] as UserRight).Right, um.mEntity)) { UserProfileBLL userProfileBll = new UserProfileBLL(); UserProfile userProfile = new UserProfile(); userProfile.ID = userProfileBll.GetProfilePKValue() + 1; userProfile.UserName = user.UserName; userProfile.TempCurveRGB = Common.GlobalProfile.TempCurveRGB; userProfile.AlarmLineRGB = Common.GlobalProfile.AlarmLineRGB; userProfile.IdealRangeRGB = Common.GlobalProfile.IdealRangeRGB; userProfile.IsShowAlarmLimit = Common.GlobalProfile.IsShowAlarmLimit; userProfile.IsShowMark = Common.GlobalProfile.IsShowMark; userProfile.IsFillIdealRange = Common.GlobalProfile.IsFillIdealRange; userProfile.DateTimeFormator = Common.GlobalProfile.DateTimeFormator; userProfile.Remark = DateTime.Now.ToString(); userProfile.ContactInfo = ""; userProfile.Logo = ShineTech.TempCentre.Platform.Utils.CopyToBinary(Properties.Resources.tempsen); userProfile.DefaultPath = ""; userProfile.ReportTitle = ""; userProfile.IsGlobal = (int)GlobalType.None; userProfile.IsShowHeader = false; userProfile.TempUnit = "C"; userProfileBll.InsertProfile(userProfile); //insert sys log InsertCreateUserLog(); InsertAssignRightsLog(); // new implementation of meanings if (flag) { DialogResult result = Utils.ShowMessageBox(Messages.FirstCreate, Messages.TitleNotification, MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { form.DialogResult = DialogResult.OK; } else { form.DialogResult = DialogResult.No; } } else { form.DialogResult = DialogResult.OK; } } else { form.DialogResult = DialogResult.No; } }
public void SaveTheGraphOption(string curveRgb, string limitRgb, string rangeRgb , bool isShowLimit, bool isShowMark, bool isFillRange, string format, bool isConfigTakeEffectNextTime) { UserProfileBLL _bll = new UserProfileBLL(); IList <UserProfile> allUserProfiles = _bll.GetAllUserProfiles(); bool result = false; if (allUserProfiles != null && allUserProfiles.Count > 0) { foreach (var item in allUserProfiles) { if (item != null && item.ID != 0) { if (CheckRGBFormat(curveRgb)) { item.TempCurveRGB = curveRgb; } if (CheckRGBFormat(limitRgb)) { item.AlarmLineRGB = limitRgb; } if (CheckRGBFormat(rangeRgb)) { item.IdealRangeRGB = rangeRgb; } item.IsShowAlarmLimit = isShowLimit; item.IsShowMark = isShowMark; item.IsFillIdealRange = isFillRange; item.DateTimeFormator = format; result = _bll.UpdateProfile(item); } if (!result) { break; } } } else { UserProfile userProfile = new UserProfile(); userProfile.ID = _bll.GetProfilePKValue() + 1; userProfile.UserName = Common.User.UserName == null ? "" : Common.User.UserName; if (CheckRGBFormat(curveRgb)) { userProfile.TempCurveRGB = curveRgb; } if (CheckRGBFormat(limitRgb)) { userProfile.AlarmLineRGB = limitRgb; } if (CheckRGBFormat(rangeRgb)) { userProfile.IdealRangeRGB = rangeRgb; } userProfile.IsShowAlarmLimit = isShowLimit; userProfile.IsShowMark = isShowMark; userProfile.IsFillIdealRange = isFillRange; userProfile.DateTimeFormator = format; userProfile.Remark = DateTime.Now.ToString(); userProfile.ContactInfo = ""; userProfile.Logo = ShineTech.TempCentre.Platform.Utils.CopyToBinary(Properties.Resources.tempsen); userProfile.DefaultPath = ""; userProfile.ReportTitle = ""; userProfile.IsGlobal = (int)GlobalType.None; userProfile.IsShowHeader = false; userProfile.TempUnit = "C"; result = _bll.InsertProfile(userProfile); } if (result) { if (isConfigTakeEffectNextTime) { Platform.Utils.ShowMessageBox(Platform.Messages.B48, Platform.Messages.TitleNotification, MessageBoxButtons.OK); } else { Platform.Utils.ShowMessageBox(Platform.Messages.B47, Platform.Messages.TitleNotification, MessageBoxButtons.OK); } Common.GlobalProfile = null; } else { Platform.Utils.ShowMessageBox(Platform.Messages.B49, Platform.Messages.TitleNotification, MessageBoxButtons.OK); } }