コード例 #1
0
		///<summary>Converts a DataTable to a list of objects.</summary>
		public static List<SheetField> TableToList(DataTable table){
			List<SheetField> retVal=new List<SheetField>();
			SheetField sheetField;
			for(int i=0;i<table.Rows.Count;i++) {
				sheetField=new SheetField();
				sheetField.SheetFieldNum   = PIn.Long  (table.Rows[i]["SheetFieldNum"].ToString());
				sheetField.SheetNum        = PIn.Long  (table.Rows[i]["SheetNum"].ToString());
				sheetField.FieldType       = (SheetFieldType)PIn.Int(table.Rows[i]["FieldType"].ToString());
				sheetField.FieldName       = PIn.String(table.Rows[i]["FieldName"].ToString());
				sheetField.FieldValue      = PIn.String(table.Rows[i]["FieldValue"].ToString());
				sheetField.FontSize        = PIn.Float (table.Rows[i]["FontSize"].ToString());
				sheetField.FontName        = PIn.String(table.Rows[i]["FontName"].ToString());
				sheetField.FontIsBold      = PIn.Bool  (table.Rows[i]["FontIsBold"].ToString());
				sheetField.XPos            = PIn.Int   (table.Rows[i]["XPos"].ToString());
				sheetField.YPos            = PIn.Int   (table.Rows[i]["YPos"].ToString());
				sheetField.Width           = PIn.Int   (table.Rows[i]["Width"].ToString());
				sheetField.Height          = PIn.Int   (table.Rows[i]["Height"].ToString());
				sheetField.GrowthBehavior  = (GrowthBehaviorEnum)PIn.Int(table.Rows[i]["GrowthBehavior"].ToString());
				sheetField.RadioButtonValue= PIn.String(table.Rows[i]["RadioButtonValue"].ToString());
				sheetField.RadioButtonGroup= PIn.String(table.Rows[i]["RadioButtonGroup"].ToString());
				sheetField.IsRequired      = PIn.Bool  (table.Rows[i]["IsRequired"].ToString());
				sheetField.TabOrder        = PIn.Int   (table.Rows[i]["TabOrder"].ToString());
				sheetField.ReportableName  = PIn.String(table.Rows[i]["ReportableName"].ToString());
				retVal.Add(sheetField);
			}
			return retVal;
		}
