示例#1
0
        ///<summary>Inserts one AutoNoteControl into the database.  Provides option to use the existing priKey.</summary>
        internal static long Insert(AutoNoteControl autoNoteControl, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                autoNoteControl.AutoNoteControlNum = ReplicationServers.GetKey("autonotecontrol", "AutoNoteControlNum");
            }
            string command = "INSERT INTO autonotecontrol (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "AutoNoteControlNum,";
            }
            command += "Descript,ControlType,ControlLabel,ControlOptions) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(autoNoteControl.AutoNoteControlNum) + ",";
            }
            command +=
                "'" + POut.String(autoNoteControl.Descript) + "',"
                + "'" + POut.String(autoNoteControl.ControlType) + "',"
                + "'" + POut.String(autoNoteControl.ControlLabel) + "',"
                + "'" + POut.String(autoNoteControl.ControlOptions) + "')";
            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                autoNoteControl.AutoNoteControlNum = Db.NonQ(command, true);
            }
            return(autoNoteControl.AutoNoteControlNum);
        }
示例#2
0
		///<summary>Inserts one AutoNoteControl into the database.  Provides option to use the existing priKey.</summary>
		public static long Insert(AutoNoteControl autoNoteControl,bool useExistingPK){
			if(!useExistingPK && PrefC.RandomKeys) {
				autoNoteControl.AutoNoteControlNum=ReplicationServers.GetKey("autonotecontrol","AutoNoteControlNum");
			}
			string command="INSERT INTO autonotecontrol (";
			if(useExistingPK || PrefC.RandomKeys) {
				command+="AutoNoteControlNum,";
			}
			command+="Descript,ControlType,ControlLabel,ControlOptions) VALUES(";
			if(useExistingPK || PrefC.RandomKeys) {
				command+=POut.Long(autoNoteControl.AutoNoteControlNum)+",";
			}
			command+=
				 "'"+POut.String(autoNoteControl.Descript)+"',"
				+"'"+POut.String(autoNoteControl.ControlType)+"',"
				+"'"+POut.String(autoNoteControl.ControlLabel)+"',"
				+"'"+POut.String(autoNoteControl.ControlOptions)+"')";
			if(useExistingPK || PrefC.RandomKeys) {
				Db.NonQ(command);
			}
			else {
				autoNoteControl.AutoNoteControlNum=Db.NonQ(command,true);
			}
			return autoNoteControl.AutoNoteControlNum;
		}
示例#3
0
        private void listBoxControls_SelectedIndexChanged(object sender, EventArgs e)
        {
            //Loads all the control info into the control viewer
            if (listBoxControls.SelectedItem.ToString() == "")
            {
                return;
            }
            string controlOptions;

            //AutoNoteControls.RefreshControlEdit(listBoxControls.SelectedIndex.ToString());
            AutoNoteControls.Refresh();
            ControlCur = AutoNoteControls.Listt[listBoxControls.SelectedIndex];
            textBoxTypeControl.Text        = ControlCur.ControlType;
            textBoxDescriptControl.Text    = ControlCur.Descript;
            textBoxLabelControl.Text       = ControlCur.ControlLabel;
            textBoxTextControl.Text        = ControlCur.MultiLineText;
            textBoxTextPrefaceControl.Text = ControlCur.PrefaceText;
            listBoxOptionsControl.Items.Clear();
            controlOptions = ControlCur.ControlOptions;
            string[] lines = controlOptions.Split(new char[] { ',' });
            for (int i = 0; i < lines.Length; i++)
            {
                listBoxOptionsControl.Items.Add(lines[i].ToString());
            }
            ControlContentViewerVisible(true);
        }
