Beispiel #1
0
 public SheetAndSheetField(webforms_sheet web_sheet,List<webforms_sheetfield> web_sheetfieldlist)
 {
     this.web_sheet=web_sheet;
     this.web_sheetfieldlist=web_sheetfieldlist;
 }
 /// <summary>
 /// Create a new webforms_sheet object.
 /// </summary>
 /// <param name="dateTimeSheet">Initial value of the DateTimeSheet property.</param>
 /// <param name="dentalOfficeID">Initial value of the DentalOfficeID property.</param>
 /// <param name="fontSize">Initial value of the FontSize property.</param>
 /// <param name="height">Initial value of the Height property.</param>
 /// <param name="isLandscape">Initial value of the IsLandscape property.</param>
 /// <param name="sheetID">Initial value of the SheetID property.</param>
 /// <param name="sheetType">Initial value of the SheetType property.</param>
 /// <param name="width">Initial value of the Width property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 public static webforms_sheet Createwebforms_sheet(global::System.DateTime dateTimeSheet, global::System.Int64 dentalOfficeID, global::System.Single fontSize, global::System.Int32 height, global::System.SByte isLandscape, global::System.Int64 sheetID, global::System.Int32 sheetType, global::System.Int32 width, global::System.String description)
 {
     webforms_sheet webforms_sheet = new webforms_sheet();
     webforms_sheet.DateTimeSheet = dateTimeSheet;
     webforms_sheet.DentalOfficeID = dentalOfficeID;
     webforms_sheet.FontSize = fontSize;
     webforms_sheet.Height = height;
     webforms_sheet.IsLandscape = isLandscape;
     webforms_sheet.SheetID = sheetID;
     webforms_sheet.SheetType = sheetType;
     webforms_sheet.Width = width;
     webforms_sheet.Description = description;
     return webforms_sheet;
 }
Beispiel #3
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.ReportableName=SheetFieldDefObj.ReportableName;
					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.");
			}
		}
 /// <summary>
 /// Deprecated Method for adding a new object to the webforms_sheet EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTowebforms_sheet(webforms_sheet webforms_sheet)
 {
     base.AddObject("webforms_sheet", webforms_sheet);
 }