コード例 #2
0
ファイル: SheetFieldCrud.cs プロジェクト: nampn/ODental
 ///<summary>Inserts one SheetField into the database.  Returns the new priKey.</summary>
 internal static long Insert(SheetField sheetField)
 {
     if(DataConnection.DBtype==DatabaseType.Oracle) {
         sheetField.SheetFieldNum=DbHelper.GetNextOracleKey("sheetfield","SheetFieldNum");
         int loopcount=0;
         while(loopcount<100){
             try {
                 return Insert(sheetField,true);
             }
             catch(Oracle.DataAccess.Client.OracleException ex){
                 if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){
                     sheetField.SheetFieldNum++;
                     loopcount++;
                 }
                 else{
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else {
         return Insert(sheetField,false);
     }
 }
コード例 #3
0
        ///<summary>Handles how each type of SheetField should be drawn to the control.</summary>
        private void RefreshSheetField(SheetField field)
        {
            if (IsWidgetClosed())
            {
                //Since we BeginInvoke back to the MainThread, it's possible to have queued up this method, and then Closed the Widget,which sets
                //_sheetDefWidget=null, before this method executes.
                return;
            }
            if (IsSheetFieldDrawnDirectlyToGraphics(field))
            {
                _listFieldsDrawnToGraphics.Add(field);
                return;
            }
            Type    type = GetControlTypeForDisplay(field);
            Control ctr  = this.GetAllControls().FirstOrDefault(x => x.Name == GetSheetFieldID(field) && x.GetType() == type);

            if (ctr == null)
            {
                ctr = CreateControl(field, type);
            }
            ctr.Location  = new Point(field.XPos, field.YPos);
            ctr.Text      = field.FieldValue;
            ctr.ForeColor = field.ItemColor;
            ctr.Size      = new Size(field.Width, field.Height);
            if (ctr is IDashWidgetField)
            {
                ((IDashWidgetField)ctr).RefreshView();
            }
            ctr.Visible = true;
        }
コード例 #4
0
        /// <summary>
        /// 檢查來源欄位中有哪些欄位是被系統支援匯入的。
        /// </summary>
        /// <param name="strSheetFields"></param>
        private List <SheetField> GetSupportFields(IEnumerable <string> strSheetFields)
        {
            List <SheetField> fields = new List <SheetField>();

            foreach (string eachField in strSheetFields)
            {
                ImportFieldCollection objFields = Context.SupportFields;

                SheetField objSheetField;

                if (objFields.Contains(eachField))
                {
                    objSheetField = new SheetField(objFields[eachField]);
                }
                else
                {
                    objSheetField = new SheetField(eachField);
                }

                //檢查欄位是否允許匯入。
                if (objSheetField.BindField == null)
                {
                    objSheetField.Lock("系統不支援此欄位匯入。", Color.Silver);
                }

                fields.Add(objSheetField);
            }

            return(fields);
        }
コード例 #5
0
ファイル: SheetFieldCrud.cs プロジェクト: kjb7749/testImport
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <SheetField> TableToList(DataTable table)
        {
            List <SheetField> retVal = new List <SheetField>();
            SheetField        sheetField;

            foreach (DataRow row in table.Rows)
            {
                sheetField = new SheetField();
                sheetField.SheetFieldNum    = PIn.Long(row["SheetFieldNum"].ToString());
                sheetField.SheetNum         = PIn.Long(row["SheetNum"].ToString());
                sheetField.FieldType        = (OpenDentBusiness.SheetFieldType)PIn.Int(row["FieldType"].ToString());
                sheetField.FieldName        = PIn.String(row["FieldName"].ToString());
                sheetField.FieldValue       = PIn.String(row["FieldValue"].ToString());
                sheetField.FontSize         = PIn.Float(row["FontSize"].ToString());
                sheetField.FontName         = PIn.String(row["FontName"].ToString());
                sheetField.FontIsBold       = PIn.Bool(row["FontIsBold"].ToString());
                sheetField.XPos             = PIn.Int(row["XPos"].ToString());
                sheetField.YPos             = PIn.Int(row["YPos"].ToString());
                sheetField.Width            = PIn.Int(row["Width"].ToString());
                sheetField.Height           = PIn.Int(row["Height"].ToString());
                sheetField.GrowthBehavior   = (OpenDentBusiness.GrowthBehaviorEnum)PIn.Int(row["GrowthBehavior"].ToString());
                sheetField.RadioButtonValue = PIn.String(row["RadioButtonValue"].ToString());
                sheetField.RadioButtonGroup = PIn.String(row["RadioButtonGroup"].ToString());
                sheetField.IsRequired       = PIn.Bool(row["IsRequired"].ToString());
                sheetField.TabOrder         = PIn.Int(row["TabOrder"].ToString());
                sheetField.ReportableName   = PIn.String(row["ReportableName"].ToString());
                sheetField.TextAlign        = (System.Windows.Forms.HorizontalAlignment)PIn.Int(row["TextAlign"].ToString());
                sheetField.IsLocked         = PIn.Bool(row["IsLocked"].ToString());
                sheetField.ItemColor        = Color.FromArgb(PIn.Int(row["ItemColor"].ToString()));
                sheetField.DateTimeSig      = PIn.DateT(row["DateTimeSig"].ToString());
                retVal.Add(sheetField);
            }
            return(retVal);
        }
コード例 #6
0
        private void lvSourceFieldList_ItemChecked(object sender, ItemCheckedEventArgs e)
        {
            if (_block_behavior)
            {
                return;
            }

            //處理群組欄位問題。
            SheetField field = e.Item as SheetField;

            if (field.BindField == null)
            {
                return;
            }

            string prefix = field.Text.Split(':')[0].Trim();

            foreach (ListViewItem each in lvSourceFieldList.Items)
            {
                if (each.Text.StartsWith(prefix))
                {
                    each.Checked = field.Checked;
                }
            }
        }
コード例 #7
0
ファイル: SheetFieldCrud.cs プロジェクト: nampn/ODental
        ///<summary>Converts a DataTable to a list of objects.</summary>
        internal static List <SheetField> TableToList(DataTable table)
        {
            List <SheetField> retVal = new List <SheetField>();
            SheetField        sheetField;

            for (int i = 0; i < table.Rows.Count; i++)
            {
                sheetField = new SheetField();
                sheetField.SheetFieldNum    = PIn.Long(table.Rows[i]["SheetFieldNum"].ToString());
                sheetField.SheetNum         = PIn.Long(table.Rows[i]["SheetNum"].ToString());
                sheetField.FieldType        = (SheetFieldType)PIn.Int(table.Rows[i]["FieldType"].ToString());
                sheetField.FieldName        = PIn.String(table.Rows[i]["FieldName"].ToString());
                sheetField.FieldValue       = PIn.String(table.Rows[i]["FieldValue"].ToString());
                sheetField.FontSize         = PIn.Float(table.Rows[i]["FontSize"].ToString());
                sheetField.FontName         = PIn.String(table.Rows[i]["FontName"].ToString());
                sheetField.FontIsBold       = PIn.Bool(table.Rows[i]["FontIsBold"].ToString());
                sheetField.XPos             = PIn.Int(table.Rows[i]["XPos"].ToString());
                sheetField.YPos             = PIn.Int(table.Rows[i]["YPos"].ToString());
                sheetField.Width            = PIn.Int(table.Rows[i]["Width"].ToString());
                sheetField.Height           = PIn.Int(table.Rows[i]["Height"].ToString());
                sheetField.GrowthBehavior   = (GrowthBehaviorEnum)PIn.Int(table.Rows[i]["GrowthBehavior"].ToString());
                sheetField.RadioButtonValue = PIn.String(table.Rows[i]["RadioButtonValue"].ToString());
                sheetField.RadioButtonGroup = PIn.String(table.Rows[i]["RadioButtonGroup"].ToString());
                sheetField.IsRequired       = PIn.Bool(table.Rows[i]["IsRequired"].ToString());
                sheetField.TabOrder         = PIn.Int(table.Rows[i]["TabOrder"].ToString());
                retVal.Add(sheetField);
            }
            return(retVal);
        }
コード例 #8
0
ファイル: SheetFieldCrud.cs プロジェクト: nampn/ODental
        ///<summary>Updates one SheetField in the database.</summary>
        internal static void Update(SheetField sheetField)
        {
            string command = "UPDATE sheetfield SET "
                             + "SheetNum        =  " + POut.Long(sheetField.SheetNum) + ", "
                             + "FieldType       =  " + POut.Int((int)sheetField.FieldType) + ", "
                             + "FieldName       = '" + POut.String(sheetField.FieldName) + "', "
                             + "FieldValue      =  " + DbHelper.ParamChar + "paramFieldValue, "
                             + "FontSize        =  " + POut.Float(sheetField.FontSize) + ", "
                             + "FontName        = '" + POut.String(sheetField.FontName) + "', "
                             + "FontIsBold      =  " + POut.Bool(sheetField.FontIsBold) + ", "
                             + "XPos            =  " + POut.Int(sheetField.XPos) + ", "
                             + "YPos            =  " + POut.Int(sheetField.YPos) + ", "
                             + "Width           =  " + POut.Int(sheetField.Width) + ", "
                             + "Height          =  " + POut.Int(sheetField.Height) + ", "
                             + "GrowthBehavior  =  " + POut.Int((int)sheetField.GrowthBehavior) + ", "
                             + "RadioButtonValue= '" + POut.String(sheetField.RadioButtonValue) + "', "
                             + "RadioButtonGroup= '" + POut.String(sheetField.RadioButtonGroup) + "', "
                             + "IsRequired      =  " + POut.Bool(sheetField.IsRequired) + ", "
                             + "TabOrder        =  " + POut.Int(sheetField.TabOrder) + " "
                             + "WHERE SheetFieldNum = " + POut.Long(sheetField.SheetFieldNum);

            if (sheetField.FieldValue == null)
            {
                sheetField.FieldValue = "";
            }
            OdSqlParameter paramFieldValue = new OdSqlParameter("paramFieldValue", OdDbType.Text, sheetField.FieldValue);

            Db.NonQ(command, paramFieldValue);
        }
コード例 #9
0
ファイル: SheetFieldCrud.cs プロジェクト: nampn/ODental
 ///<summary>Inserts one SheetField into the database.  Returns the new priKey.</summary>
 internal static long Insert(SheetField sheetField)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         sheetField.SheetFieldNum = DbHelper.GetNextOracleKey("sheetfield", "SheetFieldNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(sheetField, true));
             }
             catch (Oracle.DataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     sheetField.SheetFieldNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(sheetField, false));
     }
 }
コード例 #10
0
ファイル: ScoreSheet.cs プロジェクト: Etny/Yahtzee-Quest
        public ScoreSheet(UILayer layer, Font font) : base(layer)
        {
            Font = font;
            fields.Clear();
            maxScale = new vec2(fullSize / smallSize);

            var rc = new ImageRenderComponent(layer.Gl, "Resource/Images/UI/Other/scorePaper2.png");

            RenderComponent       = rc;
            imgSize               = ((vec2)rc.Image.Size * smallSize).ScaleToScreen();
            Quad                  = new QuadMesh(imgSize);
            Transform.Translation = new vec2((-layer.UIFrameBuffer.BoundTexture.Size.x / 2) + (Quad.Size.x / 2) + screenPadding, smallSizeHeight);

            layer.AddComponent(this);

            Font.Size = 30 * Program.Settings.ScreenRatio.x * 1.5f;

            for (int i = 0; i < 18; i++)
            {
                var t = new SheetField(this, layer, Font, fieldFuncs[i], !nonLockableIndices.Contains(i), new vec2(fieldLocs[i * 2], -fieldLocs[i * 2 + 1]));
                fields.Add(t);
            }

            OnClick += SheetClicked;
            ClearFields();
        }
コード例 #11
0
        private void pictDraw_MouseUp(object sender, MouseEventArgs e)
        {
            mouseIsDown = false;
            if (checkErase.Checked)
            {
                return;
            }
            SheetField field = new SheetField();

            field.FieldType  = SheetFieldType.Drawing;
            field.FieldName  = "";
            field.FieldValue = "";
            for (int i = 0; i < PointList.Count; i++)
            {
                if (i > 0)
                {
                    field.FieldValue += ";";
                }
                field.FieldValue += (PointList[i].X + pictDraw.Left) + "," + (PointList[i].Y + pictDraw.Top);
            }
            field.FontName         = "";
            field.RadioButtonValue = "";
            SheetCur.SheetFields.Add(field);
            PointList.Clear();
            RefreshPanel();
        }
コード例 #12
0
ファイル: SheetUtil.cs プロジェクト: nampn/ODental
        /*
         * ///<summary>After pulling a list of SheetFieldData objects from the database, we use this to convert it to a list of SheetFields as we create the Sheet.</summary>
         * public static List<SheetField> CreateSheetFields(List<SheetFieldData> sheetFieldDataList){
         *      List<SheetField> retVal=new List<SheetField>();
         *      SheetField field;
         *      FontStyle style;
         *      for(int i=0;i<sheetFieldDataList.Count;i++){
         *              style=FontStyle.Regular;
         *              if(sheetFieldDataList[i].FontIsBold){
         *                      style=FontStyle.Bold;
         *              }
         *              field=new SheetField(sheetFieldDataList[i].FieldType,sheetFieldDataList[i].FieldName,sheetFieldDataList[i].FieldValue,
         *                      sheetFieldDataList[i].XPos,sheetFieldDataList[i].YPos,sheetFieldDataList[i].Width,sheetFieldDataList[i].Height,
         *                      new Font(sheetFieldDataList[i].FontName,sheetFieldDataList[i].FontSize,style),sheetFieldDataList[i].GrowthBehavior);
         *              retVal.Add(field);
         *      }
         *      return retVal;
         * }*/

        ///<summary>Creates the initial fields from the sheetDef.FieldDefs.</summary>
        private static List <SheetField> CreateFieldList(List <SheetFieldDef> sheetFieldDefList)
        {
            List <SheetField> retVal = new List <SheetField>();
            SheetField        field;

            for (int i = 0; i < sheetFieldDefList.Count; i++)
            {
                field                  = new SheetField();
                field.IsNew            = true;
                field.FieldName        = sheetFieldDefList[i].FieldName;
                field.FieldType        = sheetFieldDefList[i].FieldType;
                field.FieldValue       = sheetFieldDefList[i].FieldValue;
                field.FontIsBold       = sheetFieldDefList[i].FontIsBold;
                field.FontName         = sheetFieldDefList[i].FontName;
                field.FontSize         = sheetFieldDefList[i].FontSize;
                field.GrowthBehavior   = sheetFieldDefList[i].GrowthBehavior;
                field.Height           = sheetFieldDefList[i].Height;
                field.RadioButtonValue = sheetFieldDefList[i].RadioButtonValue;
                //field.SheetNum=sheetFieldList[i];//set later
                field.Width            = sheetFieldDefList[i].Width;
                field.XPos             = sheetFieldDefList[i].XPos;
                field.YPos             = sheetFieldDefList[i].YPos;
                field.RadioButtonGroup = sheetFieldDefList[i].RadioButtonGroup;
                field.IsRequired       = sheetFieldDefList[i].IsRequired;
                field.TabOrder         = sheetFieldDefList[i].TabOrder;
                retVal.Add(field);
            }
            return(retVal);
        }
コード例 #13
0
ファイル: SheetUtil.cs プロジェクト: nampn/ODental
        ///<Summary>Supply the field that we are testing.  All other fields which intersect with it will be moved down.  Each time one (or maybe some) is moved down, this method is called recursively.  The end result should be no intersections among fields near the original field that grew.</Summary>
        public static void MoveAllDownWhichIntersect(Sheet sheet, SheetField field, int amountOfGrowth)
        {
            //Phase 1 is to move everything that intersects with the field down. Phase 2 is to call this method on everything that was moved.
            //Phase 1: Move
            List <SheetField> affectedFields = new List <SheetField>();

            foreach (SheetField field2 in sheet.SheetFields)
            {
                if (field2 == field)
                {
                    continue;
                }
                if (field2.YPos < field.YPos)              //only fields which are below this one
                {
                    continue;
                }
                if (field2.FieldType == SheetFieldType.Drawing)
                {
                    continue;
                    //drawings do not get moved down.
                }
                if (field.Bounds.IntersectsWith(field2.Bounds))
                {
                    field2.YPos += amountOfGrowth;
                    affectedFields.Add(field2);
                }
            }
            //Phase 2: Recursion
            foreach (SheetField field2 in affectedFields)
            {
                //reuse the same amountOfGrowth again.
                MoveAllDownWhichIntersect(sheet, field2, amountOfGrowth);
            }
        }
コード例 #14
0
 ///<summary></summary>
 public void SetData(PatientDashboardDataEventArgs data, SheetField sheetField)
 {
     if (sheetField == null)
     {
         return;
     }
     _sheetField = sheetField;
 }
コード例 #15
0
 public void SetData(PatientDashboardDataEventArgs data, SheetField sheetField)
 {
     if (!IsNecessaryDataAvailable(data))
     {
         return;
     }
     ExtractData(data);
 }
コード例 #16
0
 public void SetData(PatientDashboardDataEventArgs data, SheetField sheetField)
 {
     if (sheetField == null)
     {
         return;
     }
     _sheetField = sheetField;          //Only make a change if valid sheetField given.
 }
コード例 #17
0
ファイル: SheetFieldCrud.cs プロジェクト: kjb7749/testImport
        ///<summary>Inserts one SheetField into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(SheetField sheetField, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO sheetfield (";

            if (!useExistingPK && isRandomKeys)
            {
                sheetField.SheetFieldNum = ReplicationServers.GetKeyNoCache("sheetfield", "SheetFieldNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "SheetFieldNum,";
            }
            command += "SheetNum,FieldType,FieldName,FieldValue,FontSize,FontName,FontIsBold,XPos,YPos,Width,Height,GrowthBehavior,RadioButtonValue,RadioButtonGroup,IsRequired,TabOrder,ReportableName,TextAlign,IsLocked,ItemColor,DateTimeSig) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(sheetField.SheetFieldNum) + ",";
            }
            command +=
                POut.Long(sheetField.SheetNum) + ","
                + POut.Int((int)sheetField.FieldType) + ","
                + "'" + POut.String(sheetField.FieldName) + "',"
                + DbHelper.ParamChar + "paramFieldValue,"
                + POut.Float(sheetField.FontSize) + ","
                + "'" + POut.String(sheetField.FontName) + "',"
                + POut.Bool(sheetField.FontIsBold) + ","
                + POut.Int(sheetField.XPos) + ","
                + POut.Int(sheetField.YPos) + ","
                + POut.Int(sheetField.Width) + ","
                + POut.Int(sheetField.Height) + ","
                + POut.Int((int)sheetField.GrowthBehavior) + ","
                + "'" + POut.String(sheetField.RadioButtonValue) + "',"
                + "'" + POut.String(sheetField.RadioButtonGroup) + "',"
                + POut.Bool(sheetField.IsRequired) + ","
                + POut.Int(sheetField.TabOrder) + ","
                + "'" + POut.String(sheetField.ReportableName) + "',"
                + POut.Int((int)sheetField.TextAlign) + ","
                + POut.Bool(sheetField.IsLocked) + ","
                + POut.Int(sheetField.ItemColor.ToArgb()) + ","
                + POut.DateT(sheetField.DateTimeSig) + ")";
            if (sheetField.FieldValue == null)
            {
                sheetField.FieldValue = "";
            }
            OdSqlParameter paramFieldValue = new OdSqlParameter("paramFieldValue", OdDbType.Text, POut.StringParam(sheetField.FieldValue));

            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command, paramFieldValue);
            }
            else
            {
                sheetField.SheetFieldNum = Db.NonQ(command, true, "SheetFieldNum", "sheetField", paramFieldValue);
            }
            return(sheetField.SheetFieldNum);
        }