示例#4
0
        private void butOK_Click(object sender, EventArgs e)
        {
            string AutoNoteOutput = "";
            int    currentControl = 0;

            for (int x = 0; x < this.Controls.Count; x++)
            {
                if (this.Controls[x].Name.ToString() != "listBoxAutoNotes" &&
                    this.Controls[x].Name.ToString() != "butOK" &&
                    this.Controls[x].Name.ToString() != "listBoxControls")
                {
                    string Text        = "";
                    string prefaceText = "";
                    if (currentControl < listBoxControls.Items.Count)
                    {
                        if (this.Controls[x].Text != "")
                        {
                            AutoNoteControls.RefreshControl(listBoxControls.Items[currentControl].ToString());
                            ControlCur     = AutoNoteControls.Listt[0];
                            prefaceText    = ControlCur.PrefaceText;
                            Text           = this.Controls[x].Text;
                            AutoNoteOutput = AutoNoteOutput + " " + prefaceText + " " + Text;
                        }
                        currentControl++;
                    }
                }
            }
            AutoNoteCur.AutoNoteOutput = AutoNoteOutput;
            this.DialogResult          = DialogResult.OK;
        }
示例#5
0
 ///<summary>Inserts one AutoNoteControl into the database.  Returns the new priKey.</summary>
 internal static long Insert(AutoNoteControl autoNoteControl)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         autoNoteControl.AutoNoteControlNum = DbHelper.GetNextOracleKey("autonotecontrol", "AutoNoteControlNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(autoNoteControl, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     autoNoteControl.AutoNoteControlNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(autoNoteControl, false));
     }
 }
示例#6
0
 ///<summary>Inserts one AutoNoteControl into the database.  Returns the new priKey.</summary>
 internal static long Insert(AutoNoteControl autoNoteControl)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         autoNoteControl.AutoNoteControlNum=DbHelper.GetNextOracleKey("autonotecontrol","AutoNoteControlNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(autoNoteControl,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     autoNoteControl.AutoNoteControlNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(autoNoteControl,false);
     }
 }
示例#7
0
        ///<summary>Updates one AutoNoteControl in the database.</summary>
        internal static void Update(AutoNoteControl autoNoteControl)
        {
            string command = "UPDATE autonotecontrol SET "
                             + "Descript          = '" + POut.String(autoNoteControl.Descript) + "', "
                             + "ControlType       = '" + POut.String(autoNoteControl.ControlType) + "', "
                             + "ControlLabel      = '" + POut.String(autoNoteControl.ControlLabel) + "', "
                             + "ControlOptions    = '" + POut.String(autoNoteControl.ControlOptions) + "' "
                             + "WHERE AutoNoteControlNum = " + POut.Long(autoNoteControl.AutoNoteControlNum);

            Db.NonQ(command);
        }
示例#8
0
        public static void ControlUpdate(AutoNoteControl autonotecontrol)
        {
            string command = "UPDATE autonotecontrol "
                             + "SET ControlType = '" + POut.PString(autonotecontrol.ControlType) + "', "
                             + "Descript = '" + POut.PString(autonotecontrol.Descript) + "', "
                             + "ControlLabel = '" + POut.PString(autonotecontrol.ControlLabel) + "', "
                             + "PrefaceText = '" + POut.PString(autonotecontrol.PrefaceText) + "', "
                             + "MultiLineText = '" + POut.PString(autonotecontrol.MultiLineText) + "', "
                             + "ControlOptions = '" + POut.PString(autonotecontrol.ControlOptions) + "' "
                             + "WHERE AutoNoteControlNum = '" + POut.PInt(autonotecontrol.AutoNoteControlNum) + "'";

            General.NonQ(command);
        }
        ///<summary>Updates one AutoNoteControl in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
        public static bool Update(AutoNoteControl autoNoteControl, AutoNoteControl oldAutoNoteControl)
        {
            string command = "";

            if (autoNoteControl.Descript != oldAutoNoteControl.Descript)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Descript = '" + POut.String(autoNoteControl.Descript) + "'";
            }
            if (autoNoteControl.ControlType != oldAutoNoteControl.ControlType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ControlType = '" + POut.String(autoNoteControl.ControlType) + "'";
            }
            if (autoNoteControl.ControlLabel != oldAutoNoteControl.ControlLabel)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ControlLabel = '" + POut.String(autoNoteControl.ControlLabel) + "'";
            }
            if (autoNoteControl.ControlOptions != oldAutoNoteControl.ControlOptions)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ControlOptions = " + DbHelper.ParamChar + "paramControlOptions";
            }
            if (command == "")
            {
                return(false);
            }
            if (autoNoteControl.ControlOptions == null)
            {
                autoNoteControl.ControlOptions = "";
            }
            OdSqlParameter paramControlOptions = new OdSqlParameter("paramControlOptions", OdDbType.Text, POut.StringParam(autoNoteControl.ControlOptions));

            command = "UPDATE autonotecontrol SET " + command
                      + " WHERE AutoNoteControlNum = " + POut.Long(autoNoteControl.AutoNoteControlNum);
            Db.NonQ(command, paramControlOptions);
            return(true);
        }
