コード例 #1
0
ファイル: SheetDefCrud.cs プロジェクト: nampn/ODental
 ///<summary>Inserts one SheetDef into the database.  Returns the new priKey.</summary>
 internal static long Insert(SheetDef sheetDef)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         sheetDef.SheetDefNum=DbHelper.GetNextOracleKey("sheetdef","SheetDefNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(sheetDef,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     sheetDef.SheetDefNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(sheetDef,false);
     }
 }
コード例 #2
0
ファイル: SheetDefCrud.cs プロジェクト: nampn/ODental
 ///<summary>Inserts one SheetDef into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(SheetDef sheetDef,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         sheetDef.SheetDefNum=ReplicationServers.GetKey("sheetdef","SheetDefNum");
     }
     string command="INSERT INTO sheetdef (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="SheetDefNum,";
     }
     command+="Description,SheetType,FontSize,FontName,Width,Height,IsLandscape) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(sheetDef.SheetDefNum)+",";
     }
     command+=
          "'"+POut.String(sheetDef.Description)+"',"
         +    POut.Int   ((int)sheetDef.SheetType)+","
         +    POut.Float (sheetDef.FontSize)+","
         +"'"+POut.String(sheetDef.FontName)+"',"
         +    POut.Int   (sheetDef.Width)+","
         +    POut.Int   (sheetDef.Height)+","
         +    POut.Bool  (sheetDef.IsLandscape)+")";
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command);
     }
     else {
         sheetDef.SheetDefNum=Db.NonQ(command,true);
     }
     return sheetDef.SheetDefNum;
 }
コード例 #3
0
ファイル: LabelSingle.cs プロジェクト: nampn/ODental
        public static void PrintPatientLFAddress(long patNum)
        {
            SheetDef sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.LabelPatientLFAddress);
            Sheet    sheet    = SheetUtil.CreateSheet(sheetDef);

            SheetParameter.SetParameter(sheet, "PatNum", patNum);
            SheetFiller.FillFields(sheet);
            try {
                SheetPrinting.Print(sheet);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #4
0
ファイル: LabelSingle.cs プロジェクト: nampn/ODental
        public static void PrintCustomPatient(long patNum, SheetDef sheetDef)
        {
            SheetDefs.GetFieldsAndParameters(sheetDef);
            Sheet sheet = SheetUtil.CreateSheet(sheetDef);

            SheetParameter.SetParameter(sheet, "PatNum", patNum);
            SheetFiller.FillFields(sheet);
            try {
                SheetPrinting.Print(sheet);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #5
0
        private void butTools_Click(object sender, EventArgs e)
        {
            FormSheetTools formSheetTools = new FormSheetTools(true);

            formSheetTools.ShowDialog();
            if (formSheetTools.HasSheetsChanged)
            {
                SheetDefs.RefreshCache();
                SheetFieldDefs.RefreshCache();
                SheetDef sheetDefImported = SheetDefs.GetFirstOrDefault(x => x.SheetDefNum == formSheetTools.ImportedSheetDefNum);
                ToggleDashboardPermission(sheetDefImported, _listUserGroups.ToArray());
                FillGridCustom(false, doRefreshCache: false);
                SelectDashboardDef(sheetDefImported);
            }
        }
コード例 #6
0
        /// <summary>Takes a provided webSheetDefId and sheetDef and packages them. The package is then broken into chunks of equal or lesser size
        /// than the provided chunkSize. Size is measured in bytes.</summary>
        public static bool UpdateSheetDefChunked(long webSheetDefId, SheetDef sheetDef, int chunkSize)
        {
            string             regKey           = PrefC.GetString(PrefName.RegistrationKey);
            List <PayloadItem> listPayloadItems = new List <PayloadItem> {
                new PayloadItem(regKey, "RegKey"),
                new PayloadItem(webSheetDefId, "WebSheetDefID"),
                new PayloadItem(sheetDef, "SheetDef")
            };
            string payload         = PayloadHelper.CreatePayloadWebHostSynch(regKey, listPayloadItems.ToArray());
            string fileNamePayload = UploadSheetChunks(payload, chunkSize);
            string result          = SheetsSynchProxy.GetWebServiceInstance().UpdateSheetDefFromFile(fileNamePayload);

            PayloadHelper.CheckForError(result);
            return(true);
        }
コード例 #7
0
ファイル: SheetDefCrud.cs プロジェクト: royedwards/DRDNet
 ///<summary>Inserts one SheetDef into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(SheetDef sheetDef)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(sheetDef, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             sheetDef.SheetDefNum = DbHelper.GetNextOracleKey("sheetdef", "SheetDefNum");                  //Cacheless method
         }
         return(InsertNoCache(sheetDef, true));
     }
 }
