예제 #1
0
        ///<summary>Inserts one WebForms_SheetDef into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(WebForms_SheetDef webForms_SheetDef, bool useExistingPK)
        {
            string command = "INSERT INTO webforms_sheetdef (";

            if (useExistingPK)
            {
                command += "WebSheetDefID,";
            }
            command += "DentalOfficeID,Description,SheetType,FontSize,FontName,Width,Height,IsLandscape,SheetDefNum,HasMobileLayout,ClinicNum) VALUES(";
            if (useExistingPK)
            {
                command += POut.Long(webForms_SheetDef.WebSheetDefID) + ",";
            }
            command +=
                POut.Long(webForms_SheetDef.DentalOfficeID) + ","
                + "'" + POut.String(webForms_SheetDef.Description) + "',"
                + POut.Int((int)webForms_SheetDef.SheetType) + ","
                + POut.Float(webForms_SheetDef.FontSize) + ","
                + "'" + POut.String(webForms_SheetDef.FontName) + "',"
                + POut.Int(webForms_SheetDef.Width) + ","
                + POut.Int(webForms_SheetDef.Height) + ","
                + POut.Bool(webForms_SheetDef.IsLandscape) + ","
                + POut.Long(webForms_SheetDef.SheetDefNum) + ","
                + POut.Bool(webForms_SheetDef.HasMobileLayout) + ","
                + POut.Long(webForms_SheetDef.ClinicNum) + ")";
            if (useExistingPK)
            {
                DataCore.NonQ(command);
            }
            else
            {
                webForms_SheetDef.WebSheetDefID = DataCore.NonQ(command, true);
            }
            return(webForms_SheetDef.WebSheetDefID);
        }
예제 #2
0
        private void butCopyToClipboard_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length < 1)
            {
                return;
            }
            WebForms_SheetDef webSheetDef = gridMain.SelectedTag <WebForms_SheetDef>();

            try {
                ODClipboard.SetClipboard(textURLs.Text);
            }
            catch (Exception ex) {
                MsgBox.Show(this, "Could not copy contents to the clipboard.  Please try again.");
                ex.DoNothing();
            }
        }
예제 #3
0
        ///<summary>Updates one WebForms_SheetDef in the database.</summary>
        public static void Update(WebForms_SheetDef webForms_SheetDef)
        {
            string command = "UPDATE webforms_sheetdef SET "
                             + "DentalOfficeID =  " + POut.Long(webForms_SheetDef.DentalOfficeID) + ", "
                             + "Description    = '" + POut.String(webForms_SheetDef.Description) + "', "
                             + "SheetType      =  " + POut.Int((int)webForms_SheetDef.SheetType) + ", "
                             + "FontSize       =  " + POut.Float(webForms_SheetDef.FontSize) + ", "
                             + "FontName       = '" + POut.String(webForms_SheetDef.FontName) + "', "
                             + "Width          =  " + POut.Int(webForms_SheetDef.Width) + ", "
                             + "Height         =  " + POut.Int(webForms_SheetDef.Height) + ", "
                             + "IsLandscape    =  " + POut.Bool(webForms_SheetDef.IsLandscape) + ", "
                             + "SheetDefNum    =  " + POut.Long(webForms_SheetDef.SheetDefNum) + ", "
                             + "HasMobileLayout=  " + POut.Bool(webForms_SheetDef.HasMobileLayout) + ", "
                             + "ClinicNum      =  " + POut.Long(webForms_SheetDef.ClinicNum) + " "
                             + "WHERE WebSheetDefID = " + POut.Long(webForms_SheetDef.WebSheetDefID);

            DataCore.NonQ(command);
        }
