コード例 #1
0
        private void SendMail(BenQGuru.eMES.Domain.Alert.Alert alert)
        {
            BenQGuru.eMES.Web.Helper.ESmtpMail mail = this.GetNewMail();

            //收件人
            BenQGuru.eMES.BaseSetting.UserFacade userfacade = new BenQGuru.eMES.BaseSetting.UserFacade(DataProvider);

            int recipientCount = 0;

            foreach (ListItem li in this.lstUser.Items)
            {
                if (li.Value != null && li.Value != string.Empty)
                {
                    BenQGuru.eMES.Domain.BaseSetting.User user = userfacade.GetUser(li.Value) as BenQGuru.eMES.Domain.BaseSetting.User;
                    if (user != null && user.UserEmail != null && user.UserEmail != string.Empty && user.UserEmail.IndexOf("@") != -1)
                    {
                        mail.AddRecipient(user.UserName, user.UserEmail);
                        recipientCount++;
                    }
                }
            }

            if (recipientCount > 0)
            {
                mail.Body = alert.AlertMsg;

                if (!mail.Send())
                {
                    BenQGuru.eMES.Common.ExceptionManager.Raise(this.GetType(), mail.ErrorMessage);
                }
            }
        }
コード例 #2
0
        private void LoadData()
        {
            BenQGuru.eMES.Domain.Alert.Alert alert = (BenQGuru.eMES.Domain.Alert.Alert) this._alertFacade.GetAlert(this._alertID);
            if (alert != null)
            {
                this.drpAlertLevel.SelectedValue = alert.AlertLevel;
                this.txtAlertMsg.Text            = alert.AlertMsg;
                this.txtDesc.Text          = alert.Description;
                this.chbMailNotify.Checked = (alert.MailNotify == "Y");

//				//load 用户
//				if(this.chbMailNotify.Checked)
//				{
                object[] objs = _alertFacade.QueryAlertManualNotifier(alert.AlertID);
                if (objs != null)
                {
                    foreach (object obj in objs)
                    {
                        BenQGuru.eMES.Domain.Alert.AlertManualNotifier notifier = obj as BenQGuru.eMES.Domain.Alert.AlertManualNotifier;
                        if (notifier == null)
                        {
                            continue;
                        }

                        BenQGuru.eMES.Domain.BaseSetting.User user = _userfacade.GetUser(notifier.UserCode) as BenQGuru.eMES.Domain.BaseSetting.User;
                        if (user != null && user.UserEmail != null)
                        {
                            this.lstUser.Items.Add(new ListItem(user.UserCode + "(" + user.UserEmail + ")", user.UserCode));
                        }
                    }
                }
                //}
            }
        }
コード例 #3
0
ファイル: FAlertEP.aspx.cs プロジェクト: windygu/.net-wms
        private void SaveData()
        {
            try
            {
                DataProvider.BeginTransaction();

                BenQGuru.eMES.Domain.Alert.Alert alert = this._alertFacade.GetAlert(this._alertID) as BenQGuru.eMES.Domain.Alert.Alert;
                if (alert != null)
                {
                    alert.AlertLevel   = this.drpAlertLevel.SelectedValue;
                    alert.AlertStatus  = this.drpAlertStatus.SelectedValue;
                    alert.Description  = this.txtDesc.Text;
                    alert.MaintainUser = this.GetUserCode();
                    alert.MaintainDate = FormatHelper.TODateInt(DateTime.Now.ToShortDateString());
                    alert.MaintainTime = FormatHelper.TOTimeInt(DateTime.Now);
                    _alertFacade.UpdateAlert(alert);

                    //写处理记录表
                    BenQGuru.eMES.Domain.Alert.AlertHandleLog log = this._alertFacade.CreateNewAlertHandleLog();
                    log.AlertID     = alert.AlertID;
                    log.AlertLevel  = alert.AlertLevel;
                    log.AlertStatus = alert.AlertStatus;
                    log.HandleUser  = alert.MaintainUser;
                    log.HandleDate  = alert.MaintainDate;
                    log.HandleTime  = alert.MaintainTime;
                    log.HandleMsg   = alert.Description;
                    log.HandleSeq   = _alertFacade.GetNextHandleSeq(alert.AlertID);

                    BenQGuru.eMES.BaseSetting.UserFacade  userfacade = new BenQGuru.eMES.BaseSetting.UserFacade(DataProvider);
                    BenQGuru.eMES.Domain.BaseSetting.User user       = userfacade.GetUser(log.HandleUser) as BenQGuru.eMES.Domain.BaseSetting.User;
                    if (user != null)
                    {
                        log.UserEmail = user.UserEmail;
                    }

                    _alertFacade.AddAlertHandleLog(log);
                }

                DataProvider.CommitTransaction();
            }
            catch (System.Exception ex)
            {
                this.DataProvider.RollbackTransaction();
                throw ex;
            }
        }