コード例 #8
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 = (webforms_sheetdef)gridMain.Rows[gridMain.SelectedIndices[0]].Tag;
            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;
            if (!TestWebServiceExists())
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "Either the web service is not available or the WebHostSynch URL is incorrect");
                return;
            }
            WebFormL.LoadImagesToSheetDef(sheetDef);
            wh.UpdateSheetDef(RegistrationKey, wf_sheetDef.WebSheetDefID, sheetDef);
            FillGrid();
            Cursor = Cursors.Default;
        }
コード例 #9
0
 ///<summary>Attempts to find a UserOdPref indicating to the the most recently loaded layout for user, defaulting to the practice default if not
 ///found, then defaulting to the first SheetDef in listLayoutSheetDefs.  Returns null if listLayoutSheetDefs is null or empty.</summary>
 public SheetDef GetLayoutForUser()
 {
     //Avoid changing the layout when user is simply navigating and switching view modes.
     //If this user is using the practice default and then the practice default is changed by another user
     //we want to continue to use the same layout the user is currently viewing.
     //If the user logs off/exits for the day the next time they log in they will get the new practice default layout.
     if (!_hasUserLoggedOff &&
         _userNumCur == Security.CurUser.UserNum &&
         _clinicNumCur == Clinics.ClinicNum &&
         _sheetDefDynamicLayoutCur != null &&
         ListSheetDefsLayout.Any(x => x.SheetDefNum == _sheetDefDynamicLayoutCur.SheetDefNum))
     {
         return(ListSheetDefsLayout.First(x => x.SheetDefNum == _sheetDefDynamicLayoutCur.SheetDefNum));
     }
     #region UserOdPref based layout selection. If no UserOdPref use practice default or first item in list as last line of defense.
     SheetDef          def       = null;
     List <UserOdPref> listPrefs = UserOdPrefs.GetByUserAndFkeyType(Security.CurUser.UserNum, UserOdFkeyType.DynamicChartLayout);
     UserOdPref        userPref  = listPrefs.FirstOrDefault();                          //There is only at most a single link per user.
     if (userPref != null &&      //User has viewed the chart module before
         ListSheetDefsLayout.Any(x => x.SheetDefNum == userPref.Fkey))                  //Layout still exists in the list of options
     {
         def = ListSheetDefsLayout.FirstOrDefault(x => x.SheetDefNum == userPref.Fkey); //Use previous layout when not practice or Clinic default.
     }
     else                                                                               //Try to use the practice default.
                                                                                        //If there is a Clinic default, get it.
     {
         if (!PrefC.HasClinicsEnabled || Clinics.ClinicNum == 0 ||
             !ClinicPrefs.TryGetLong(PrefName.SheetsDefaultChartModule, Clinics.ClinicNum, out long sheetDefNum))
         {
             //Either, clinics are off, HQ is selected, or ClinicPref did not exist.
             if (_hasUserLoggedOff)                     //Currently the cache is not loaded fast enough after logging back on to trust.
             {
                 sheetDefNum = PIn.Long(PrefC.GetStringNoCache(PrefName.SheetsDefaultChartModule));
             }
             else
             {
                 sheetDefNum = PrefC.GetLong(PrefName.SheetsDefaultChartModule);                      //Serves as our HQ default.
             }
         }
         def = ListSheetDefsLayout.FirstOrDefault(x => x.SheetDefNum == sheetDefNum); //Can be null
     }
     if (def == null)                                                                 //Just in case.
     {
         def = ListSheetDefsLayout[0];                                                //Use first in the list.
     }
     #endregion
     return(def);
 }
コード例 #10
0
        private void butCopy_Click(object sender, EventArgs e)
        {
            if (gridInternal.GetSelectedIndex() == -1)
            {
                MsgBox.Show(this, "Please select an internal sheet first.");
                return;
            }
            SheetDef sheetDef = gridInternal.SelectedTag <SheetDef>().Copy();

            sheetDef.IsNew = true;
            SheetDefs.InsertOrUpdate(sheetDef);
            ToggleDashboardPermission(sheetDef, _listUserGroups.ToArray());
            FillGridCustom(false);
            gridInternal.SetSelected(false);            //Clear selection.
            SelectDashboardDef(sheetDef);
        }
コード例 #11
0
ファイル: LabelSingle.cs プロジェクト: radtek/opendental
        public static void PrintText(long patNum, string text)
        {
            SheetDef sheetDef = SheetsInternal.GetSheetDef(SheetInternalType.LabelText);
            Sheet    sheet    = SheetUtil.CreateSheet(sheetDef);

            SheetParameter.SetParameter(sheet, "PatNum", patNum);
            sheet.Parameters.Add(new SheetParameter(false, "text"));
            SheetParameter.SetParameter(sheet, "text", text);
            SheetFiller.FillFields(sheet);
            try {
                SheetPrinting.Print(sheet);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
            }
        }
