Exemplo n.º 1
0
 /// <summary>
 /// All checkboxes that require validation are stored in the format:
 /// key=hiddenChkBoxGroup+(ChkBoxGroupName) and value= "chkbxid1 chkbxid1 chkbxid1"
 /// </summary>
 private void AddChkBoxIdsToHashTable(webforms_sheetfielddef sfd)
 {
     String ChkBoxGroupName=GetChkBoxGroupName(sfd);
     String Key="hiddenChkBoxGroup"+ChkBoxGroupName;
     String Value=""+sfd.WebSheetFieldDefID;
     if(hiddenChkBoxGroupHashTable.ContainsKey(Key)) {
         hiddenChkBoxGroupHashTable[Key]+=" "+Value;
     }
     else {
         hiddenChkBoxGroupHashTable.Add(Key,Value);
     }
 }
Exemplo n.º 2
0
 private WebControl AddCheckBox(webforms_sheetfielddef sfd)
 {
     WebControl wc=null;
     CheckBox cb=new CheckBox();
     cb.ID=""+sfd.WebSheetFieldDefID;
     AjaxControlToolkit.MutuallyExclusiveCheckBoxExtender mecb=new AjaxControlToolkit.MutuallyExclusiveCheckBoxExtender();
     mecb.ID=cb.ID+"MutuallyExclusiveCheckBoxExtender";
     mecb.TargetControlID=cb.ID;
     mecb.Key=GetChkBoxGroupName(sfd);
     Panel1.Controls.Add(mecb);
     wc=cb;
     return wc;
 }
Exemplo n.º 3
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
     }
 }
Exemplo n.º 4
0
		private void AddRequiredChkBoxValidator(webforms_sheetfielddef sfd,float CheckBoxXOffset,float CheckBoxYOffset) {
			if(sfd.IsRequired!=(sbyte)1) {
				return;
			}
			int XPosErrorMessageOffset=2;
			int XPos=sfd.XPos;
			int YPos=sfd.YPos;
			String ErrorMessage="This is a required section. Please check one of the Check Boxes";
			//add dummy textbox to get around the limitation of checkboxes not having validators and call outs.
			TextBox tb=new TextBox();
			tb.Rows=1;
			tb.Text=".";// there has to be some character here the least visible is the period.
			tb.MaxLength=1;
			tb.Width=Unit.Pixel(1);
			tb.ID="TextBoxForCheckbox"+sfd.WebSheetFieldDefID;
			tb.Style["position"]="absolute";
			tb.Style["top"]=YPos+CheckBoxYOffset+"px";
			tb.Style["left"]=XPos+CheckBoxXOffset+XPosErrorMessageOffset+ sfd.Width+"px";
			tb.Style["z-index"]="-2";
			tb.ReadOnly=true;
			tb.BorderWidth=Unit.Pixel(0);
			Panel1.Controls.Add(tb);
			CustomValidator cv=new CustomValidator();
			cv.ControlToValidate=tb.ID;
			cv.ErrorMessage=ErrorMessage;
			cv.Display=ValidatorDisplay.None;
			cv.SetFocusOnError=true;
			cv.ID="CustomValidator"+cv.ControlToValidate;
			cv.ClientValidationFunction="CheckCheckBoxes";
			Panel1.Controls.Add(cv);
			//callout extender
			AjaxControlToolkit.ValidatorCalloutExtender vc=new AjaxControlToolkit.ValidatorCalloutExtender();
			vc.TargetControlID=cv.ID;
			vc.ID="ValidatorCalloutExtender"+cv.ID;
			Panel1.Controls.Add(vc);
			AddChkBoxIdsToHashTable(sfd);			
		}
Exemplo n.º 5
0
		private void AddTextBoxValidator(webforms_sheetfielddef sfd ) {
			String FieldName=sfd.FieldName;
			String ErrorMessage="";
			if(FieldName.ToLower()=="fname" || FieldName.ToLower()=="firstname") {
				ErrorMessage="First Name is a required field";
			}
			else if(FieldName.ToLower()=="lname" || FieldName.ToLower()=="lastname") {
				ErrorMessage="Last Name is a required field";
			}
			else if(FieldName.ToLower()=="birthdate" || FieldName.ToLower()=="bdate") {
				ErrorMessage="Birthdate is a required field";
			}
			else if(sfd.IsRequired==(sbyte)1) {
				ErrorMessage="This is a required field";
			}
			else {
				return;
			}
			// required field validator
			RequiredFieldValidator rv=new RequiredFieldValidator();
			rv.ControlToValidate=""+sfd.WebSheetFieldDefID;
			rv.ErrorMessage=ErrorMessage;
			rv.Display=ValidatorDisplay.None;
			rv.SetFocusOnError=true;
			rv.ID="RequiredFieldValidator"+rv.ControlToValidate;
			Panel1.Controls.Add(rv);
			//callout extender
			AjaxControlToolkit.ValidatorCalloutExtender vc=new AjaxControlToolkit.ValidatorCalloutExtender();
			vc.TargetControlID=rv.ID;
			vc.ID="ValidatorCalloutExtender"+rv.ID;
			Panel1.Controls.Add(vc);
			if(FieldName.ToLower()=="birthdate" || FieldName.ToLower()=="bdate") {
				//compare validator
				CompareValidator cv=new CompareValidator();
				cv.ControlToValidate=""+sfd.WebSheetFieldDefID;
				cv.ErrorMessage="Invalid Date of Birth.";
				cv.Display=ValidatorDisplay.None;
				cv.Type=ValidationDataType.Date;
				cv.Operator=ValidationCompareOperator.DataTypeCheck;
				cv.SetFocusOnError=true;
				cv.ID="CompareValidator"+cv.ControlToValidate;
				//callout extender
				AjaxControlToolkit.ValidatorCalloutExtender vc1=new AjaxControlToolkit.ValidatorCalloutExtender();
				vc1.TargetControlID=cv.ID;
				vc1.ID="ValidatorCalloutExtender"+cv.ID;
				Panel1.Controls.Add(cv);
				Panel1.Controls.Add(vc1);
				
			}
		}