示例#10
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<AutoNoteControl> TableToList(DataTable table){
			List<AutoNoteControl> retVal=new List<AutoNoteControl>();
			AutoNoteControl autoNoteControl;
			for(int i=0;i<table.Rows.Count;i++) {
				autoNoteControl=new AutoNoteControl();
				autoNoteControl.AutoNoteControlNum= PIn.Long  (table.Rows[i]["AutoNoteControlNum"].ToString());
				autoNoteControl.Descript          = PIn.String(table.Rows[i]["Descript"].ToString());
				autoNoteControl.ControlType       = PIn.String(table.Rows[i]["ControlType"].ToString());
				autoNoteControl.ControlLabel      = PIn.String(table.Rows[i]["ControlLabel"].ToString());
				autoNoteControl.ControlOptions    = PIn.String(table.Rows[i]["ControlOptions"].ToString());
				retVal.Add(autoNoteControl);
			}
			return retVal;
		}
示例#11
0
        public static void Insert(AutoNoteControl autonotecontrol)
        {
            string command = "INSERT INTO autonotecontrol (AutoNoteControlNum,Descript,ControlType,ControlLabel,PrefaceText,MultiLineText,ControlOptions)"
                             + "VALUES ("
                             + "'DEFAULT', "
                             + "'" + POut.PString(autonotecontrol.Descript) + "', "
                             + "'" + POut.PString(autonotecontrol.ControlType) + "', "
                             + "'" + POut.PString(autonotecontrol.ControlLabel) + "' ,"
                             + "'" + POut.PString(autonotecontrol.PrefaceText) + "', "
                             + "'" + POut.PString(autonotecontrol.MultiLineText) + "', "
                             + "'" + POut.PString(autonotecontrol.ControlOptions) + "')";

            General.NonQ(command);
        }
示例#12
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            FormAutoNoteControlEdit FormA   = new FormAutoNoteControlEdit();
            AutoNoteControl         control = new AutoNoteControl();

            control.ControlType = "Text";
            FormA.ControlCur    = control;
            FormA.IsNew         = true;
            FormA.ShowDialog();
            if (FormA.DialogResult != DialogResult.OK)
            {
                return;
            }
            FillGrid();
        }
示例#13
0
 ///<summary>Inserts one AutoNoteControl into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(AutoNoteControl autoNoteControl)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(autoNoteControl, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             autoNoteControl.AutoNoteControlNum = DbHelper.GetNextOracleKey("autonotecontrol", "AutoNoteControlNum");                  //Cacheless method
         }
         return(InsertNoCache(autoNoteControl, true));
     }
 }
        ///<summary>Updates one AutoNoteControl in the database.</summary>
        public static void Update(AutoNoteControl autoNoteControl)
        {
            string command = "UPDATE autonotecontrol SET "
                             + "Descript          = '" + POut.String(autoNoteControl.Descript) + "', "
                             + "ControlType       = '" + POut.String(autoNoteControl.ControlType) + "', "
                             + "ControlLabel      = '" + POut.String(autoNoteControl.ControlLabel) + "', "
                             + "ControlOptions    =  " + DbHelper.ParamChar + "paramControlOptions "
                             + "WHERE AutoNoteControlNum = " + POut.Long(autoNoteControl.AutoNoteControlNum);

            if (autoNoteControl.ControlOptions == null)
            {
                autoNoteControl.ControlOptions = "";
            }
            OdSqlParameter paramControlOptions = new OdSqlParameter("paramControlOptions", OdDbType.Text, POut.StringParam(autoNoteControl.ControlOptions));

            Db.NonQ(command, paramControlOptions);
        }
