public AddControlPropertyLabel(string screen, string user, string controlName = "")
{
InitializeComponent();
currentScreen = screen;
currentUser = user;
LoadObjects();
LoadColors();
txtFont.Text = "Arial";
txtSize.Text = "12";
//Check if controlName was passed in, if so, goto edit mode
if (controlName != "")
{
//Let's validate the controlName and then call a Pre-Load of its properties
DataSet dsScreenControl = OSAESql.RunSQL("SELECT COUNT(object_name) FROM osae_v_object where object_name = '" + controlName + "'");
if (dsScreenControl.Tables[0].Rows[0][0].ToString() == "1")
{
// We have a hit, this is an Update call, se call the preload
sMode = "Update";
sOriginalName = controlName;
txtControlName.Text = controlName;
LoadCurrentScreenObject(controlName);
}
}
if (controlName == "")
{
//Let's create a new name
sWorkingName = currentScreen + " - New Property Label";
DataSet dsScreenControl = OSAESql.RunSQL("SELECT COUNT(object_name) FROM osae_v_object where object_name = '" + sWorkingName + "'");
int iCount = 0;
while (dsScreenControl.Tables[0].Rows[0][0].ToString() == "1")
{
// We have a duplicate name, we must get a unique name
iCount += 1;
sWorkingName = currentScreen + " - New Property Label" + iCount;
dsScreenControl = OSAESql.RunSQL("SELECT COUNT(object_name) FROM osae_v_object where object_name = '" + sWorkingName + "'");
}
sMode = "Add";
controlName = sWorkingName;
txtControlName.Text = controlName;
// LoadCurrentScreenObject(controlName);
}
Enable_Buttons();
}