Exemplo n.º 6
0
		private string GetChkBoxGroupName(webforms_sheetfielddef sfd) {
			String FieldName=sfd.FieldName;
			String RadioButtonValue=sfd.RadioButtonValue;
			String RadioButtonGroup=sfd.RadioButtonGroup;
			String ChkBoxGroupName=null;
			if(!String.IsNullOrEmpty(RadioButtonGroup) && FieldName=="misc") {
				ChkBoxGroupName=RadioButtonGroup;
			}
			else if(!String.IsNullOrEmpty(RadioButtonValue)) {// cases like gender, position etc that have no value for RadioButtonGroup but have RadioButtonValue
				ChkBoxGroupName=FieldName;
			}
			if(!String.IsNullOrEmpty(ChkBoxGroupName)) {
				ChkBoxGroupName=GetValidCheckBoxName(ChkBoxGroupName);
			}
			return ChkBoxGroupName;
		}
 /// <summary>
 /// Deprecated Method for adding a new object to the webforms_sheetfielddef EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTowebforms_sheetfielddef(webforms_sheetfielddef webforms_sheetfielddef)
 {
     base.AddObject("webforms_sheetfielddef", webforms_sheetfielddef);
 }
 /// <summary>
 /// Create a new webforms_sheetfielddef object.
 /// </summary>
 /// <param name="fieldName">Initial value of the FieldName property.</param>
 /// <param name="fieldType">Initial value of the FieldType property.</param>
 /// <param name="fieldValue">Initial value of the FieldValue property.</param>
 /// <param name="fontIsBold">Initial value of the FontIsBold property.</param>
 /// <param name="fontName">Initial value of the FontName property.</param>
 /// <param name="fontSize">Initial value of the FontSize property.</param>
 /// <param name="growthBehavior">Initial value of the GrowthBehavior property.</param>
 /// <param name="height">Initial value of the Height property.</param>
 /// <param name="imageData">Initial value of the ImageData property.</param>
 /// <param name="isRequired">Initial value of the IsRequired property.</param>
 /// <param name="radioButtonGroup">Initial value of the RadioButtonGroup property.</param>
 /// <param name="radioButtonValue">Initial value of the RadioButtonValue property.</param>
 /// <param name="webSheetDefID">Initial value of the WebSheetDefID property.</param>
 /// <param name="webSheetFieldDefID">Initial value of the WebSheetFieldDefID property.</param>
 /// <param name="width">Initial value of the Width property.</param>
 /// <param name="xPos">Initial value of the XPos property.</param>
 /// <param name="yPos">Initial value of the YPos property.</param>
 /// <param name="tabOrder">Initial value of the TabOrder property.</param>
 public static webforms_sheetfielddef Createwebforms_sheetfielddef(global::System.String fieldName, global::System.Int32 fieldType, global::System.String fieldValue, global::System.SByte fontIsBold, global::System.String fontName, global::System.Single fontSize, global::System.Int32 growthBehavior, global::System.Int32 height, global::System.String imageData, global::System.SByte isRequired, global::System.String radioButtonGroup, global::System.String radioButtonValue, global::System.Int64 webSheetDefID, global::System.Int64 webSheetFieldDefID, global::System.Int32 width, global::System.Int32 xPos, global::System.Int32 yPos, global::System.Int32 tabOrder)
 {
     webforms_sheetfielddef webforms_sheetfielddef = new webforms_sheetfielddef();
     webforms_sheetfielddef.FieldName = fieldName;
     webforms_sheetfielddef.FieldType = fieldType;
     webforms_sheetfielddef.FieldValue = fieldValue;
     webforms_sheetfielddef.FontIsBold = fontIsBold;
     webforms_sheetfielddef.FontName = fontName;
     webforms_sheetfielddef.FontSize = fontSize;
     webforms_sheetfielddef.GrowthBehavior = growthBehavior;
     webforms_sheetfielddef.Height = height;
     webforms_sheetfielddef.ImageData = imageData;
     webforms_sheetfielddef.IsRequired = isRequired;
     webforms_sheetfielddef.RadioButtonGroup = radioButtonGroup;
     webforms_sheetfielddef.RadioButtonValue = radioButtonValue;
     webforms_sheetfielddef.WebSheetDefID = webSheetDefID;
     webforms_sheetfielddef.WebSheetFieldDefID = webSheetFieldDefID;
     webforms_sheetfielddef.Width = width;
     webforms_sheetfielddef.XPos = xPos;
     webforms_sheetfielddef.YPos = yPos;
     webforms_sheetfielddef.TabOrder = tabOrder;
     return webforms_sheetfielddef;
 }
Exemplo n.º 9
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);
								}
							}
							//Check if the current field is of type Color.  We check fieldinfo instead of propertyinfo because propertyinfo should be of type int (if done correctly).
							else if(fieldinfo.FieldType==typeof(Color)) {
								propertyinfo.SetValue(SheetFieldDefObj,((Color)fieldinfo.GetValue(sheetDef.SheetFieldDefs[i])).ToArgb(),null);//Color fields are stored as ints.
							}
							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
			}
		}