示例#15
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        internal static List <AutoNoteControl> TableToList(DataTable table)
        {
            List <AutoNoteControl> retVal = new List <AutoNoteControl>();
            AutoNoteControl        autoNoteControl;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                autoNoteControl = new AutoNoteControl();
                autoNoteControl.AutoNoteControlNum = PIn.Long(table.Rows[i]["AutoNoteControlNum"].ToString());
                autoNoteControl.Descript           = PIn.String(table.Rows[i]["Descript"].ToString());
                autoNoteControl.ControlType        = PIn.String(table.Rows[i]["ControlType"].ToString());
                autoNoteControl.ControlLabel       = PIn.String(table.Rows[i]["ControlLabel"].ToString());
                autoNoteControl.ControlOptions     = PIn.String(table.Rows[i]["ControlOptions"].ToString());
                retVal.Add(autoNoteControl);
            }
            return(retVal);
        }
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <AutoNoteControl> TableToList(DataTable table)
        {
            List <AutoNoteControl> retVal = new List <AutoNoteControl>();
            AutoNoteControl        autoNoteControl;

            foreach (DataRow row in table.Rows)
            {
                autoNoteControl = new AutoNoteControl();
                autoNoteControl.AutoNoteControlNum = PIn.Long(row["AutoNoteControlNum"].ToString());
                autoNoteControl.Descript           = PIn.String(row["Descript"].ToString());
                autoNoteControl.ControlType        = PIn.String(row["ControlType"].ToString());
                autoNoteControl.ControlLabel       = PIn.String(row["ControlLabel"].ToString());
                autoNoteControl.ControlOptions     = PIn.String(row["ControlOptions"].ToString());
                retVal.Add(autoNoteControl);
            }
            return(retVal);
        }
示例#17
0
        /// <summary>
        /// Converts the Num of the control to it^s Name.
        /// </summary>
        /// <returns></returns>
        public static List <AutoNoteControl> ControlNumToName(string controlNum)
        {
            string command = "SELECT Descript FROM autonotecontrol "
                             + "WHERE AutoNoteControlNum = " + "'" + controlNum + "'";
            DataTable table = General.GetTable(command);

            Listt = new List <AutoNoteControl>();
            AutoNoteControl note;

            note = new AutoNoteControl();
            for (int i = 0; i < table.Rows.Count; i++)
            {
                note.Descript = PIn.PString(table.Rows[0]["Descript"].ToString());
                Listt.Add(note);
            }
            return(Listt);
        }