コード例 #18
0
ファイル: SheetUtil.cs プロジェクト: nampn/ODental
 public static void MoveAllDownBelowThis(Sheet sheet, SheetField field, int amountOfGrowth)
 {
     foreach (SheetField field2 in sheet.SheetFields)
     {
         if (field2.YPos > field.YPos)               //for all fields that are below this one
         {
             field2.YPos += amountOfGrowth;          //bump down by amount that this one grew
         }
     }
 }
コード例 #19
0
 private void SetOrRefreshData(Action <IDashWidgetField, SheetField> actionSetOrRefresh)
 {
     foreach (Control ctr in this.GetAllControls())
     {
         SheetField sheetField = _sheetWidget.SheetFields.FirstOrDefault(x => GetSheetFieldID(x) == ctr.Name);
         if (ctr is IDashWidgetField)
         {
             actionSetOrRefresh((IDashWidgetField)ctr, sheetField);
         }
     }
 }
コード例 #20
0
        public void RefreshData(Patient pat, SheetField sheetField)
        {
            long patNum = pat?.PatNum ?? 0;

            _sheetField = sheetField;
            TreatPlan treatPlan     = TreatPlans.GetActiveForPat(patNum);
            Image     imgToothChart = GetToothChart(patNum, treatPlan);

            _imgToothChart?.Dispose();
            _imgToothChart = imgToothChart;
        }