예제 #4
0
        private void butUpdate_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length < 1)
            {
                MsgBox.Show(this, "Please select an item from the grid first.");
                return;
            }
            if (gridMain.SelectedIndices.Length > 1)
            {
                MsgBox.Show(this, "Please select one web form at a time.");
                return;
            }
            WebForms_SheetDef wf_sheetDef = gridMain.SelectedTag <WebForms_SheetDef>();
            SheetDef          sheetDef    = SheetDefs.GetFirstOrDefault(x => x.SheetDefNum == wf_sheetDef.SheetDefNum);

            if (sheetDef == null)           //This web form has never had a SheetDefNum assigned or the sheet has been deleted.
            {
                MsgBox.Show(this, "This Web Form is not linked to a valid Sheet.  Please select the correct Sheet that this Web Form should be linked to.");
                FormSheetPicker FormS = new FormSheetPicker();
                FormS.SheetType       = SheetTypeEnum.PatientForm;
                FormS.HideKioskButton = true;
                FormS.ShowDialog();
                if (FormS.DialogResult != DialogResult.OK || FormS.SelectedSheetDefs.Count == 0)
                {
                    return;
                }
                sheetDef = FormS.SelectedSheetDefs.FirstOrDefault();
            }
            else              //sheetDef not null
            {
                SheetDefs.GetFieldsAndParameters(sheetDef);
            }
            if (!WebFormL.VerifyRequiredFieldsPresent(sheetDef))
            {
                return;
            }
            Cursor = Cursors.WaitCursor;
            WebFormL.LoadImagesToSheetDef(sheetDef);
            WebFormL.TryAddOrUpdateSheetDef(this, sheetDef, false, new List <WebForms_SheetDef> {
                wf_sheetDef
            });
            FillGrid();
            Cursor = Cursors.Default;
        }
예제 #5
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <WebForms_SheetDef> TableToList(DataTable table)
        {
            List <WebForms_SheetDef> retVal = new List <WebForms_SheetDef>();
            WebForms_SheetDef        webForms_SheetDef;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                webForms_SheetDef = new WebForms_SheetDef();
                webForms_SheetDef.WebSheetDefID   = PIn.Long(table.Rows[i]["WebSheetDefID"].ToString());
                webForms_SheetDef.DentalOfficeID  = PIn.Long(table.Rows[i]["DentalOfficeID"].ToString());
                webForms_SheetDef.Description     = PIn.String(table.Rows[i]["Description"].ToString());
                webForms_SheetDef.SheetType       = (OpenDentBusiness.SheetFieldType)PIn.Int(table.Rows[i]["SheetType"].ToString());
                webForms_SheetDef.FontSize        = PIn.Float(table.Rows[i]["FontSize"].ToString());
                webForms_SheetDef.FontName        = PIn.String(table.Rows[i]["FontName"].ToString());
                webForms_SheetDef.Width           = PIn.Int(table.Rows[i]["Width"].ToString());
                webForms_SheetDef.Height          = PIn.Int(table.Rows[i]["Height"].ToString());
                webForms_SheetDef.IsLandscape     = PIn.Bool(table.Rows[i]["IsLandscape"].ToString());
                webForms_SheetDef.SheetDefNum     = PIn.Long(table.Rows[i]["SheetDefNum"].ToString());
                webForms_SheetDef.HasMobileLayout = PIn.Bool(table.Rows[i]["HasMobileLayout"].ToString());
                webForms_SheetDef.ClinicNum       = PIn.Long(table.Rows[i]["ClinicNum"].ToString());
                retVal.Add(webForms_SheetDef);
            }
            return(retVal);
        }
예제 #6
0
        ///<summary>Updates one WebForms_SheetDef 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(WebForms_SheetDef webForms_SheetDef, WebForms_SheetDef oldWebForms_SheetDef)
        {
            string command = "";

            if (webForms_SheetDef.DentalOfficeID != oldWebForms_SheetDef.DentalOfficeID)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DentalOfficeID = " + POut.Long(webForms_SheetDef.DentalOfficeID) + "";
            }
            if (webForms_SheetDef.Description != oldWebForms_SheetDef.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(webForms_SheetDef.Description) + "'";
            }
            if (webForms_SheetDef.SheetType != oldWebForms_SheetDef.SheetType)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SheetType = " + POut.Int((int)webForms_SheetDef.SheetType) + "";
            }
            if (webForms_SheetDef.FontSize != oldWebForms_SheetDef.FontSize)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FontSize = " + POut.Float(webForms_SheetDef.FontSize) + "";
            }
            if (webForms_SheetDef.FontName != oldWebForms_SheetDef.FontName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FontName = '" + POut.String(webForms_SheetDef.FontName) + "'";
            }
            if (webForms_SheetDef.Width != oldWebForms_SheetDef.Width)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Width = " + POut.Int(webForms_SheetDef.Width) + "";
            }
            if (webForms_SheetDef.Height != oldWebForms_SheetDef.Height)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Height = " + POut.Int(webForms_SheetDef.Height) + "";
            }
            if (webForms_SheetDef.IsLandscape != oldWebForms_SheetDef.IsLandscape)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsLandscape = " + POut.Bool(webForms_SheetDef.IsLandscape) + "";
            }
            if (webForms_SheetDef.SheetDefNum != oldWebForms_SheetDef.SheetDefNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "SheetDefNum = " + POut.Long(webForms_SheetDef.SheetDefNum) + "";
            }
            if (webForms_SheetDef.HasMobileLayout != oldWebForms_SheetDef.HasMobileLayout)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "HasMobileLayout = " + POut.Bool(webForms_SheetDef.HasMobileLayout) + "";
            }
            if (webForms_SheetDef.ClinicNum != oldWebForms_SheetDef.ClinicNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ClinicNum = " + POut.Long(webForms_SheetDef.ClinicNum) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE webforms_sheetdef SET " + command
                      + " WHERE WebSheetDefID = " + POut.Long(webForms_SheetDef.WebSheetDefID);
            DataCore.NonQ(command);
            return(true);
        }