示例#18
0
        ///<summary>Updates one AutoNoteControl in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
        internal static void Update(AutoNoteControl autoNoteControl, AutoNoteControl oldAutoNoteControl)
        {
            string command = "";

            if (autoNoteControl.Descript != oldAutoNoteControl.Descript)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Descript = '" + POut.String(autoNoteControl.Descript) + "'";
            }
            if (autoNoteControl.ControlType != oldAutoNoteControl.ControlType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ControlType = '" + POut.String(autoNoteControl.ControlType) + "'";
            }
            if (autoNoteControl.ControlLabel != oldAutoNoteControl.ControlLabel)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ControlLabel = '" + POut.String(autoNoteControl.ControlLabel) + "'";
            }
            if (autoNoteControl.ControlOptions != oldAutoNoteControl.ControlOptions)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ControlOptions = '" + POut.String(autoNoteControl.ControlOptions) + "'";
            }
            if (command == "")
            {
                return;
            }
            command = "UPDATE autonotecontrol SET " + command
                      + " WHERE AutoNoteControlNum = " + POut.Long(autoNoteControl.AutoNoteControlNum);
            Db.NonQ(command);
        }
 ///<summary>Returns true if Update(AutoNoteControl,AutoNoteControl) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(AutoNoteControl autoNoteControl, AutoNoteControl oldAutoNoteControl)
 {
     if (autoNoteControl.Descript != oldAutoNoteControl.Descript)
     {
         return(true);
     }
     if (autoNoteControl.ControlType != oldAutoNoteControl.ControlType)
     {
         return(true);
     }
     if (autoNoteControl.ControlLabel != oldAutoNoteControl.ControlLabel)
     {
         return(true);
     }
     if (autoNoteControl.ControlOptions != oldAutoNoteControl.ControlOptions)
     {
         return(true);
     }
     return(false);
 }
示例#20
0
        /// <summary>A list with all the control settings</summary>
        public static void Refresh()
        {
            string    command = "SELECT * FROM autonotecontrol ORDER BY AutoNoteControlNum";
            DataTable table   = General.GetTable(command);

            Listt = new List <AutoNoteControl>();
            //List = new AutoNote[table.Rows.Count];
            AutoNoteControl noteCont;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                noteCont = new AutoNoteControl();
                noteCont.AutoNoteControlNum = PIn.PInt(table.Rows[i][0].ToString());
                noteCont.Descript           = PIn.PString(table.Rows[i]["Descript"].ToString());
                noteCont.ControlType        = PIn.PString(table.Rows[i]["ControlType"].ToString());
                noteCont.ControlLabel       = PIn.PString(table.Rows[i]["ControlLabel"].ToString());
                noteCont.PrefaceText        = PIn.PString(table.Rows[i]["PrefaceText"].ToString());
                noteCont.MultiLineText      = PIn.PString(table.Rows[i]["MultiLineText"].ToString());
                noteCont.ControlOptions     = PIn.PString(table.Rows[i]["ControlOptions"].ToString());
                Listt.Add(noteCont);
            }
        }
        ///<summary>Inserts one AutoNoteControl into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(AutoNoteControl autoNoteControl, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO autonotecontrol (";

            if (!useExistingPK && isRandomKeys)
            {
                autoNoteControl.AutoNoteControlNum = ReplicationServers.GetKeyNoCache("autonotecontrol", "AutoNoteControlNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "AutoNoteControlNum,";
            }
            command += "Descript,ControlType,ControlLabel,ControlOptions) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(autoNoteControl.AutoNoteControlNum) + ",";
            }
            command +=
                "'" + POut.String(autoNoteControl.Descript) + "',"
                + "'" + POut.String(autoNoteControl.ControlType) + "',"
                + "'" + POut.String(autoNoteControl.ControlLabel) + "',"
                + DbHelper.ParamChar + "paramControlOptions)";
            if (autoNoteControl.ControlOptions == null)
            {
                autoNoteControl.ControlOptions = "";
            }
            OdSqlParameter paramControlOptions = new OdSqlParameter("paramControlOptions", OdDbType.Text, POut.StringParam(autoNoteControl.ControlOptions));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramControlOptions);
            }
            else
            {
                autoNoteControl.AutoNoteControlNum = Db.NonQ(command, true, "AutoNoteControlNum", "autoNoteControl", paramControlOptions);
            }
            return(autoNoteControl.AutoNoteControlNum);
        }
 ///<summary>Inserts one AutoNoteControl into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(AutoNoteControl autoNoteControl)
 {
     return(InsertNoCache(autoNoteControl, false));
 }
 ///<summary>Inserts many AutoNoteControls into the database.  Provides option to use the existing priKey.</summary>
 public static void InsertMany(List <AutoNoteControl> listAutoNoteControls, bool useExistingPK)
 {
     if (!useExistingPK && PrefC.RandomKeys)
     {
         foreach (AutoNoteControl autoNoteControl in listAutoNoteControls)
         {
             Insert(autoNoteControl);
         }
     }
     else
     {
         StringBuilder sbCommands = null;
         int           index      = 0;
         int           countRows  = 0;
         while (index < listAutoNoteControls.Count)
         {
             AutoNoteControl autoNoteControl = listAutoNoteControls[index];
             StringBuilder   sbRow           = new StringBuilder("(");
             bool            hasComma        = false;
             if (sbCommands == null)
             {
                 sbCommands = new StringBuilder();
                 sbCommands.Append("INSERT INTO autonotecontrol (");
                 if (useExistingPK)
                 {
                     sbCommands.Append("AutoNoteControlNum,");
                 }
                 sbCommands.Append("Descript,ControlType,ControlLabel,ControlOptions) VALUES ");
                 countRows = 0;
             }
             else
             {
                 hasComma = true;
             }
             if (useExistingPK)
             {
                 sbRow.Append(POut.Long(autoNoteControl.AutoNoteControlNum)); sbRow.Append(",");
             }
             sbRow.Append("'" + POut.String(autoNoteControl.Descript) + "'"); sbRow.Append(",");
             sbRow.Append("'" + POut.String(autoNoteControl.ControlType) + "'"); sbRow.Append(",");
             sbRow.Append("'" + POut.String(autoNoteControl.ControlLabel) + "'"); sbRow.Append(",");
             sbRow.Append("'" + POut.String(autoNoteControl.ControlOptions) + "'"); sbRow.Append(")");
             if (sbCommands.Length + sbRow.Length + 1 > TableBase.MaxAllowedPacketCount && countRows > 0)
             {
                 Db.NonQ(sbCommands.ToString());
                 sbCommands = null;
             }
             else
             {
                 if (hasComma)
                 {
                     sbCommands.Append(",");
                 }
                 sbCommands.Append(sbRow.ToString());
                 countRows++;
                 if (index == listAutoNoteControls.Count - 1)
                 {
                     Db.NonQ(sbCommands.ToString());
                 }
                 index++;
             }
         }
     }
 }
