private void AddNextProcess()
 {
     nextProcess.ProcessName  = "registars";
     nextProcess.ChangeLogId  = log.LogId;
     nextProcess.ActionTaken  = "pending";
     nextProcess.ProcessGroup = "registars";
     nextProcess.AddRecord();
 }
Ejemplo n.º 2
0
    private void AddProcess(string processname, string processGroup)
    {
        ClsChangeLogProcessing nextProcess = new ClsChangeLogProcessing("MasterSchedule");

        nextProcess.ProcessName  = processname;
        nextProcess.ChangeLogId  = log.LogId;
        nextProcess.ActionTaken  = "pending";
        nextProcess.ProcessGroup = processGroup;
        nextProcess.AddRecord();
    }
Ejemplo n.º 3
0
    public void AddRecord()
    {
        if (_sectionsId > 0)
        {
            ClsSections s = new ClsSections("MasterSchedule");
            s.SectionsId = _sectionsId;
            s.GetRecord();
            ClsCourses c = new ClsCourses("MasterSchedule");
            c.CoursesId = s.CoursesId;
            c.GetRecord();
            _departmentsId = c.DepartmentsId;
        }
        _processGroup = "divisionchairs";

        bool       divchair = Helpers.UserIsDivisionChair();
        SqlCommand cmd      = new SqlCommand();

        cmd.Connection  = _conn;
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.CommandText = "ChangeLog_Add";
        cmd.Parameters.Add("@SubmittedBy", SqlDbType.VarChar, 64).Value  = _submittedBy;
        cmd.Parameters.Add("@SectionsID", SqlDbType.Int, 4).Value        = _sectionsId;
        cmd.Parameters.Add("@Change", SqlDbType.VarChar, -1).Value       = _change;
        cmd.Parameters.Add("@DepartmentsID", SqlDbType.Int, 4).Value     = _departmentsId;
        cmd.Parameters.Add("@ProcessGroup", SqlDbType.VarChar, 24).Value = _processGroup;
        cmd.Parameters.Add("@LogID", SqlDbType.Int, 4).Direction         = ParameterDirection.Output;

        try
        {
            _conn.Open();
            cmd.ExecuteScalar();
            _logId = (int)cmd.Parameters["@LogID"].Value;
            System.Diagnostics.Debug.WriteLine("the change log has been comitted to the database");

            this._dateSubmitted = DateTime.Now;
        }
        catch (SqlException ex)
        {
            _lastError = ex.Message;
        }
        finally
        {
            if (_conn.State.Equals(ConnectionState.Open))
            {
                _conn.Close();
            }
        }
        cmd.Dispose();
        bool usePreview = false;

        if (HttpContext.Current.Session["usepreview"] != null)
        {
            usePreview = (bool)HttpContext.Current.Session["usepreview"];
        }
        //reset the use preview session option.
        HttpContext.Current.Session["usepreview"] = false;
        if (!divchair || usePreview)
        {
            //Don't need to send email to the division chair.
            if (!divchair)
            {
                /* Commented out for testing..  Cyrus */
                Helpers.SendEmail("Master Schedule Form Submitted", GetDescriptiveEmail() + this._change,
                                  Helpers.GetDivisionEmail(this._sectionsId));
            }
        }
        else
        {
            AutoApprove();
            ClsChangeLogProcessing nextProcess = new ClsChangeLogProcessing("MasterSchedule");
            nextProcess.ProcessName  = "registars";
            nextProcess.ChangeLogId  = _logId;
            nextProcess.ActionTaken  = "pending";
            nextProcess.ProcessGroup = "registars";
            nextProcess.AddRecord();
            Helpers.SendEmail("Schedule change submitted", GetDescriptiveEmail() + this._change, "[email protected];[email protected]");
        }
    }