コード例 #21
0
        public void SetData(PatientDashboardDataEventArgs data, SheetField sheetField)
        {
            if (!IsNecessaryDataAvailable(data))
            {
                return;
            }
            Image imgToothChart = ExtractToothChart(data);

            _imgToothChart?.Dispose();
            _imgToothChart = imgToothChart;
        }
コード例 #22
0
ファイル: MiddleTierTests.cs プロジェクト: kjb7749/testImport
        public void MiddleTier_SendSheetWithFields()
        {
            Sheet sheet = new Sheet();

            sheet.SheetFields = new List <SheetField>();
            sheet.Parameters  = new List <SheetParameter>();
            SheetField field = new SheetField();

            field.FieldName = "FieldName";
            sheet.SheetFields.Add(field);
            Assert.AreEqual("FieldName", WebServiceTests.SendSheetWithFields(sheet));
        }
コード例 #23
0
        ///<summary>Determines if a SheetField will be drawn directly to the UserControlDashboardWidget's graphics, rather than creating its own control.
        ///</summary>
        private static bool IsSheetFieldDrawnDirectlyToGraphics(SheetField field)
        {
            switch (field.FieldType)
            {
            case SheetFieldType.Line:
            case SheetFieldType.Rectangle:
                return(true);

            default:
                return(false);
            }
        }
