Exemple #1
0
        ///<summary>Re-orders the SheetFieldType enum to a drawing order. Images should be drawn first, then drawings, then lines, then rectangles, etc...</summary>
        internal static int FieldTypeSortOrder(SheetFieldType t)
        {
            switch (t)
            {
            case SheetFieldType.Image:
            case SheetFieldType.PatImage:
                return(0);

            case SheetFieldType.Drawing:
                return(1);

            case SheetFieldType.Line:
            case SheetFieldType.Rectangle:
                return(2);

            case SheetFieldType.Grid:
                return(3);

            case SheetFieldType.OutputText:
            case SheetFieldType.InputField:
            case SheetFieldType.StaticText:
                return(4);

            case SheetFieldType.CheckBox:
                return(5);

            case SheetFieldType.SigBox:
                return(6);

            case SheetFieldType.Special:
            case SheetFieldType.Parameter:
            default:
                return(int.MaxValue);
            }
        }
Exemple #2
0
 private SheetFieldDef(SheetFieldType fieldType, string fieldName, string fieldValue,
                       float fontSize, string fontName, bool fontIsBold,
                       int xPos, int yPos, int width, int height,
                       GrowthBehaviorEnum growthBehavior, string radioButtonValue, bool isPaymentOption = false, KnownColor itemColor = KnownColor.Black, HorizontalAlignment textAlign = HorizontalAlignment.Left, bool isNew = false)
 {
     FieldType                = fieldType;
     FieldName                = fieldName;
     FieldValue               = fieldValue;
     FontSize                 = fontSize;
     FontName                 = fontName;
     FontIsBold               = fontIsBold;
     XPos                     = xPos;
     YPos                     = yPos;
     Width                    = width;
     Height                   = height;
     GrowthBehavior           = growthBehavior;
     RadioButtonValue         = radioButtonValue;
     IsNew                    = isNew;
     IsPaymentOption          = isPaymentOption;
     ItemColor                = Color.FromKnownColor(itemColor);
     TextAlign                = textAlign;
     RadioButtonGroup         = "";
     ImageData                = "";
     ReportableName           = "";
     UiLabelMobile            = "";
     UiLabelMobileRadioButton = "";
 }
Exemple #3
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);
     }
 }
Exemple #4
0
 ///<summary>Evaluates input fields an determines if this is a SheetField (or SheetFieldDef) that would be shown in mobile layout.
 ///Returns true if criteria is met to show this field in mobile layout. Otherwise returns false.</summary>
 public static bool IsMobileFieldType(SheetFieldType sheetFieldType, int tabOrderMobile, string fieldName)
 {
     //No remoting role needed.
     //Always include these FieldTypes
     return(sheetFieldType.In
            (
                SheetFieldType.ComboBox,
                SheetFieldType.InputField,
                SheetFieldType.MobileHeader,
                SheetFieldType.SigBox,
                SheetFieldType.OutputText
            )
            //Only include StaticText if it has a valid TabOrderMobile.  Treat OutputText fields as a StaticText
            || (sheetFieldType.In(SheetFieldType.StaticText, SheetFieldType.OutputText) && tabOrderMobile >= 1)
            //checkMed checkboxes are ignored. All other checkboxes are included.
            || (sheetFieldType == SheetFieldType.CheckBox && !fieldName.StartsWith("checkMed")));
 }
Exemple #5
0
 ///<summary>DEPRECATED. Simple constructor, useful in conjunction with initializer.</summary>
 public SheetFieldDef(SheetFieldType fieldType, int x, int y, int width, int height, Font font = null, string fieldValue = "")
 {
     this.RadioButtonGroup = "";
     this.ImageData        = "";
     this.FieldType        = fieldType;
     this.XPos             = x;
     this.YPos             = y;
     this.Width            = width;
     this.Height           = height;
     if (font != null)
     {
         this.FontName   = font.Name;
         this.FontSize   = font.SizeInPoints;
         this.FontIsBold = font.Bold;
     }
     this.FieldValue = fieldValue;
     this.ItemColor  = Color.Black;
 }