示例#24
0
		///<summary>Updates one AutoNoteControl in the database.</summary>
		public static void Update(AutoNoteControl autoNoteControl){
			string command="UPDATE autonotecontrol SET "
				+"Descript          = '"+POut.String(autoNoteControl.Descript)+"', "
				+"ControlType       = '"+POut.String(autoNoteControl.ControlType)+"', "
				+"ControlLabel      = '"+POut.String(autoNoteControl.ControlLabel)+"', "
				+"ControlOptions    = '"+POut.String(autoNoteControl.ControlOptions)+"' "
				+"WHERE AutoNoteControlNum = "+POut.Long(autoNoteControl.AutoNoteControlNum);
			Db.NonQ(command);
		}
示例#25
0
		///<summary>Updates one AutoNoteControl in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
		public static bool Update(AutoNoteControl autoNoteControl,AutoNoteControl oldAutoNoteControl){
			string command="";
			if(autoNoteControl.Descript != oldAutoNoteControl.Descript) {
				if(command!=""){ command+=",";}
				command+="Descript = '"+POut.String(autoNoteControl.Descript)+"'";
			}
			if(autoNoteControl.ControlType != oldAutoNoteControl.ControlType) {
				if(command!=""){ command+=",";}
				command+="ControlType = '"+POut.String(autoNoteControl.ControlType)+"'";
			}
			if(autoNoteControl.ControlLabel != oldAutoNoteControl.ControlLabel) {
				if(command!=""){ command+=",";}
				command+="ControlLabel = '"+POut.String(autoNoteControl.ControlLabel)+"'";
			}
			if(autoNoteControl.ControlOptions != oldAutoNoteControl.ControlOptions) {
				if(command!=""){ command+=",";}
				command+="ControlOptions = '"+POut.String(autoNoteControl.ControlOptions)+"'";
			}
			if(command==""){
				return false;
			}
			command="UPDATE autonotecontrol SET "+command
				+" WHERE AutoNoteControlNum = "+POut.Long(autoNoteControl.AutoNoteControlNum);
			Db.NonQ(command);
			return true;
		}