コード例 #12
0
        private void butCopy2_Click(object sender, EventArgs e)
        {
            //This button is not enabled unless user has appropriate permission for setup.
            if (grid2.GetSelectedIndex() == -1)
            {
                MsgBox.Show(this, "Please select a sheet from the list above first.");
                return;
            }
            SheetDef sheetdef = grid2.SelectedTag <SheetDef>();

            sheetdef.Description = sheetdef.Description + "2";
            SheetDefs.GetFieldsAndParameters(sheetdef);
            sheetdef.IsNew = true;
            SheetDefs.InsertOrUpdate(sheetdef, isOldSheetDuplicate: sheetdef.DateTCreated.Year < 1880);
            FillGrid2(sheetdef.SheetDefNum);
        }
コード例 #13
0
        ///<summary>Uses the given sheetDef to set the location, size, and anchors for dynamic controls.
        ///Usually only called from outside base DynamicLayoutControl when UI is switching to a different layout sheetDef.
        ///Set isUserSelection true in order to save the current layout to the user's preference override.</summary>
        public void InitLayoutForSheetDef(SheetDef sheetDef, SheetFieldLayoutMode sheetFieldLayoutMode, Dictionary <string, Control> dictionaryControls
                                          , bool isForcedRefresh = false, bool isUserSelection = false)
        {
            _hasUserLoggedOff = false;          //At this point we are showing the chart module to a user, reset.
            _userNumCur       = Security.CurUser.UserNum;
            _clinicNumCur     = Clinics.ClinicNum;
            if (!isForcedRefresh && _sheetDefDynamicLayoutCur != null && sheetDef.SheetDefNum == _sheetDefDynamicLayoutCur.SheetDefNum)
            {
                //Not forcing a refresh and _dynamicLayoutCur and sheetDef are the same sheet. No point in re-running logic.  Prevents flicker.
                return;
            }
            _sheetDefDynamicLayoutCur = sheetDef;
            if (_sheetDefDynamicLayoutCur.SheetDefNum != 0)           //0 represents an internal sheetDef, internal sheet defs do not need their field and params set.
            {
                SheetDefs.GetFieldsAndParameters(_sheetDefDynamicLayoutCur);
            }
            List <SheetFieldDef> listSheetFieldDefs  = GetPertinentSheetFieldDefs(sheetFieldLayoutMode);
            List <Control>       listDynamicControls = new List <Control>();

            foreach (SheetFieldDef fieldDef in listSheetFieldDefs)
            {
                Control control = GetControlForField(fieldDef, dictionaryControls);
                if (control == null)
                {
                    continue;                    //For example, HQ only controls when running from customer location.
                }
                //The height above and below calculations assumes the staic controls are all entire at the top or bottom of the this dynamic control.
                int heightAbove = GetStaticControlsHeightAbove(fieldDef.YPos);
                int heightBelow = GetStaticControlsHeightBelow(fieldDef.YPos);
                control.MinimumSize = new Size(0, 0);             //Do not limit min size
                control.MaximumSize = new Size(0, 0);             //Do not limit max size
                SheetUtil.SetControlSizeAndAnchors(fieldDef, control, _controlHosting, (heightAbove + heightBelow));
                control.Location = new Point(fieldDef.XPos, (fieldDef.YPos + heightAbove));
                control.Visible  = true;
                listDynamicControls.Add(control);
            }
            RefreshGridVerticalSpace(sheetFieldLayoutMode, dictionaryControls, listSheetFieldDefs);
            RefreshGridHorizontalSpace(sheetFieldLayoutMode, dictionaryControls);
            _listControlsStatic.ForEach(x => x.BringToFront());
            _controlHosting.Controls.OfType <Control>()
            .Where(x => !listDynamicControls.Contains(x) && !_listControlsStatic.Contains(x))
            .ForEach(x => x.Visible = false);
            if (isUserSelection)
            {
                UpdateChartLayoutUserPref();
            }
        }
コード例 #14
0
ファイル: SheetDefCrud.cs プロジェクト: royedwards/DRDNet
        ///<summary>Updates one SheetDef in the database.</summary>
        public static void Update(SheetDef sheetDef)
        {
            string command = "UPDATE sheetdef SET "
                             + "Description     = '" + POut.String(sheetDef.Description) + "', "
                             + "SheetType       =  " + POut.Int((int)sheetDef.SheetType) + ", "
                             + "FontSize        =  " + POut.Float(sheetDef.FontSize) + ", "
                             + "FontName        = '" + POut.String(sheetDef.FontName) + "', "
                             + "Width           =  " + POut.Int(sheetDef.Width) + ", "
                             + "Height          =  " + POut.Int(sheetDef.Height) + ", "
                             + "IsLandscape     =  " + POut.Bool(sheetDef.IsLandscape) + ", "
                             + "PageCount       =  " + POut.Int(sheetDef.PageCount) + ", "
                             + "IsMultiPage     =  " + POut.Bool(sheetDef.IsMultiPage) + ", "
                             + "BypassGlobalLock=  " + POut.Int((int)sheetDef.BypassGlobalLock) + " "
                             + "WHERE SheetDefNum = " + POut.Long(sheetDef.SheetDefNum);

            Db.NonQ(command);
        }
