示例#1
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;
     }
 }
示例#2
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
     }
 }
示例#3
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 ;
     }
 }
 /// <summary>
 /// Create a new webforms_sheetdef object.
 /// </summary>
 /// <param name="dentalOfficeID">Initial value of the DentalOfficeID property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 /// <param name="fontName">Initial value of the FontName 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="sheetType">Initial value of the SheetType property.</param>
 /// <param name="webSheetDefID">Initial value of the WebSheetDefID property.</param>
 /// <param name="width">Initial value of the Width property.</param>
 public static webforms_sheetdef Createwebforms_sheetdef(global::System.Int64 dentalOfficeID, global::System.String description, global::System.String fontName, global::System.Single fontSize, global::System.Int32 height, global::System.SByte isLandscape, global::System.Int32 sheetType, global::System.Int64 webSheetDefID, global::System.Int32 width)
 {
     webforms_sheetdef webforms_sheetdef = new webforms_sheetdef();
     webforms_sheetdef.DentalOfficeID = dentalOfficeID;
     webforms_sheetdef.Description = description;
     webforms_sheetdef.FontName = fontName;
     webforms_sheetdef.FontSize = fontSize;
     webforms_sheetdef.Height = height;
     webforms_sheetdef.IsLandscape = isLandscape;
     webforms_sheetdef.SheetType = sheetType;
     webforms_sheetdef.WebSheetDefID = webSheetDefID;
     webforms_sheetdef.Width = width;
     return webforms_sheetdef;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the webforms_sheetdef EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTowebforms_sheetdef(webforms_sheetdef webforms_sheetdef)
 {
     base.AddObject("webforms_sheetdef", webforms_sheetdef);
 }
示例#6
0
文件: Sheets.asmx.cs 项目: mnisl/OD
		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
			}
		}