Ejemplo n.º 1
0
    public void UpdateRules()
    {
        RulesData _rules = new RulesData();

        ProcessSpeedingNotQueries update = new ProcessSpeedingNotQueries(AlarmasABC.BLL.InvokeOperations.operations.UPDATE);

        try
        {
            bool _status = false;
        bool isSMS = _ckOnSMS.Checked;

            _status = _chkOn.Checked;

            _rules.RulesValue = _txtSpeedValue.Text.ToString();
            _rules.Email = _txtNotificationEmails.Text.ToString();
            _rules.Message = _txtMessage.Text.ToString();
            _rules.SpeedingPhoneNum = _txtPhoneNumber.Text.Trim();
            if (_txtPhoneNumber.Text == "")
            {
        isSMS = false;
            }
            _rules.IsSMS = isSMS;
            _rules.UnitID = int.Parse( Request.QueryString["unitID"].ToString());
            _rules.RulesID = int.Parse(ViewState["rulesID"].ToString());
            _rules.IsActive = _status;

            update.RulesInfo = _rules;
            update.invoke();

            _lblMessage.ForeColor = System.Drawing.Color.Green;
            _lblMessage.Text = "Rules Update Successfully.";

        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message.ToString());
            _lblMessage.ForeColor = System.Drawing.Color.Red;
            _lblMessage.Text = "Rules Update fail.";
        }
        finally
        {
            _rules = null;
        }
    }
Ejemplo n.º 2
0
    public void AssignRules()
    {
        RulesData _rules = new RulesData();

        ProcessSpeedingNotQueries insert = new ProcessSpeedingNotQueries(AlarmasABC.BLL.InvokeOperations.operations.INSERT);

        try
        {
            _rules.RulesName = "";
            _rules.RulesValue = _txtSpeedValue.Text.ToString();
            _rules.Email = _txtNotificationEmails.Text.ToString();

            bool isSMS = _ckOnSMS.Checked;
            if (_txtPhoneNumber.Text == "")
            {
        isSMS = false;
            }
            _rules.SpeedingPhoneNum = _txtPhoneNumber.Text.Trim();
            _rules.IsSMS = isSMS;
            _rules.Message = _txtMessage.Text.ToString();
            string _comID = Session["trkCompany"].ToString();
            _rules.ComID = int.Parse(_comID);
            _rules.UnitID =int.Parse( Request.QueryString["unitID"].ToString());

            insert.RulesInfo = _rules;
            insert.invoke();

            _lblMessage.ForeColor = System.Drawing.Color.Green;
           _lblMessage.Text = "Rules Assign Successfully.";

        }
        catch (Exception ex)
        {
            Console.WriteLine(ex.Message.ToString());
           _lblMessage.ForeColor = System.Drawing.Color.Red;
           _lblMessage.Text = "Rules Assign fail.";
        }
        finally
        {
            _rules = null;
        }
    }