コード例 #24
0
ファイル: DashApptGrid.cs プロジェクト: ChemBrain/OpenDental
 public void SetData(PatientDashboardDataEventArgs data, SheetField sheetField)
 {
     if (!IsNecessaryDataAvailable(data))
     {
         return;
     }
     _listApptOthers         = data.ListAppts.FindAll(x => x.PatNum == data.Pat.PatNum).Select(y => new ApptOther(y)).ToList();;
     _listPlannedAppts       = data.ListPlannedAppts;
     _listPlannedIncompletes = _listPlannedAppts.FindAll(x => !_listApptOthers.ToList()
                                                         .Exists(y => y.NextAptNum == x.AptNum && y.AptStatus == ApptStatus.Complete))
                               .OrderBy(x => x.ItemOrder).ToList();
     _listProgNoteColorDefs = Defs.GetDefsForCategory(DefCat.ProgNoteColors);          //cached
 }
コード例 #25
0
        ///<summary>Inserts one SheetField into the database.  Provides option to use the existing priKey.</summary>
        public static long Insert(SheetField sheetField, bool useExistingPK)
        {
            if (!useExistingPK && PrefC.RandomKeys)
            {
                sheetField.SheetFieldNum = ReplicationServers.GetKey("sheetfield", "SheetFieldNum");
            }
            string command = "INSERT INTO sheetfield (";

            if (useExistingPK || PrefC.RandomKeys)
            {
                command += "SheetFieldNum,";
            }
            command += "SheetNum,FieldType,FieldName,FieldValue,FontSize,FontName,FontIsBold,XPos,YPos,Width,Height,GrowthBehavior,RadioButtonValue,RadioButtonGroup,IsRequired,TabOrder,ReportableName) VALUES(";
            if (useExistingPK || PrefC.RandomKeys)
            {
                command += POut.Long(sheetField.SheetFieldNum) + ",";
            }
            command +=
                POut.Long(sheetField.SheetNum) + ","
                + POut.Int((int)sheetField.FieldType) + ","
                + "'" + POut.String(sheetField.FieldName) + "',"
                + DbHelper.ParamChar + "paramFieldValue,"
                + POut.Float(sheetField.FontSize) + ","
                + "'" + POut.String(sheetField.FontName) + "',"
                + POut.Bool(sheetField.FontIsBold) + ","
                + POut.Int(sheetField.XPos) + ","
                + POut.Int(sheetField.YPos) + ","
                + POut.Int(sheetField.Width) + ","
                + POut.Int(sheetField.Height) + ","
                + POut.Int((int)sheetField.GrowthBehavior) + ","
                + "'" + POut.String(sheetField.RadioButtonValue) + "',"
                + "'" + POut.String(sheetField.RadioButtonGroup) + "',"
                + POut.Bool(sheetField.IsRequired) + ","
                + POut.Int(sheetField.TabOrder) + ","
                + "'" + POut.String(sheetField.ReportableName) + "')";
            if (sheetField.FieldValue == null)
            {
                sheetField.FieldValue = "";
            }
            OdSqlParameter paramFieldValue = new OdSqlParameter("paramFieldValue", OdDbType.Text, sheetField.FieldValue);

            if (useExistingPK || PrefC.RandomKeys)
            {
                Db.NonQ(command, paramFieldValue);
            }
            else
            {
                sheetField.SheetFieldNum = Db.NonQ(command, true, paramFieldValue);
            }
            return(sheetField.SheetFieldNum);
        }