Exemple #6
0
 public SheetFieldDef(SheetFieldType fieldType, string fieldName, string fieldValue,
                      float fontSize, string fontName, bool fontIsBold,
                      int xPos, int yPos, int width, int height,
                      GrowthBehaviorEnum growthBehavior, string radioButtonValue)
 {
     FieldType        = fieldType;
     FieldName        = fieldName;
     FieldValue       = fieldValue;
     FontSize         = fontSize;
     FontName         = fontName;
     FontIsBold       = fontIsBold;
     XPos             = xPos;
     YPos             = yPos;
     Width            = width;
     Height           = height;
     GrowthBehavior   = growthBehavior;
     RadioButtonValue = radioButtonValue;
 }
Exemple #7
0
        public SheetFieldDef(SheetFieldType fieldType,string fieldName,string fieldValue,
			float fontSize,string fontName,bool fontIsBold,
			int xPos,int yPos,int width,int height,
			GrowthBehaviorEnum growthBehavior,string radioButtonValue)
        {
            FieldType=fieldType;
            FieldName=fieldName;
            FieldValue=fieldValue;
            FontSize=fontSize;
            FontName=fontName;
            FontIsBold=fontIsBold;
            XPos=xPos;
            YPos=yPos;
            Width=width;
            Height=height;
            GrowthBehavior=growthBehavior;
            RadioButtonValue=radioButtonValue;
        }
Exemple #8
0
		public SheetFieldDef(SheetFieldType fieldType,string fieldName,string fieldValue,
			float fontSize,string fontName,bool fontIsBold,
			int xPos,int yPos,int width,int height,
			GrowthBehaviorEnum growthBehavior,string radioButtonValue,bool isPaymentOption=false,KnownColor itemColor=KnownColor.Black,HorizontalAlignment textAlign=HorizontalAlignment.Left) 
		{
			FieldType=fieldType;
			FieldName=fieldName;
			FieldValue=fieldValue;
			FontSize=fontSize;
			FontName=fontName;
			FontIsBold=fontIsBold;
			XPos=xPos;
			YPos=yPos;
			Width=width;
			Height=height;
			GrowthBehavior=growthBehavior;
			RadioButtonValue=radioButtonValue;
			IsPaymentOption=isPaymentOption;
			ItemColor=Color.FromKnownColor(itemColor);
			TextAlign=textAlign;
		}
Exemple #9
0
 public SheetFieldDef(SheetFieldType fieldType, string fieldName, string fieldValue,
                      float fontSize, string fontName, bool fontIsBold,
                      int xPos, int yPos, int width, int height,
                      GrowthBehaviorEnum growthBehavior, string radioButtonValue, bool isPaymentOption = false, KnownColor itemColor = KnownColor.Black, HorizontalAlignment textAlign = HorizontalAlignment.Left)
 {
     FieldType        = fieldType;
     FieldName        = fieldName;
     FieldValue       = fieldValue;
     FontSize         = fontSize;
     FontName         = fontName;
     FontIsBold       = fontIsBold;
     XPos             = xPos;
     YPos             = yPos;
     Width            = width;
     Height           = height;
     GrowthBehavior   = growthBehavior;
     RadioButtonValue = radioButtonValue;
     IsPaymentOption  = isPaymentOption;
     ItemColor        = Color.FromKnownColor(itemColor);
     TextAlign        = textAlign;
 }
Exemple #10
0
 public static SheetFieldDef NewSigBox(int xPos, int yPos, int width, int height, SheetFieldType sigBox = SheetFieldType.SigBox)
 {
     return(new SheetFieldDef(sigBox, "", "", 0, "", false,
                              xPos, yPos, width, height, GrowthBehaviorEnum.None, "", isNew: true));
 }
Exemple #11
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");
     }
 }
Exemple #12
0
		///<summary>Re-orders the SheetFieldType enum to a drawing order. Images should be drawn first, then drawings, then lines, then rectangles, etc...</summary>
		internal static int FieldTypeSortOrder(SheetFieldType t) {
			switch(t) {
				case SheetFieldType.Image:
				case SheetFieldType.PatImage:
					return 0;
				case SheetFieldType.Drawing:
					return 1;
				case SheetFieldType.Line:
				case SheetFieldType.Rectangle:
					return 2;
				case SheetFieldType.Grid:
					return 3;
				case SheetFieldType.OutputText:
				case SheetFieldType.InputField:
				case SheetFieldType.StaticText:
					return 4;
				case SheetFieldType.CheckBox:
					return 5;
				case SheetFieldType.SigBox:
					return 6;
				case SheetFieldType.Special:
				case SheetFieldType.Parameter:
				default:
					return int.MaxValue;
			}
		}