示例#26
0
        private void DrawControls()
        {
            int TextBoxCount  = 0;
            int ComboBoxCount = 0;

            for (int i = 0; i < listBoxControls.Items.Count; i++)
            {
                AutoNoteControls.RefreshControl(listBoxControls.Items[i].ToString());
                ControlCur = AutoNoteControls.Listt[0];
                switch (ControlCur.ControlType)
                {
                case "TextBox":
                    TextBoxCount++;
                    break;

                case "MultiLineTextBox":
                    TextBoxCount++;
                    break;

                case "ComboBox":
                    ComboBoxCount++;
                    break;
                }
            }
            System.Windows.Forms.ComboBox[] comboBox = new ComboBox[ComboBoxCount];
            System.Windows.Forms.TextBox[]  textBox  = new TextBox[TextBoxCount];
            System.Windows.Forms.Label[]    label    = new Label[listBoxControls.Items.Count];
            for (int l = 0; l < listBoxControls.Items.Count; l++)
            {
                AutoNoteControls.RefreshControl(listBoxControls.Items[l].ToString());
                ControlCur        = AutoNoteControls.Listt[0];
                label[l]          = new Label();
                label[l].AutoSize = true;
                label[l].Text     = ControlCur.ControlLabel;
            }
            int CurText  = 0;
            int CurCombo = 0;
            int spacing  = 140;

            for (int l = 0; l < listBoxControls.Items.Count; l++)
            {
                AutoNoteControls.RefreshControl(listBoxControls.Items[l].ToString());
                ControlCur = AutoNoteControls.Listt[0];
                switch (ControlCur.ControlType)
                {
                case "TextBox":
                    textBox[CurText]          = new TextBox();
                    textBox[CurText].TabIndex = this.Controls.Count;
                    textBox[CurText].Location = new Point(label[l].Text.Length * 6 + 15, spacing);
                    this.Controls.Add(textBox[CurText]);
                    label[l].Location = new Point(10, spacing);
                    spacing           = spacing + 30;
                    CurText++;
                    break;

                case "MultiLineTextBox":
                    textBox[CurText]           = new TextBox();
                    textBox[CurText].Multiline = true;
                    textBox[CurText].Size      = new Size(177, 67);
                    textBox[CurText].Location  = new Point(label[l].Text.Length * 6 + 15, spacing);
                    textBox[CurText].Text      = ControlCur.MultiLineText;
                    this.Controls.Add(textBox[CurText]);
                    label[l].Location = new Point(10, spacing);
                    spacing           = spacing + 77;
                    CurText++;
                    break;

                case "ComboBox":
                    comboBox[CurCombo] = new ComboBox();
                    string[] lines = ControlCur.ControlOptions.Split(new char[] { ',' });
                    for (int i = 0; i < lines.Length; i++)
                    {
                        comboBox[CurCombo].Items.Add(lines[i]);
                    }
                    comboBox[CurCombo].AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
                    comboBox[CurCombo].AutoCompleteSource = AutoCompleteSource.ListItems;
                    this.Controls.Add(comboBox[CurCombo]);
                    label[l].Location           = new Point(10, spacing);
                    comboBox[CurCombo].Location = new Point(label[l].Text.Length * 6 + 15, spacing);
                    spacing = spacing + 30;
                    CurCombo++;
                    break;
                }
                for (int xl = 0; xl < listBoxControls.Items.Count; xl++)
                {
                    this.Controls.Add(label[xl]);
                }
            }
            butOK.Visible  = true;
            butOK.Location = new Point(330, spacing);
        }