コード例 #26
0
ファイル: FormWebForms.cs プロジェクト: ChemBrain/OpenDental
        /// <summary>
        /// </summary>
        private Sheet CreateSheet(long PatNum, WebForms_Sheet webFormSheet)
        {
            Sheet newSheet = null;

            try{
                SheetDef sheetDef = new SheetDef((SheetTypeEnum)webFormSheet.SheetType);
                newSheet = SheetUtil.CreateSheet(sheetDef, PatNum);
                SheetParameter.SetParameter(newSheet, "PatNum", PatNum);
                newSheet.DateTimeSheet = webFormSheet.DateTimeSheet;
                newSheet.Description   = webFormSheet.Description;
                newSheet.Height        = webFormSheet.Height;
                newSheet.Width         = webFormSheet.Width;
                newSheet.FontName      = webFormSheet.FontName;
                newSheet.FontSize      = webFormSheet.FontSize;
                newSheet.SheetType     = (SheetTypeEnum)webFormSheet.SheetType;
                newSheet.IsLandscape   = webFormSheet.IsLandscape;
                newSheet.InternalNote  = "";
                newSheet.IsWebForm     = true;
                //loop through each variable in a single sheetfield
                foreach (WebForms_SheetField field in webFormSheet.SheetFields)
                {
                    SheetField sheetfield = new SheetField();
                    sheetfield.FieldName        = field.FieldName;
                    sheetfield.FieldType        = field.FieldType;
                    sheetfield.FontIsBold       = field.FontIsBold;
                    sheetfield.FontName         = field.FontName;
                    sheetfield.FontSize         = field.FontSize;
                    sheetfield.Height           = field.Height;
                    sheetfield.Width            = field.Width;
                    sheetfield.XPos             = field.XPos;
                    sheetfield.YPos             = field.YPos;
                    sheetfield.IsRequired       = field.IsRequired;
                    sheetfield.TabOrder         = field.TabOrder;
                    sheetfield.ReportableName   = field.ReportableName;
                    sheetfield.RadioButtonGroup = field.RadioButtonGroup;
                    sheetfield.RadioButtonValue = field.RadioButtonValue;
                    sheetfield.GrowthBehavior   = field.GrowthBehavior;
                    sheetfield.FieldValue       = field.FieldValue;
                    sheetfield.TextAlign        = field.TextAlign;
                    sheetfield.ItemColor        = field.ItemColor;
                    newSheet.SheetFields.Add(sheetfield);
                }                        // end of j loop
                Sheets.SaveNewSheet(newSheet);
                return(newSheet);
            }
            catch (Exception e) {
                gridMain.EndUpdate();
                MessageBox.Show(e.Message);
            }
            return(newSheet);
        }
コード例 #27
0
        ///<summary>Updates one SheetField in the database.</summary>
        public static void Update(SheetField sheetField)
        {
            string command = "UPDATE sheetfield SET "
                             + "SheetNum                =  " + POut.Long(sheetField.SheetNum) + ", "
                             + "FieldType               =  " + POut.Int((int)sheetField.FieldType) + ", "
                             + "FieldName               = '" + POut.String(sheetField.FieldName) + "', "
                             + "FieldValue              =  " + DbHelper.ParamChar + "paramFieldValue, "
                             + "FontSize                =  " + POut.Float(sheetField.FontSize) + ", "
                             + "FontName                = '" + POut.String(sheetField.FontName) + "', "
                             + "FontIsBold              =  " + POut.Bool(sheetField.FontIsBold) + ", "
                             + "XPos                    =  " + POut.Int(sheetField.XPos) + ", "
                             + "YPos                    =  " + POut.Int(sheetField.YPos) + ", "
                             + "Width                   =  " + POut.Int(sheetField.Width) + ", "
                             + "Height                  =  " + POut.Int(sheetField.Height) + ", "
                             + "GrowthBehavior          =  " + POut.Int((int)sheetField.GrowthBehavior) + ", "
                             + "RadioButtonValue        = '" + POut.String(sheetField.RadioButtonValue) + "', "
                             + "RadioButtonGroup        = '" + POut.String(sheetField.RadioButtonGroup) + "', "
                             + "IsRequired              =  " + POut.Bool(sheetField.IsRequired) + ", "
                             + "TabOrder                =  " + POut.Int(sheetField.TabOrder) + ", "
                             + "ReportableName          = '" + POut.String(sheetField.ReportableName) + "', "
                             + "TextAlign               =  " + POut.Int((int)sheetField.TextAlign) + ", "
                             + "IsLocked                =  " + POut.Bool(sheetField.IsLocked) + ", "
                             + "ItemColor               =  " + POut.Int(sheetField.ItemColor.ToArgb()) + ", "
                             + "DateTimeSig             =  " + POut.DateT(sheetField.DateTimeSig) + ", "
                             + "TabOrderMobile          =  " + POut.Int(sheetField.TabOrderMobile) + ", "
                             + "UiLabelMobile           =  " + DbHelper.ParamChar + "paramUiLabelMobile, "
                             + "UiLabelMobileRadioButton=  " + DbHelper.ParamChar + "paramUiLabelMobileRadioButton "
                             + "WHERE SheetFieldNum = " + POut.Long(sheetField.SheetFieldNum);

            if (sheetField.FieldValue == null)
            {
                sheetField.FieldValue = "";
            }
            OdSqlParameter paramFieldValue = new OdSqlParameter("paramFieldValue", OdDbType.Text, POut.StringParam(sheetField.FieldValue));

            if (sheetField.UiLabelMobile == null)
            {
                sheetField.UiLabelMobile = "";
            }
            OdSqlParameter paramUiLabelMobile = new OdSqlParameter("paramUiLabelMobile", OdDbType.Text, POut.StringParam(sheetField.UiLabelMobile));

            if (sheetField.UiLabelMobileRadioButton == null)
            {
                sheetField.UiLabelMobileRadioButton = "";
            }
            OdSqlParameter paramUiLabelMobileRadioButton = new OdSqlParameter("paramUiLabelMobileRadioButton", OdDbType.Text, POut.StringParam(sheetField.UiLabelMobileRadioButton));

            Db.NonQ(command, paramFieldValue, paramUiLabelMobile, paramUiLabelMobileRadioButton);
        }
コード例 #28
0
ファイル: SheetFieldCrud.cs プロジェクト: kjb7749/testImport
 ///<summary>Inserts one SheetField into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(SheetField sheetField)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(sheetField, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             sheetField.SheetFieldNum = DbHelper.GetNextOracleKey("sheetfield", "SheetFieldNum");                  //Cacheless method
         }
         return(InsertNoCache(sheetField, true));
     }
 }
コード例 #29
0
        ///<summary>Creates a new Control of Type type, setting its Name as a unique identifier corresponding to properties in field.
        ///Hooks up appropriate events so that drag/drop on the control causes the UserControlDashboardWidget to be dragged/dropped.</summary>
        private Control CreateControl(SheetField field, Type type)
        {
            Control ctr = (Control)Activator.CreateInstance(type);

            //Since field has not been inserted into the db, field.SheetFieldNum=0.  It's possible to have two fields with the same FieldName.
            //Use NameXPosYPos as a likely unique id.
            ctr.Name = GetSheetFieldID(field);
            Lan.C(this, new Control[] { ctr });
            Controls.Add(ctr);
            if (ctr is IDashWidgetField)
            {
                ((IDashWidgetField)ctr).RefreshData(_pat, field);
            }
            return(ctr);
        }
