Exemplo n.º 1
0
        public bool SetPreferencesV2(string RegistrationKey, webforms_preference prefObj)
        {
            long DentalOfficeID = util.GetDentalOfficeID(RegistrationKey);

            try {
                ODWebServiceEntities db = new ODWebServiceEntities();
                if (DentalOfficeID == 0)
                {
                }
                var wspObj = db.webforms_preference.Where(wsp => wsp.DentalOfficeID == DentalOfficeID);
                //update preference
                if (wspObj.Count() > 0)
                {
                    wspObj.First().ColorBorder = prefObj.ColorBorder;
                    wspObj.First().CultureName = prefObj.CultureName;
                }
                // if there is no entry for that dental office make a new entry.
                if (wspObj.Count() == 0)
                {
                    prefObj.DentalOfficeID = DentalOfficeID;
                    db.AddTowebforms_preference(prefObj);
                }
                db.SaveChanges();
                Logger.Information("Preferences saved IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID);
            }
            catch (Exception ex) {
                Logger.LogError("IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID, ex);
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
0
        public void DeleteSheetData(string RegistrationKey, List <long> SheetsForDeletion)
        {
            long DentalOfficeID = util.GetDentalOfficeID(RegistrationKey);

            try {
                if (DentalOfficeID == 0)
                {
                    return;
                }
                ODWebServiceEntities db = new ODWebServiceEntities();
                for (int i = 0; i < SheetsForDeletion.Count(); i++)
                {
                    long SheetID = SheetsForDeletion.ElementAt(i);                  // LINQ throws an error if this is directly put into the select expression
                    // first delete all sheet field then delete the sheet so that a foreign key error is not thrown
                    var delSheetField = from wsf in db.webforms_sheetfield where wsf.webforms_sheet.SheetID == SheetID
                                        select wsf;
                    for (int j = 0; j < delSheetField.Count(); j++)
                    {
                        // the ElementAt operator only works with lists. Hence ToList()
                        db.DeleteObject(delSheetField.ToList().ElementAt(j));
                    }
                    var delSheet = from ws in db.webforms_sheet where ws.SheetID == SheetID
                                   select ws;
                    db.DeleteObject(delSheet.First());
                    Logger.Information("deleted SheetID=" + SheetID + " DentalOfficeID=" + DentalOfficeID);
                }
                db.SaveChanges();
                Logger.Information("In DeleteSheetData IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID);
            }
            catch (Exception ex) {
                Logger.LogError("IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID, ex);
            }
        }
Exemplo n.º 4
0
        public List <SheetAndSheetField> GetSheets(string RegistrationKey)
        {
            List <SheetAndSheetField> sAndsfList = new List <SheetAndSheetField>();
            long DentalOfficeID = util.GetDentalOfficeID(RegistrationKey);

            try {
                if (DentalOfficeID == 0)
                {
                    return(sAndsfList);
                }
                ODWebServiceEntities db = new ODWebServiceEntities();
                var wsRes = from wsf in db.webforms_sheet
                            where wsf.webforms_preference.DentalOfficeID == DentalOfficeID
                            select wsf;
                for (int i = 0; i < wsRes.Count(); i++)
                {
                    //Only download 20 sheets at a time.  This an attempt to fix DeleteSheetData from timing out after all sheets have been imported.
                    if (i > 19)
                    {
                        break;
                    }
                    var wsobj = wsRes.ToList()[i];
                    wsobj.webforms_sheetfield.Load();
                    var sheetfieldList       = wsobj.webforms_sheetfield;
                    SheetAndSheetField sAnds = new SheetAndSheetField(wsobj, sheetfieldList.ToList());
                    sAndsfList.Add(sAnds);
                }
                Logger.Information("In GetSheetData IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID + " Sheets sent to Client=" + wsRes.Count());
                return(sAndsfList);
            }
            catch (Exception ex) {
                Logger.LogError("IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID, ex);
                return(sAndsfList);
            }
        }
Exemplo n.º 5
0
 public void ProcessRequest(HttpContext context)
 {
     try {
         if (context.Request["WebSheetFieldDefID"] != null)
         {
             Int64.TryParse(context.Request["WebSheetFieldDefID"].ToString().Trim(), out WebSheetFieldDefID);
         }
         /*png images are used because the background of rectangles/lines can be set to transparent. For gif images the process of making the background transparent is convoluted*/
         context.Response.ContentType = "image/png";
         ODWebServiceEntities db  = new ODWebServiceEntities();
         var            sfdObj    = db.webforms_sheetfielddef.Where(sfd => sfd.WebSheetFieldDefID == WebSheetFieldDefID).First();
         SheetFieldType FieldType = (SheetFieldType)sfdObj.FieldType;
         Bitmap         bmp       = null;
         Graphics       g         = null;
         Pen            p         = new Pen(Color.Black, 2.0f);//1.0f does not show, this is a bug in the Drawing namespace.
         if (FieldType == SheetFieldType.Rectangle || FieldType == SheetFieldType.Line)
         {
             bmp = new Bitmap(sfdObj.Width, sfdObj.Height);
             g   = Graphics.FromImage(bmp);
             //g.Clear(Color.Transparent);
         }
         if (FieldType == SheetFieldType.Rectangle)
         {
             g.DrawRectangle(p, 0, 0, sfdObj.Width, sfdObj.Height);
         }
         if (FieldType == SheetFieldType.Line)
         {
             g.DrawLine(p, 0, 0, sfdObj.Width, sfdObj.Height);
         }
         if ((SheetFieldType)sfdObj.FieldType == SheetFieldType.Image)
         {
             string ImageData = sfdObj.ImageData;
             bmp = PIn.Bitmap(ImageData);
         }
         /*  These 3 lines are used in lue of the shorter "bmp.Save(context.Response.OutputStream,ImageFormat.Png);" because it does not work with png images.*/
         MemoryStream MemStream = new MemoryStream();
         bmp.Save(MemStream, System.Drawing.Imaging.ImageFormat.Png);
         MemStream.WriteTo(context.Response.OutputStream);
         if (FieldType == SheetFieldType.Rectangle || FieldType == SheetFieldType.Line)
         {
             g.Dispose();
         }
         bmp.Dispose();
     }
     catch (Exception ex) {
         Logger.LogError("WebSheetFieldDefID=" + WebSheetFieldDefID, ex);
     }
 }
Exemplo n.º 6
0
        public List <webforms_sheetdef> DownloadSheetDefs(string RegistrationKey)
        {
            List <webforms_sheetdef> sheetDefList = null;

            try {
                long DentalOfficeID = util.GetDentalOfficeID(RegistrationKey);
                if (DentalOfficeID == 0)
                {
                    return(sheetDefList);
                }
                ODWebServiceEntities db = new ODWebServiceEntities();
                var SheetDefResult      = db.webforms_sheetdef.Where(sheetdef => sheetdef.webforms_preference.DentalOfficeID == DentalOfficeID);
                sheetDefList = SheetDefResult.ToList();
            }
            catch (Exception ex) {
                Logger.Information(ex.Message.ToString());
                return(sheetDefList);
            }
            return(sheetDefList);
        }
Exemplo n.º 7
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;
            }
        }
Exemplo n.º 8
0
        public webforms_preference GetPreferences(string RegistrationKey)
        {
            Logger.Information("In GetPreferences IpAddress=" + HttpContext.Current.Request.UserHostAddress + " RegistrationKey=" + RegistrationKey);
            ODWebServiceEntities db     = new ODWebServiceEntities();
            webforms_preference  wspObj = null;
            int  DefaultColorBorder     = -12550016;
            long DentalOfficeID         = util.GetDentalOfficeID(RegistrationKey);

            try {
                if (DentalOfficeID == 0)
                {
                    return(wspObj);
                }
                var wspRes = db.webforms_preference.Where(wsp => wsp.DentalOfficeID == DentalOfficeID);
                if (wspRes.Count() > 0)
                {
                    wspObj = wspRes.First();
                }
                // if there is no entry for that dental office make a new entry.
                if (wspRes.Count() == 0)
                {
                    wspObj = new webforms_preference();
                    wspObj.DentalOfficeID = DentalOfficeID;
                    wspObj.ColorBorder    = DefaultColorBorder;
                    wspObj.CultureName    = "";               //empty string because null is not allowed
                    SetPreferencesV2(RegistrationKey, wspObj);
                    Logger.Information("new entry IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID);
                }
                Logger.Information("In GetPreferences IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID);
            }
            catch (Exception ex) {
                Logger.LogError("IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID, ex);
                return(wspObj);
            }
            return(wspObj);
        }
Exemplo n.º 9
0
 private void SaveFieldValuesInDB(long DentalOfficeID, long WebSheetDefID)
 {
     try {
         Logger.Information("In SaveFieldValuesInDB" + " IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID);
         ODWebServiceEntities db    = new ODWebServiceEntities();
         var            SheetDefObj = db.webforms_sheetdef.Where(sd => sd.WebSheetDefID == WebSheetDefID && sd.webforms_preference.DentalOfficeID == DentalOfficeID).First();
         webforms_sheet NewSheetObj = new webforms_sheet();
         NewSheetObj.DateTimeSheet = DateTime.Now;
         NewSheetObj.Height        = SheetDefObj.Height;
         NewSheetObj.Width         = SheetDefObj.Width;
         NewSheetObj.FontName      = SheetDefObj.FontName;
         NewSheetObj.FontSize      = SheetDefObj.FontSize;
         NewSheetObj.SheetType     = SheetDefObj.SheetType;
         NewSheetObj.Description   = SheetDefObj.Description;
         NewSheetObj.IsLandscape   = SheetDefObj.IsLandscape;
         SheetDefObj.webforms_sheetfielddef.Load();
         var SheetFieldDefResult = SheetDefObj.webforms_sheetfielddef;
         //copy sheetfielddef values to sheetfield.The FieldValue, if any is overwritten from the hash table.
         for (int i = 0; i < SheetFieldDefResult.Count(); i++)
         {
             webforms_sheetfield NewSheetfieldObj = new webforms_sheetfield();
             var SheetFieldDefObj = SheetFieldDefResult.ElementAt(i);
             NewSheetfieldObj.FieldName        = SheetFieldDefObj.FieldName;
             NewSheetfieldObj.FieldType        = SheetFieldDefObj.FieldType;
             NewSheetfieldObj.FontIsBold       = SheetFieldDefObj.FontIsBold;
             NewSheetfieldObj.FontName         = SheetFieldDefObj.FontName;
             NewSheetfieldObj.FontSize         = SheetFieldDefObj.FontSize;
             NewSheetfieldObj.Height           = SheetFieldDefObj.Height;
             NewSheetfieldObj.Width            = SheetFieldDefObj.Width;
             NewSheetfieldObj.XPos             = SheetFieldDefObj.XPos;
             NewSheetfieldObj.YPos             = SheetFieldDefObj.YPos;
             NewSheetfieldObj.IsRequired       = SheetFieldDefObj.IsRequired;
             NewSheetfieldObj.RadioButtonGroup = SheetFieldDefObj.RadioButtonGroup;
             NewSheetfieldObj.RadioButtonValue = SheetFieldDefObj.RadioButtonValue;
             NewSheetfieldObj.GrowthBehavior   = SheetFieldDefObj.GrowthBehavior;
             NewSheetfieldObj.TabOrder         = SheetFieldDefObj.TabOrder;
             NewSheetfieldObj.FieldValue       = SheetFieldDefObj.FieldValue;
             long WebSheetFieldDefID = SheetFieldDefObj.WebSheetFieldDefID;
             if (FormValuesHashTable.ContainsKey(WebSheetFieldDefID + ""))
             {
                 NewSheetfieldObj.FieldValue = FormValuesHashTable[WebSheetFieldDefID + ""].ToString();
             }
             #region  saving dates in right formats
             string FieldValue  = NewSheetfieldObj.FieldValue;
             string FieldName   = NewSheetfieldObj.FieldName;
             string CultureName = db.webforms_preference.Where(pref => pref.DentalOfficeID == DentalOfficeID).First().CultureName;                      // culture of the opendental installation
             if (String.IsNullOrEmpty(CultureName))
             {
                 CultureName = "en-US";
             }
             if (FieldValue.Contains("[dateToday]"))
             {
                 FieldValue = FieldValue.Replace("[dateToday]", ExtractBrowserDate().ToString("d", new CultureInfo(CultureName, false)));
                 Logger.Information("FieldName=" + FieldName + " FieldValue=" + FieldValue);
                 NewSheetfieldObj.FieldValue = FieldValue;
             }
             if (FieldName.ToLower() == "birthdate" || FieldName.ToLower() == "bdate")
             {
                 Logger.Information("FieldName=" + FieldName + " FieldValue=" + FieldValue);
                 DateTime birthdate = DateTime.Parse(FieldValue, System.Threading.Thread.CurrentThread.CurrentCulture); //use the browsers culture to get correct date.
                 FieldValue = birthdate.ToString("d", new CultureInfo(CultureName, false));                             //now convert the birthdate into a string using the culture of the corresponding opendental installation.
                 NewSheetfieldObj.FieldValue = FieldValue;
             }
             #endregion
             NewSheetObj.webforms_sheetfield.Add(NewSheetfieldObj);
         }
         var PrefObj = db.webforms_preference.Where(wp => wp.DentalOfficeID == DentalOfficeID);
         if (PrefObj.Count() > 0)
         {
             PrefObj.First().webforms_sheet.Add(NewSheetObj);
             db.SaveChanges();
             DisplayMessage("Your details have been successfully submitted");
             Logger.Information("Form values saved from IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID);
         }
     }
     catch (Exception ex) {
         Logger.LogError("IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID + " WebSheetDefID=" + WebSheetDefID, ex);
         Panel1.Visible = false;
         DisplayMessage("There has been a problem submitting your details. <br /> We apologize for the inconvenience.");
     }
 }
Exemplo n.º 10
0
 private void GeneratePage(long DentalOfficeID, long WebSheetDefID)
 {
     try {
         int    FormXOffset                         = 37;
         int    FormYOffset                         = 26;
         int    ImageXOffset                        = 0;
         int    ImageYOffset                        = 0;
         int    ImageZIndex                         = 1;
         int    DrawingZIndex                       = 2;
         int    ElementZIndex                       = 3;
         int    SubmitButtonWidth                   = 70;
         int    SubmitButtonYoffset                 = 10;
         int    RadioButtonXOffset                  = -4;
         int    RadioButtonYOffset                  = -5;
         int    RadioButtonXOffsetIE                = 0;
         int    RadioButtonXOffsetFirefox           = -2;
         float  CheckBoxXOffset                     = -4.0f;
         float  CheckBoxYOffset                     = -4.0f;
         int    SignatureFontSize                   = 16;
         String SignatureFont                       = "sans-serif";
         float  heightfactor                        = 1.2f;
         System.Web.HttpBrowserCapabilities browser = Request.Browser;
         if (browser.Browser == "Firefox")
         {
             RadioButtonXOffset += RadioButtonXOffsetFirefox;
         }
         if (browser.Browser == "IE")
         {
             RadioButtonXOffset += RadioButtonXOffsetIE;
         }
         ODWebServiceEntities db = new ODWebServiceEntities();
         int ColorBorder         = db.webforms_preference.Where(pref => pref.DentalOfficeID == DentalOfficeID).First().ColorBorder;
         bodytag.Attributes.Add("bgcolor", ColorTranslator.ToHtml(Color.FromArgb(ColorBorder)));
         var  SheetDefObj         = db.webforms_sheetdef.Where(sd => sd.WebSheetDefID == WebSheetDefID && sd.webforms_preference.DentalOfficeID == DentalOfficeID).First();
         int  SheetDefWidth       = SheetDefObj.Width;
         int  SheetDefHeight      = SheetDefObj.Height;
         bool SheetDefIsLandscape = SheetDefObj.IsLandscape == (sbyte)1?true:false;
         if (SheetDefIsLandscape)
         {
             SheetDefWidth  = SheetDefObj.Height;
             SheetDefHeight = SheetDefObj.Width;
         }
         form1.Style["position"]         = "absolute";
         form1.Style["top"]              = FormXOffset + "px";
         form1.Style["left"]             = FormYOffset + "px";
         form1.Style["width"]            = SheetDefWidth + "px";
         form1.Style["height"]           = SheetDefHeight + "px";
         form1.Style["background-color"] = "white";
         var SheetFieldDefList = (db.webforms_sheetfielddef.Where(sfd => sfd.webforms_sheetdef.WebSheetDefID == WebSheetDefID && sfd.webforms_sheetdef.webforms_preference.DentalOfficeID == DentalOfficeID)).ToList();
         for (int j = 0; j < SheetFieldDefList.Count(); j++)
         {
             String         FieldName  = SheetFieldDefList.ElementAt(j).FieldName;
             String         FieldValue = SheetFieldDefList.ElementAt(j).FieldValue;
             SheetFieldType FieldType  = (SheetFieldType)SheetFieldDefList.ElementAt(j).FieldType;
             int            XPos       = SheetFieldDefList.ElementAt(j).XPos;
             int            YPos       = SheetFieldDefList.ElementAt(j).YPos;
             int            width      = SheetFieldDefList.ElementAt(j).Width;
             int            height     = SheetFieldDefList.ElementAt(j).Height;
             float          fontsize   = SheetFieldDefList.ElementAt(j).FontSize;
             String         fontname   = SheetFieldDefList.ElementAt(j).FontName;
             //bool fontIsBold=SheetFieldDefList.ElementAt(j).FontIsBold==(sbyte)1?true:false;
             bool fontIsBold;
             if (SheetFieldDefList.ElementAt(j).FontIsBold == (sbyte)1)
             {
                 fontIsBold = true;
             }
             else
             {
                 fontIsBold = false;
             }
             short TabOrder = (short)SheetFieldDefList.ElementAt(j).TabOrder;
             if (TabOrder != 0)
             {
                 doTabOrder = false;
             }
             long       WebSheetFieldDefID = SheetFieldDefList.ElementAt(j).WebSheetFieldDefID;
             WebControl wc = null;                           // WebControl is the parent class of all controls
             if (FieldType == SheetFieldType.InputField)
             {
                 TextBox tb       = new TextBox();
                 int     rowcount = (int)Math.Floor((double)height / fontsize);
                 if (rowcount > 1)
                 {
                     tb.TextMode = TextBoxMode.MultiLine;
                     tb.Rows     = rowcount;
                 }
                 tb.Text = FieldValue;
                 wc      = tb;
             }
             if (FieldType == SheetFieldType.CheckBox)
             {
                 wc = AddCheckBox(SheetFieldDefList.ElementAt(j));
             }
             if (FieldType == SheetFieldType.StaticText)
             {
                 Label lb = new Label();
                 if (FieldValue.Contains("[dateToday]"))
                 {
                     dateTodayList.Add(WebSheetFieldDefID);                                           // the replacing is done at the client side using javascript via a hidden variable.
                 }
                 lb.Text = FieldValue.Replace(Environment.NewLine, "<br />").Replace("\n", "<br />"); //it appears that the text contains only "\n" as the newline character and not Environment.NewLine (i.e "\n\r") as the line break, so the code takes into account both cases.
                 wc      = lb;
             }
             if (FieldType == SheetFieldType.Image || FieldType == SheetFieldType.Rectangle || FieldType == SheetFieldType.Line)
             {
                 // this is a bug which must be addressed. Horizontal and vertical lines may have either height or width as zero. this throws an error, so they have been excluded for now
                 if (width != 0 && height != 0)
                 {
                     System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
                     img.ImageUrl = ("~/Handler1.ashx?WebSheetFieldDefID=" + WebSheetFieldDefID);
                     wc           = img;
                 }
             }
             if (FieldType == SheetFieldType.SigBox)
             {
                 Panel pa = new Panel();
                 pa.BorderStyle     = BorderStyle.Solid;
                 pa.BorderWidth     = Unit.Pixel(1);
                 pa.HorizontalAlign = HorizontalAlign.Center;
                 Label lb = new Label();
                 lb.Style["font-family"] = SignatureFont;
                 lb.Style["font-size"]   = SignatureFontSize + "px";
                 lb.Style["position"]    = "relative";
                 lb.Style["top"]         = (height - SignatureFontSize) / 2 + "px";
                 lb.Text = "Signature will be recorded later";
                 pa.Controls.Add(lb);
                 wc = pa;
             }
             if (wc != null)
             {
                 wc.ID = "" + WebSheetFieldDefID;
                 wc.Style["position"] = "absolute";
                 wc.Style["width"]    = width + "px";
                 wc.Style["height"]   = height + "px";
                 wc.Style["top"]      = YPos + "px";
                 wc.Style["left"]     = XPos + "px";
                 wc.Style["z-index"]  = "" + ElementZIndex;
                 wc.TabIndex          = TabOrder;
                 if (FieldType == SheetFieldType.Image)
                 {
                     wc.Style["top"]     = YPos + ImageYOffset + "px";
                     wc.Style["left"]    = XPos + ImageXOffset + "px";
                     wc.Style["z-index"] = "" + ImageZIndex;
                 }
                 if (FieldType == SheetFieldType.Rectangle || FieldType == SheetFieldType.Line)
                 {
                     wc.Style["z-index"] = "" + DrawingZIndex;
                 }
                 if (FieldType == SheetFieldType.InputField)                                //textboxes
                 {
                     wc.Style["font-family"] = fontname;
                     wc.Style["font-size"]   = fontsize + "pt";
                     wc.Style["height"]      = height / heightfactor + "px";
                     if (fontIsBold)
                     {
                         wc.Font.Bold = true;
                     }
                     wc.BorderWidth = Unit.Pixel(0);
                     wc.BackColor   = Color.LightYellow;
                     AddTextBoxValidator(SheetFieldDefList.ElementAt(j));
                     WControl wcobj = new WControl(XPos, YPos, wc);
                     listwc.Add(wcobj);
                 }
                 if (wc.GetType() == typeof(RadioButtonList))
                 {
                     wc.Style["position"] = "static";
                     WControl wcobj = new WControl(XPos, YPos, wc);
                     listwc.Add(wcobj);
                 }
                 if (wc.GetType() == typeof(CheckBox))
                 {
                     wc.Style["top"]  = YPos + CheckBoxYOffset + "px";
                     wc.Style["left"] = XPos + CheckBoxXOffset + "px";
                     AddRequiredChkBoxValidator(SheetFieldDefList.ElementAt(j), CheckBoxXOffset, CheckBoxYOffset);
                     WControl wcobj = new WControl(XPos, YPos, wc);
                     listwc.Add(wcobj);
                 }
                 if (FieldType == SheetFieldType.StaticText)
                 {
                     wc.Style["font-family"] = fontname;
                     wc.Style["font-size"]   = fontsize + "pt";
                     if (fontIsBold)
                     {
                         wc.Font.Bold = true;
                     }
                 }
                 Panel1.Controls.Add(wc);
             }
         }                        //for loop end here
         AdjustErrorMessageForChkBoxes();
         CreateChkBoxValidatorsHiddenFields();
         CreateHiddenFieldForDateToday();
         if (doTabOrder)
         {
             AssignTabOrder();
         }
         //position the submit button at the end of the page.
         Button1.Style["position"] = "absolute";
         Button1.Style["left"]     = SheetDefWidth / 2 - (SubmitButtonWidth / 2) + "px";
         Button1.Style["top"]      = SheetDefHeight + SubmitButtonYoffset + "px";
         Button1.Style["z-index"]  = "" + ElementZIndex;
         Button1.Width             = Unit.Pixel(SubmitButtonWidth);
         Panel3.Style["position"]  = "absolute";
         Panel3.Style["top"]       = FormXOffset + SheetDefHeight + SubmitButtonYoffset + "px";
     }
     catch (ApplicationException ex) {
         Logger.LogError("IpAddress=" + HttpContext.Current.Request.UserHostAddress + " DentalOfficeID=" + DentalOfficeID, ex);
         DisplayMessage("Error: Your form is not available. Please contact your Dental Office");
     }
 }