예제 #7
0
        ///<summary>Inserts many WebForms_SheetDefs into the database.  Provides option to use the existing priKey.</summary>
        public static void InsertMany(List <WebForms_SheetDef> listWebForms_SheetDefs, bool useExistingPK)
        {
            StringBuilder sbCommands = null;
            int           index      = 0;
            int           countRows  = 0;

            while (index < listWebForms_SheetDefs.Count)
            {
                WebForms_SheetDef webForms_SheetDef = listWebForms_SheetDefs[index];
                StringBuilder     sbRow             = new StringBuilder("(");
                bool hasComma = false;
                if (sbCommands == null)
                {
                    sbCommands = new StringBuilder();
                    sbCommands.Append("INSERT INTO webforms_sheetdef (");
                    if (useExistingPK)
                    {
                        sbCommands.Append("WebSheetDefID,");
                    }
                    sbCommands.Append("DentalOfficeID,Description,SheetType,FontSize,FontName,Width,Height,IsLandscape,SheetDefNum,HasMobileLayout,ClinicNum) VALUES ");
                    countRows = 0;
                }
                else
                {
                    hasComma = true;
                }
                if (useExistingPK)
                {
                    sbRow.Append(POut.Long(webForms_SheetDef.WebSheetDefID)); sbRow.Append(",");
                }
                sbRow.Append(POut.Long(webForms_SheetDef.DentalOfficeID)); sbRow.Append(",");
                sbRow.Append("'" + POut.String(webForms_SheetDef.Description) + "'"); sbRow.Append(",");
                sbRow.Append(POut.Int((int)webForms_SheetDef.SheetType)); sbRow.Append(",");
                sbRow.Append(POut.Float(webForms_SheetDef.FontSize)); sbRow.Append(",");
                sbRow.Append("'" + POut.String(webForms_SheetDef.FontName) + "'"); sbRow.Append(",");
                sbRow.Append(POut.Int(webForms_SheetDef.Width)); sbRow.Append(",");
                sbRow.Append(POut.Int(webForms_SheetDef.Height)); sbRow.Append(",");
                sbRow.Append(POut.Bool(webForms_SheetDef.IsLandscape)); sbRow.Append(",");
                sbRow.Append(POut.Long(webForms_SheetDef.SheetDefNum)); sbRow.Append(",");
                sbRow.Append(POut.Bool(webForms_SheetDef.HasMobileLayout)); sbRow.Append(",");
                sbRow.Append(POut.Long(webForms_SheetDef.ClinicNum)); sbRow.Append(")");
                if (sbCommands.Length + sbRow.Length + 1 > TableBase.MaxAllowedPacketCount && countRows > 0)
                {
                    DataCore.NonQ(sbCommands.ToString());
                    sbCommands = null;
                }
                else
                {
                    if (hasComma)
                    {
                        sbCommands.Append(",");
                    }
                    sbCommands.Append(sbRow.ToString());
                    countRows++;
                    if (index == listWebForms_SheetDefs.Count - 1)
                    {
                        DataCore.NonQ(sbCommands.ToString());
                    }
                    index++;
                }
            }
        }
예제 #8
0
 ///<summary>Inserts one WebForms_SheetDef into the database.  Returns the new priKey.</summary>
 public static long Insert(WebForms_SheetDef webForms_SheetDef)
 {
     return(Insert(webForms_SheetDef, false));
 }
예제 #9
0
 private string SheetDefBaseURL(WebForms_SheetDef sheetDef)
 {
     return(_sheetDefAddress + "?DOID=" + _dentalOfficeID + "&WSDID=" + sheetDef.WebSheetDefID);
 }