コード例 #15
0
        private void ButAdd_Click(object sender, EventArgs e)
        {
            long sheetDefWidgetNum = EditWidget();          //Adding a new Dashboard Widget.

            if (sheetDefWidgetNum == -1)
            {
                return;
            }
            SheetDef sheetDef = SheetDefs.GetWhere(x => x.SheetDefNum == sheetDefWidgetNum).FirstOrDefault();

            if (sheetDef != null)
            {
                ToggleDashboardPermission(sheetDef, _listUserGroups.ToArray());
            }
            FillGridCustom(false);
            SelectDashboardDef(sheetDef);
        }
コード例 #16
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<SheetDef> TableToList(DataTable table){
			List<SheetDef> retVal=new List<SheetDef>();
			SheetDef sheetDef;
			for(int i=0;i<table.Rows.Count;i++) {
				sheetDef=new SheetDef();
				sheetDef.SheetDefNum= PIn.Long  (table.Rows[i]["SheetDefNum"].ToString());
				sheetDef.Description= PIn.String(table.Rows[i]["Description"].ToString());
				sheetDef.SheetType  = (SheetTypeEnum)PIn.Int(table.Rows[i]["SheetType"].ToString());
				sheetDef.FontSize   = PIn.Float (table.Rows[i]["FontSize"].ToString());
				sheetDef.FontName   = PIn.String(table.Rows[i]["FontName"].ToString());
				sheetDef.Width      = PIn.Int   (table.Rows[i]["Width"].ToString());
				sheetDef.Height     = PIn.Int   (table.Rows[i]["Height"].ToString());
				sheetDef.IsLandscape= PIn.Bool  (table.Rows[i]["IsLandscape"].ToString());
				retVal.Add(sheetDef);
			}
			return retVal;
		}
コード例 #17
0
ファイル: Sheets.asmx.cs プロジェクト: steev90/opendental
 private void FillSheetDef(SheetDef sheetDef, webforms_sheetdef SheetDefObj)
 {
     SheetDefObj.Description = sheetDef.Description;
     SheetDefObj.FontName    = sheetDef.FontName;
     SheetDefObj.SheetType   = (int)sheetDef.SheetType;
     SheetDefObj.FontSize    = sheetDef.FontSize;
     SheetDefObj.Width       = sheetDef.Width;
     SheetDefObj.Height      = sheetDef.Height;
     if (sheetDef.IsLandscape == true)
     {
         SheetDefObj.IsLandscape = (sbyte)1;
     }
     else
     {
         SheetDefObj.IsLandscape = (sbyte)0;
     }
 }
コード例 #18
0
        private void butDuplicate_Click(object sender, EventArgs e)
        {
            if (gridCustom.GetSelectedIndex() == -1)
            {
                MsgBox.Show(this, "Please select a sheet from the custom list first.");
                return;
            }
            SheetDef sheetDef = gridCustom.SelectedTag <SheetDef>().Copy();

            sheetDef.Description = sheetDef.Description + "2";
            SheetDefs.GetFieldsAndParameters(sheetDef);
            sheetDef.IsNew = true;
            SheetDefs.InsertOrUpdate(sheetDef);
            ToggleDashboardPermission(sheetDef, _listUserGroups.ToArray());
            FillGridCustom(false);
            SelectDashboardDef(sheetDef);
        }
コード例 #19
0
        private void butDuplicate_Click(object sender, EventArgs e)
        {
            //This button is not enabled unless user has appropriate permission for setup.
            if (gridCustomLayouts.SelectedIndices.Length == 0)
            {
                MsgBox.Show("Please select a sheet from My Custom Layouts before duplicating.");
                return;
            }
            SheetDef sheetDef = _listCustomSheetDefs[gridCustomLayouts.SelectedIndices[0]].Copy();

            //sheetDef.UserNum=Security.CurUser.UserNum;
            sheetDef.Description = sheetDef.Description + " 2";
            SheetDefs.GetFieldsAndParameters(sheetDef);
            sheetDef.IsNew = true;
            SheetDefs.InsertOrUpdate(sheetDef);
            RefreshAndFillGrids(sheetDef.SheetDefNum);
        }