コード例 #4
0
        protected void cmdAddUser_Click(object sender, System.EventArgs e)
        {
            BenQGuru.eMES.BaseSetting.UserFacade userFacade = null;
            string[] users = this.stbUser.Text.Trim().Split(',');
            if (users.Length > 0)
            {
                userFacade = new BenQGuru.eMES.BaseSetting.UserFacade(this.DataProvider);
            }

            for (int i = 0; i < users.Length; i++)
            {
                if (this.lstUser.Items.FindByValue(users[i]) == null)
                {
                    BenQGuru.eMES.Domain.BaseSetting.User user = (BenQGuru.eMES.Domain.BaseSetting.User)userFacade.GetUser(users[i]);
                    if (user != null)
                    {
                        lstUser.Items.Add(new ListItem(user.UserCode + "(" + user.UserEmail + ")", user.UserCode));
                    }
                }
            }
        }
コード例 #5
0
        protected override Infragistics.WebUI.UltraWebGrid.UltraGridRow GetGridRow(object obj)
        {
            BenQGuru.eMES.Domain.Alert.AlertNotifier notifier = obj as BenQGuru.eMES.Domain.Alert.AlertNotifier;
            if (notifier == null)
            {
                return(null);
            }

            Infragistics.WebUI.UltraWebGrid.UltraGridRow ur = new UltraGridRow(
                new object[]
            {
                notifier.UserCode,
                notifier.EMail
            }
                );
            BenQGuru.eMES.Domain.BaseSetting.User user = _userfacade.GetUser(notifier.UserCode) as BenQGuru.eMES.Domain.BaseSetting.User;
            if (user != null && user.UserEmail != null)
            {
                ur.Cells[1].Value = user.UserEmail;
            }

            return(ur);
        }
コード例 #6
0
        private void LoadResData()
        {
            this.ExecuteClientFunction("setResDisplay", "");
            BenQGuru.eMES.Domain.Alert.AlertResBill alert = (BenQGuru.eMES.Domain.Alert.AlertResBill) this._alertBillFacade.GetAlertResBill(this._billId);
            if (alert != null)
            {
                this.ViewState["_itemcode"] = alert.ItemCode;
                _alerttype = alert.AlertType;
                this.ViewState["_alertitem"] = alert.AlertItem;
                this.ViewState["_rescode"]   = alert.ResourceCode;
                this.ViewState["._ecg2ec"]   = alert.ErrorGroup2Code;

                this.txtResource.Text  = this.ViewState["_rescode"].ToString();
                this.txtEcg2Ec.Text    = this.ViewState["._ecg2ec"].ToString();
                this.txtItemCode.Text  = alert.ItemCode;
                this.txtAlertItem.Text = AlertMsg.GetAlertName(alert.AlertItem, this.languageComponent1);
                this.txtAlertType.Text = AlertMsg.GetAlertName(alert.AlertType, this.languageComponent1);

                //不良资源只有大于等于才有效
                if (this._alerttype == AlertType_Old.ResourceNG)
                {
                    this.txtStartNum.Text = string.Empty;
                    this.drpOperator.Items.RemoveAt(0);
                    this.drpOperator.Items.RemoveAt(0);
                }
                else
                {
                    this.txtStartNum.Text = NumberHelper.TrimZero(alert.StartNum);
                }

                this.drpOperator.SelectedValue = alert.Operator;
                if (this.drpOperator.SelectedValue != Operator_Old.BW)
                {
                    this.lblAnd.Visible = false;
                    this.txtUp.Visible  = false;
                }
                this.txtLow.Text           = NumberHelper.TrimZero(alert.LowValue);
                this.txtUp.Text            = NumberHelper.TrimZero(alert.UpValue);
                this.dateValidDate.Text    = FormatHelper.ToDateString(alert.ValidDate);
                this.txtAlertMsg.Text      = alert.AlertMsg;
                this.txtDesc.Text          = alert.Description;
                this.chbMailNotify.Checked = (alert.MailNotify == "Y");
                //load 用户
                //if(this.chbMailNotify.Checked)
                //{
                object[] objs = _alertBillFacade.QueryAlertNotifier(_billId);
                if (objs != null)
                {
                    foreach (object obj in objs)
                    {
                        BenQGuru.eMES.Domain.Alert.AlertNotifier notifier = obj as BenQGuru.eMES.Domain.Alert.AlertNotifier;
                        if (notifier == null)
                        {
                            continue;
                        }

                        BenQGuru.eMES.Domain.BaseSetting.User user = _userfacade.GetUser(notifier.UserCode) as BenQGuru.eMES.Domain.BaseSetting.User;
                        if (user != null && user.UserEmail != null)
                        {
                            this.lstUser.Items.Add(new ListItem(user.UserCode + "(" + user.UserEmail + ")", user.UserCode));
                        }
                        else                         //没找到则是手动加入的用户
                        {
                            this.lstUser.Items.Add(new ListItem(notifier.UserCode + "(" + notifier.EMail + ")", notifier.UserCode));
                        }
                    }
                }
                //}
            }
        }
