Exemple #1
0
        public void DeleteSheetDef(string RegistrationKey, long WebSheetDefID)
        {
            long DentalOfficeID = util.GetDentalOfficeID(RegistrationKey);

            try {
                if (DentalOfficeID == 0)
                {
                    return;
                }
                ODWebServiceEntities db          = new ODWebServiceEntities();
                webforms_sheetdef    SheetDefObj = null;
                var SheetDefResult = db.webforms_sheetdef.Where(sd => sd.WebSheetDefID == WebSheetDefID);
                if (SheetDefResult.Count() > 0)
                {
                    SheetDefObj = SheetDefResult.First();
                    //load and delete existing child objects i.e sheetfielddefs objects
                    SheetDefObj.webforms_sheetfielddef.Load();
                    var SheetFieldDefResult = SheetDefObj.webforms_sheetfielddef;
                    while (SheetFieldDefResult.Count() > 0)
                    {
                        db.DeleteObject(SheetFieldDefResult.First());                   //Delete SheetFieldDefObj
                    }
                    db.DeleteObject(SheetDefResult.First());                            //Delete SheetDefObj
                    Logger.Information("deleted WebSheetDefID=" + WebSheetDefID + " DentalOfficeID=" + DentalOfficeID);
                }
                db.SaveChanges();
                Logger.Information("In DeleteSheetDef IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID);
            }
            catch (Exception ex) {
                Logger.LogError("IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID, ex);
            }
        }
Exemple #2
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;
        }
Exemple #3
0
 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;
     }
 }
Exemple #4
0
 private void FillFieldSheetDef(SheetDef sheetDef, webforms_sheetdef SheetDefObj)
 {
     for (int i = 0; i < sheetDef.SheetFieldDefs.Count(); i++)       //assign several webforms_sheetfielddef
     {
         webforms_sheetfielddef SheetFieldDefObj = new webforms_sheetfielddef();
         SheetDefObj.webforms_sheetfielddef.Add(SheetFieldDefObj);
         // assign each property of a single webforms_sheetfielddef with corresponding values.
         foreach (FieldInfo fieldinfo in sheetDef.SheetFieldDefs[i].GetType().GetFields())
         {
             foreach (PropertyInfo propertyinfo in SheetFieldDefObj.GetType().GetProperties())
             {
                 if (fieldinfo.Name == propertyinfo.Name)
                 {
                     if (propertyinfo.PropertyType == typeof(SByte))
                     {
                         if ((bool)fieldinfo.GetValue(sheetDef.SheetFieldDefs[i]) == true)
                         {
                             propertyinfo.SetValue(SheetFieldDefObj, (sbyte)1, null);
                         }
                         else
                         {
                             propertyinfo.SetValue(SheetFieldDefObj, (sbyte)0, null);
                         }
                     }
                     else
                     {
                         if (fieldinfo.GetValue(sheetDef.SheetFieldDefs[i]) == null)
                         {
                             propertyinfo.SetValue(SheetFieldDefObj, "", null);
                         }
                         else
                         {
                             propertyinfo.SetValue(SheetFieldDefObj, fieldinfo.GetValue(sheetDef.SheetFieldDefs[i]), null);
                         }
                     }
                 }
             }            //foreach propertyinfo
         }                //foreach fieldinfo
     }
 }
Exemple #5
0
        public void UpLoadSheetDef(string RegistrationKey, SheetDef sheetDef)
        {
            ODWebServiceEntities db = new ODWebServiceEntities();
            long DentalOfficeID     = util.GetDentalOfficeID(RegistrationKey);

            try{
                if (DentalOfficeID == 0)
                {
                    return;
                }
                var PreferenceResult          = db.webforms_preference.Where(pref => pref.DentalOfficeID == DentalOfficeID);
                webforms_sheetdef SheetDefObj = null;
                SheetDefObj = new webforms_sheetdef();
                PreferenceResult.First().webforms_sheetdef.Add(SheetDefObj);
                FillSheetDef(sheetDef, SheetDefObj);
                FillFieldSheetDef(sheetDef, SheetDefObj);
                db.SaveChanges();
            }
            catch (Exception ex) {
                Logger.LogError("IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID, ex);
                return;
            }
        }
Exemple #6
0
 private string SheetDefBaseURL(webforms_sheetdef sheetDef)
 {
     return(SheetDefAddress + "?DOID=" + DentalOfficeID + "&WSDID=" + sheetDef.WebSheetDefID);
 }