コード例 #30
0
 public void RefreshData(Patient pat, SheetField sheetField)
 {
     _listInsPlans = new List <InsPlan>();
     _listInsSubs  = new List <InsSub>();
     _listPatPlans = new List <PatPlan>();
     _listBenefits = new List <Benefit>();
     _pat          = pat;
     if (_pat == null)
     {
         return;
     }
     _listPatPlans = PatPlans.Refresh(_pat.PatNum);
     _listInsSubs  = InsSubs.RefreshForFam(Patients.GetFamily(_pat.PatNum));
     _listInsPlans = InsPlans.RefreshForSubList(_listInsSubs);
     _listBenefits = Benefits.Refresh(_listPatPlans, _listInsSubs);
 }
コード例 #31
0
        ///<summary>Creates a textbox from the text sheetfield provided.  Used for display and for text wrapping calculations.</summary>
        public static RichTextBox CreateTextBoxForSheetDisplay(string text, Font font, int width, int height, HorizontalAlignment align, bool isClipText = true)
        {
            SheetField field = new SheetField();

            field.FieldType  = SheetFieldType.StaticText;
            field.TabOrder   = 0;
            field.XPos       = 0;
            field.YPos       = 0;
            field.Width      = width;
            field.ItemColor  = Color.Black;
            field.TextAlign  = align;
            field.FieldValue = text;
            field.FontIsBold = font.Bold;
            field.FontName   = font.Name;
            field.FontSize   = font.Size;
            field.Height     = height;
            return(CreateTextBoxForSheetDisplay(field, isClipText));
        }
コード例 #32
0
        private void lvSourceFieldList_ItemCheck(object sender, ItemCheckEventArgs e)
        {
            if (_block_behavior)
            {
                return;
            }

            SheetField field = lvSourceFieldList.Items[e.Index] as SheetField;

            if (field == null)
            {
                return;
            }

            if (field.Locked)
            {
                e.NewValue = e.CurrentValue;
            }
        }
コード例 #33
0
ファイル: SheetFieldCrud.cs プロジェクト: nampn/ODental
 ///<summary>Inserts one SheetField into the database.  Provides option to use the existing priKey.</summary>
 internal static long Insert(SheetField sheetField,bool useExistingPK)
 {
     if(!useExistingPK && PrefC.RandomKeys) {
         sheetField.SheetFieldNum=ReplicationServers.GetKey("sheetfield","SheetFieldNum");
     }
     string command="INSERT INTO sheetfield (";
     if(useExistingPK || PrefC.RandomKeys) {
         command+="SheetFieldNum,";
     }
     command+="SheetNum,FieldType,FieldName,FieldValue,FontSize,FontName,FontIsBold,XPos,YPos,Width,Height,GrowthBehavior,RadioButtonValue,RadioButtonGroup,IsRequired,TabOrder) VALUES(";
     if(useExistingPK || PrefC.RandomKeys) {
         command+=POut.Long(sheetField.SheetFieldNum)+",";
     }
     command+=
              POut.Long  (sheetField.SheetNum)+","
         +    POut.Int   ((int)sheetField.FieldType)+","
         +"'"+POut.String(sheetField.FieldName)+"',"
         +DbHelper.ParamChar+"paramFieldValue,"
         +    POut.Float (sheetField.FontSize)+","
         +"'"+POut.String(sheetField.FontName)+"',"
         +    POut.Bool  (sheetField.FontIsBold)+","
         +    POut.Int   (sheetField.XPos)+","
         +    POut.Int   (sheetField.YPos)+","
         +    POut.Int   (sheetField.Width)+","
         +    POut.Int   (sheetField.Height)+","
         +    POut.Int   ((int)sheetField.GrowthBehavior)+","
         +"'"+POut.String(sheetField.RadioButtonValue)+"',"
         +"'"+POut.String(sheetField.RadioButtonGroup)+"',"
         +    POut.Bool  (sheetField.IsRequired)+","
         +    POut.Int   (sheetField.TabOrder)+")";
     if(sheetField.FieldValue==null) {
         sheetField.FieldValue="";
     }
     OdSqlParameter paramFieldValue=new OdSqlParameter("paramFieldValue",OdDbType.Text,sheetField.FieldValue);
     if(useExistingPK || PrefC.RandomKeys) {
         Db.NonQ(command,paramFieldValue);
     }
     else {
         sheetField.SheetFieldNum=Db.NonQ(command,true,paramFieldValue);
     }
     return sheetField.SheetFieldNum;
 }
コード例 #34
0
        /// <summary>
        /// 根據資料表讀取欄位定義
        /// </summary>
        /// <param name="sheet">資料表</param>
        /// <returns></returns>
        private static Dictionary<string, SheetField> GetFieldList(Worksheet sheet)
        {
            Cell startCell = sheet.Cells[StartRow, StartColumn];
            int maxColumn = sheet.Cells.MaxDataColumn; //最大的資料欄 Index (zero based)。
            Dictionary<string, SheetField> columns = new Dictionary<string, SheetField>();

            for (int i = StartColumn; i <= maxColumn; i++)
            {
                Cell colCell = sheet.Cells[StartRow, i];
                if (colCell.StringValue != null && colCell.StringValue.Trim() != string.Empty)
                {
                    SheetField objField = new SheetField(colCell);

                    if (columns.ContainsKey(objField.FieldName))
                        throw new ArgumentException("重覆的欄位名稱:" + objField.FieldName);

                    columns.Add(objField.FieldName, objField);
                }
            }

            return columns;
        }
