CinderellaMGS.SQL_Queries.getShiftStartEnd C# (CSharp) 메소드

getShiftStartEnd() 공개 메소드

Method is used to determine if a shift can be started or ended. If a shift is started it can be ended but not started again. EXAMPLE USAGE: if (sqlQuery.getShiftStartEnd(true)) \\shiftend { randomizeStartToolStripMenuItem1.Enabled = true; } else { randomizeStartToolStripMenuItem1.Enabled = false; } if (sqlQuery.getShiftStartEnd(false))//aka shiftEnd { endShiftToolStripMenuItem.Enabled = true; } else { endShiftToolStripMenuItem.Enabled = false; } if (sqlQuery.getShiftStartEnd(true) && sqlQuery.getShiftStartEnd(false)) { //This is an initial launch of the program and both fields are blank randomizeStartToolStripMenuItem1.Enabled = true; endShiftToolStripMenuItem.Enabled = false; }
public getShiftStartEnd ( bool shiftStart ) : bool
shiftStart bool True-shift start : False-shift end
리턴 bool
        public bool getShiftStartEnd(bool shiftStart)
        {
            string sql = "";
            if (shiftStart)
            {
                sql = "Select [PropertyValue] From [ConfigSettings] WHERE [appProperty]='shiftStart'";
            }
            else
            {
                sql = "Select [PropertyValue] From [ConfigSettings] WHERE [appProperty]='shiftEnd'";
            }

            DataSet ds = database.getDataSet(sql, "tableName");
            string propertyValue = ds.Tables["tableName"].Rows[0]["propertyValue"].ToString();

            if (propertyValue == "" || propertyValue == null)
            {//If true then option can be selected
                return true;
            }
            else//The option cannot be selected
            {
                return false;
            }
        }