コード例 #20
0
        private void grid2_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            SheetDef sheetdef = SheetDefC.Listt[e.Row];

            SheetDefs.GetFieldsAndParameters(sheetdef);
            FormSheetDefEdit FormS = new FormSheetDefEdit(sheetdef);

            FormS.ShowDialog();
            FillGrid2();
            for (int i = 0; i < SheetDefC.Listt.Count; i++)
            {
                if (SheetDefC.Listt[i].SheetDefNum == sheetdef.SheetDefNum)
                {
                    grid2.SetSelected(i, true);
                }
            }
            changed = true;
        }
コード例 #21
0
ファイル: SheetUtil.cs プロジェクト: nampn/ODental
        ///<summary>Creates a Sheet object from a sheetDef, complete with fields and parameters.  Sets date to today.</summary>
        public static Sheet CreateSheet(SheetDef sheetDef, long patNum)
        {
            Sheet sheet = new Sheet();

            sheet.IsNew         = true;
            sheet.DateTimeSheet = DateTime.Now;
            sheet.FontName      = sheetDef.FontName;
            sheet.FontSize      = sheetDef.FontSize;
            sheet.Height        = sheetDef.Height;
            sheet.SheetType     = sheetDef.SheetType;
            sheet.Width         = sheetDef.Width;
            sheet.PatNum        = patNum;
            sheet.Description   = sheetDef.Description;
            sheet.IsLandscape   = sheetDef.IsLandscape;
            sheet.SheetFields   = CreateFieldList(sheetDef.SheetFieldDefs);
            sheet.Parameters    = sheetDef.Parameters;
            return(sheet);
        }
コード例 #22
0
ファイル: SheetDefCrud.cs プロジェクト: royedwards/DRDNet
 ///<summary>Returns true if Update(SheetDef,SheetDef) 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(SheetDef sheetDef, SheetDef oldSheetDef)
 {
     if (sheetDef.Description != oldSheetDef.Description)
     {
         return(true);
     }
     if (sheetDef.SheetType != oldSheetDef.SheetType)
     {
         return(true);
     }
     if (sheetDef.FontSize != oldSheetDef.FontSize)
     {
         return(true);
     }
     if (sheetDef.FontName != oldSheetDef.FontName)
     {
         return(true);
     }
     if (sheetDef.Width != oldSheetDef.Width)
     {
         return(true);
     }
     if (sheetDef.Height != oldSheetDef.Height)
     {
         return(true);
     }
     if (sheetDef.IsLandscape != oldSheetDef.IsLandscape)
     {
         return(true);
     }
     if (sheetDef.PageCount != oldSheetDef.PageCount)
     {
         return(true);
     }
     if (sheetDef.IsMultiPage != oldSheetDef.IsMultiPage)
     {
         return(true);
     }
     if (sheetDef.BypassGlobalLock != oldSheetDef.BypassGlobalLock)
     {
         return(true);
     }
     return(false);
 }
コード例 #23
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;
        }
コード例 #24
0
ファイル: FormRxEdit.cs プロジェクト: royedwards/DRDNet
        private void butPrint_Click(object sender, System.EventArgs e)
        {
            if (PrinterSettings.InstalledPrinters.Count == 0)
            {
                MsgBox.Show(this, "Error: No Printers Installed\r\n" +
                            "If you do have a printer installed, restarting the workstation may solve the problem."
                            );
                return;
            }
            //only visible if sheet==null.
            if (comboSendStatus.SelectedIndex == (int)RxSendStatus.InElectQueue ||
                comboSendStatus.SelectedIndex == (int)RxSendStatus.SentElect)
            {
                //do not change status
            }
            else
            {
                comboSendStatus.SelectedIndex = (int)RxSendStatus.Printed;
            }
            if (!SaveRx())
            {
                return;
            }
            //This logic is an exact copy of FormRxManage.butPrintSelect_Click()'s logic when 1 Rx is selected.
            //If this is updated, that method needs to be updated as well.
            SheetDef sheetDef = SheetDefs.GetSheetsDefault(SheetTypeEnum.Rx, Clinics.ClinicNum);

            sheet = SheetUtil.CreateSheet(sheetDef, PatCur.PatNum);
            SheetParameter.SetParameter(sheet, "RxNum", RxPatCur.RxNum);
            SheetFiller.FillFields(sheet);
            SheetUtil.CalculateHeights(sheet);
            if (!SheetPrinting.PrintRx(sheet, RxPatCur))
            {
                return;
            }
            if (RxPatCur.IsNew)
            {
                AutomationL.Trigger(AutomationTrigger.RxCreate, new List <string>(), PatCur.PatNum, 0, new List <RxPat>()
                {
                    RxPatCur
                });
            }
            DialogResult = DialogResult.OK;
        }