コード例 #35
0
		///<summary>Updates one SheetField in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.</summary>
		public static void Update(SheetField sheetField,SheetField oldSheetField){
			string command="";
			if(sheetField.SheetNum != oldSheetField.SheetNum) {
				if(command!=""){ command+=",";}
				command+="SheetNum = "+POut.Long(sheetField.SheetNum)+"";
			}
			if(sheetField.FieldType != oldSheetField.FieldType) {
				if(command!=""){ command+=",";}
				command+="FieldType = "+POut.Int   ((int)sheetField.FieldType)+"";
			}
			if(sheetField.FieldName != oldSheetField.FieldName) {
				if(command!=""){ command+=",";}
				command+="FieldName = '"+POut.String(sheetField.FieldName)+"'";
			}
			if(sheetField.FieldValue != oldSheetField.FieldValue) {
				if(command!=""){ command+=",";}
				command+="FieldValue = "+DbHelper.ParamChar+"paramFieldValue";
			}
			if(sheetField.FontSize != oldSheetField.FontSize) {
				if(command!=""){ command+=",";}
				command+="FontSize = "+POut.Float(sheetField.FontSize)+"";
			}
			if(sheetField.FontName != oldSheetField.FontName) {
				if(command!=""){ command+=",";}
				command+="FontName = '"+POut.String(sheetField.FontName)+"'";
			}
			if(sheetField.FontIsBold != oldSheetField.FontIsBold) {
				if(command!=""){ command+=",";}
				command+="FontIsBold = "+POut.Bool(sheetField.FontIsBold)+"";
			}
			if(sheetField.XPos != oldSheetField.XPos) {
				if(command!=""){ command+=",";}
				command+="XPos = "+POut.Int(sheetField.XPos)+"";
			}
			if(sheetField.YPos != oldSheetField.YPos) {
				if(command!=""){ command+=",";}
				command+="YPos = "+POut.Int(sheetField.YPos)+"";
			}
			if(sheetField.Width != oldSheetField.Width) {
				if(command!=""){ command+=",";}
				command+="Width = "+POut.Int(sheetField.Width)+"";
			}
			if(sheetField.Height != oldSheetField.Height) {
				if(command!=""){ command+=",";}
				command+="Height = "+POut.Int(sheetField.Height)+"";
			}
			if(sheetField.GrowthBehavior != oldSheetField.GrowthBehavior) {
				if(command!=""){ command+=",";}
				command+="GrowthBehavior = "+POut.Int   ((int)sheetField.GrowthBehavior)+"";
			}
			if(sheetField.RadioButtonValue != oldSheetField.RadioButtonValue) {
				if(command!=""){ command+=",";}
				command+="RadioButtonValue = '"+POut.String(sheetField.RadioButtonValue)+"'";
			}
			if(sheetField.RadioButtonGroup != oldSheetField.RadioButtonGroup) {
				if(command!=""){ command+=",";}
				command+="RadioButtonGroup = '"+POut.String(sheetField.RadioButtonGroup)+"'";
			}
			if(sheetField.IsRequired != oldSheetField.IsRequired) {
				if(command!=""){ command+=",";}
				command+="IsRequired = "+POut.Bool(sheetField.IsRequired)+"";
			}
			if(sheetField.TabOrder != oldSheetField.TabOrder) {
				if(command!=""){ command+=",";}
				command+="TabOrder = "+POut.Int(sheetField.TabOrder)+"";
			}
			if(sheetField.ReportableName != oldSheetField.ReportableName) {
				if(command!=""){ command+=",";}
				command+="ReportableName = '"+POut.String(sheetField.ReportableName)+"'";
			}
			if(command==""){
				return;
			}
			if(sheetField.FieldValue==null) {
				sheetField.FieldValue="";
			}
			OdSqlParameter paramFieldValue=new OdSqlParameter("paramFieldValue",OdDbType.Text,sheetField.FieldValue);
			command="UPDATE sheetfield SET "+command
				+" WHERE SheetFieldNum = "+POut.Long(sheetField.SheetFieldNum);
			Db.NonQ(command,paramFieldValue);
		}
コード例 #36
0
		///<summary>Updates one SheetField in the database.</summary>
		public static void Update(SheetField sheetField){
			string command="UPDATE sheetfield SET "
				+"SheetNum        =  "+POut.Long  (sheetField.SheetNum)+", "
				+"FieldType       =  "+POut.Int   ((int)sheetField.FieldType)+", "
				+"FieldName       = '"+POut.String(sheetField.FieldName)+"', "
				+"FieldValue      =  "+DbHelper.ParamChar+"paramFieldValue, "
				+"FontSize        =  "+POut.Float (sheetField.FontSize)+", "
				+"FontName        = '"+POut.String(sheetField.FontName)+"', "
				+"FontIsBold      =  "+POut.Bool  (sheetField.FontIsBold)+", "
				+"XPos            =  "+POut.Int   (sheetField.XPos)+", "
				+"YPos            =  "+POut.Int   (sheetField.YPos)+", "
				+"Width           =  "+POut.Int   (sheetField.Width)+", "
				+"Height          =  "+POut.Int   (sheetField.Height)+", "
				+"GrowthBehavior  =  "+POut.Int   ((int)sheetField.GrowthBehavior)+", "
				+"RadioButtonValue= '"+POut.String(sheetField.RadioButtonValue)+"', "
				+"RadioButtonGroup= '"+POut.String(sheetField.RadioButtonGroup)+"', "
				+"IsRequired      =  "+POut.Bool  (sheetField.IsRequired)+", "
				+"TabOrder        =  "+POut.Int   (sheetField.TabOrder)+", "
				+"ReportableName  = '"+POut.String(sheetField.ReportableName)+"' "
				+"WHERE SheetFieldNum = "+POut.Long(sheetField.SheetFieldNum);
			if(sheetField.FieldValue==null) {
				sheetField.FieldValue="";
			}
			OdSqlParameter paramFieldValue=new OdSqlParameter("paramFieldValue",OdDbType.Text,sheetField.FieldValue);
			Db.NonQ(command,paramFieldValue);
		}