コード例 #7
0
ファイル: FLogin.aspx.cs プロジェクト: windygu/.net-wms
        protected void cmdOK_ServerClick(object sender, System.EventArgs e)
        {
            SessionHelper sessionHelper = SessionHelper.Current(this.Session);

            _facade = new SecurityFacade(base.DataProvider);
            try
            {
                // 未输入用户名
                if (this.txtUserCode.Text.Trim() == string.Empty)
                {
                    ExceptionManager.Raise(this.GetType(), "$Error_User_Code_Empty");
                }
                //用户输入密码错误5次
                if (this.loguser.Value != this.txtUserCode.Text.Trim() && this.loguser.Value != string.Empty)
                {
                    this.logintimes.Value = "0";                                                              //登陆用户与上一次的用户不同且不是第一次登陆,输入密码错误次数清零
                }
                if (this.loguser.Value == this.txtUserCode.Text.Trim() || this.loguser.Value == string.Empty) //登陆用户第一次或者和上次登陆的相同
                {
                    this.loguser.Value = this.txtUserCode.Text.Trim();
                    int logtimes = Convert.ToInt32(this.logintimes.Value);
                    logtimes = logtimes + 1;
                    this.logintimes.Value = logtimes.ToString();
                    ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection();
                    DataProvider.BeginTransaction();
                    try
                    {
                        string login = "******" + txtUserCode.Text.Trim().ToUpper() + "'";
                        if (logtimes > 5)
                        {
                            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.Execute(login);                            //密码错误5次将userstat改为L,锁定账户
                            DataProvider.CommitTransaction();
                            this.logintimes.Value = "0";
                            return;
                        }
                    }
                    catch
                    {
                        DataProvider.RollbackTransaction();
                    }
                    finally
                    {
                        ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection();
                    }
                }
                // 未输入密码
                if (this.txtPassword.Text.Trim() == string.Empty)
                {
                    ExceptionManager.Raise(this.GetType(), "$Error_Password_Empty");
                }

                BenQGuru.eMES.Domain.BaseSetting.User user = this._facade.LoginCheck(FormatHelper.CleanString(this.txtUserCode.Text.ToUpper()), FormatHelper.CleanString(this.txtPassword.Text.ToUpper()));

                // 用户名不存在
                if (user == null)
                {
                    ExceptionManager.Raise(this.GetType(), "$Error_User_Not_Exist");
                }
                //新用户必须更改密码,用户限制,锁定账户
                string  userstat = "select userstat from tbluser where usercode ='" + txtUserCode.Text.Trim().ToUpper() + "'";
                DataSet ds       = ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider) this.DataProvider).PersistBroker.Query(userstat);
                if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[0].Rows[0][0].ToString() == "C")                   //用户限制
                    {
                        ExceptionManager.Raise(this.GetType(), "$Error_User_Confined");
                        return;
                    }
                    else if (ds.Tables[0].Rows[0][0].ToString() == "L")                    //锁定账户
                    {
                        ExceptionManager.Raise(this.GetType(), "$Error_User_Locked");
                        return;
                    }
                    else if (ds.Tables[0].Rows[0][0].ToString() == "N")                    //新用户必须更改密码
                    {
                        ExceptionManager.Raise(this.GetType(), "$Error_User_New");
                        return;
                    }
                }

                sessionHelper.IsBelongToAdminGroup = this._facade.IsBelongToAdminGroup(this.txtUserCode.Text.ToUpper());
                sessionHelper.UserName             = user.UserName;
                sessionHelper.UserCode             = user.UserCode;
                sessionHelper.UserMail             = user.UserEmail;
                sessionHelper.Language             = this.drpLanguage.Value;

//				//sammer kong 20050408 statisical for account of loggin user
//				if( sessionHelper.UserCode != null )
//				{
//					WebStatisical.Instance()["user"].Add( (sessionHelper.UserCode ) );
//				}

                this.Response.Redirect(this.MakeRedirectUrl("./FStartPage.aspx"), false);
            }
            catch (Exception ex)
            {
                this.lblMessage.Text = MessageCenter.ParserMessage(ex.Message, this.languageComponent1);
            }
        }