コード例 #25
0
 private void LoadImagesToSheetDef(SheetDef sheetDefCur)
 {
     for (int j = 0; j < sheetDefCur.SheetFieldDefs.Count; j++)
     {
         try {
             if (sheetDefCur.SheetFieldDefs[j].FieldType == SheetFieldType.Image)
             {
                 string filePathAndName = ODFileUtils.CombinePaths(SheetUtil.GetImagePath(), sheetDefCur.SheetFieldDefs[j].FieldName);
                 Image  img             = null;
                 if (sheetDefCur.SheetFieldDefs[j].FieldName == "Patient Info.gif")
                 {
                     img = Properties.Resources.Patient_Info;
                 }
                 else if (File.Exists(filePathAndName))
                 {
                     img = Image.FromFile(filePathAndName);
                 }
                 //sheetDefCur.SheetFieldDefs[j].ImageData=POut.Bitmap(new Bitmap(img),ImageFormat.Png);//Because that's what we did before. Review this later.
                 long fileByteSize = 0;
                 using (MemoryStream ms = new MemoryStream()) {
                     img.Save(ms, img.RawFormat);                            // done solely to compute the file size of the image
                     fileByteSize = ms.Length;
                 }
                 if (fileByteSize > 2000000)
                 {
                     //for large images greater that ~2MB use jpeg format for compression. Large images in the 4MB + range have difficulty being displayed. It could be an issue with MYSQL or ASP.NET
                     sheetDefCur.SheetFieldDefs[j].ImageData = POut.Bitmap(new Bitmap(img), ImageFormat.Jpeg);
                 }
                 else
                 {
                     sheetDefCur.SheetFieldDefs[j].ImageData = POut.Bitmap(new Bitmap(img), img.RawFormat);
                 }
             }
             else
             {
                 sheetDefCur.SheetFieldDefs[j].ImageData = "";                      // because null is not allowed
             }
         }
         catch (Exception ex) {
             sheetDefCur.SheetFieldDefs[j].ImageData = "";
             MessageBox.Show(ex.Message);
         }
     }
 }
コード例 #26
0
ファイル: FormSheetDef.cs プロジェクト: steev90/opendental
        private void listSheetType_Click(object sender, EventArgs e)
        {
            if (!IsInitial)
            {
                return;
            }
            if (listSheetType.SelectedIndex == -1)
            {
                return;
            }
            SheetDef sheetdef = null;

            switch ((SheetTypeEnum)listSheetType.SelectedIndex)
            {
            case SheetTypeEnum.LabelCarrier:
            case SheetTypeEnum.LabelPatient:
            case SheetTypeEnum.LabelReferral:
                sheetdef = SheetsInternal.GetSheetDef(SheetInternalType.LabelPatientMail);
                if (textDescription.Text == "")
                {
                    textDescription.Text = ((SheetTypeEnum)listSheetType.SelectedIndex).ToString();
                }
                comboFontName.Text       = sheetdef.FontName;
                textFontSize.Text        = sheetdef.FontSize.ToString();
                textWidth.Text           = sheetdef.Width.ToString();
                textHeight.Text          = sheetdef.Height.ToString();
                checkIsLandscape.Checked = sheetdef.IsLandscape;
                break;

            case SheetTypeEnum.ReferralSlip:
                sheetdef = SheetsInternal.GetSheetDef(SheetInternalType.ReferralSlip);
                if (textDescription.Text == "")
                {
                    textDescription.Text = ((SheetTypeEnum)listSheetType.SelectedIndex).ToString();
                }
                comboFontName.Text       = sheetdef.FontName;
                textFontSize.Text        = sheetdef.FontSize.ToString();
                textWidth.Text           = sheetdef.Width.ToString();
                textHeight.Text          = sheetdef.Height.ToString();
                checkIsLandscape.Checked = sheetdef.IsLandscape;
                break;
            }
        }
コード例 #27
0
        private void butCopy_Click(object sender, EventArgs e)
        {
            if (grid1.GetSelectedIndex() == -1)
            {
                MsgBox.Show(this, "Please select an internal sheet from the list above first.");
                return;
            }
            SheetDef sheetdef = grid1.SelectedTag <SheetDef>();

            sheetdef.IsNew = true;
            SheetDefs.InsertOrUpdate(sheetdef);
            if (sheetdef.SheetType == SheetTypeEnum.MedicalHistory &&
                (sheetdef.Description == "Medical History New Patient" || sheetdef.Description == "Medical History Update"))
            {
                MsgBox.Show(this, "This is just a template, it may contain allergies and problems that do not exist in your setup.");
            }
            grid1.SetSelected(false);
            FillGrid2(sheetdef.SheetDefNum);
        }
コード例 #28
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        internal static List <SheetDef> TableToList(DataTable table)
        {
            List <SheetDef> retVal = new List <SheetDef>();
            SheetDef        sheetDef;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                sheetDef             = new SheetDef();
                sheetDef.SheetDefNum = PIn.Long(table.Rows[i]["SheetDefNum"].ToString());
                sheetDef.Description = PIn.String(table.Rows[i]["Description"].ToString());
                sheetDef.SheetType   = (SheetTypeEnum)PIn.Int(table.Rows[i]["SheetType"].ToString());
                sheetDef.FontSize    = PIn.Float(table.Rows[i]["FontSize"].ToString());
                sheetDef.FontName    = PIn.String(table.Rows[i]["FontName"].ToString());
                sheetDef.Width       = PIn.Int(table.Rows[i]["Width"].ToString());
                sheetDef.Height      = PIn.Int(table.Rows[i]["Height"].ToString());
                sheetDef.IsLandscape = PIn.Bool(table.Rows[i]["IsLandscape"].ToString());
                retVal.Add(sheetDef);
            }
            return(retVal);
        }
コード例 #29
0
        private void butCopy_Click(object sender, EventArgs e)
        {
            //This button is not enabled unless user has appropriate permission for setup.
            if (gridOtherLayouts.SelectedIndices.Length == 0)
            {
                MsgBox.Show("Please select a sheet from Internal and Other User Layouts before copying.");
                return;
            }
            SheetDef sheetDef = _listOtherSheetDefs[gridOtherLayouts.SelectedIndices[0]].Copy();

            if (sheetDef.SheetDefNum != 0)                  //Is not the internal sheet.
            {
                SheetDefs.GetFieldsAndParameters(sheetDef); //Other user custom sheetdefs need their fields filled.
            }
            //sheetDef.UserNum=Security.CurUser.UserNum;
            sheetDef.IsNew = true;
            SheetDefs.InsertOrUpdate(sheetDef);
            _isSignalNeeded = true;
            RefreshAndFillGrids(sheetDef.SheetDefNum);
        }
コード例 #30
0
 /// <summary>Initializes a Dashboard.</summary>
 /// <param name="sheetDefDashboard">SheetDef for the Patient Dashboard to open.</param>
 /// <param name="actionOnDashboardContentsChanged">Action is fired when the contents of the Dashboard change.</param>
 /// <param name="actionOnDashboardClosing">Action is fired when the Dashboard is closing.</param>
 /// in the Appointment Edit window. </param>
 public void Initialize(SheetDef sheetDefDashboard, Action actionOnDashboardContentsChanged, Action actionOnDashboardClosing)
 {
     if (sheetDefDashboard == null)
     {
         return;
     }
     AddWidget(sheetDefDashboard);
     _actionDashboardContentsChanged = actionOnDashboardContentsChanged;
     _actionDashboardClosing         = actionOnDashboardClosing;
     //Failed to open any of the previously attached widgets, likely due to user no longer having permissions to widgets.
     //Continue if initializing Dashboard for the first time so that a widget can be added later.
     if (ListOpenWidgets.Count == 0)
     {
         CloseDashboard(false);
         return;
     }
     IsInitialized = true;                      //Subscribes to relevant events.
     _actionDashboardContentsChanged?.Invoke(); //Only after the Patient Dashboard SheetDef is added.
     StartRefreshThread();
 }
コード例 #31
0
        ///<summary>Inserts one SheetDef into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(SheetDef sheetDef, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO sheetdef (";

            if (!useExistingPK && isRandomKeys)
            {
                sheetDef.SheetDefNum = ReplicationServers.GetKeyNoCache("sheetdef", "SheetDefNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "SheetDefNum,";
            }
            command += "Description,SheetType,FontSize,FontName,Width,Height,IsLandscape,PageCount,IsMultiPage,BypassGlobalLock,HasMobileLayout,DateTCreated) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(sheetDef.SheetDefNum) + ",";
            }
            command +=
                "'" + POut.String(sheetDef.Description) + "',"
                + POut.Int((int)sheetDef.SheetType) + ","
                + POut.Float(sheetDef.FontSize) + ","
                + "'" + POut.String(sheetDef.FontName) + "',"
                + POut.Int(sheetDef.Width) + ","
                + POut.Int(sheetDef.Height) + ","
                + POut.Bool(sheetDef.IsLandscape) + ","
                + POut.Int(sheetDef.PageCount) + ","
                + POut.Bool(sheetDef.IsMultiPage) + ","
                + POut.Int((int)sheetDef.BypassGlobalLock) + ","
                + POut.Bool(sheetDef.HasMobileLayout) + ","
                + POut.DateT(sheetDef.DateTCreated) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                sheetDef.SheetDefNum = Db.NonQ(command, true, "SheetDefNum", "sheetDef");
            }
            return(sheetDef.SheetDefNum);
        }
コード例 #32
0
 private void FormScreenPatEdit_Load(object sender, EventArgs e)
 {
     if (IsNew)
     {
         ScreenPatCur.SheetNum = PrefC.GetLong(PrefName.PublicHealthScreeningSheet);
     }
     PatCur = Patients.GetPat(ScreenPatCur.PatNum);
     if (PatCur != null)
     {
         textPatient.Text = PatCur.GetNameLF();
     }
     if (ScreenGroupCur != null)
     {
         textScreenGroup.Text = ScreenGroupCur.Description;
     }
     ExamSheetDefCur = SheetDefs.GetSheetDef(ScreenPatCur.SheetNum);
     if (ExamSheetDefCur != null)
     {
         textSheet.Text = ExamSheetDefCur.Description;
     }
 }
コード例 #33
0
        private void butCopy_Click(object sender, EventArgs e)
        {
            if (grid1.GetSelectedIndex() == -1)
            {
                MsgBox.Show(this, "Please select an internal sheet from the list above first.");
                return;
            }
            SheetDef sheetdef = internalList[grid1.GetSelectedIndex()].Copy();

            sheetdef.IsNew = true;
            SheetDefs.InsertOrUpdate(sheetdef);
            grid1.SetSelected(false);
            FillGrid2();
            for (int i = 0; i < SheetDefC.Listt.Count; i++)
            {
                if (SheetDefC.Listt[i].SheetDefNum == sheetdef.SheetDefNum)
                {
                    grid2.SetSelected(i, true);
                }
            }
        }
コード例 #34
0
ファイル: SheetDefCrud.cs プロジェクト: mnisl/OD
		///<summary>Updates one SheetDef in the database.</summary>
		public static void Update(SheetDef sheetDef){
			string command="UPDATE sheetdef SET "
				+"Description= '"+POut.String(sheetDef.Description)+"', "
				+"SheetType  =  "+POut.Int   ((int)sheetDef.SheetType)+", "
				+"FontSize   =  "+POut.Float (sheetDef.FontSize)+", "
				+"FontName   = '"+POut.String(sheetDef.FontName)+"', "
				+"Width      =  "+POut.Int   (sheetDef.Width)+", "
				+"Height     =  "+POut.Int   (sheetDef.Height)+", "
				+"IsLandscape=  "+POut.Bool  (sheetDef.IsLandscape)+", "
				+"PageCount  =  "+POut.Int   (sheetDef.PageCount)+", "
				+"IsMultiPage=  "+POut.Bool  (sheetDef.IsMultiPage)+" "
				+"WHERE SheetDefNum = "+POut.Long(sheetDef.SheetDefNum);
			Db.NonQ(command);
		}
コード例 #35
0
ファイル: SheetDefCrud.cs プロジェクト: mnisl/OD
		///<summary>Updates one 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(SheetDef sheetDef,SheetDef oldSheetDef){
			string command="";
			if(sheetDef.Description != oldSheetDef.Description) {
				if(command!=""){ command+=",";}
				command+="Description = '"+POut.String(sheetDef.Description)+"'";
			}
			if(sheetDef.SheetType != oldSheetDef.SheetType) {
				if(command!=""){ command+=",";}
				command+="SheetType = "+POut.Int   ((int)sheetDef.SheetType)+"";
			}
			if(sheetDef.FontSize != oldSheetDef.FontSize) {
				if(command!=""){ command+=",";}
				command+="FontSize = "+POut.Float(sheetDef.FontSize)+"";
			}
			if(sheetDef.FontName != oldSheetDef.FontName) {
				if(command!=""){ command+=",";}
				command+="FontName = '"+POut.String(sheetDef.FontName)+"'";
			}
			if(sheetDef.Width != oldSheetDef.Width) {
				if(command!=""){ command+=",";}
				command+="Width = "+POut.Int(sheetDef.Width)+"";
			}
			if(sheetDef.Height != oldSheetDef.Height) {
				if(command!=""){ command+=",";}
				command+="Height = "+POut.Int(sheetDef.Height)+"";
			}
			if(sheetDef.IsLandscape != oldSheetDef.IsLandscape) {
				if(command!=""){ command+=",";}
				command+="IsLandscape = "+POut.Bool(sheetDef.IsLandscape)+"";
			}
			if(sheetDef.PageCount != oldSheetDef.PageCount) {
				if(command!=""){ command+=",";}
				command+="PageCount = "+POut.Int(sheetDef.PageCount)+"";
			}
			if(sheetDef.IsMultiPage != oldSheetDef.IsMultiPage) {
				if(command!=""){ command+=",";}
				command+="IsMultiPage = "+POut.Bool(sheetDef.IsMultiPage)+"";
			}
			if(command==""){
				return false;
			}
			command="UPDATE sheetdef SET "+command
				+" WHERE SheetDefNum = "+POut.Long(sheetDef.SheetDefNum);
			Db.NonQ(command);
			return true;
		}