コード例 #1
0
ファイル: GPGSA.cs プロジェクト: fivepmtechnology/SharpGPS
 /// <summary>
 ///  GPS DOP and active satellites and parses an NMEA sentence
 /// </summary>
 /// <param name="NMEAsentence"></param>
 public GPGSA(string NMEAsentence)
 {
     _pRNInSolution = new List<string>();
     try
     {
         if (NMEAsentence.IndexOf('*') > 0)
             NMEAsentence = NMEAsentence.Substring(0, NMEAsentence.IndexOf('*'));
         //Split into an array of strings.
         string[] split = NMEAsentence.Split(new Char[] { ',' });
         if (split[1].Length > 0)
             _mode = split[1][0];
         else
             _mode = ' ';
         if (split[2].Length > 0)
         {
             switch (split[2])
             {
                 case "2": _fixMode = GSAFixModeEnum._2D; break;
                 case "3": _fixMode = GSAFixModeEnum._3D; break;
                 default: _fixMode = GSAFixModeEnum.FixNotAvailable; break;
             }
         }
         _pRNInSolution.Clear();
         for (int i = 0; i <= 11; i++)
             if(split[i + 3]!="")
                 _pRNInSolution.Add(split[i + 3]);
         GPSHandler.dblTryParse(split[15], out _pdop);
         GPSHandler.dblTryParse(split[16], out _hdop);
         GPSHandler.dblTryParse(split[17], out _vdop);
     }
     catch { }
 }
コード例 #2
0
        public static void ImportPods(string directory, string pubsuburl)
        {
            if (string.IsNullOrEmpty(directory) || string.IsNullOrEmpty(pubsuburl))
            {
                throw new Exception("Arguments cannot be null");
            }
            System.Collections.Generic.List <ProofOfDelivery> pods = new System.Collections.Generic.List <ProofOfDelivery>();
            bool skipheaders = true;

            string[] entries = null;


            System.Collections.Generic.List <char> delim = new System.Collections.Generic.List <char>();
            delim.Add('\r');
            delim.Add('\n');

            string[] files = System.IO.Directory.GetFiles(directory);

            foreach (var file in files)
            {
                if (!file.Contains("OrdersExported"))
                {
                    continue;
                }
                skipheaders = true;
                foreach (var row in System.IO.File.ReadAllText(file, System.Text.Encoding.GetEncoding(1253)).Split(delim.ToArray()) ?? Enumerable.Empty <string>())
                {
                    if (((((row == null || row == "")) == false) && (((row == null || row.Trim() == "")) == false)))
                    {
                        entries = row?.Split(';');
                        if ((skipheaders))
                        {
                            skipheaders = false;
                            continue;
                        }
                        if ((entries.Length > 0 && (entries[0] == null || entries[0] == "") == false))
                        {
                            ProofOfDelivery proof = new ProofOfDelivery();
                            try
                            {
                                proof.DateIssued = DateTime.Parse(entries[0]);
                            }
                            catch (System.Exception e)
                            {
                                Console.WriteLine(e.Message);
                            }
                            proof.PODNumber      = entries[1].Trim();
                            proof.DeliveryStatus = entries[3];
                            pods?.Add(proof);
                        }
                    }
                }
                string message = ConvertToPubSubMessage(pods);
                PostMessage(message, "");
                pods?.Clear();
            }
        }
コード例 #3
0
        public void PrepareWriteData(int v)
        {
            if (v > variables)
            {
                checkcom = null;
            }
            variables = v;
            coms.Clear();
            System.Random r   = new Random();
            StringBuilder con = new StringBuilder();

            con.Append("insert /*+ AUTO */ into mydata\n\t");
            VerticaCommand command;

            for (int i = 1; i <= variables; i++)
            {
                if (i >= 1000 && (i % 1000 == 0))
                {
                    command             = client.CreateCommand();
                    command.CommandText = con.ToString();
                    coms.Add(command);
                    con.Clear();
                    con.Append("insert /*+ AUTO */ into mydata\n\t");
                }
                DateTime ts    = DateTime.UtcNow;
                int      upVal = r.Next(1, 1000000);
                if (i == max_var)
                {
                    ts_max = ts;
                }
                con.Append(" select 'testinstance_" + i + "','OK', TIMESTAMP '" + ts.ToString("yyyy-MM-dd hh:mm:ss.ffffff", dtfi) + "', " + upVal.ToString());
                if (i != variables && ((i + 1) % 1000 != 0))
                {
                    con.Append(" UNION ");
                }
            }
            command             = client.CreateCommand();
            command.CommandText = con.ToString();
            command.Prepare();
            coms.Add(command);
        }
コード例 #4
0
 static public int Clear(IntPtr l)
 {
     try {
         System.Collections.Generic.List <WWWRequest> self = (System.Collections.Generic.List <WWWRequest>)checkSelf(l);
         self.Clear();
         pushValue(l, true);
         return(1);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #5
0
 // Update is called once per frame
 void Update()
 {
     if (counter % 60 == 0)
     {
         print(average + "fps");
         framerates.Clear();
         counter = 0;
     }
     framerates.Add(Mathf.RoundToInt(1 / Time.deltaTime));
     average = Mean(framerates);
     counter++;
 }
コード例 #6
0
 // inherit javadocs
 public override bool Next()
 {
     if (firstTime)
     {
         firstTime = false;
         for (int i = 0; i < subSpans.Length; i++)
         {
             if (!subSpans[i].Next())
             {
                 more = false;
                 return(false);
             }
         }
         more = true;
     }
     if (collectPayloads)
     {
         matchPayload.Clear();
     }
     return(AdvanceAfterOrdered());
 }
コード例 #7
0
ファイル: ChessBoard.cs プロジェクト: tabee1999/Aiproject
 private void ChessBoard_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Left)
     {
         if (!Playing)
         {
             Queens.Clear();
             ResetCells();
             Playing = true;
             DrawBoard();
         }
         mUserPlay = true;
         byte  colIndex = (e.Location.X - this.Left) / 80;
         byte  rowIndex = (e.Location.Y - this.Top) / 80;
         Int16 index    = Exists(ref new Queen(rowIndex, colIndex));
         if (Queens.Count < 8)
         {
             if (index > -1)
             {
                 mCells[rowIndex, colIndex] = false;
                 Queens.RemoveAt(index);
             }
             else
             {
                 mCells[rowIndex, colIndex] = true;
                 Queens.Add(new Queen(rowIndex, colIndex));
             }
         }
         else
         {
             if (index > -1)
             {
                 mCells[rowIndex, colIndex] = false;
                 Queens.RemoveAt(index);
             }
         }
         DrawBoard();
     }
 }
コード例 #8
0
 private List <string> GetItemsValueList(CheckBoxList cblItems)
 {
     System.Collections.Generic.List <string> lsItems = new System.Collections.Generic.List <string>();
     try
     {
         for (int list = 0; list < cblItems.Items.Count; list++)
         {
             lsItems.Add(cblItems.Items[list].Value);
         }
     }
     catch { lsItems.Clear(); }
     return(lsItems);
 }
コード例 #9
0
        double writeandread(Tick[] data, int date, bool printperf, bool clearreadbuffer)
        {
            // clear out the read buffer
            if (clearreadbuffer)
            {
                readdata.Clear();
            }
            // keep track of time
            double elapms;

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            // write new file from data
            TikWriter tw   = new TikWriter(PATH, data[0].symbol, date == 0 ? data[0].date: date);
            string    FILE = tw.Filepath;

            sw.Start();
            foreach (Tick k in data)
            {
                tw.newTick(k);
            }
            sw.Stop();
            tw.Close();
            elapms = (double)sw.ElapsedMilliseconds;
            if (printperf)
            {
                Console.WriteLine("write speed (ticks/sec): " + (data.Length / (elapms / 1000)).ToString("n0"));
            }

            // read file back in from file
            TikReader tr = new TikReader(FILE);

            tr.gotTick += new TickDelegate(tr_gotTick);
            sw.Reset();
            sw.Start();
            while (tr.NextTick())
            {
                ;
            }
            sw.Stop();
            tr.Close();
            elapms = (double)sw.ElapsedMilliseconds;
            if (printperf)
            {
                Console.WriteLine("read speed (ticks/sec): " + (data.Length / (elapms / 1000)).ToString("n0"));
            }

            // remove file
            removefile(FILE);

            return(elapms);
        }
コード例 #10
0
        /// <summary>
        /// Destroys all registered external data, full cleanup for internal data.
        /// </summary>
        public void Dispose()
        {
#if DEBUG
            if (_isDisposed)
            {
                throw new Exception("EcsSystems instance already disposed");
            }
            if (!_inited)
            {
                throw new Exception("EcsSystems instance was not initialized");
            }
            _isDisposed = true;
            for (var i = _debugListeners.Count - 1; i >= 0; i--)
            {
                _debugListeners[i].OnSystemsDestroyed();
            }
            _debugListeners.Clear();
            DisabledInDebugSystems.Clear();
            _inited = false;
#endif
            for (var i = _initSystemsCount - 1; i >= 0; i--)
            {
                _initSystems[i].Destroy();
                _initSystems[i] = null;
                _supervisor.ProcessDelayedUpdates();
            }
            _initSystemsCount = 0;

            for (var i = _preInitSystemsCount - 1; i >= 0; i--)
            {
                _preInitSystems[i].PreDestroy();
                _preInitSystems[i] = null;
                _supervisor.ProcessDelayedUpdates();
            }
            _preInitSystemsCount = 0;

            for (var i = _runSystemsCount - 1; i >= 0; i--)
            {
                _runSystems[i] = null;
            }
            _runSystemsCount = 0;

#if !ECP_DISABLE_INJECT
            for (var i = _injectSystemsCount - 1; i >= 0; i--)
            {
                _injectSystems[i] = null;
            }
            _injectSystemsCount = 0;
            _injections.Clear();
#endif
        }
コード例 #11
0
ファイル: MyEvent.cs プロジェクト: qpidthc/QPID
        /// <summary>
        /// 參與率次數比例
        /// </summary>
        public DataTable getScanRate(string event_no, string counter, out string total, out THC_Library.Error error)
        {
            error = null;
            total = "";
            //select EUR005,count(EUR005) as cc from event_user_records
            //where EUR002=1033
            //group by EUR005
            //having count(EUR005) > 2

            error = null;
            DataTable resultTable = null;

            IList <SqlParameter> paraList = new System.Collections.Generic.List <SqlParameter>();
            string strSQL = "select EUR005 as acc,count(EUR005) as cc,CM007 as tel from event_user_records " +
                            "left join consumer_member on EUR005=CM002 " +
                            "where EUR002=@EUR002 group by EUR005,CM007 having count(EUR005) >= @counter " +
                            "order by cc";

            paraList.Add(new SqlParameter("@EUR002", event_no));
            paraList.Add(new SqlParameter("@counter", counter));

            DataBaseControl dbCtl = new DataBaseControl();

            try
            {
                dbCtl.Open();
                resultTable = dbCtl.GetDataTable(strSQL, paraList);

                strSQL = "select count(distinct EUR005) from event_user_records where EUR002=@EUR002";
                paraList.Clear();
                paraList.Add(new SqlParameter("@EUR002", event_no));
                IDataReader dataReader = dbCtl.GetReader(strSQL, paraList);
                dataReader.Read();
                total = dataReader[0].ToString();
                dataReader.Close();
            }
            catch (Exception ex)
            {
                error              = new THC_Library.Error();
                error.Number       = THC_Library.THCException.SYSTEM_ERROR;
                error.ErrorMessage = ex.Message;
            }
            finally
            {
                dbCtl.Close();
            }

            return(resultTable);

            return(null);
        }
コード例 #12
0
 private void ClearEntGroupManagerWindows()
 {
     System.Collections.Generic.List <EntGroupManagerWindow> temEntGroupManagerWindows = new System.Collections.Generic.List <EntGroupManagerWindow>();
     foreach (System.Collections.Generic.KeyValuePair <long, EntGroupManagerWindow> item in this.entGroupManagerWindows)
     {
         temEntGroupManagerWindows.Add(item.Value);
     }
     for (int i = 0; i < temEntGroupManagerWindows.Count; i++)
     {
         temEntGroupManagerWindows[i].Close();
     }
     temEntGroupManagerWindows.Clear();
     this.entGroupManagerWindows.Clear();
 }
コード例 #13
0
        // Use this for initialization

        void Awake()
        {
            this.hideFlags |= HideFlags.HideInHierarchy;

            if (instance != null && instance != this)
            {
                Debug.LogError("Error there is only supposed to be one instance of this...");
            }

            instance = this;

            initialized = true;

            //actions.Clear();

            toBeAdded.Clear();

            toBeRemoved.Clear();

            processing = false;

            killCurrentStep = false;
        }
コード例 #14
0
        static StackObject *Clear_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Collections.Generic.List <global::EventDelegate> instance_of_this_method = (System.Collections.Generic.List <global::EventDelegate>) typeof(System.Collections.Generic.List <global::EventDelegate>).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Clear();

            return(__ret);
        }
コード例 #15
0
        /// <summary>
        /// キーボード操作時のイベントを全て削除します。
        /// </summary>
        public static void ClearEvent()
        {
            if (Events == null)
            {
                return;
            }

            foreach (HookHandler e in Events)
            {
                HookEvent -= e;
            }

            Events.Clear();
        }
コード例 #16
0
ファイル: MyEvent.cs プロジェクト: qpidthc/QPID
        public void ClearEvent(string event_no, out THC_Library.Error error)
        {
            error = null;
            IList <SqlParameter> paraList = new System.Collections.Generic.List <SqlParameter>();
            string strSQL = "select AE001 from activity_event where AE002=@AE002";

            paraList.Add(new SqlParameter("@AE002", event_no));

            DataBaseControl dbCtl = new DataBaseControl();

            try
            {
                dbCtl.Open();

                IDataReader dataReader = dbCtl.GetReader(strSQL, paraList);
                dataReader.Read();
                string eventKey = dataReader[0].ToString();
                dataReader.Close();

                paraList.Clear();
                strSQL = "update qr_record  set QRC012=0,QRC013=NULL,QRC014=NULL,QRC016=NULL " +
                         "where QRC002=@QRC002;delete from event_user_records where EUR003=@EUR003";
                paraList.Add(new SqlParameter("@QRC002", event_no));
                paraList.Add(new SqlParameter("@EUR003", event_no));

                dbCtl.BeginTransaction();

                string  jsonResult = THC_Library.APPCURL.ClearRecordLogActivity(eventKey);
                dynamic resultObj  = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonResult);
                if (resultObj.Number != 0)
                {
                    throw new Exception(resultObj.ErrorMessage.ToString());
                }

                dbCtl.ExecuteCommad(strSQL, paraList);
                dbCtl.CommintTransaction();
            }
            catch (Exception ex)
            {
                dbCtl.RollBackTransaction();
                error              = new THC_Library.Error();
                error.Number       = THC_Library.THCException.SYSTEM_ERROR;
                error.ErrorMessage = ex.Message;
            }
            finally
            {
                dbCtl.Close();
            }
        }
コード例 #17
0
 protected System.Collections.Generic.List <int> GetPrjState()
 {
     System.Collections.Generic.List <int> list = new System.Collections.Generic.List <int>
     {
         5,
         6
     };
     if (this.dropPrjState.SelectedValue != "")
     {
         int item = int.Parse(this.dropPrjState.SelectedValue);
         list.Clear();
         list.Add(item);
     }
     return(list);
 }
コード例 #18
0
        //http://clintbellanger.net/articles/isometric_math/
        //spriteBatch.Draw(texture, new Rectangle(400, 50, 100, 100), null, Color.Red, 0, Vector2.Zero, SpriteEffects.None, 0);



        public void drawIsometricGridSystem(MapInfoObject mapInfo, Camera2d camera, GraphicsDeviceManager graphics)
        {
            barriersList.Clear();
            spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);
            for (int i = 0; i < mapInfo.gridSizeX; ++i)
            {
                for (int j = 0; j < mapInfo.gridSizeY; ++j)
                {
                    //  tempPt.x = pt.x - pt.y;
                    //tempPt.y = (pt.x + pt.y) / 2;
                    //var x=j*mapInfo.tileSize/2;
                    //var y=i*mapInfo.tileSize/2;

                    var x = j * mapInfo.tileSize;
                    var y = i * mapInfo.tileSize;

                    //var isotileX = x - y;
                    //var isotileY = (x+y) / 2;
                    //var isotileX = (x - y) * mapInfo.tileSize / 2;
                    //var isotileY = (x + y) * mapInfo.tileSize / 2;
                    Vector2 isoPt        = TwoDToIso(new Vector2(x, y));
                    Vector2 transformedV = Vector2.Transform(new Vector2(isoPt.X, isoPt.Y), Matrix.Invert(camera.get_transformation(graphics.GraphicsDevice)));
                    var     tile         = new Rectangle((int)transformedV.X, (int)transformedV.Y, mapInfo.tileSize, mapInfo.tileSize);

                    TileObject tile2 = new TileObject();
                    tile2.Rectangle = tile;
                    tile2.isGreen   = false;
                    barriersList.Add(tile2);
                    DrawBorder(tile, 2, Color.Red);
                    var positionsLabel = "(" + tile2.Rectangle.X + ":" + tile2.Rectangle.Y + ")";

                    spriteBatch.DrawString(verdana36, positionsLabel, new Vector2(tile2.Rectangle.X, tile2.Rectangle.Y), Color.White, 0, Vector2.Zero, new Vector2(1, 1), SpriteEffects.None, 0);
                }
            }
            spriteBatch.End();
        }
コード例 #19
0
ファイル: SoraikoDesigner.cs プロジェクト: GovanifY/Teamod
 void ConsoleWriteLine(string debugLine)
 {
     if (lastLines.Contains(debugLine) == false)
     {
         if (lastLines.Count == 3)
         {
             lastLines.Clear();
         }
         Console.WriteLine(debugLine);
     }
     if (lastLines.Count < 3)
     {
         lastLines.Add(debugLine);
     }
 }
コード例 #20
0
ファイル: EVOApiProcessor.cs プロジェクト: brooklikeme/wantai
        public override bool ResumeScript()
        {
            CheckEvoSystemClass();

            bool bSuccessful = false;

            if (iScriptID != -1 && ((m_evoSys.GetStatus() & EVOAPILib.SC_Status.STATUS_PAUSED) == EVOAPILib.SC_Status.STATUS_PAUSED) && m_evoSys.GetScriptStatus(iScriptID) == EVOAPILib.SC_ScriptStatus.SS_PAUSED)
            {
                errorList = new System.Collections.Generic.List <string>();
                m_evoSys.Resume();

                System.Threading.Thread.Sleep(5000);

                do
                {
                    Application.DoEvents();
                    System.Threading.Thread.Sleep(1000);
                    if (m_evoSys.GetScriptStatus(iScriptID) == EVOAPILib.SC_ScriptStatus.SS_ERROR)
                    {
                        bSuccessful = false;
                        return(bSuccessful);
                    }
                } while (m_evoSys.GetScriptStatus(iScriptID) == EVOAPILib.SC_ScriptStatus.SS_BUSY);

                if (m_evoSys.GetScriptStatus(iScriptID) == EVOAPILib.SC_ScriptStatus.SS_STOPPED)
                {
                    System.Threading.Thread.Sleep(5000);
                    if (errorList != null && errorList.Count > 0 &&
                        (errorList[errorList.Count - 1].StartsWith("Run finished with errors") || ((errorList.Count - 2) >= 0 &&
                                                                                                   errorList[errorList.Count - 2].StartsWith("Run finished with errors"))))
                    {
                        bSuccessful = false;
                    }
                }
                else
                {
                    bSuccessful = true;
                }
            }
            else
            {
                bSuccessful = true;
            }

            errorList.Clear();
            errorList = null;
            return(bSuccessful);
        }
コード例 #21
0
 //TEST 4
 public void ReleaseAllAnimals()
 {
     foreach (var animal in farmAnimals)
     {
         Console.WriteLine($"{animal.AnimalType} has left the farm");
     }
     farmAnimals.Clear();
     if (farmAnimals.Count > 0)
     {
         Console.WriteLine($"There are {farmAnimals.Count} animals in the farm");
     }
     else
     {
         Console.WriteLine("Emydex Farm is now empty");
     }
 }
コード例 #22
0
 private List <string> GetSelectedItemsValueList(CheckBoxList cblSelected)
 {
     System.Collections.Generic.List <string> lsSelected = new System.Collections.Generic.List <string>();
     try
     {
         for (int list = 0; list < cblSelected.Items.Count; list++)
         {
             if (cblSelected.Items[list].Selected)
             {
                 lsSelected.Add(cblSelected.Items[list].Value);
             }
         }
     }
     catch { lsSelected.Clear(); }
     return(lsSelected);
 }
コード例 #23
0
ファイル: BidManage.aspx.cs プロジェクト: zxl881203/src
 protected System.Collections.Generic.List <int> GetPrjState()
 {
     System.Collections.Generic.List <int> list = new System.Collections.Generic.List <int>
     {
         int.Parse(ProjectParameter.Bid),
         int.Parse(ProjectParameter.QualificationPass),
         int.Parse(ProjectParameter.GiveUpState)
     };
     if (this.dropPrjState.SelectedValue != "")
     {
         list.Clear();
         int item = int.Parse(this.dropPrjState.SelectedValue);
         list.Add(item);
     }
     return(list);
 }
コード例 #24
0
 private void Awake()
 {
     Singleton = this;
     UnityEngine.Object.DontDestroyOnLoad(base.gameObject);
     list_0.Clear();
     list_1.Clear();
     list_2.Clear();
     process_0       = Process.GetCurrentProcess();
     ApplicationPath = Path.GetDirectoryName(process_0.MainModule.FileName);
     ApplicationPath = string_0 + Path.DirectorySeparatorChar.ToString();
     thread_0        = new Thread(new ThreadStart(Protection.smethod_7));
     thread_0.Start();
     base.InvokeRepeating(Class3.smethod_10(0x290), 0f, 0.1f);
     base.InvokeRepeating(Class3.smethod_10(0x2a6), 0f, 1f);
     UnityEngine.Debug.Log(Class3.smethod_10(0x2ca));
 }
コード例 #25
0
 protected void gvDataInfo_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow)
     {
         string value = this.gvDataInfo.DataKeys[e.Row.RowIndex].Value.ToString();
         string text  = this.gvDataInfo.DataKeys[e.Row.RowIndex]["PrjState"].ToString();
         e.Row.Attributes["id"]        = value;
         e.Row.Attributes["Guid"]      = value;
         e.Row.Attributes["state"]     = text;
         e.Row.Attributes["flowState"] = this.gvDataInfo.DataKeys[e.Row.RowIndex]["PftFlowState"].ToString();
         if (text == ProjectParameter.GiveUpState)
         {
             e.Row.Attributes["flowState"] = this.gvDataInfo.DataKeys[e.Row.RowIndex]["GiveUpFlowState"].ToString();
         }
         if (text == ProjectParameter.Prequalification || text == ProjectParameter.Initiate)
         {
             e.Row.Cells[9].Text = "";
             return;
         }
     }
     else
     {
         if (e.Row.RowType == DataControlRowType.Footer)
         {
             e.Row.Cells[0].Text = "合计";
             System.Collections.Generic.List <int> list = new System.Collections.Generic.List <int>
             {
                 int.Parse(ProjectParameter.Initiate),
                 int.Parse(ProjectParameter.QualificationFail),
                 int.Parse(ProjectParameter.QualificationPass)
             };
             if (this.dropPrjState.SelectedValue != "")
             {
                 list.Clear();
                 list.Add(int.Parse(this.dropPrjState.SelectedValue));
             }
             System.Collections.Generic.List <int> flowState = new System.Collections.Generic.List <int>
             {
                 1
             };
             decimal sumTotal = TenderInfo.GetSumTotal(this.txtPrjName.Text, this.txtPrjCode.Text, this.txtOwner.Text, this.dropPrjKindClass.SelectedValue, this.txtStartTime.Text, this.txtEndTime.Text, list, flowState, base.UserCode, this.txtName.Text, 4, ProjectParameter.Prequalification, "InitiateFlowState");
             e.Row.Cells[6].Text = sumTotal.ToString("#0.000");
             e.Row.Cells[6].Style.Add("text-align", "right");
             e.Row.Cells[6].CssClass = "decimal_input";
         }
     }
 }
コード例 #26
0
        /// <summary>
        /// Finds all permutations of the items within the list
        /// </summary>
        /// <typeparam name="T">Object type in the list</typeparam>
        /// <param name="Input">Input list</param>
        /// <returns>The list of permutations</returns>
        public static ListMapping <int, T> Permute <T>(this IEnumerable <T> Input)
        {
            if (Input == null)
            {
                throw new ArgumentNullException("Input");
            }
            System.Collections.Generic.List <T> Current = new System.Collections.Generic.List <T>();
            Current.AddRange(Input);
            ListMapping <int, T> ReturnValue = new ListMapping <int, T>();
            int Max          = (Input.Count() - 1).Factorial();
            int CurrentValue = 0;

            for (int x = 0; x < Input.Count(); ++x)
            {
                int z = 0;
                while (z < Max)
                {
                    int y = Input.Count() - 1;
                    while (y > 1)
                    {
                        T TempHolder = Current[y - 1];
                        Current[y - 1] = Current[y];
                        Current[y]     = TempHolder;
                        --y;
                        foreach (T Item in Current)
                        {
                            ReturnValue.Add(CurrentValue, Item);
                        }
                        ++z;
                        ++CurrentValue;
                        if (z == Max)
                        {
                            break;
                        }
                    }
                }
                if (x + 1 != Input.Count())
                {
                    Current.Clear();
                    Current.AddRange(Input);
                    T TempHolder2 = Current[0];
                    Current[0]     = Current[x + 1];
                    Current[x + 1] = TempHolder2;
                }
            }
            return(ReturnValue);
        }
コード例 #27
0
        public void Shutdown()
        {
            lock (_Items)
            {
                foreach (var t in _Items)
                {
                    t.Shutdown();
                }
                _Items.Clear();
            }

            Operation operation;

            while (_Operations.TryDequeue(out operation))
            {
            }
        }
コード例 #28
0
        public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context)
        {
            if (context != null && context.Instance is PartAttributes)
            {
                List <string> values = new System.Collections.Generic.List <string>();
                values.Clear();

                for (int i = 0; i < (context.Instance as PartAttributes).ProjectObject.SingerList.Count; i++)
                {
                    values.Add((context.Instance as PartAttributes).ProjectObject.SingerList[i].VocalName);
                }
                values.Add("添加/删除歌手...");
                return(new StandardValuesCollection(values));
            }

            return(base.GetStandardValues(context));
        }
コード例 #29
0
    public void Update()
    {
        foreach (var onClickFunction in onClickEventFnList)
        {
            onClickFunction();
        }
        onClickEventFnList.Clear();

        // Update object positions that supposed to be visible into the range of the camera
        _minPos = currentSong.WorldYPositionToTick(camYMin.position.y);
        _maxPos = currentSong.WorldYPositionToTick(camYMax.position.y);

        // Set window text to represent if the current song has been saved or not
        windowHandleManager.UpdateDirtyNotification(isDirty);

        applicationStateMachine.Update();
    }
コード例 #30
0
ファイル: CAT65.cs プロジェクト: tanxulong/MUAC
        // 1. Item presence
        // 2. Item description
        //
        // Based on the data item identifer


        public static void Intitialize()
        {
            I065DataItems.Clear();

            // 1 I065/010 Data Source Identifier
            I065DataItems.Add(new I065DataItem());
            I065DataItems[ItemIDToIndex("010")].ID          = "010";
            I065DataItems[ItemIDToIndex("010")].Description = "Data Source Identifier";
            I065DataItems[ItemIDToIndex("010")].IsPresent   = false;

            // 2 I065/000 Message Type
            I065DataItems.Add(new I065DataItem());
            I065DataItems[ItemIDToIndex("000")].ID          = "000";
            I065DataItems[ItemIDToIndex("000")].Description = "Message Type";
            I065DataItems[ItemIDToIndex("000")].IsPresent   = false;

            // 3 I065/015  Service Identification
            I065DataItems.Add(new I065DataItem());
            I065DataItems[ItemIDToIndex("015")].ID          = "015";
            I065DataItems[ItemIDToIndex("015")].Description = "Service Identification";
            I065DataItems[ItemIDToIndex("015")].IsPresent   = false;

            // 4 I065/030  Time of Message
            I065DataItems.Add(new I065DataItem());
            I065DataItems[ItemIDToIndex("030")].ID          = "030";
            I065DataItems[ItemIDToIndex("030")].Description = "Time of Message";
            I065DataItems[ItemIDToIndex("030")].IsPresent   = false;

            // 5 I065/020  Batch Number
            I065DataItems.Add(new I065DataItem());
            I065DataItems[ItemIDToIndex("020")].ID          = "020";
            I065DataItems[ItemIDToIndex("020")].Description = "Batch Number";
            I065DataItems[ItemIDToIndex("020")].IsPresent   = false;

            // 6 I065/040  SDPS Configuration and Status
            I065DataItems.Add(new I065DataItem());
            I065DataItems[ItemIDToIndex("040")].ID          = "040";
            I065DataItems[ItemIDToIndex("040")].Description = "SDPS Configuration and Status";
            I065DataItems[ItemIDToIndex("040")].IsPresent   = false;

            // 7 I065/050  Service Status Report
            I065DataItems.Add(new I065DataItem());
            I065DataItems[ItemIDToIndex("050")].ID          = "050";
            I065DataItems[ItemIDToIndex("050")].Description = "Service Status Report";
            I065DataItems[ItemIDToIndex("050")].IsPresent   = false;
        }
コード例 #31
0
    protected void btnDel_Click(object sender, System.EventArgs e)
    {
        ConIncometContractService conIncometContractService = new ConIncometContractService();
        BudContractTaskService    budContractTaskService    = new BudContractTaskService();

        using (SqlConnection sqlConnection = new SqlConnection(SqlHelper.ConnectionString))
        {
            sqlConnection.Open();
            SqlTransaction sqlTransaction = sqlConnection.BeginTransaction();
            try
            {
                string message = "";
                System.Collections.Generic.List <string> list = new System.Collections.Generic.List <string>();
                foreach (GridViewRow gridViewRow in this.gvConract.Rows)
                {
                    CheckBox checkBox = gridViewRow.FindControl("cbBox") as CheckBox;
                    if (checkBox != null && checkBox.Checked)
                    {
                        if (!this.incometContractBll.IsDel(checkBox.ToolTip))
                        {
                            list.Clear();
                            message = "alert('系统提示:\\n\\n请先删除与收款合同相关的其他数据!')";
                            break;
                        }
                        ConIncometContract byContractId = conIncometContractService.GetByContractId(checkBox.ToolTip);
                        budContractTaskService.DelRalationBudgetAndContract(byContractId.Project, checkBox.ToolTip);
                        this.rptSev.DelByContractId(checkBox.ToolTip);
                        list.Add(checkBox.ToolTip);
                        message = "alert('系统提示:\\n\\n数据删除成功!');location='IncometContractList.aspx'";
                    }
                }
                Common2.DelByStrWhere("Con_Incomet_Contract", " where ContractId in (" + StringUtility.GetArrayToInStr(list.ToArray()) + ")");
                ConConfigContractService conConfigContractService = new ConConfigContractService();
                conConfigContractService.Deltes(list);
                base.RegisterScript(message);
                sqlTransaction.Commit();
                this.BindGv();
            }
            catch (System.Exception)
            {
                sqlTransaction.Rollback();
                base.RegisterScript("alert('系统提示:\\n\\n对不起删除失败!');");
            }
        }
    }
コード例 #32
0
        private void findLoadedParts(string OboznOfPart)
        {
            if (!SQLOracle.existParamQuery("OBOZN", "DB_DATA", "OBOZN", OboznOfPart))
            {
                toolStripStatusLabel1.Text = "Модель не найдена!";

                string NMF = SQLOracle.ParamQuerySelect("SELECT NMF FROM KTC.MODEL_ATTR20 WHERE HD = :HD", "HD", OboznOfPart);

                if (SQLOracle.existParamQuery("NMF", "FILE_BLOB20", "NMF", NMF.Trim()))
                {
                    toolStripStatusLabel1.Text = "Модель создана и ожидает внесения информации в базу данных!";

                    System.Collections.Generic.List<string> AcquiredInformation = new System.Collections.Generic.List<string>();

                    treeOfModel.BeginUpdate();

                    treeOfModel.Nodes.Clear();

                    treeOfModel.Nodes.Add(NMF);

                    AcquiredInformation = SQLOracle.GetInformationListWithParamQuery("NMF", "MODEL_STRUCT20", "PARENT", (NMF));

                    for (int i = 0; i < AcquiredInformation.Count; i++)
                    {
                        treeOfModel.Nodes[0].Nodes.Add(AcquiredInformation[i].ToString());
                    }

                    AcquiredInformation.Clear();

                    treeOfModel.EndUpdate();

                    treeOfModel.Nodes[0].ExpandAll();
                }

            }
            else {

                toolStripStatusLabel1.Text = "Информация о модели уже внесена!";

            }
        }
コード例 #33
0
ファイル: Setings.cs プロジェクト: Blyumenshteyn/UchetUSP
        public void voidCloseAPP()
        {
            if (SQLOracle.existParamQuery("FORM_SAVE", "USP_USER_SETTING", "FORM_SAVE = '1' AND USR ", "USR", SQLOracle.GetCurrentUser()))
            {

                System.Collections.Generic.List<string> parametr = new System.Collections.Generic.List<string>();
                System.Collections.Generic.List<string> value = new System.Collections.Generic.List<string>();

                string InputString = "UPDATE USP_USER_SETTING SET FORM_WIDTH = :FORM_WIDTH, FORM_HEIGHT = :FORM_HEIGHT WHERE USR = : USR  ";

                parametr.Add("FORM_WIDTH");
                value.Add(WidthForm.ToString());
                parametr.Add("FORM_HEIGHT");
                value.Add(HeightForm.ToString());
                parametr.Add("USR");
                value.Add(SQLOracle.GetCurrentUser());
                SQLOracle.UpdateQuery(InputString, parametr, value);
                parametr.Clear();
                value.Clear();
            }
        }
コード例 #34
0
ファイル: Signature.cs プロジェクト: yunxiaokeji/IntFactory
        public static string GetSignature(string appkey, string appsecret,
        string userID)
        {
            System.Collections.Generic.List<string> arr = new System.Collections.Generic.List<string>();
            arr.Add(appkey.ToLower());
            arr.Add(appsecret.ToLower());
            arr.Sort();
            string appinfo = string.Join(string.Empty, arr.ToArray());

            appinfo = GetMd5(appinfo).ToLower();

            arr.Clear();
            arr.Add(appinfo);
            arr.Add(userID.ToLower());
            arr.Sort();

            string signature = string.Join(string.Empty, arr.ToArray());
            signature = GetSha1(signature).ToLower();

            return signature;
        }
コード例 #35
0
        /// <summary>
        /// Create columns for ListView
        /// </summary>
        private void CreateListViewColumnTH(string olvType, string sortColumnName, SortOrder order)
        {
            if (olvType == "Strings") this.olvTHStrings.AllColumns.Clear();
              if (olvType == "DLStrings") this.olvTHILStrings.AllColumns.Clear();
              if (olvType == "ILStrings") this.olvTHDLStrings.AllColumns.Clear();
              if (olvType == "OtherStrings") this.olvTHOtherStrings.AllColumns.Clear();

              string typeCol = "STR";
              if (olvType == "DLStrings") typeCol = "DL";
              if (olvType == "ILStrings") typeCol = "IL";
              if (olvType == "OtherStrings") typeCol = "OTHER";

              System.Collections.Generic.List<OLVColumn> listCol = new System.Collections.Generic.List<OLVColumn>();
              BrightIdeasSoftware.OLVColumn olvCol;
              BrightIdeasSoftware.OLVColumn primarySortColumn = null;
              BrightIdeasSoftware.OLVColumn secondarySortColumn = null;

              listCol.Clear();

              #region GroupName

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "GroupName";
              olvCol.Text = "Group";
              olvCol.Width = 100;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = true;
              olvCol.Name = "olvColGroup" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Left;
              olvCol.Sortable = true;
              olvCol.Groupable = true;
              listCol.Add(olvCol);
              primarySortColumn = olvCol;

              #endregion

              #region StringStatus

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "StringStatus";
              olvCol.Text = "State";
              olvCol.Width = 50;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = true;
              olvCol.Name = "olvColStringStatus" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Center;
              olvCol.Sortable = false;
              olvCol.Groupable = false;
              listCol.Add(olvCol);

              #endregion

              #region CompareStatusSource

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "CompareStatusSource";
              olvCol.Text = "Src <>";
              olvCol.Width = 50;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = true;
              olvCol.Name = "olvColCompareStatus" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Center;
              olvCol.Sortable = false;
              olvCol.Groupable = false;
              listCol.Add(olvCol);

              #endregion

              #region CompareStatusSource

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "CompareStatusTarget";
              olvCol.Text = "Tgt <>";
              olvCol.Width = 50;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = true;
              olvCol.Name = "olvColCompareStatusTarget" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Center;
              olvCol.Sortable = false;
              olvCol.Groupable = false;
              listCol.Add(olvCol);

              #endregion

              #region CompareStatusSource

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "RecordType";
              olvCol.Text = "Type";
              olvCol.Width = 60;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = true;
              olvCol.Name = "olvColRecordType" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Left;
              olvCol.Sortable = true;
              olvCol.Groupable = false;
              if (sortColumnName == "RecordType") secondarySortColumn = olvCol;
              listCol.Add(olvCol);

              #endregion

              #region EditorID

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "EditorID";
              olvCol.Text = "Editor ID";
              olvCol.Width = 200;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColEditorID" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Left;
              olvCol.Sortable = true;
              olvCol.Groupable = false;
              if (sortColumnName == "EditorID") { secondarySortColumn = olvCol; olvCol.HeaderImageKey = order == SortOrder.Ascending ? "sort-descend" : "sort-ascend"; }
              listCol.Add(olvCol);

              #endregion

              #region SourceItemDesc

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "SourceItemDesc";
              olvCol.Text = "Source Text";
              olvCol.Width = 300;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColSourceItemDesc" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Left;
              olvCol.Sortable = true;
              olvCol.Groupable = false;
              if (sortColumnName == "SourceItemDesc") secondarySortColumn = olvCol;
              listCol.Add(olvCol);

              #endregion

              #region TargetItemDesc

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "TargetItemDesc";
              olvCol.Text = "Target Text";
              olvCol.Width = 300;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColTargetItemDesc" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Left;
              olvCol.Sortable = true;
              olvCol.Groupable = false;
              if (sortColumnName == "TargetItemDesc") secondarySortColumn = olvCol;
              listCol.Add(olvCol);

              #endregion

              #region SourceStringIDHexa

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "SourceStringIDHexa";
              olvCol.Text = "String ID";
              olvCol.Width = 70;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColSourceStringIDHexa" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Center;
              olvCol.Sortable = false;
              olvCol.Groupable = false;
              olvCol.IsVisible = false;
              listCol.Add(olvCol);

              #endregion

              #region WriteStringInPlugIn

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "WriteStringInPlugIn";
              olvCol.Text = "Write";
              olvCol.Width = 300;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvWriteStringInPlugIn" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Center;
              olvCol.Sortable = false;
              olvCol.Groupable = false;
              olvCol.IsVisible = false;
              listCol.Add(olvCol);

              #endregion

              #region FormID

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "FormID";
              olvCol.Text = "Form ID";
              olvCol.Width = 70;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColFormID" + typeCol;
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Center;
              olvCol.Sortable = false;
              olvCol.Groupable = false;
              olvCol.IsVisible = false;
              listCol.Add(olvCol);

              #endregion

              ObjectListView ovl = null;

              if (olvType == "Strings") ovl = olvTHStrings;
              if (olvType == "DLStrings") ovl = olvTHDLStrings;
              if (olvType == "ILStrings") ovl = olvTHILStrings;
              if (olvType == "OtherStrings") ovl = olvTHOtherStrings;

              if (olvType != null)
              {
            ovl.BeginUpdate();
            ovl.HeaderUsesThemes = false;
            ovl.Items.Clear();
            ovl.Columns.Clear();
            ovl.AllColumns.AddRange(listCol);
            ovl.RebuildColumns();
            ovl.AlwaysGroupByColumn = primarySortColumn;
            ovl.AlwaysGroupBySortOrder = SortOrder.Ascending;
            ovl.SortGroupItemsByPrimaryColumn = true;
            ovl.GridLines = true;
            if (secondarySortColumn != null)
            {
              ovl.SecondarySortColumn = secondarySortColumn;
              ovl.SecondarySortOrder = order;
            }
            ovl.EndUpdate();
              }
        }
コード例 #36
0
        private void UpdateInformationToDB()
        {
            if (string.Compare(CheckInformationForEditing(), "0") == 0)
            {
                System.Collections.Generic.List<string> Parameters = new System.Collections.Generic.List<string>();

                System.Collections.Generic.List<string> DataFromTextBox = new System.Collections.Generic.List<string>();

                Parameters.Add("NAME"); DataFromTextBox.Add(IsNullParametr(box_NAME));
                Parameters.Add("GOST"); DataFromTextBox.Add(box_GOST.Text.ToString());
                Parameters.Add("L"); DataFromTextBox.Add(IsNullParametr(box_L));
                Parameters.Add("B"); DataFromTextBox.Add(IsNullParametr(box_B));
                Parameters.Add("B1"); DataFromTextBox.Add(IsNullParametr(box_B1));
                Parameters.Add("H"); DataFromTextBox.Add(IsNullParametr(box_H));
                Parameters.Add("D"); DataFromTextBox.Add(IsNullParametr(box_D));
                Parameters.Add("D1"); DataFromTextBox.Add(IsNullParametr(box_D1));
                Parameters.Add("D_SM_DB"); DataFromTextBox.Add(IsNullParametr(box_d_sm));
                Parameters.Add("D1_SM_DB"); DataFromTextBox.Add(IsNullParametr(box_d_sm1));
                Parameters.Add("A"); DataFromTextBox.Add(IsNullParametr(box_alfa));
                Parameters.Add("S"); DataFromTextBox.Add(IsNullParametr(box_s));
                Parameters.Add("B_SM_DB"); DataFromTextBox.Add(IsNullParametr(box_b_sm));
                Parameters.Add("H0"); DataFromTextBox.Add(IsNullParametr(box_H0));
                Parameters.Add("H_SM_DB"); DataFromTextBox.Add(IsNullParametr(box_h_sm));
                Parameters.Add("T"); DataFromTextBox.Add(IsNullParametr(box_t));
                Parameters.Add("N"); DataFromTextBox.Add(IsNullParametr(box_N));
                Parameters.Add("MASSA"); DataFromTextBox.Add(IsNullParametr(box_MASSA));
                Parameters.Add("NALICHI"); DataFromTextBox.Add(box_NALICHIE.Text.ToString());
                Parameters.Add("TT"); DataFromTextBox.Add(IsNullParametr(box_TT));
                Parameters.Add("YT"); DataFromTextBox.Add(IsNullParametr(box_YT));
                Parameters.Add("PR"); DataFromTextBox.Add(IsNullParametr(box_PR));
                Parameters.Add("RZ"); DataFromTextBox.Add(IsNullParametr(box_RZ));
                Parameters.Add("GROUP_USP"); DataFromTextBox.Add(Convert.ToString(comboBox3.SelectedIndex));
                Parameters.Add("KATALOG_USP"); DataFromTextBox.Add(Convert.ToString(comboBox2.SelectedIndex));
                Parameters.Add("UG"); DataFromTextBox.Add("123"/*Convert.ToString(comboBox1.SelectedIndex)*/);
                Parameters.Add("OBOZN"); DataFromTextBox.Add(box_OBOZN.Text.ToString());

                if (String.Compare(box_DET.Text.ToString(), "0") != 0)
                {
                    System.IO.FileStream FileStreamBMP = new System.IO.FileStream(box_DET.Text, System.IO.FileMode.Open, System.IO.FileAccess.Read);
                    byte[] BMPInByte = new Byte[FileStreamBMP.Length - 1];
                    FileStreamBMP.Read(BMPInByte, 0, BMPInByte.Length);
                    FileStreamBMP.Close();
                    IDisposable disp = (IDisposable)FileStreamBMP;
                    disp.Dispose();

                     string cmd = "UPDATE DB_DATA SET NAME = :NAME, GOST = :GOST, L=:L, B=:B, B1=:B1, H=:H, D =:D, D1 =:D1, D_SM_DB =: D_SM_DB, D1_SM_DB = :D1_SM_DB, A =:A, " +
                     "S =:S, B_SM_DB = :B_SM_DB, H0 = :H0, H_SM_DB =:H_SM_DB, T = :T, N = :N, MASSA = :MASSA, NALICHI =:NALICHI, TT = :TT, YT = :YT, PR = :PR, RZ =: RZ, GROUP_USP =:GROUP_USP ," +
                     "KATALOG_USP =:KATALOG_USP,UG =:UG ,DET =:DET WHERE OBOZN = :OBOZN";

                     SQLOracle.SpecificUpdateQuery(cmd, Parameters, DataFromTextBox, BMPInByte);

                }
                else {

                     string cmd = "UPDATE DB_DATA SET NAME = :NAME, GOST = :GOST, L=:L, B=:B, B1=:B1, H=:H, D =:D, D1 =:D1, D_SM_DB =: D_SM_DB, D1_SM_DB = :D1_SM_DB, A =:A, " +
                     "S =:S, B_SM_DB = :B_SM_DB, H0 = :H0, H_SM_DB =:H_SM_DB, T = :T, N = :N, MASSA = :MASSA, NALICHI =:NALICHI, TT = :TT, YT = :YT, PR = :PR, RZ =: RZ, GROUP_USP =:GROUP_USP ," +
                     "KATALOG_USP =:KATALOG_USP,UG =:UG WHERE OBOZN = :OBOZN";

                     if (SQLOracle.UpdateQuery(cmd, Parameters, DataFromTextBox) == true)
                     {
                         System.Windows.Forms.MessageBox.Show("Данные успешно обновлены!");
                     }

                }

                Parameters.Clear();
                DataFromTextBox.Clear();

            }
            else
            {
                MessageBox.Show(CheckInformation(), "Ошибка!");
            }
        }
コード例 #37
0
ファイル: page3.cs プロジェクト: svn2github/eztx
        //平衡指数
        public string[] pingHengZhiShu()
        {
            System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();
            string[] allNum = fanBianQiuCal();

            int overMy = 0;
            List<int> nums = new List<int>();
            foreach (Control ctls in this.pHZSGpb.Controls)
            {
                bool isNum = isNumber(ctls.Text);
                if (ctls is CheckBox)
                {
                    if ((ctls as CheckBox).Checked == true && isNum == true)
                    {
                        nums.Add(Convert.ToInt16(ctls.Text));
                    }
                }
            }

            if (nums.Count == 1)
            {
                if (nums.Contains(1))
                {
                    if (jiaCkb.Checked == true)
                    {
                        overMy++;
                        result.AddRange(phJia());
                    }

                    if (jianCkb.Checked == true)
                    {
                        overMy++;
                        result.AddRange(phJian());
                    }

                    if (dengCkb.Checked == true)
                    {
                        overMy++;
                        result.AddRange(phDeng());
                    }
                }

                if (nums.Contains(0))
                {
                    if (jiaCkb.Checked == true)
                    {
                        overMy++;
                        result.AddRange(phJia());
                    }

                    if (jianCkb.Checked == true)
                    {
                        overMy++;
                        result.AddRange(phJian());
                    }

                    if (dengCkb.Checked == true)
                    {
                        overMy++;
                        result.AddRange(phDeng());
                    }

                    List<string> temp = new List<string>();
                    temp.AddRange(chaHe());
                    for (int i = 0; i < result.Count(); i++)
                    {
                        temp.Remove(result[i]);
                    }
                    result.Clear();
                    result.AddRange(temp);
                }

            }

            if (nums.Count == 2)
            {
                result.AddRange(allNum);
            }

            if (overMy == 0)
                result.AddRange(allNum);

            List<string> result1 = result.Distinct().ToList();//去除重复项
            result1.Sort();
            return result1.ToArray();
        }
コード例 #38
0
ファイル: page3.cs プロジェクト: svn2github/eztx
        //判断龙头凤尾
        private string[] longTouFengWei()
        {
            System.Collections.Generic.List<string> result = new System.Collections.Generic.List<string>();

            int nums = 0;

            List<string> mm = new List<string>();
            foreach (Control ctls in this.ltfwMustGpb.Controls)
            {
                if ((ctls as CheckBox).Checked == true)
                {
                    mm.Add(ctls.Text);
                }
            }

            if (mm.Contains("包含"))
            {
                foreach (Control ctls in this.touDxGpb.Controls)
                {
                    if ((ctls as CheckBox).Checked == true)
                    {
                        nums++;
                        result.AddRange(touDx());
                    }
                }
                foreach (Control ctls in this.touDsGpb.Controls)
                {
                    if ((ctls as CheckBox).Checked == true)
                    {
                        nums++;
                        result.AddRange(touDs());
                    }
                }
                foreach (Control ctls in this.touZhGpb.Controls)
                {
                    if ((ctls as CheckBox).Checked == true)
                    {
                        nums++;
                        result.AddRange(touZh());
                    }
                }
                foreach (Control ctls in this.weiDxGpb.Controls)
                {
                    if ((ctls as CheckBox).Checked == true)
                    {
                        nums++;
                        result.AddRange(weiDx());
                    }
                }
                foreach (Control ctls in this.weiDsGpb.Controls)
                {
                    if ((ctls as CheckBox).Checked == true)
                    {
                        nums++;
                        result.AddRange(weiDs());
                    }
                }
                foreach (Control ctls in this.weiZhGpb.Controls)
                {
                    if ((ctls as CheckBox).Checked == true)
                    {
                        nums++;
                        result.AddRange(weiZh());
                    }
                }
            }

            if (mm.Contains("杀去"))
            {
                foreach (Control ctls in this.touDxGpb.Controls)
                {
                    if ((ctls as CheckBox).Checked == true)
                    {
                        nums++;
                        result.AddRange(touDx());
                    }
                }
                foreach (Control ctls in this.touDsGpb.Controls)
                {
                    if ((ctls as CheckBox).Checked == true)
                    {
                        nums++;
                        result.AddRange(touDs());
                    }
                }
                foreach (Control ctls in this.touZhGpb.Controls)
                {
                    if ((ctls as CheckBox).Checked == true)
                    {
                        nums++;
                        result.AddRange(touZh());
                    }
                }
                foreach (Control ctls in this.weiDxGpb.Controls)
                {
                    if ((ctls as CheckBox).Checked == true)
                    {
                        nums++;
                        result.AddRange(weiDx());
                    }
                }
                foreach (Control ctls in this.weiDsGpb.Controls)
                {
                    if ((ctls as CheckBox).Checked == true)
                    {
                        nums++;
                        result.AddRange(weiDs());
                    }
                }
                foreach (Control ctls in this.weiZhGpb.Controls)
                {
                    if ((ctls as CheckBox).Checked == true)
                    {
                        nums++;
                        result.AddRange(weiZh());
                    }
                }

                List<string> temp = new List<string>();
                temp.AddRange(chaHe());
                for (int i = 0; i < result.Count(); i++)
                {
                    temp.Remove(result[i]);
                }
                result.Clear();
                result.AddRange(temp);

            }

            if (nums == 0)
            {
                result.AddRange(chaHe());
            }

            List<string> result1 = result.Distinct().ToList();//去除重复项
            return result1.ToArray();
        }
コード例 #39
0
        /// <summary>
        /// Create columns for ListView
        /// </summary>
        private void CreateListViewColumn()
        {
            this.olvSkyrimDict.AllColumns.Clear();
              this.olvTHSkyrimSourceStrings.AllColumns.Clear();
              this.olvTHSkyrimTargetStrings.AllColumns.Clear();

              string typeCol = String.Empty;

              System.Collections.Generic.List<OLVColumn> listCol = new System.Collections.Generic.List<OLVColumn>();
              BrightIdeasSoftware.OLVColumn olvCol;
              BrightIdeasSoftware.OLVColumn primarySortColumn;

              #region olvTHSkyrimSourceStrings / olvTHSkyrimTargetStrings

              for (int i = 0; i < 2; i++)
              {
            listCol.Clear();

            olvCol = new BrightIdeasSoftware.OLVColumn();
            olvCol.AspectName = "StringID";
            olvCol.Text = "ID";
            olvCol.Width = 60;
            olvCol.HeaderTextAlign = HorizontalAlignment.Center;
            olvCol.Groupable = false;
            olvCol.Name = "olvColSkyrimSourceStringsIDHexa";
            olvCol.HeaderFormatStyle = headerFormatStyleData2;
            olvCol.TextAlign = HorizontalAlignment.Center;
            olvCol.Sortable = true;
            listCol.Add(olvCol);

            olvCol = new BrightIdeasSoftware.OLVColumn();
            olvCol.AspectName = "SkyrimText";
            olvCol.Text = "Text";
            olvCol.Width = 450;
            olvCol.HeaderTextAlign = HorizontalAlignment.Center;
            olvCol.Groupable = false;
            olvCol.Name = "olvColSkyrimSourceStringsText";
            olvCol.HeaderFormatStyle = headerFormatStyleData2;
            olvCol.TextAlign = HorizontalAlignment.Left;
            olvCol.Sortable = true;
            listCol.Add(olvCol);
            primarySortColumn = olvCol;

            if (i == 0)
            {
              this.olvTHSkyrimSourceStrings.AllColumns.AddRange(listCol);
              this.olvTHSkyrimSourceStrings.RebuildColumns();
            }

            if (i == 1)
            {
              this.olvTHSkyrimTargetStrings.AllColumns.AddRange(listCol);
              this.olvTHSkyrimTargetStrings.RebuildColumns();
            }
              }
              #endregion

              #region olvSkyrimDict

              listCol.Clear();

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "StringID";
              olvCol.Text = "ID";
              olvCol.Width = 60;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColSkyrimStringIDHexa";
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Center;
              olvCol.Sortable = true;
              listCol.Add(olvCol);

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "SourceString";
              olvCol.Text = "Source";
              olvCol.Width = 240;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColSkyrimItemDescSourceLang";
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Left;
              olvCol.Sortable = true;
              listCol.Add(olvCol);
              primarySortColumn = olvCol;

              olvCol = new BrightIdeasSoftware.OLVColumn();
              olvCol.AspectName = "TargetString";
              olvCol.Text = "Target";
              olvCol.Width = 240;
              olvCol.HeaderTextAlign = HorizontalAlignment.Center;
              olvCol.Groupable = false;
              olvCol.Name = "olvColSkyrimItemDescTargetLang";
              olvCol.HeaderFormatStyle = headerFormatStyleData;
              olvCol.TextAlign = HorizontalAlignment.Left;
              olvCol.Sortable = true;
              listCol.Add(olvCol);

              this.olvSkyrimDict.AllColumns.AddRange(listCol);
              this.olvSkyrimDict.RebuildColumns();
              this.olvSkyrimDict.PrimarySortColumn = primarySortColumn;

              #endregion
        }
コード例 #40
0
        //функция обновления данных
        private void UpdateInformationInDB()
        {
            if (string.Compare(CheckInformation(), "0") != 0)
            {
                bool successToLoadData = false;

                System.Collections.Generic.List<string> Parameters = new System.Collections.Generic.List<string>();

                System.Collections.Generic.List<string> DataFromTextBox = new System.Collections.Generic.List<string>();

                string cmd = "UPDATE KTC.USP_NAKLADNAYA_HEAD SET " +
                " ORGANIZATION = :ORGANIZATION, " +
                " DATA_SOSTAVLENIYA = to_date(:DATA_SOSTAVLENIYA,'DD.MM.YYYY hh24:mi:ss'), " +
                " COD_VIDA_OPER = :COD_VIDA_OPER, " +
                " OTPRAV_STRUCT_PODR = :OTPRAV_STRUCT_PODR, " +
                " OTPRAV_VID_DEYAT = :OTPRAV_VID_DEYAT, " +
                " SHIFR_POLUCH = :SHIFR_POLUCH, " +
                " SHIFR_POTREB = :SHIFR_POTREB, " +
                " VID_DEYAT = :VID_DEYAT, " +
                " UCH_ED_VIP = :UCH_ED_VIP, " +
                " PORYAD_NUM = :PORYAD_NUM, " +
                " CHEREZ_KOGO = :CHEREZ_KOGO, " +
                " ZATREBOVAL = :ZATREBOVAL, " +
                " RAZRESHIL = :RAZRESHIL, " +
                " OTPUSTIL_DATE = to_date(:OTPUSTIL_DATE,'DD.MM.YYYY hh24:mi:ss'), " +
                " OTPUSTIL_FAM = :OTPUSTIL_FAM, " +
                " POLUCHIL_DATE = to_date(:POLUCHIL_DATE,'DD.MM.YYYY hh24:mi:ss'), " +
                " POLUCHIL_FAM = :POLUCHIL_FAM " +
                " WHERE NOMER_TREBOV_NAKLADNOI = :NOMER_TREBOV_NAKLADNOI";

                Parameters.Add("ORGANIZATION"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(textBox1));
                Parameters.Add("DATA_SOSTAVLENIYA"); DataFromTextBox.Add(PanelN1One.Value.ToString());
                Parameters.Add("COD_VIDA_OPER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(PanelN1two));
                Parameters.Add("OTPRAV_STRUCT_PODR"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(PanelN1three));
                Parameters.Add("OTPRAV_VID_DEYAT"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(PanelN1four));
                Parameters.Add("SHIFR_POLUCH"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(PanelN1five));
                Parameters.Add("SHIFR_POTREB"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(PanelN1FiveA));
                Parameters.Add("VID_DEYAT"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(PanelN1Six));
                Parameters.Add("UCH_ED_VIP"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(PanelN1Seven));
                Parameters.Add("PORYAD_NUM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(PanelN1sevenA));
                Parameters.Add("CHEREZ_KOGO"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(textBox2));
                Parameters.Add("ZATREBOVAL"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(textBox3));
                Parameters.Add("RAZRESHIL"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(textBox4));
                Parameters.Add("OTPUSTIL_DATE"); DataFromTextBox.Add(dateTimePicker1.Value.ToString());
                Parameters.Add("OTPUSTIL_FAM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(textBox245));
                Parameters.Add("POLUCHIL_DATE"); DataFromTextBox.Add(dateTimePicker2.Value.ToString());
                Parameters.Add("POLUCHIL_FAM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(textBox246));
                Parameters.Add("NOMER_TREBOV_NAKLADNOI"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(PanelN1OneA));

                successToLoadData = SQLOracle.UpdateQuery(cmd, Parameters, DataFromTextBox);

                Parameters.Clear();
                DataFromTextBox.Clear();

                if (successToLoadData == true)
                    for (int i = 0; i < 16; i++)
                    {
                        string cmdDATA = "UPDATE KTC.USP_NAKLADNAYA_DATA SET   ";

                        for (int j = 0; j < ((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls.Count; j++)
                        {

                            int TagOfObject = (Convert.ToInt32(((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j].Tag));

                            if (TagOfObject == 0)
                            {
                                //Корресп. Счет, суб-счет, код аналит. Учета
                                Parameters.Add("KORRESP_SCHET"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));

                                cmdDATA += "KORRESP_SCHET = :KORRESP_SCHET, ";
                            }
                            else if (TagOfObject == 1)
                            {
                                //Материальные ценности наименование (9)
                                Parameters.Add("MATERR_CENNOSTI"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "MATERR_CENNOSTI = :MATERR_CENNOSTI, ";
                            }
                            else if (TagOfObject == 2)
                            {
                                //код материала
                                Parameters.Add("COD_MATER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "COD_MATER = :COD_MATER, ";
                            }
                            else if (TagOfObject == 3)
                            {
                                //заводской номер
                                Parameters.Add("ZAVOD_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "ZAVOD_NOMER = :ZAVOD_NOMER, ";
                            }
                            else if (TagOfObject == 4)
                            {
                                //Ед. изм. Наимен. Код
                                Parameters.Add("ED_IZM_NAIM_1"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "ED_IZM_NAIM_1 = :ED_IZM_NAIM_1, ";
                            }
                            else if (TagOfObject == 5)
                            {
                                //Ед. изм. Наимен. Код
                                Parameters.Add("ED_IZM_NAIM_2"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "ED_IZM_NAIM_2 = :ED_IZM_NAIM_2, ";
                            }
                            else if (TagOfObject == 6)
                            {
                                //затребовано
                                Parameters.Add("ZATREBOVANO"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "ZATREBOVANO = :ZATREBOVANO, ";
                            }
                            else if (TagOfObject == 7)
                            {
                                //отпущено
                                Parameters.Add("OTPUSHENO"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "OTPUSHENO = :OTPUSHENO, ";
                            }
                            else if (TagOfObject == 8)
                            {
                                //Цена (руб., коп.)
                                Parameters.Add("CENA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "CENA = :CENA, ";
                            }
                            else if (TagOfObject == 9)
                            {
                                //Сумма без расчета НДС, руб. коп.
                                Parameters.Add("SUMMA_BEZ_NDS"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "SUMMA_BEZ_NDS = :SUMMA_BEZ_NDS, ";
                            }
                            else if (TagOfObject == 10)
                            {
                                //Корреспон. счет, суб-счет, код аналит. учета
                                Parameters.Add("KORRESP_SCHET_2"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "KORRESP_SCHET_2 = :KORRESP_SCHET_2, ";
                            }
                            else if (TagOfObject == 11)
                            {
                                //Обесп. Серийн. № машины
                                Parameters.Add("OBESP_SER_MASH"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "OBESP_SER_MASH = :OBESP_SER_MASH, ";
                            }
                            else if (TagOfObject == 12)
                            {
                                //Некомп-плектный остаток
                                Parameters.Add("NEKOMPLEKT_OSTATOK"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "NEKOMPLEKT_OSTATOK = :NEKOMPLEKT_OSTATOK, ";
                            }
                            else if (TagOfObject == 13)
                            {
                                //Код издел. ШР, БЛ, № с/з
                                Parameters.Add("COD_IZD_SHR_BL"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "COD_IZD_SHR_BL = :COD_IZD_SHR_BL, ";
                            }
                            else if (TagOfObject == 14)
                            {
                                //Признак раздела
                                Parameters.Add("PRIZNAK"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "PRIZNAK = :PRIZNAK, ";
                            }
                            else if (TagOfObject == 15)
                            {
                                //Код основ. Матер.
                                Parameters.Add("COD_OSNOV_MATER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)((System.Windows.Forms.Panel)(this.Controls.Find(("panelN" + (i + 2).ToString()), true)[0])).Controls[j]));
                                cmdDATA += "COD_OSNOV_MATER = :COD_OSNOV_MATER, ";
                            }
                        }

                        cmdDATA = cmdDATA.Remove(cmdDATA.Length - 2);

                        string cmdEnd = " WHERE NOMER_TREBOV_NAKLADNOI = :NOMER_TREBOV_NAKLADNOI AND NUMBER_OF_PANEL = :NUMBER_OF_PANEL";

                        Parameters.Add("NOMER_TREBOV_NAKLADNOI"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(PanelN1OneA));
                        Parameters.Add("NUMBER_OF_PANEL"); DataFromTextBox.Add((i + 2).ToString());

                        successToLoadData = SQLOracle.UpdateQuery(cmdDATA + cmdEnd, Parameters, DataFromTextBox);

                        Parameters.Clear();
                        DataFromTextBox.Clear();

                    }

                if (successToLoadData == true)
                {
                    MessageBox.Show("Данные успешно загружены!");
                }

            }
            else
            {
                MessageBox.Show(CheckInformation(), "Ошибка!");
            }
        }
コード例 #41
0
ファイル: AreaAddressesTree.cs プロジェクト: u4097/SQLScript
 public void RemoveNodesByLocalAddress(ObjectList<LocalAddress> addressesSource, ObjectList<LocalAddress> la)
 {
     System.Collections.Generic.List<LocalAddress> list = new System.Collections.Generic.List<LocalAddress>();
     foreach (LocalAddress address in la)
     {
         LocalAddress address2 = address;
         while (true)
         {
             LocalAddress parent = address2.GetParent();
             if (parent == LocalAddress.Null)
             {
                 break;
             }
             list.Add(parent);
             address2 = parent;
         }
         if (list.get_Count() == 0)
         {
             this.Load(addressesSource, false);
             return;
         }
         for (int i = (int) (list.get_Count() - 1); i >= 0; i = (int) (i - 1))
         {
             this.GetNodeByAddress(list.get_Item(i)).OnBeforeExpand();
         }
         AddressesNode nodeByAddress = this.GetNodeByAddress(address);
         if (nodeByAddress != null)
         {
             this.RemoveNode(nodeByAddress);
         }
         list.Clear();
     }
     if (this.OnChangeSelectAddresses != null)
     {
         this.OnChangeSelectAddresses();
     }
 }
コード例 #42
0
        private async void cbDiagramSelect_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            System.Collections.Generic.List<UIElement> Removelist = new System.Collections.Generic.List<UIElement>();

            int planeid= (cbDiagramSelect.SelectedItem as tblERPlane).PlaneID;
             this.imgPic.Source = new BitmapImage(new Uri("/Diagrams/" + (cbDiagramSelect.SelectedItem as tblERPlane).PlaneID+".png", UriKind.Relative));
             foreach (UIElement c in grdDeviceLayer.Children)
             {
                 if (c is Image) continue;
                 Removelist.Add(c);
                 //grdDeviceLayer.Children.Remove(c);
             }

            foreach(UIElement ui in Removelist)
                grdDeviceLayer.Children.Remove(ui);
            Removelist.Clear();
             #region  Door
             var q = from n in db.GetTblControllerConfigQuery() where (n.ControlType == 1 || n.ControlType == 2  ) && n.PlaneID== (cbDiagramSelect.SelectedValue as tblERPlane).PlaneID   select n;
             var res= await   DB.LoadAsync<tblControllerConfig>(db, q);

             foreach (tblControllerConfig tbl in res)
             {
                DOOR item = new DOOR();
                item.Name = "Door"+tbl.ControlID;
             //  tblItem info = CreateInputItemInfo("DOOR", "DOOR", "", 1, 0);
                
                item.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                item.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                item.SetValue(Grid.MarginProperty, new Thickness(tbl.X??0, tbl.Y??0, 0, 0));
              
              //  item.Margin = new Thickness(0);

              // grdSetting.DataContext = 
                item.DataContext = tbl;
                 
                item.SetDefaultColor();
                

                this.grdDeviceLayer.Children.Add(item);

                item.MouseLeftButtonDown += selectedDevice_MouseLeftButtonDown;
                item.MouseLeftButtonUp += selectedDevice_MouseLeftButtonUp;
                item.MouseMove += selectedDevice_MouseMove;
               // ctl = item;

             }
             #endregion
            #region          CCTV
             var q2 = from n in db.GetTblCCTVConfigQuery() where n.PlaneID == planeid select n;
             var res2 = await DB.LoadAsync<tblCCTVConfig>(db, q2);
             foreach (tblCCTVConfig tbl in res2)
             {
                 CCTV item = new CCTV();
                 item.Name = "CCTV" + tbl.CCTVID;
                 item.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                 item.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                 item.SetValue(Grid.MarginProperty, new Thickness(tbl.X, tbl.Y, 0, 0));
                 //  item.Margin = new Thickness(0);

                 //  grdSetting.DataContext = 
                 item.DataContext = tbl;



                 this.grdDeviceLayer.Children.Add(item);

                 item.MouseLeftButtonDown += selectedDevice_MouseLeftButtonDown;
                 item.MouseLeftButtonUp += selectedDevice_MouseLeftButtonUp;
                 item.MouseMove += selectedDevice_MouseMove;
             }

            #endregion
#region AI DI DO  
             var qai = from n in db.GetTblItemConfigQuery() where n.IsShow && n.tblItemGroup.PlaneID==planeid   select n;
             var resqai = await DB.LoadAsync<tblItemConfig>(db, qai);

             foreach (tblItemConfig tbl in resqai)
             {
                 if (tbl.Type == "AI")
                 {
                     AI ai = new AI();
                     ai.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                     ai.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                     ai.SetValue(Grid.MarginProperty, new Thickness(tbl.X ?? 0, tbl.Y ?? 0, 0, 0));
                     ai.Content ="AI:"+ tbl.ItemName;
                     //CompositeTransform transform = new CompositeTransform() { Rotation = tbl.Rotation ?? 0, ScaleX = tbl.ScaleX ?? 1, ScaleY = tbl.ScaleY ?? 1 };
                     //ai.RenderTransform = transform;
                     ai.DataContext = tbl;    //new SecureServer.BindingData.ItemBindingData { ColorString = "Green", Content = "100V", ItemID =1, Type=  "AI" };
                     this.grdDeviceLayer.Children.Add(ai);
                     ai.MouseLeftButtonDown += selectedDevice_MouseLeftButtonDown;
                     ai.MouseLeftButtonUp += selectedDevice_MouseLeftButtonUp;
                     ai.MouseMove += selectedDevice_MouseMove;
                 }
                 else if (tbl.Type == "DI")
                 {
                     DI di = new DI();
                     di.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                     di.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                     di.SetValue(Grid.MarginProperty, new Thickness(tbl.X ?? 0, tbl.Y ?? 0, 0, 0));
                     di.Content ="DI:"+ tbl.ItemName;
                     
                     //CompositeTransform transform = new CompositeTransform() { Rotation = tbl.Rotation ?? 0, ScaleX = tbl.ScaleX ?? 1, ScaleY = tbl.ScaleY ?? 1 };
                     //ai.RenderTransform = transform;
                     di.DataContext = tbl;    //new SecureServer.BindingData.ItemBindingData { ColorString = "Green", Content = "100V", ItemID =1, Type=  "AI" };
                     this.grdDeviceLayer.Children.Add(di);
                     di.MouseLeftButtonDown += selectedDevice_MouseLeftButtonDown;
                     di.MouseLeftButtonUp += selectedDevice_MouseLeftButtonUp;
                     di.MouseMove += selectedDevice_MouseMove;

                 }
                 else if (tbl.Type == "DO")
                 {

                     DO di = new DO();
                     di.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                     di.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                     di.SetValue(Grid.MarginProperty, new Thickness(tbl.X ?? 0, tbl.Y ?? 0, 0, 0));
                     di.Content ="DO:"+ tbl.ItemName;
                     //CompositeTransform transform = new CompositeTransform() { Rotation = tbl.Rotation ?? 0, ScaleX = tbl.ScaleX ?? 1, ScaleY = tbl.ScaleY ?? 1 };
                     //ai.RenderTransform = transform;
                     di.DataContext = tbl;    //new SecureServer.BindingData.ItemBindingData { ColorString = "Green", Content = "100V", ItemID =1, Type=  "AI" };
                     this.grdDeviceLayer.Children.Add(di);
                     di.Width = 52;
                     di.Height = 40;
                     di.MouseLeftButtonDown += selectedDevice_MouseLeftButtonDown;
                     di.MouseLeftButtonUp += selectedDevice_MouseLeftButtonUp;
                     di.MouseMove += selectedDevice_MouseMove;

                 }
                 
             }

#endregion

#region ItemGroup
             var qgrouo = from n in db.GetTblItemGroupQuery() where n.IsShow && n.PlaneID == planeid select n;
             var resgroup = await DB.LoadAsync<tblItemGroup>(db, qgrouo);
             foreach (tblItemGroup tbl in resgroup)
             {
                 ItemGroup grp = new ItemGroup();
                 grp.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
                 grp.VerticalAlignment = System.Windows.VerticalAlignment.Top;
                 grp.SetValue(Grid.MarginProperty, new Thickness(tbl.X  , tbl.Y , 0, 0));
                 grp.Content ="Group:"+ tbl.GroupName;
                
                 grp.DataContext = tbl;
                 this.grdDeviceLayer.Children.Add(grp);
                 grp.MouseLeftButtonDown += selectedDevice_MouseLeftButtonDown;
                 grp.MouseLeftButtonUp += selectedDevice_MouseLeftButtonUp;
                 grp.MouseMove += selectedDevice_MouseMove;
             }


#endregion

        }
コード例 #43
0
ファイル: ActSpisanie.cs プロジェクト: Blyumenshteyn/UchetUSP
        /// <summary>
        /// Загрузка данных в БД (запускается на статусе добавления данныз)
        /// </summary>      
        /// <returns></returns>   
        private void LoadInformationToDB()
        {
            if (string.Compare(CheckInformation(), "0") == 0)
            {
                bool successToLoadData = false;

                System.Collections.Generic.List<string> Parameters = new System.Collections.Generic.List<string>();

                System.Collections.Generic.List<string> DataFromTextBox = new System.Collections.Generic.List<string>();

                //Основные данные
                Parameters.Add("N_ACT"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(J8));
                Parameters.Add("OKUD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(Z10));
                Parameters.Add("UTV_DOLZNOST"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(U4));
                Parameters.Add("UTV_RAS_PODP"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(U6));
                Parameters.Add("ORAGANIZATION_HEAD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(D12));
                Parameters.Add("STRUCT_PODR_HEAD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(F14));
                Parameters.Add("DATA_SOST"); DataFromTextBox.Add(H22.Value.ToString());
                Parameters.Add("COD_VIDA_OPER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(K22));
                Parameters.Add("STRUCT_PODR"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(M22));
                Parameters.Add("NOMER_CEHA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(P22));
                Parameters.Add("VID_DEYAT"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(R22));
                Parameters.Add("CORRESP_SCHET"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(U22));
                Parameters.Add("COD_ZATRAT"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(Y22));
                Parameters.Add("PRICAZ_OT"); DataFromTextBox.Add(J26.Value.ToString());
                Parameters.Add("PRICAZ_YEAR"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(S26));
                Parameters.Add("KOL_PREDETOV"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(F86));
                Parameters.Add("NOM_ACT_VIB"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(F89));
                Parameters.Add("UTIL"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(F112));
                //Итог 1
                Parameters.Add("ITOG_KOL"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(J83));
                Parameters.Add("ITOG_DATA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(L83));
                Parameters.Add("ITOG_CENA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(N83));
                Parameters.Add("ITOG_SUM_CENA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(P83));
                Parameters.Add("ITOG_SUM_AMOR"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(R83));
                Parameters.Add("ITOG_SROK_SLUZ"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(T83));
                Parameters.Add("ITOG_PRIHINA_NAIMENOV"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(V83));
                Parameters.Add("ITOG_PRICH_COD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(X83));
                Parameters.Add("ITOG_SROK"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(Z83));
                //Итог 2
                Parameters.Add("ITOGTWO_KOL"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(S103));
                Parameters.Add("ITOGTWO_CENA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(U103));
                Parameters.Add("ITOGTWO_SUMMA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(X103));
                Parameters.Add("ITOGTWO_PORYAD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(Z103));

                string cmd = "INSERT INTO USP_ACTNASPISANIE_HEAD" +
                    "(N_ACT, OKUD, UTV_DOLZNOST, UTV_RAS_PODP, ORAGANIZATION_HEAD, STRUCT_PODR_HEAD, "+
                    "DATA_SOST, COD_VIDA_OPER, STRUCT_PODR, NOMER_CEHA, VID_DEYAT, CORRESP_SCHET, COD_ZATRAT, "+
                    "PRICAZ_OT, PRICAZ_YEAR, KOL_PREDETOV, NOM_ACT_VIB, UTIL, ITOG_KOL, ITOG_DATA, ITOG_CENA, ITOG_SUM_CENA, "+
                    "ITOG_SUM_AMOR, ITOG_SROK_SLUZ, ITOG_PRIHINA_NAIMENOV, ITOG_PRICH_COD, ITOG_SROK, ITOGTWO_KOL, ITOGTWO_CENA, ITOGTWO_SUMMA, ITOGTWO_PORYAD)"+
                    " VALUES (:N_ACT, :OKUD, :UTV_DOLZNOST, :UTV_RAS_PODP, :ORAGANIZATION_HEAD, :STRUCT_PODR_HEAD,"+
                    "  to_date(:DATA_SOST,'DD.MM.YYYY hh24:mi:ss'), :COD_VIDA_OPER, :STRUCT_PODR, :NOMER_CEHA, :VID_DEYAT, :CORRESP_SCHET, :COD_ZATRAT, "+
                    "to_date(:PRICAZ_OT,'DD.MM.YYYY hh24:mi:ss'), :PRICAZ_YEAR, :KOL_PREDETOV, :NOM_ACT_VIB, :UTIL, :ITOG_KOL, :ITOG_DATA, :ITOG_CENA, :ITOG_SUM_CENA, "+
                    ":ITOG_SUM_AMOR, :ITOG_SROK_SLUZ, :ITOG_PRIHINA_NAIMENOV, :ITOG_PRICH_COD, :ITOG_SROK, :ITOGTWO_KOL, :ITOGTWO_CENA, :ITOGTWO_SUMMA, :ITOGTWO_PORYAD)";

                successToLoadData = SQLOracle.InsertQuery(cmd, Parameters, DataFromTextBox);

                //MessageBox.Show("1");

                Parameters.Clear();
                DataFromTextBox.Clear();

                if (successToLoadData == true)
                    for (int i = 1; i < 6; i++)
                    {
                        if (successToLoadData == true)
                        {
                            string cmdDATA = "INSERT INTO USP_ACTNASPISANIE_DATA_ONE(ACT_NOMER,NUMBER_OF_PANEL," +
                                " PREDMET_NAIM, PREDMET_NOMEN_NOMER, PREDMET_INVENT_NOMER, ED_IZM_NAIM, ED_IZM_KOD, KOL_VO, DATA_POSTUPLENIYA, "+
                                "CENA, SUMMA_CENA_RUB, SUMMA_AMORTIZ, SROK_SLUZ, PRICH_SPIS_NAIM, PRICH_SPIS_KOD, NOMER_PASPORTA)" +
                                " VALUES(:ACT_NOMER,:NUMBER_OF_PANEL," +
                                " :PREDMET_NAIM, :PREDMET_NOMEN_NOMER, :PREDMET_INVENT_NOMER, :ED_IZM_NAIM, :ED_IZM_KOD, :KOL_VO,to_date(:DATA_POSTUPLENIYA,'DD.MM.YYYY hh24:mi:ss')," +
                                " :CENA, :SUMMA_CENA_RUB, :SUMMA_AMORTIZ, :SROK_SLUZ, :PRICH_SPIS_NAIM, :PRICH_SPIS_KOD, :NOMER_PASPORTA)";

                            Parameters.Add("ACT_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(J8));
                            Parameters.Add("NUMBER_OF_PANEL"); DataFromTextBox.Add((i).ToString());

                            Parameters.Add("PREDMET_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("A" + ((4 * (i - 1))+36).ToString()), true)[0])));
                            Parameters.Add("PREDMET_NOMEN_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("A" + ((4 * (i - 1))+38).ToString()), true)[0])));
                            Parameters.Add("PREDMET_INVENT_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("F" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("ED_IZM_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("H" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("ED_IZM_KOD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("H" + ((4 * (i - 1)) + 38).ToString()), true)[0])));
                            Parameters.Add("KOL_VO"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("J" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("DATA_POSTUPLENIYA"); DataFromTextBox.Add(((System.Windows.Forms.DateTimePicker)(this.tabPage1.Controls.Find(("L" + ((4 * (i - 1)) + 36).ToString()), true)[0])).Value.ToString());
                            Parameters.Add("CENA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("N" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("SUMMA_CENA_RUB"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("P" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("SUMMA_AMORTIZ"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("R" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("SROK_SLUZ"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("T" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("PRICH_SPIS_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("V" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("PRICH_SPIS_KOD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("X" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("NOMER_PASPORTA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("Z" + ((4 * (i - 1)) + 36).ToString()), true)[0])));

                            successToLoadData = SQLOracle.InsertQuery(cmdDATA, Parameters, DataFromTextBox);

                            Parameters.Clear();
                            DataFromTextBox.Clear();
                        }
                    }

                if (successToLoadData == true)
                    for (int i = 7; i < 12; i++)
                    {
                        if (successToLoadData == true)
                        {
                            string cmdDATA = "INSERT INTO USP_ACTNASPISANIE_DATA_ONE(ACT_NOMER,NUMBER_OF_PANEL," +
                                " PREDMET_NAIM, PREDMET_NOMEN_NOMER, PREDMET_INVENT_NOMER, ED_IZM_NAIM, ED_IZM_KOD, KOL_VO, DATA_POSTUPLENIYA, " +
                                "CENA, SUMMA_CENA_RUB, SUMMA_AMORTIZ, SROK_SLUZ, PRICH_SPIS_NAIM, PRICH_SPIS_KOD,NOMER_PASPORTA)" +
                                " VALUES(:ACT_NOMER,:NUMBER_OF_PANEL," +
                                " :PREDMET_NAIM, :PREDMET_NOMEN_NOMER, :PREDMET_INVENT_NOMER, :ED_IZM_NAIM, :ED_IZM_KOD, :KOL_VO, to_date(:DATA_POSTUPLENIYA,'DD.MM.YYYY hh24:mi:ss')," +
                                " :CENA, :SUMMA_CENA_RUB, :SUMMA_AMORTIZ, :SROK_SLUZ, :PRICH_SPIS_NAIM, :PRICH_SPIS_KOD, :NOMER_PASPORTA)";

                            Parameters.Add("ACT_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(J8));
                            Parameters.Add("NUMBER_OF_PANEL"); DataFromTextBox.Add((i).ToString());

                            Parameters.Add("PREDMET_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("A" + ((4 * (i - 1)) + 39 ).ToString()), true)[0])));
                            Parameters.Add("PREDMET_NOMEN_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("A" + ((4 * (i - 1)) +41).ToString()), true)[0])));
                            Parameters.Add("PREDMET_INVENT_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("F" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("ED_IZM_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("H" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("ED_IZM_KOD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("H" + ((4 * (i - 1)) + 41).ToString()), true)[0])));
                            Parameters.Add("KOL_VO"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("J" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("DATA_POSTUPLENIYA"); DataFromTextBox.Add(((System.Windows.Forms.DateTimePicker)(this.tabPage2.Controls.Find(("L" + ((4 * (i - 1)) + 39).ToString()), true)[0])).Value.ToString());
                            Parameters.Add("CENA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("N" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("SUMMA_CENA_RUB"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("P" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("SUMMA_AMORTIZ"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("R" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("SROK_SLUZ"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("T" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("PRICH_SPIS_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("V" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("PRICH_SPIS_KOD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("X" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("NOMER_PASPORTA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("Z" + ((4 * (i - 1)) + 39).ToString()), true)[0])));

                            successToLoadData = SQLOracle.InsertQuery(cmdDATA, Parameters, DataFromTextBox);

                            Parameters.Clear();
                            DataFromTextBox.Clear();
                        }
                    }

                if (successToLoadData == true)
                    for (int i = 1; i <=2; i++)
                    {
                        if (successToLoadData == true)
                        {
                            string cmdDATA = "INSERT INTO USP_ACTNASPISANIE_DATA_TWO(ACT_NOMER,NUMBER_OF_PANEL,KOD_VIDA_OPER, VID_DEYAT, STRUCT_PODR, UTIL_NAIM, UTIL_NOMEN_NOMER, ED_IZM_NAIM, ED_IZM_KOD, KOL_VO, CENA, SUMMA_RUB, PORYADKOV_NUM)" +
                                " VALUES(:ACT_NOMER,:NUMBER_OF_PANEL, :KOD_VIDA_OPER, :VID_DEYAT, :STRUCT_PODR, :UTIL_NAIM, :UTIL_NOMEN_NOMER, :ED_IZM_NAIM, :ED_IZM_KOD, :KOL_VO, :CENA, :SUMMA_RUB,:PORYADKOV_NUM)";

                            Parameters.Add("ACT_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(J8));
                            Parameters.Add("NUMBER_OF_PANEL"); DataFromTextBox.Add((i).ToString());

                            Parameters.Add("KOD_VIDA_OPER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("A" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("VID_DEYAT"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("C" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("STRUCT_PODR"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("F" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("UTIL_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("I" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("UTIL_NOMEN_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("L" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("ED_IZM_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("O" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("ED_IZM_KOD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("Q" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("KOL_VO"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("S" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("CENA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("U" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("SUMMA_RUB"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("X" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("PORYADKOV_NUM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("Z" + ((2 * (i - 1)) + 99).ToString()), true)[0])));

                            successToLoadData = SQLOracle.InsertQuery(cmdDATA, Parameters, DataFromTextBox);

                            Parameters.Clear();
                            DataFromTextBox.Clear();
                        }
                    }

                if (successToLoadData == true)
                {
                    MessageBox.Show("Данные успешно загружены!");
                }

            }
            else
            {
                MessageBox.Show(CheckInformation(), "Ошибка!");
            }
        }
コード例 #44
0
ファイル: Google2u.cs プロジェクト: DarkRay/neverending-story
        // Update is called once per frame
        private void Update()
        {
            if (_Instance == null)
                Init();

            var notification = PopNotification();
            if (!string.IsNullOrEmpty(notification))
            {
                Debug.Log(notification);
                ShowNotification(new GUIContent(notification));
            }

            if (!string.IsNullOrEmpty(UpdateMessage))
            {
                Debug.Log(UpdateMessage);
                UpdateMessage = string.Empty;
            }

            if ((DateTime.Now - LastEllipses).Milliseconds > 500)
            {
                LastEllipses = DateTime.Now;
                EllipsesCount += 1;
                if (EllipsesCount > 5)
                    EllipsesCount = 2;
                Ellipses = string.Empty;
                for (var i = 0; i < EllipsesCount; ++i)
                    Ellipses += ".";
                Repaint();
            }

            // Detect Skin Changes
            var oldUseDarkSkin = UseDarkSkin;
            if (EditorGUIUtility.isProSkin)
            {
                UseDarkSkin = true;
                if(oldUseDarkSkin != UseDarkSkin)
                    LoadStyles();
            }

            if (IsDirty)
            {
                Google2uGUIUtil.Save();
                IsDirty = false;
            }

            // Prevent Google2u from doing anything while in play mode
            if (EditorApplication.isPlayingOrWillChangePlaymode || EditorApplication.isCompiling)
                return;

            if ((DateTime.Now - LastCheckedRSS).Hours > 0)
            {
                LastCheckedRSS = DateTime.Now;
                var t = new Thread(CheckForService);
                t.Start();
            }

            if (InstanceData.Commands.Contains(GFCommand.DoLogout))
            {
                InstanceData.Commands.Remove(GFCommand.DoLogout);
                var t = new Thread(DoLogout) { Name = "DoLogout" };
                t.Start(InstanceData);
            }

            if (InstanceData.Commands.Contains(GFCommand.RetrieveWorkbooks))
            {
                InstanceData.Commands.Remove(GFCommand.RetrieveWorkbooks);
                InstanceData.Commands.Add(GFCommand.WaitForRetrievingWorkbooks);
                InstanceData.AccountWorkbooks.Clear();
                var t = new Thread(DoWorkbookQuery) { Name = "RetrieveWorkbooks" };
                t.Start(InstanceData);
            }

            if (InstanceData.Commands.Contains(GFCommand.RetrieveManualWorkbooks))
            {
                InstanceData.Commands.Remove(GFCommand.RetrieveManualWorkbooks);
                InstanceData.Commands.Add(GFCommand.WaitForRetrievingManualWorkbooks);
                var t = new Thread(DoManualWorkbookRetrieval) { Name = "ManualWorkbookRetrieval" };
                t.Start(InstanceData);
            }

            if (InstanceData.Commands.Contains(GFCommand.ManualWorkbooksRetrievalComplete))
            {
                InstanceData.Commands.Remove(GFCommand.ManualWorkbooksRetrievalComplete);
                var manualWorkbooksString = InstanceData.ManualWorkbooks.Aggregate(string.Empty, (in_current, in_wb) => in_current + (in_wb.WorkbookUrl + "|"));
                Google2uGUIUtil.SetString(InstanceData.ProjectPath + "_ManualWorkbookCache", manualWorkbooksString);
            }

            if (InstanceData.Commands.Contains(GFCommand.DoUpload))
            {
                InstanceData.Commands.Remove(GFCommand.DoUpload);
                InstanceData.Commands.Add(GFCommand.WaitingForUpload);
                var t = new Thread(DoWorkbookUpload) {Name = "WorkbookUpload"};
                t.Start(InstanceData);
            }

            if (InstanceData.Commands.Contains(GFCommand.UploadComplete))
            {
                InstanceData.Commands.Remove(GFCommand.UploadComplete);
                InstanceData.WorkbookUploadProgress = 0;
                InstanceData.AccountWorkbooks.Clear();
                InstanceData.Commands.Add(GFCommand.RetrieveWorkbooks);
            }

            foreach (var Google2uSpreadsheet in InstanceData.AccountWorkbooksDisplay)
            {
                Google2uSpreadsheet.Update();
            }

            foreach (var Google2uSpreadsheet in InstanceData.ManualWorkbooksDisplay)
            {
                Google2uSpreadsheet.Update();
            }

            if (_ObjDbExport != null && _ObjDbExport.Count > 0)
            {

                var dbInfo = _ObjDbExport[0];

                if (dbInfo == null)
                {
                    _ObjDbExport.RemoveAt(0);
                    return;
                }

                if ((DateTime.Now - dbInfo.LastAttempt).TotalSeconds < 2)
                    return;

                if (dbInfo.ReloadedAssets == false)
                {
                    AssetDatabase.Refresh(ImportAssetOptions.ForceUpdate);
                    dbInfo.ReloadedAssets = true;
                    return;
                }

                dbInfo.LastAttempt = DateTime.Now;

                Component comp = null;
                var myAssetPath = string.Empty;


                Debug.Log("Looking for Database Script: " + dbInfo.ScriptName);
                var findAssetArray = AssetDatabase.FindAssets(dbInfo.ScriptName);
                if (findAssetArray.Length > 0)
                {
                    foreach (var s in findAssetArray)
                    {
                        var mypath = AssetDatabase.GUIDToAssetPath(s);

                        if (mypath.EndsWith(".cs"))
                        {
                            myAssetPath = mypath;
                            Debug.Log("Found Database Script at: " + mypath);
                        }
                    }

                    var myType = GetAssemblyType("Google2u." + dbInfo.ScriptName);

                    Debug.Log(dbInfo.ScriptName + ": GetAssemblyType returns " + myType);
                    if (myType != null)
                    {
                var go = GameObject.Find(dbInfo.ObjectName) ?? new GameObject(dbInfo.ObjectName);


                        var toDestroy = go.GetComponent(dbInfo.ScriptName);
                if (toDestroy != null)
                    DestroyImmediate(toDestroy);

#if UNITY_5
                        comp = go.AddComponent(myType);
#else
                        comp = go.AddComponent(dbInfo.ScriptName);
#endif
                }
                }



                if (comp == null)
                {
                    if (!string.IsNullOrEmpty(myAssetPath))
                    {
                        Debug.Log("Attempting to compile: " + myAssetPath);
                        AssetDatabase.ImportAsset(myAssetPath,
                    ImportAssetOptions.ForceSynchronousImport |
                    ImportAssetOptions.ForceUpdate);
                    }

                    if (_ImportTryCount < 5)
                        {
                            _ImportTryCount++;
                            return;
                        }
                        Debug.LogError("Could not add Google2u component base " + dbInfo.ScriptName);
                        _ObjDbExport.Clear();
                        _ImportTryCount = 0;
                        return;
                    }

                _ImportTryCount = 0;
                Debug.Log("Database Script Attached!");
                _ObjDbExport.Remove(dbInfo);

                var rowInputs = new System.Collections.Generic.List<string>();

                var currow = 0;
                foreach (var row in dbInfo.Data.Rows)
                {
                    if (currow == 0)
                    {
                        currow++;
                        continue;
                    }
                    // if types in first row
                    if(dbInfo.Data.UseTypeRow && currow == 1)
                    {
                        currow++;
                        continue;
                    }

                    var rowType = row[0].GetTypeFromValue();
                    var rowHeader = row[0].CellValueString;
                    if (string.IsNullOrEmpty(rowHeader))
                    // if this header is empty
                    {
                        if (dbInfo.CullEmptyRows)
                            break;
                        currow++;
                        continue;
                    }

                    if (rowType == SupportedType.Void ||
                    rowHeader.Equals("void", StringComparison.InvariantCultureIgnoreCase))
                    // if this cell is void, then skip the row completely
                    {
                        currow++;
                        continue;
                    }

                    foreach (var cell in row.Cells)
                    {
                        if (cell.MyType == SupportedType.Void)
                            continue;
                        rowInputs.Add(cell.CellValueString);
                    }
                    (comp as Google2uComponentBase).AddRowGeneric(rowInputs);
                    rowInputs.Clear();
                    currow++;
                }
            }
        }
コード例 #45
0
		bool ButtonCommitClicked ()
		{
			// In case we have local unsaved files with changes, throw a dialog for the user.
			System.Collections.Generic.List<Document> docList = new System.Collections.Generic.List<Document> ();
			foreach (var item in IdeApp.Workbench.Documents) {
				if (!item.IsDirty || !selected.Contains (item.FileName))
					continue;
				docList.Add (item);
			}

			if (docList.Count != 0) {
				AlertButton response = MessageService.GenericAlert (
					MonoDevelop.Ide.Gui.Stock.Question,
					GettextCatalog.GetString ("You are trying to commit files which have unsaved changes."),
					GettextCatalog.GetString ("Do you want to save the changes before committing?"),
					new AlertButton[] {
						AlertButton.Cancel,
						new AlertButton ("Don't Save"),
						AlertButton.Save
					}
				);

				if (response == AlertButton.Cancel)
					return false;

				if (response == AlertButton.Save) {
					// Go through all the items and save them.
					foreach (var item in docList)
						item.Save ();

					// Check if save failed on any item and abort.
					foreach (var item in docList)
						if (item.IsDirty) {
							MessageService.ShowMessage (GettextCatalog.GetString (
								"Some files could not be saved. Commit operation aborted"));
							return false;
						}
				}

				docList.Clear ();
			}

			// Update the change set
			List<FilePath> todel = new List<FilePath> ();
			foreach (ChangeSetItem it in changeSet.Items) {
				if (!selected.Contains (it.LocalPath))
					todel.Add (it.LocalPath);
			}
			foreach (string file in todel)
				changeSet.RemoveFile (file);
			changeSet.GlobalComment = Message;
			
			// Perform the commit
			
			int n;
			for (n=0; n<extensions.Count; n++) {
				CommitDialogExtension ext = extensions [n];
				bool res;
				try {
					res = ext.OnBeginCommit (changeSet);
				} catch (Exception ex) {
					LoggingService.LogInternalError (ex);
					res = false;
				}
				if (!res) {
					// Commit failed. Rollback the previous extensions
					for (int m=0; m<n; m++) {
						ext = extensions [m];
						try {
							ext.OnEndCommit (changeSet, false);
						} catch {}
					}
					return false;
				}
			}
			return true;
		}
コード例 #46
0
ファイル: clsProcessor.cs プロジェクト: fieldbob/CNCInfusion
    // modified to take first argument as a preprocessed buffer, instead of filename
    public void ProcessFile(string ncFile, List<clsMotionRecord> gfxRecs)
    {
        mGfxRecs = gfxRecs;
        mCodefile = ncFile;
        {
            mMotion.SubCall.Label = mCurMachine.Subcall[0];
            mMotion.SubCall.Value = int.Parse(mCurMachine.Subcall.Substring(1));

            mMotion.SubReturn.Label = mCurMachine.SubReturn[0];
            mMotion.SubReturn.Value = int.Parse(mCurMachine.SubReturn.Substring(1));

            mMotion.Abs.Label = mCurMachine.Absolute[0];
            mMotion.Abs.Value = int.Parse(mCurMachine.Absolute.Substring(1));
            mMotion.CCArc.Label = mCurMachine.CCArc[0];
            mMotion.CCArc.Value = int.Parse(mCurMachine.CCArc.Substring(1));
            mMotion.CWArc.Label = mCurMachine.CWArc[0];
            mMotion.CWArc.Value = int.Parse(mCurMachine.CWArc.Substring(1));

            mMotion.Inc.Label = mCurMachine.Incremental[0];
            mMotion.Inc.Value = int.Parse(mCurMachine.Incremental.Substring(1));

            mMotion.Linear.Label = mCurMachine.Linear[0];
            mMotion.Linear.Value = int.Parse(mCurMachine.Linear.Substring(1));

            mMotion.Rapid.Label = mCurMachine.Rapid[0];
            mMotion.Rapid.Value = int.Parse(mCurMachine.Rapid.Substring(1));

            mMotion.Rotary.Label = mCurMachine.Rotary[0];
            mMotion.Rotary.Value = 0;

            mMotion.DrillRapid.Label = mCurMachine.DrillRapid[0];
            mMotion.DrillRapid.Value = 0;

            mMotion.Plane[0].Label = mCurMachine.XYplane[0];
            mMotion.Plane[0].Value = int.Parse(mCurMachine.XYplane.Substring(1));
            mMotion.Plane[1].Label = mCurMachine.XZplane[0];
            mMotion.Plane[1].Value = int.Parse(mCurMachine.XZplane.Substring(1));
            mMotion.Plane[2].Label = mCurMachine.YZplane[0];
            mMotion.Plane[2].Value = int.Parse(mCurMachine.YZplane.Substring(1));

            mMotion.ReturnLevel[0].Label = mCurMachine.ReturnLevel[0][0];
            mMotion.ReturnLevel[0].Value = int.Parse(mCurMachine.ReturnLevel[0].Substring(1));
            mMotion.ReturnLevel[1].Label = mCurMachine.ReturnLevel[1][0];
            mMotion.ReturnLevel[1].Value = int.Parse(mCurMachine.ReturnLevel[1].Substring(1));

            for (int r = 0; r <= mMotion.Drills.Length - 1; r++)
            {
                if (mCurMachine.Drills[r].Length > 2)
                {
                    mMotion.Drills[r].Label = mCurMachine.Drills[r][0];
                    mMotion.Drills[r].Value = int.Parse(mCurMachine.Drills[r].Substring(1));
                }
            }
        }


        //Reset all positions. 
        mGfxRecs.Clear();
        mCurrentColor = 0;
        mPrevTool = -1;
        mXpos = 0;
        mYpos = 0;
        mZpos = 0;
        mPrevX = 0;
        mPrevY = 0;
        mPrevZ = 0;
        mPrevABC = 0;
        mABC = 0;
        mRpoint = 0;
        mSpeed = 0;
        mFeed = 0;
        mDrillClear = 0;
        mInitialZBeforeDrill = 0;
        mRotDir = 1;
        mAbsolute = true;
        mMode = Motion.RAPID;
        mDrillReturnMode = Motion.I_PLN;

        if (mCurMachine.MachineType == MachineType.MILL)
        {
            mPlane = Motion.XY_PLN; //Mill 
        }
        else
        {
            mPlane = Motion.XZ_PLN;//Lathe 
        }

        mEndmain = mCurMachine.Endmain.Trim();
        mSubcall = mCurMachine.Subcall.Trim();
        mSubRepeats = mCurMachine.SubRepeats.Trim();
		
        string sFileContents = null;
        sFileContents = FilterJunk(ncFile);
        
        mNcProgs.Clear();
        int lastIndex = -1;
        int thisIndex = -1;
        clsProg p = default(clsProg);
        foreach (Match m in this.mRegSubs.Matches(sFileContents))
        {
            if (mCurMachine.ProgramId.Contains(m.Value[0].ToString()))
            {
                thisIndex = m.Index;
                //Each program 
                if (lastIndex > -1)
                {
                    mNcProgs[mNcProgs.Count - 1].Contents = sFileContents.Substring(lastIndex, thisIndex - lastIndex).TrimEnd();
                    if (mNcProgs[mNcProgs.Count - 1].Contents.Contains(mCurMachine.Endmain))
                    {
                        mNcProgs[mNcProgs.Count - 1].Main = true;
                    }
                }
                p = new clsProg();
                p.Main = false;
                p.Index = thisIndex;
                p.Label = Char.ToUpper(m.Value[0]).ToString();
                p.Value = int.Parse(m.Groups[1].Value);
                mNcProgs.Add(p);
                lastIndex = m.Index;
            }
        }

        mTotalLines = 1;
        if (mNcProgs.Count == 0)
        {
            //Just add all the text we found in the file 
            p = new clsProg();
            p.Main = true;
            p.Index = 0;
            p.Label = "MAIN";
            p.Value = 0;
            p.Contents = sFileContents;
            mNcProgs.Add(p);
            mTotalBites = sFileContents.Length;
            ProcessSubWords(p);
        }
        else
        {
            mNcProgs[mNcProgs.Count - 1].Contents = sFileContents.Substring(lastIndex).TrimEnd();
            if (mNcProgs[mNcProgs.Count - 1].Contents.Contains(mCurMachine.Endmain))
            {
                mNcProgs[mNcProgs.Count - 1].Main = true;
            }
            foreach (clsProg pr in mNcProgs)
            {
                mTotalBites = pr.Contents.Length;
                ProcessSubWords(pr);
            }
        }
    }
コード例 #47
0
ファイル: users.aspx.cs プロジェクト: jaytem/minGit
    private void UpdateActivityPreferences()
    {
        Ektron.Cms.Activity.ActivityTypeCriteria activityCollListCriteria = new Ektron.Cms.Activity.ActivityTypeCriteria();
        Ektron.Cms.Activity.ActivityTypeCriteria activityGroupListCriteria = new Ektron.Cms.Activity.ActivityTypeCriteria();
        long uId = 0;

        if ((!(Request.QueryString["id"] == null)) && Information.IsNumeric(Request.QueryString["id"]))
        {
            long.TryParse(Request.QueryString["id"], out uId);
        }

        activityCollListCriteria.AddFilter(Ektron.Cms.Activity.ActivityTypeProperty.Scope, CriteriaFilterOperator.EqualTo, EkEnumeration.ActivityActionSource.Colleague);
        activityGroupListCriteria.AddFilter(Ektron.Cms.Activity.ActivityTypeProperty.Scope, CriteriaFilterOperator.EqualTo, EkEnumeration.ActivityActionSource.CommunityGroup);

        collActivityTypeList = _activityListApi.GetList(activityCollListCriteria);
        groupActivityTypeList = _activityListApi.GetList(activityGroupListCriteria);
        if (uId > 0)
        {
            //Colleague Preferences
            preferenceList = new System.Collections.Generic.List<NotificationPreferenceData>();
            preferenceList.Clear();
            for (int i = 0; i <= collActivityTypeList.Count - 1; i++)
            {
                if ((Page.Request.Form["email" + collActivityTypeList[i].Id] != null) && Page.Request.Form["email" + collActivityTypeList[i].Id] == "on")
                {
                    prefData = new NotificationPreferenceData();
                    prefData.ActivityTypeId = collActivityTypeList[i].Id;
                    prefData.AgentId = 1;
                    prefData.UserId = uId;
                    preferenceList.Add(prefData);
                }
                else
                {
                    prefData = new NotificationPreferenceData();
                    prefData.ActivityTypeId = collActivityTypeList[i].Id;
                    prefData.DataState = Ektron.Cms.Common.EkEnumeration.DataState.Deleted;
                    prefData.AgentId = 1;
                    prefData.UserId = uId;
                    preferenceList.Add(prefData);
                }
                if ((Page.Request.Form["sms" + collActivityTypeList[i].Id] != null) && Page.Request.Form["sms" + collActivityTypeList[i].Id] == "on")
                {
                    prefData = new NotificationPreferenceData();
                    prefData.ActivityTypeId = collActivityTypeList[i].Id;
                    prefData.AgentId = 3;
                    prefData.UserId = uId;
                    preferenceList.Add(prefData);
                }
                else
                {
                    prefData = new NotificationPreferenceData();
                    prefData.ActivityTypeId = collActivityTypeList[i].Id;
                    prefData.DataState = Ektron.Cms.Common.EkEnumeration.DataState.Deleted;
                    prefData.AgentId = 3;
                    prefData.UserId = uId;
                    preferenceList.Add(prefData);
                }
                if ((Page.Request.Form["feed" + collActivityTypeList[i].Id] != null) && Page.Request.Form["feed" + collActivityTypeList[i].Id] == "on")
                {
                    prefData = new NotificationPreferenceData();
                    prefData.ActivityTypeId = collActivityTypeList[i].Id;
                    prefData.AgentId = 2;
                    prefData.UserId = uId;
                    preferenceList.Add(prefData);
                }
                else
                {
                    prefData = new NotificationPreferenceData();
                    prefData.ActivityTypeId = collActivityTypeList[i].Id;
                    prefData.DataState = Ektron.Cms.Common.EkEnumeration.DataState.Deleted;
                    prefData.AgentId = 2;
                    prefData.UserId = uId;
                    preferenceList.Add(prefData);
                }

            }
            //Group Preferences

            for (int i = 0; i <= groupActivityTypeList.Count - 1; i++)
            {

                if ((Page.Request.Form["email" + groupActivityTypeList[i].Id] != null) && Page.Request.Form["email" + groupActivityTypeList[i].Id] == "on")
                {
                    prefData = new NotificationPreferenceData();
                    prefData.ActivityTypeId = groupActivityTypeList[i].Id;
                    prefData.AgentId = 1;
                    prefData.UserId = uId;
                    prefData.ActionSourceId = -1;
                    preferenceList.Add(prefData);
                }
                else
                {
                    prefData = new NotificationPreferenceData();
                    prefData.ActivityTypeId = groupActivityTypeList[i].Id;
                    prefData.DataState = Ektron.Cms.Common.EkEnumeration.DataState.Deleted;
                    prefData.AgentId = 1;
                    prefData.UserId = uId;
                    prefData.ActionSourceId = -1;
                    preferenceList.Add(prefData);
                }
                if ((Page.Request.Form["feed" + groupActivityTypeList[i].Id] != null) && Page.Request.Form["feed" + groupActivityTypeList[i].Id] == "on")
                {
                    prefData = new NotificationPreferenceData();
                    prefData.ActivityTypeId = groupActivityTypeList[i].Id;
                    prefData.AgentId = 2;
                    prefData.UserId = uId;
                    prefData.ActionSourceId = -1;
                    preferenceList.Add(prefData);
                }
                else
                {
                    prefData = new NotificationPreferenceData();
                    prefData.ActivityTypeId = groupActivityTypeList[i].Id;
                    prefData.DataState = Ektron.Cms.Common.EkEnumeration.DataState.Deleted;
                    prefData.AgentId = 2;
                    prefData.UserId = uId;
                    prefData.ActionSourceId = -1;
                    preferenceList.Add(prefData);
                }
                if ((Page.Request.Form["sms" + groupActivityTypeList[i].Id] != null) && Page.Request.Form["sms" + groupActivityTypeList[i].Id] == "on")
                {
                    prefData = new NotificationPreferenceData();
                    prefData.ActivityTypeId = groupActivityTypeList[i].Id;
                    prefData.AgentId = 3;
                    prefData.UserId = uId;
                    prefData.ActionSourceId = -1;
                    preferenceList.Add(prefData);
                }
                else
                {
                    prefData = new NotificationPreferenceData();
                    prefData.ActivityTypeId = groupActivityTypeList[i].Id;
                    prefData.DataState = Ektron.Cms.Common.EkEnumeration.DataState.Deleted;
                    prefData.AgentId = 3;
                    prefData.UserId = uId;
                    prefData.ActionSourceId = -1;
                    preferenceList.Add(prefData);
                }
            }
            _notificationPreferenceApi.SaveUserPreferences(preferenceList);
        }
    }
コード例 #48
0
ファイル: Program.cs プロジェクト: Bert6623/Gedcom.Net
        public void controller(string[] args)
        {
            
            if (args.Length >= 2 && args[0].ToUpper().Equals("-FTDNA"))
            {
                FamilyTreeDNA.FamilyTreeDNA ftd = new FamilyTreeDNA.FamilyTreeDNA();
                if (args.Length >= 3)
                    ftd.Login(args[1], args[2]);
                else
                    ftd.Login("169551", "D3742");
            }
            if (args.Length >= 2 && args[0].ToUpper().Equals("-23"))
            {
                MeAnd23.MeAnd23 m23 = new MeAnd23.MeAnd23();
                if (args.Length >= 3)
                    m23.Login(args[1], args[2]);
                else
                    m23.Login("*****@*****.**", "nurse1");
            }
            if (args.Length >= 2 && args[0].ToUpper().Equals("-CSV"))
            {

            }
             
            if (args.Length >= 2 && args[0].Equals("-compare"))
            {
                GedcomDatabase gd1 = new GedcomDatabase();
                GedcomIndividualRecord record = new GedcomIndividualRecord(gd1, "Robert Warthen");
                record.Sex = GedcomSex.Male;
                //record.Birth = new GedcomIndividualEvent().Date.;

                GedcomParser.GedcomRecordWriter grw = new GedcomParser.GedcomRecordWriter();
                grw.WriteGedcom(gd1, "C:\\Temp\\Rob.ged");

            }
            if (args.Length >= 2 && args[0].Equals("-surlist"))
            {
                swsn = new StreamWriter(args[1] + "\\surname.csv", false);

                string[] files = Directory.GetFiles(args[1], "*.*", SearchOption.TopDirectoryOnly);
                string[] files2 = Directory.GetFiles(args[1], "*.*", SearchOption.TopDirectoryOnly);

                if (args.Length >= 3 && args[2].Equals("-file"))
                {
                    files = new string[1];
                    files[0] = args[3];
                }

                if (args.Length >= 3 && args[2].Equals("-dir"))
                {
                    files2 = Directory.GetFiles(args[3], "*.*", SearchOption.TopDirectoryOnly);
                }

                foreach (string gdf1 in files)
                {
                    string gedcomFile1 = gdf1.ToUpper();
                    if (!gedcomFile1.EndsWith(".GED"))
                        continue;

                    swFile1 = Path.GetFileName(gedcomFile1);
                    //Console.WriteLine("Loading " + );
                    GedcomParser.GedcomRecordReader grr1 = new GedcomParser.GedcomRecordReader();
                    grr1.GedcomFile = gedcomFile1;
                    try { grr1.ReadGedcom(); }
                    catch { Console.WriteLine("Couldn't read file " + gedcomFile1);  continue; }
                    GedcomDatabase gd1 = grr1.Database;
                    System.Collections.Generic.List<string> sv = new System.Collections.Generic.List<string>();
                    sv.Clear();
                    foreach (GedcomIndividualRecord rec in gd1.Individuals)
                    {
                        try
                        {
                            foreach (GedcomName sname in rec.Names)
                            {
                                string sn = sname.Surname.ToUpper();
                                if (sn.Length == 0)
                                    continue;
                                if (!sv.Contains(sname.Surname.ToUpper()))
                                {
                                    sv.Add(sname.Surname.ToUpper());
                                    swsn.WriteLine(gedcomFile1 + ",\"" + sname.Surname.ToUpper().Replace("\"", "_") + "\"");
                                }
                            }
                        }
                        catch
                        {
                            Console.WriteLine("Can't read");
                        }
                    }
                }
                swsn.Close();
            }
            if (args.Length >= 2 && args[0].Equals("-compdir"))
            {
                sw = new StreamWriter(args[1] + "\\match.csv");
                sw.WriteLine("File1,File2,Exact Match,Given1,Surname1,Birth Date1,Birth Place1,Death Date1,Death Place1,Given2,Surname2,Birth Date2,Birth Place2,Death Date2,Death Place2");
                
                swsn = new StreamWriter(args[1] + "\\surname.csv",false);
                
                string[] files = Directory.GetFiles(args[1], "*.*", SearchOption.TopDirectoryOnly);
                string[] files2 = Directory.GetFiles(args[1], "*.*", SearchOption.TopDirectoryOnly);

                if (args.Length >= 3 && args[2].Equals("-file"))
                {
                    files = new string[1];
                    files[0] = args[3];
                }

                if (args.Length >= 3 && args[2].Equals("-dir"))
                {
                    files2 = Directory.GetFiles(args[3], "*.*", SearchOption.TopDirectoryOnly);
                }

                foreach (string gdf1 in files)
                {
                    string gedcomFile1 = gdf1.ToUpper();
                    if (!gedcomFile1.EndsWith(".GED"))
                        continue;

                    swFile1 = Path.GetFileName(gedcomFile1);
                    //Console.WriteLine("Loading " + );
                    GedcomParser.GedcomRecordReader grr1 = new GedcomParser.GedcomRecordReader();
                    grr1.GedcomFile = gedcomFile1;
                    try { grr1.ReadGedcom(); }
                    catch { continue; }
                    GedcomDatabase gd1 = grr1.Database;
                    System.Collections.Generic.List<string> sv = new System.Collections.Generic.List<string>();
                    foreach (GedcomIndividualRecord rec in gd1.Individuals)
                    {
                        try
                        {
                            foreach (GedcomName sname in rec.Names)
                            {
                                if (!sv.Contains(sname.Surname.ToUpper()))
                                {
                                    sv.Add(sname.Surname.ToUpper());
                                    swsn.WriteLine(gedcomFile1 + ",\"" + sname.Surname.ToUpper().Replace("\"","_") + "\"");
                                }
                            }
                        }
                        catch
                        {
                            Console.WriteLine("Can't read");
                        }
                    }
                    foreach (string gdf2 in files2)
                    {
                        string gedcomFile2 = gdf2.ToUpper();
                        if (!gedcomFile2.EndsWith(".GED"))
                            continue;
                        if (gedcomFile2.Equals(gedcomFile1))
                            continue;
                        swFile2 = Path.GetFileName(gedcomFile2);
                        //Console.WriteLine("Comparing " + gedcomFile1 + " and " + gedcomFile2);
                        GedcomParser.GedcomRecordReader grr2 = new GedcomParser.GedcomRecordReader();
                        grr2.GedcomFile = gedcomFile2;
                        try { grr2.ReadGedcom(); }
                        catch { continue; }
                        GedcomDatabase gd2 = grr2.Database;

                        GedcomDuplicate.DuplicateFoundFunc found = new GedcomDuplicate.DuplicateFoundFunc(FoundDuplicate);
                        float matchThreshold = 95;

                        GedcomDuplicate.FindDuplicates(gd1, gd2, matchThreshold, found);
                    }
                    sw.Flush();
                    swsn.Flush();
                }
                sw.Close();
                swsn.Close();
            }
            if (args.Length >= 2 && args[0].Equals("-surname"))
            {
                string[] files = Directory.GetFiles(args[1], "*.*", SearchOption.AllDirectories);
                string surname = args[2].ToUpper();

                foreach (string gedcomFile1 in files)
                {
                    if (!gedcomFile1.ToUpper().EndsWith(".GED"))
                        continue;

                    //Console.WriteLine("Comparing " + gedcomFile1 + " for surname " + surname);
                    GedcomParser.GedcomRecordReader grr1 = new GedcomParser.GedcomRecordReader();
                    try
                    {
                        grr1.GedcomFile = gedcomFile1;
                        grr1.ReadGedcom();
                        GedcomDatabase gd1 = grr1.Database;
                        bool foundfile = false;

                        foreach (GedcomIndividualRecord rec in gd1.Individuals)
                        {
                            try
                            {
                                if (rec.Names.Count > 0 && rec.Names[0].Surname.ToUpper().Equals(surname))
                                {
                                    if (!foundfile)
                                    {
                                        Console.WriteLine("File " + gedcomFile1);
                                        foundfile = true;
                                    }
                                    Console.Write("  Found " + rec.Names[0].Given + " " + rec.Names[0].Surname);
                                    try { Console.Write(" Born: " + rec.Birth.Date.DateString); }
                                    catch { }
                                    try { Console.Write(" in " + rec.Birth.Place.Name); }
                                    catch { }
                                    try { Console.Write(" Died: " + rec.Death.Date.DateString); }
                                    catch { }
                                    try { Console.Write(" at " + rec.Death.Place.Name); }
                                    catch { }
                                    Console.WriteLine();
                                }
                            }
                            catch
                            {
                                Console.WriteLine("Can't read");
                            }
                        }
                    }
                    catch { }

                }
            }

            if (args.Length >= 2 && args[0].Equals("-surfile"))
            {
                List<string> lstSurname = new List<string>();
                string[] files = Directory.GetFiles(args[1], "*.*", SearchOption.TopDirectoryOnly);
                //string surname = args[2].ToUpper();
                
                foreach (string gedcomFile1 in files)
                {
                    if (!gedcomFile1.ToUpper().EndsWith(".GED"))
                        continue;

                    //Console.WriteLine("Comparing " + gedcomFile1 + " for surname " + surname);
                    GedcomParser.GedcomRecordReader grr1 = new GedcomParser.GedcomRecordReader();
                    try
                    {
                        grr1.GedcomFile = gedcomFile1;
                        grr1.ReadGedcom();
                        GedcomDatabase gd1 = grr1.Database;
                        bool foundfile = false;

                        if (!Directory.Exists(args[1] + "\\Surname"))
                            Directory.CreateDirectory(args[1] + "\\Surname");

                        foreach (GedcomIndividualRecord rec in gd1.Individuals)
                        {
                            try
                            {
                                StreamWriter sw;
                                if (rec.Names.Count > 0)
                                {
                                    string surname = rec.Names[0].Surname.Replace("(", "").Replace(")", "").Replace("_", "").Replace("?", "").Replace("[", "").Replace("]", "").Replace("\'", "").Replace("\\", "").Replace("/", "");
                                    if (!lstSurname.Contains(surname))
                                    {
                                        sw = new StreamWriter(args[1] + "\\Surname\\Surname_" + surname + ".csv", false);
                                        sw.WriteLine("File,Given,Surname,Birth Date,Birth Place,Death Date,Death Place");
                                        lstSurname.Add(surname);
                                    }
                                    else
                                        sw = new StreamWriter(args[1] + "\\Surname\\Surname_" + surname + ".csv", true);

                                    sw.Write("\"" + gedcomFile1 + "\"," + "\"" + rec.Names[0].Given + "\"," + "\"" + rec.Names[0].Surname + "\",");
                                    try { sw.Write("\"" + rec.Birth.Date.DateString + "\"," + "\"" + rec.Birth.Place.Name + "\","); }
                                    catch { sw.Write(",,"); }
                                    try { sw.WriteLine( "\"" + rec.Death.Date.DateString + "\"," + "\"" + rec.Death.Place.Name + "\"");}
                                    catch { sw.WriteLine(","); }
                                    sw.Close();
                                }
                            }
                            catch (Exception ex)
                            {
                                Console.WriteLine("Can't read: " + ex.Message + "-" + ex.StackTrace);
                            }
                            finally
                            {
                                if (sw != null)
                                    sw.Close();
                            }
                        }
                    }
                    catch { }

                }
            }

            if (args.Length >= 2 && args[0].Equals("-birth"))
            {
                string[] files = Directory.GetFiles(args[1], "*.*", SearchOption.AllDirectories);
                string surname = args[2].ToUpper();

                foreach (string gedcomFile1 in files)
                {
                    if (!gedcomFile1.ToUpper().EndsWith(".GED"))
                        continue;

                    //Console.WriteLine("Comparing " + gedcomFile1 + " for surname " + surname);
                    GedcomParser.GedcomRecordReader grr1 = new GedcomParser.GedcomRecordReader();
                    grr1.GedcomFile = gedcomFile1;
                    grr1.ReadGedcom();
                    GedcomDatabase gd1 = grr1.Database;
                    bool foundfile = false;

                    foreach (GedcomIndividualRecord rec in gd1.Individuals)
                    {
                        try
                        {
                            if (rec.Birth != null && rec.Birth.Place != null && rec.Birth.Place.Name != null && rec.Birth.Place.Name.ToUpper().Contains(surname))
                            {
                                if (!foundfile)
                                {
                                    Console.WriteLine("File " + gedcomFile1);
                                    foundfile = true;
                                }
                                Console.Write("  Found " + rec.Names[0].Given + " " + rec.Names[0].Surname);
                                try { Console.Write(" Born: " + rec.Birth.Date.DateString); }
                                catch { }
                                try { Console.Write(" in " + rec.Birth.Place.Name); }
                                catch { }
                                try { Console.Write(" Died: " + rec.Death.Date.DateString); }
                                catch { }
                                try { Console.Write(" at " + rec.Death.Place.Name); }
                                catch { }
                                Console.WriteLine();
                            }
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine("Can't read:" + ex.Message + " : " + ex.StackTrace);
                        }
                    }

                }
            }

            if (args.Length >= 2 && args[0].Equals("-soundex"))
            {
                string[] files = Directory.GetFiles(args[1], "*.*", SearchOption.AllDirectories);
                string surname = args[2].ToUpper();
                string sunameSoundex = Util.GenerateSoundex(surname);

                foreach (string gedcomFile1 in files)
                {
                    if (!gedcomFile1.ToUpper().EndsWith(".GED"))
                        continue;

                    //Console.WriteLine("Comparing " + gedcomFile1 + " for surname " + surname);
                    GedcomParser.GedcomRecordReader grr1 = new GedcomParser.GedcomRecordReader();
                    grr1.GedcomFile = gedcomFile1;
                    grr1.ReadGedcom();
                    GedcomDatabase gd1 = grr1.Database;
                    bool foundfile = false;

                    foreach (GedcomIndividualRecord rec in gd1.Individuals)
                    {
                        if (rec.Names[0].SurnameSoundex.Equals(sunameSoundex))
                        {
                            if (!foundfile)
                            {
                                Console.WriteLine("File " + gedcomFile1);
                                foundfile = true;
                            }
                            Console.Write("  Found " + rec.Names[0].Given + " " + rec.Names[0].Surname);
                            try { Console.Write(" Born: " + rec.Birth.Date.DateString); }
                            catch { }
                            try { Console.Write(" in " + rec.Birth.Place.Name); }
                            catch { }
                            try { Console.Write(" Died: " + rec.Death.Date.DateString); }
                            catch { }
                            try { Console.Write(" at " + rec.Death.Place.Name); }
                            catch { }
                            Console.WriteLine();
                        }
                    }

                }
            }

            if (args.Length >= 2 && args[0].Equals("-loaddir"))
            {
                string[] files = Directory.GetFiles(args[1], "*.*", SearchOption.AllDirectories);

                foreach (string gedcomFile1 in files)
                {
                    Console.WriteLine("Loading " + gedcomFile1);
                    GedcomParser.GedcomRecordReader grr1 = new GedcomParser.GedcomRecordReader();
                    grr1.GedcomFile = gedcomFile1;
                    grr1.ReadGedcom();
                    GedcomDatabase gd1 = grr1.Database;

                    foreach (GedcomIndividualRecord matchIndi in gd1.Individuals)
                    {
                        SaveDatabase(matchIndi);
                    }
                }
            }

            
            if (args.Length >= 2 && args[0].ToUpper().Equals("-GEDMATCH"))
            {
                GedMatch.GedMatch gm = new GedMatch.GedMatch();
                gm.WorkDir = args[1];
                gm.DoMatch = true;
                gm.DoGed = true;

                gm.loadGedMatch(args[2],true);
            }
            
            if (args.Length >= 2 && args[0].ToUpper().Equals("-GETGEDMATCH"))
            {
                GedMatch.GedMatch gm = new GedMatch.GedMatch();
                gm.WorkDir = args[1];
                gm.DoGed = true;

                gm.loadGedMatch(args[2], true);
            }
             
        }
コード例 #49
0
ファイル: CMS.cs プロジェクト: ufjl0683/Center
        /// <summary>
        /// �̾�CMS���������o��ܤ��e
        /// </summary>
        /// <param name="blockType">���O����</param>
        /// <param name="message">�T��</param>
        /// <param name="isIcon">���O�ϧ����(0:�����q,1:�q��D�ϥ�,2:�q�ƬG�ϥ�,3:�q�C��)</param>
        /// <param name="mode">�Ҧ�</param>
        /// <returns></returns>
        private RemoteInterface.HC.CMSOutputData SetCMSDislay(string blockType, string message, int isIcon,int mode,string Location,int Show_icon)
        {
            this.mode = mode;
            List<string> changeTexts = new List<string>();
            string str = "";
            if (CMSDevName == "CMS-N3-S-196.7")
            {
                message = "�x���a�k";
            }
            else if (CMSDevName == "CMS-N3-S-196.8")
            {
                message = "�x���a�k";
            }

            foreach (char word in message)
            {
                if (word == '[') str = "";

                str += word;

                if (word == ']')
                {
                    changeTexts.Add(str);
                }
            }

            System.Collections.Generic.List<RSPMegColor> rspMegColors = new System.Collections.Generic.List<RSPMegColor>();

            try
            {
                foreach (string text in changeTexts)
                {
                    int no = Convert.ToInt32(text.Substring(text.IndexOf('[') + 1, text.IndexOf(']') - 1));
                    string mag = setMessage(no,Location);
                    message = message.Replace(text,'\b' +  mag + '\f');
                    MessColor messColor = (MessColor)messColorsHT[no];
                    //if (blockType == "2X8(���m)")
                    //{
                    //    rspMegColors.Add(new RSPMegColor(mag, messColor.Forecolor, messColor.BackColor));
                    //}
                    //else
                    //{
                        rspMegColors.Add(new RSPMegColor(mag, getCMSWordColor(messColor.Forecolor, messColor.BackColor)));
                    //}
                }
            }
            catch (OBSLastDeviceException)
            {
                message = "���h�p�߾r�p";
                rspMegColors.Clear();
            }

            string newMeg = message.Replace("\r", "");
            List<byte> colors = new List<byte>();

            //byte[] colors = new byte[message.Replace("\r", "").Length];
            for (int i = 0; i < newMeg.Length; i++)
            {
                colors.Add(32);
            }

            foreach (RSPMegColor de in rspMegColors)
            {
                for (int i = newMeg.IndexOf(de.Message); i <= newMeg.IndexOf(de.Message) + de.Message.Length - 1; i++)
                {
                    if (i == -1) continue;
                    colors[i] = Convert.ToByte(de.Color);
                    if (newMeg[i] == '��')
                        colors.Insert(i, colors[i]);
                }
            }

            RemoteInterface.HC.CMSOutputData outputData;
            if (Show_icon == 1)
            {
                byte[] vspaces = new byte[colors.Count];
                outputData = new RemoteInterface.HC.CMSOutputData(4, 0, 0, 0, message.Replace("��", "�@�@"), colors.ToArray(), vspaces);
                outputData.AlarmClass = (int)ht["INC_NAME"];
            }
            else
            {
                 outputData = new RemoteInterface.HC.CMSOutputData(0, 0, 0, message.Replace("��", "�@�@"), colors.ToArray());
                 outputData.AlarmClass = (int)ht["INC_NAME"];
            }

            switch (blockType)
            {
                case "1X4"://�]�w1x4���O��ܤ��e
                    return getDisplay(outputData, 1, 4);
                case "2X6"://�]�w2X6���O��ܤ��e
                    return getDisplay(outputData, 2, 6);
                case "2X8(�T��)"://�]�w2x8�T�⭱�O��ܤ��e
                    return getDisplay(outputData, 2, 8);
                case "2X8(���m)":
                    return get2x8Display(outputData, isIcon);
                case "3X6"://�]�w3X6���O��ܤ��e
                    return getDisplay(outputData, 3, 6);
                case "5X2"://�]�w5X2���O��ܤ��e
                    return getDisplay(outputData, 2, 5);
                case "8X1"://�]�w8X1���O��ܤ��e
                    return getDisplay(outputData, 1, 8);
                default:
                    throw new Exception("�ʤ�CMS���O�w�q!!");
            }
        }
コード例 #50
0
ファイル: TGAFormat.cs プロジェクト: aa2gcoder/AA2Snowflake
        /// <summary>
        /// Loads the thumbnail of the loaded image file, if any.
        /// </summary>
        /// <param name="binReader">A BinaryReader that points the loaded file byte stream.</param>
        /// <param name="pfPixelFormat">A PixelFormat value indicating what pixel format to use when loading the thumbnail.</param>
        private void LoadThumbnail(BinaryReader binReader, PixelFormat pfPixelFormat)
        {
            // read the Thumbnail image data into a byte array
            // take into account stride has to be a multiple of 4
            // use padding to make sure multiple of 4

            byte[] data = null;
            if (binReader != null && binReader.BaseStream != null && binReader.BaseStream.Length > 0 && binReader.BaseStream.CanSeek == true)
            {
                if (this.ExtensionArea.PostageStampOffset > 0)
                {

                    // seek to the beginning of the image data using the ImageDataOffset value
                    binReader.BaseStream.Seek(this.ExtensionArea.PostageStampOffset, SeekOrigin.Begin);

                    int iWidth = (int)binReader.ReadByte();
                    int iHeight = (int)binReader.ReadByte();

                    int iStride = ((iWidth * (int)this.objTargaHeader.PixelDepth + 31) & ~31) >> 3; // width in bytes
                    int iPadding = iStride - (((iWidth * (int)this.objTargaHeader.PixelDepth) + 7) / 8);

                    System.Collections.Generic.List<System.Collections.Generic.List<byte>> rows = new System.Collections.Generic.List<System.Collections.Generic.List<byte>>();
                    System.Collections.Generic.List<byte> row = new System.Collections.Generic.List<byte>();

                    byte[] padding = new byte[iPadding];
                    MemoryStream msData = null;
                    bool blnEachRowReverse = false;
                    bool blnRowsReverse = false;

                    using (msData = new MemoryStream())
                    {
                        // get the size in bytes of each row in the image
                        int intImageRowByteSize = iWidth * ((int)this.objTargaHeader.PixelDepth / 8);

                        // get the size in bytes of the whole image
                        int intImageByteSize = intImageRowByteSize * iHeight;

                        // thumbnails are never compressed
                        for (int i = 0; i < iHeight; i++)
                        {
                            for (int j = 0; j < intImageRowByteSize; j++)
                            {
                                row.Add(binReader.ReadByte());
                            }
                            rows.Add(row);
                            row = null;
                            row = new System.Collections.Generic.List<byte>();
                        }

                        switch (this.objTargaHeader.FirstPixelDestination)
                        {
                            case FirstPixelDestination.TOP_LEFT:
                                break;

                            case FirstPixelDestination.TOP_RIGHT:
                                blnRowsReverse = false;
                                blnEachRowReverse = false;
                                break;

                            case FirstPixelDestination.BOTTOM_LEFT:
                                break;

                            case FirstPixelDestination.BOTTOM_RIGHT:
                            case FirstPixelDestination.UNKNOWN:
                                blnRowsReverse = true;
                                blnEachRowReverse = false;

                                break;
                        }

                        if (blnRowsReverse == true)
                            rows.Reverse();

                        for (int i = 0; i < rows.Count; i++)
                        {
                            if (blnEachRowReverse == true)
                                rows[i].Reverse();

                            byte[] brow = rows[i].ToArray();
                            msData.Write(brow, 0, brow.Length);
                            msData.Write(padding, 0, padding.Length);
                        }
                        data = msData.ToArray();
                    }

                    if (data != null && data.Length > 0)
                    {
                        this.ThumbnailByteHandle = GCHandle.Alloc(data, GCHandleType.Pinned);
                        this.bmpImageThumbnail = new Bitmap(iWidth, iHeight, iStride, pfPixelFormat,
                                                        this.ThumbnailByteHandle.AddrOfPinnedObject());

                        if (this.ThumbnailByteHandle != null && this.ThumbnailByteHandle.IsAllocated)
                            this.ThumbnailByteHandle.Free();
                    }

                    // clear our row arrays
                    if (rows != null)
                    {
                        for (int i = 0; i < rows.Count; i++)
                        {
                            rows[i].Clear();
                            rows[i] = null;
                        }
                        rows.Clear();
                        rows = null;
                    }
                    if (rows != null)
                    {
                        row.Clear();
                        row = null;
                    }

                }
                else
                {
                    if (this.bmpImageThumbnail != null)
                    {
                        this.bmpImageThumbnail.Dispose();
                        this.bmpImageThumbnail = null;
                    }
                }
            }
            else
            {
                if (this.bmpImageThumbnail != null)
                {
                    this.bmpImageThumbnail.Dispose();
                    this.bmpImageThumbnail = null;
                }
            }
        }
コード例 #51
0
 private void ClearEntGroupManagerWindows()
 {
     System.Collections.Generic.List<EntGroupManagerWindow> temEntGroupManagerWindows = new System.Collections.Generic.List<EntGroupManagerWindow>();
     foreach (System.Collections.Generic.KeyValuePair<long, EntGroupManagerWindow> item in this.entGroupManagerWindows)
     {
         temEntGroupManagerWindows.Add(item.Value);
     }
     for (int i = 0; i < temEntGroupManagerWindows.Count; i++)
     {
         temEntGroupManagerWindows[i].Close();
     }
     temEntGroupManagerWindows.Clear();
     this.entGroupManagerWindows.Clear();
 }
コード例 #52
0
ファイル: ActSpisanie.cs プロジェクト: Blyumenshteyn/UchetUSP
        /// <summary>
        /// Загрузка данных в БД (запускается на статусе добавления данныз)
        /// </summary>      
        /// <returns></returns>   
        private void UpdateInformationInDB()
        {
            //проверяем есть ли такой номер в БД (на случай если кто-то удалит его в процессе работы)
            if (string.Compare(CheckInformation(), "0") != 0)
            {
                bool successToLoadData = false;

                System.Collections.Generic.List<string> Parameters = new System.Collections.Generic.List<string>();

                System.Collections.Generic.List<string> DataFromTextBox = new System.Collections.Generic.List<string>();

                //Основные данные

                Parameters.Add("OKUD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(Z10));
                Parameters.Add("UTV_DOLZNOST"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(U4));
                Parameters.Add("UTV_RAS_PODP"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(U6));
                Parameters.Add("ORAGANIZATION_HEAD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(D12));
                Parameters.Add("STRUCT_PODR_HEAD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(F14));
                Parameters.Add("DATA_SOST"); DataFromTextBox.Add(H22.Value.ToString());
                Parameters.Add("COD_VIDA_OPER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(K22));
                Parameters.Add("STRUCT_PODR"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(M22));
                Parameters.Add("NOMER_CEHA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(P22));
                Parameters.Add("VID_DEYAT"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(R22));
                Parameters.Add("CORRESP_SCHET"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(U22));
                Parameters.Add("COD_ZATRAT"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(Y22));
                Parameters.Add("PRICAZ_OT"); DataFromTextBox.Add(J26.Value.ToString());
                Parameters.Add("PRICAZ_YEAR"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(S26));
                Parameters.Add("KOL_PREDETOV"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(F86));
                Parameters.Add("NOM_ACT_VIB"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(F89));
                Parameters.Add("UTIL"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(F112));
                //Итог 1
                Parameters.Add("ITOG_KOL"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(J83));
                Parameters.Add("ITOG_DATA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(L83));
                Parameters.Add("ITOG_CENA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(N83));
                Parameters.Add("ITOG_SUM_CENA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(P83));
                Parameters.Add("ITOG_SUM_AMOR"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(R83));
                Parameters.Add("ITOG_SROK_SLUZ"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(T83));
                Parameters.Add("ITOG_PRIHINA_NAIMENOV"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(V83));
                Parameters.Add("ITOG_PRICH_COD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(X83));
                Parameters.Add("ITOG_SROK"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(Z83));
                //Итог 2
                Parameters.Add("ITOGTWO_KOL"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(S103));
                Parameters.Add("ITOGTWO_CENA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(U103));
                Parameters.Add("ITOGTWO_SUMMA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(X103));
                Parameters.Add("ITOGTWO_PORYAD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(Z103));
                //Номер акта
                Parameters.Add("N_ACT"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(J8));

                string cmd = "UPDATE USP_ACTNASPISANIE_HEAD SET" +
                " OKUD = :OKUD,  "+
                " UTV_DOLZNOST = :UTV_DOLZNOST,  "+
                " UTV_RAS_PODP = :UTV_RAS_PODP,  "+
                " ORAGANIZATION_HEAD = :ORAGANIZATION_HEAD,  "+
                " STRUCT_PODR_HEAD = :STRUCT_PODR_HEAD, " +
                " DATA_SOST = to_date(:DATA_SOST,'DD.MM.YYYY hh24:mi:ss'),  "+
                " COD_VIDA_OPER = :COD_VIDA_OPER,  "+
                " STRUCT_PODR = :STRUCT_PODR,  "+
                " NOMER_CEHA = :NOMER_CEHA,  "+
                " VID_DEYAT = :VID_DEYAT,  "+
                " CORRESP_SCHET = :CORRESP_SCHET,  "+
                " COD_ZATRAT = :COD_ZATRAT, " +
                " PRICAZ_OT = to_date(:PRICAZ_OT,'DD.MM.YYYY hh24:mi:ss'), "+
                " PRICAZ_YEAR = :PRICAZ_YEAR,  "+
                " KOL_PREDETOV = :KOL_PREDETOV, "+
                " NOM_ACT_VIB = :NOM_ACT_VIB,  "+
                " UTIL = :UTIL,  "+
                " ITOG_KOL = :ITOG_KOL,  "+
                " ITOG_DATA = :ITOG_DATA,  "+
                " ITOG_CENA = :ITOG_CENA,  "+
                " ITOG_SUM_CENA = :ITOG_SUM_CENA, " +
                " ITOG_SUM_AMOR = :ITOG_SUM_AMOR, " +
                " ITOG_SROK_SLUZ = :ITOG_SROK_SLUZ,  "+
                " ITOG_PRIHINA_NAIMENOV = :ITOG_PRIHINA_NAIMENOV,  "+
                " ITOG_PRICH_COD = :ITOG_PRICH_COD,  "+
                " ITOG_SROK = :ITOG_SROK,  "+
                " ITOGTWO_KOL = :ITOGTWO_KOL,  "+
                " ITOGTWO_CENA = :ITOGTWO_CENA,  "+
                " ITOGTWO_SUMMA = :ITOGTWO_SUMMA, "+
                " ITOGTWO_PORYAD = :ITOGTWO_PORYAD " +
                "WHERE N_ACT = :N_ACT";

                successToLoadData = SQLOracle.UpdateQuery(cmd, Parameters, DataFromTextBox);

                Parameters.Clear();
                DataFromTextBox.Clear();

                if (successToLoadData == true)
                    for (int i = 1; i < 6; i++)
                    {
                        if (successToLoadData == true)
                        {
                            string cmdDATA = "UPDATE USP_ACTNASPISANIE_DATA_ONE SET  " +
                                " PREDMET_NAIM = :PREDMET_NAIM, " +
                                " PREDMET_NOMEN_NOMER = :PREDMET_NOMEN_NOMER, " +
                                " PREDMET_INVENT_NOMER = :PREDMET_INVENT_NOMER, " +
                                " ED_IZM_NAIM = :ED_IZM_NAIM, " +
                                " ED_IZM_KOD = :ED_IZM_KOD, "+
                                " KOL_VO =: KOL_VO, " +
                                " DATA_POSTUPLENIYA = to_date(:DATA_POSTUPLENIYA,'DD.MM.YYYY hh24:mi:ss'), " +
                                " CENA = :CENA, " +
                                " SUMMA_CENA_RUB = :SUMMA_CENA_RUB, " +
                                " SUMMA_AMORTIZ = :SUMMA_AMORTIZ, " +
                                " SROK_SLUZ = :SROK_SLUZ, " +
                                " PRICH_SPIS_NAIM =:PRICH_SPIS_NAIM, " +
                                " PRICH_SPIS_KOD = :PRICH_SPIS_KOD, " +
                                " NOMER_PASPORTA = :NOMER_PASPORTA WHERE " +
                                " ACT_NOMER = :ACT_NOMER AND" +
                                " NUMBER_OF_PANEL = :NUMBER_OF_PANEL " ;

                            Parameters.Add("PREDMET_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("A" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("PREDMET_NOMEN_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("A" + ((4 * (i - 1)) + 38).ToString()), true)[0])));
                            Parameters.Add("PREDMET_INVENT_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("F" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("ED_IZM_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("H" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("ED_IZM_KOD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("H" + ((4 * (i - 1)) + 38).ToString()), true)[0])));
                            Parameters.Add("KOL_VO"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("J" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("DATA_POSTUPLENIYA"); DataFromTextBox.Add(((System.Windows.Forms.DateTimePicker)(this.tabPage1.Controls.Find(("L" + ((4 * (i - 1)) + 36).ToString()), true)[0])).Value.ToString());
                            Parameters.Add("CENA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("N" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("SUMMA_CENA_RUB"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("P" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("SUMMA_AMORTIZ"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("R" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("SROK_SLUZ"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("T" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("PRICH_SPIS_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("V" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("PRICH_SPIS_KOD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("X" + ((4 * (i - 1)) + 36).ToString()), true)[0])));
                            Parameters.Add("NOMER_PASPORTA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage1.Controls.Find(("Z" + ((4 * (i - 1)) + 36).ToString()), true)[0])));

                            Parameters.Add("ACT_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(J8));
                            Parameters.Add("NUMBER_OF_PANEL"); DataFromTextBox.Add((i).ToString());

                            successToLoadData = SQLOracle.UpdateQuery(cmdDATA, Parameters, DataFromTextBox);

                            Parameters.Clear();
                            DataFromTextBox.Clear();
                        }
                    }

                if (successToLoadData == true)
                    for (int i = 7; i < 12; i++)
                    {
                        if (successToLoadData == true)
                        {
                            string cmdDATA = "UPDATE USP_ACTNASPISANIE_DATA_ONE SET  " +
                               " PREDMET_NAIM = :PREDMET_NAIM, " +
                               " PREDMET_NOMEN_NOMER = :PREDMET_NOMEN_NOMER, " +
                               " PREDMET_INVENT_NOMER = :PREDMET_INVENT_NOMER, " +
                               " ED_IZM_NAIM = :ED_IZM_NAIM, " +
                               " ED_IZM_KOD = :ED_IZM_KOD, " +
                               " KOL_VO =: KOL_VO, " +
                               " DATA_POSTUPLENIYA = to_date(:DATA_POSTUPLENIYA,'DD.MM.YYYY hh24:mi:ss'), " +
                               " CENA = :CENA, " +
                               " SUMMA_CENA_RUB = :SUMMA_CENA_RUB, " +
                               " SUMMA_AMORTIZ = :SUMMA_AMORTIZ, " +
                               " SROK_SLUZ = :SROK_SLUZ, " +
                               " PRICH_SPIS_NAIM =:PRICH_SPIS_NAIM, " +
                               " PRICH_SPIS_KOD = :PRICH_SPIS_KOD, " +
                               " NOMER_PASPORTA = :NOMER_PASPORTA WHERE " +
                               " ACT_NOMER = :ACT_NOMER AND " +
                                " NUMBER_OF_PANEL = :NUMBER_OF_PANEL " ;

                            Parameters.Add("PREDMET_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("A" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("PREDMET_NOMEN_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("A" + ((4 * (i - 1)) + 41).ToString()), true)[0])));
                            Parameters.Add("PREDMET_INVENT_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("F" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("ED_IZM_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("H" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("ED_IZM_KOD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("H" + ((4 * (i - 1)) + 41).ToString()), true)[0])));
                            Parameters.Add("KOL_VO"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("J" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("DATA_POSTUPLENIYA"); DataFromTextBox.Add(((System.Windows.Forms.DateTimePicker)(this.tabPage2.Controls.Find(("L" + ((4 * (i - 1)) + 39).ToString()), true)[0])).Value.ToString());
                            Parameters.Add("CENA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("N" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("SUMMA_CENA_RUB"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("P" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("SUMMA_AMORTIZ"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("R" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("SROK_SLUZ"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("T" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("PRICH_SPIS_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("V" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("PRICH_SPIS_KOD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("X" + ((4 * (i - 1)) + 39).ToString()), true)[0])));
                            Parameters.Add("NOMER_PASPORTA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("Z" + ((4 * (i - 1)) + 39).ToString()), true)[0])));

                            Parameters.Add("ACT_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(J8));
                            Parameters.Add("NUMBER_OF_PANEL"); DataFromTextBox.Add((i).ToString());

                            successToLoadData = SQLOracle.UpdateQuery(cmdDATA, Parameters, DataFromTextBox);

                            Parameters.Clear();
                            DataFromTextBox.Clear();
                        }
                    }

                if (successToLoadData == true)
                    for (int i = 1; i <= 2; i++)
                    {
                        if (successToLoadData == true)
                        {
                            string cmdDATA = "UPDATE USP_ACTNASPISANIE_DATA_TWO SET " +
                                " KOD_VIDA_OPER =: KOD_VIDA_OPER, " +
                                " VID_DEYAT =: VID_DEYAT, " +
                                " STRUCT_PODR =: STRUCT_PODR, " +
                                " UTIL_NAIM = :UTIL_NAIM, " +
                                " UTIL_NOMEN_NOMER = :UTIL_NOMEN_NOMER, " +
                                " ED_IZM_NAIM =:ED_IZM_NAIM, " +
                                " ED_IZM_KOD =:ED_IZM_KOD, " +
                                " KOL_VO =:KOL_VO, " +
                                " CENA = :CENA, " +
                                " SUMMA_RUB =:SUMMA_RUB, " +
                                " PORYADKOV_NUM =:PORYADKOV_NUM" +
                                " WHERE ACT_NOMER = :ACT_NOMER  AND " +
                                " NUMBER_OF_PANEL = :NUMBER_OF_PANEL ";

                            Parameters.Add("KOD_VIDA_OPER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("A" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("VID_DEYAT"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("C" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("STRUCT_PODR"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("F" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("UTIL_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("I" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("UTIL_NOMEN_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("L" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("ED_IZM_NAIM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("O" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("ED_IZM_KOD"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("Q" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("KOL_VO"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("S" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("CENA"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("U" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("SUMMA_RUB"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("X" + ((2 * (i - 1)) + 99).ToString()), true)[0])));
                            Parameters.Add("PORYADKOV_NUM"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr((System.Windows.Forms.TextBox)(this.tabPage2.Controls.Find(("Z" + ((2 * (i - 1)) + 99).ToString()), true)[0])));

                            Parameters.Add("ACT_NOMER"); DataFromTextBox.Add(PriemSpisanie.IsNullParametr(J8));
                            Parameters.Add("NUMBER_OF_PANEL"); DataFromTextBox.Add((i).ToString());

                            successToLoadData = SQLOracle.UpdateQuery(cmdDATA, Parameters, DataFromTextBox);

                            Parameters.Clear();
                            DataFromTextBox.Clear();
                        }
                    }

                if (successToLoadData == true)
                {
                    MessageBox.Show("Данные успешно обновлены!");
                }

            }
            else
            {
                MessageBox.Show(CheckInformation(), "Ошибка!");
            }
        }
コード例 #53
0
        /// <summary>
        /// Takes an ISF Stream and populates the StrokeCollection
        ///  attached to this StrokeCollectionSerializer.
        /// </summary>
        /// <param name="inputStream">a Stream the raw isf to decode</param>
#endif
        private void DecodeRawISF(Stream inputStream)
        {
            Debug.Assert(inputStream != null);

            KnownTagCache.KnownTagIndex isfTag;
            uint remainingBytesInStream;
            uint bytesDecodedInCurrentTag = 0;
            bool strokeDescriptorBlockDecoded = false;
            bool drawingAttributesBlockDecoded = false;
            bool metricBlockDecoded = false;
            bool transformDecoded = false;
            uint strokeDescriptorTableIndex = 0;
            uint oldStrokeDescriptorTableIndex = 0xFFFFFFFF;
            uint drawingAttributesTableIndex = 0;
            uint oldDrawingAttributesTableIndex = 0xFFFFFFFF;
            uint metricDescriptorTableIndex = 0;
            uint oldMetricDescriptorTableIndex = 0xFFFFFFFF;
            uint transformTableIndex = 0;
            uint oldTransformTableIndex = 0xFFFFFFFF;
            GuidList guidList = new GuidList();
            int strokeIndex = 0;

            StylusPointDescription currentStylusPointDescription = null;
            Matrix currentTabletToInkTransform = Matrix.Identity;

            _strokeDescriptorTable = new System.Collections.Generic.List<StrokeDescriptor>();
            _drawingAttributesTable = new System.Collections.Generic.List<DrawingAttributes>();
            _transformTable = new System.Collections.Generic.List<TransformDescriptor>();
            _metricTable = new System.Collections.Generic.List<MetricBlock>();

            // First make sure this ink is empty
            if (0 != _coreStrokes.Count || _coreStrokes.ExtendedProperties.Count != 0)
            {
                throw new InvalidOperationException(ISFDebugMessage("ISF decoder cannot operate on non-empty ink container"));
            }
#if OLD_ISF
            //
            // store a compressor reference at this scope, if it is needed (if there is a compresson header) and
            // therefore instanced during this routine, we will dispose of it
            // in the finally block
            //
            Compressor compressor = null;

            try
            {
#endif

            // First read the isfTag
            uint uiTag;
            uint localBytesDecoded = SerializationHelper.Decode(inputStream, out uiTag);
            if (0x00 != uiTag)
                throw new ArgumentException(SR.Get(SRID.InvalidStream));

            // Now read the size of the stream
            localBytesDecoded = SerializationHelper.Decode(inputStream, out remainingBytesInStream);
            ISFDebugTrace("Decoded Stream Size in Bytes: " + remainingBytesInStream.ToString());
            if (0 == remainingBytesInStream)
                return;

            while (0 < remainingBytesInStream)
            {
                bytesDecodedInCurrentTag = 0;

                // First read the isfTag
                localBytesDecoded = SerializationHelper.Decode(inputStream, out uiTag);
                isfTag = (KnownTagCache.KnownTagIndex)uiTag;
                if (remainingBytesInStream >= localBytesDecoded)
                    remainingBytesInStream -= localBytesDecoded;
                else
                {
                    throw new ArgumentException(ISFDebugMessage("Invalid ISF data"));
                }

                ISFDebugTrace("Decoding Tag: " + ((KnownTagCache.KnownTagIndex)isfTag).ToString());
                switch (isfTag)
                {
                    case KnownTagCache.KnownTagIndex.GuidTable:
                    case KnownTagCache.KnownTagIndex.DrawingAttributesTable:
                    case KnownTagCache.KnownTagIndex.DrawingAttributesBlock:
                    case KnownTagCache.KnownTagIndex.StrokeDescriptorTable:
                    case KnownTagCache.KnownTagIndex.StrokeDescriptorBlock:
                    case KnownTagCache.KnownTagIndex.MetricTable:
                    case KnownTagCache.KnownTagIndex.MetricBlock:
                    case KnownTagCache.KnownTagIndex.TransformTable:
                    case KnownTagCache.KnownTagIndex.ExtendedTransformTable:
                    case KnownTagCache.KnownTagIndex.Stroke:
                    case KnownTagCache.KnownTagIndex.CompressionHeader:
                    case KnownTagCache.KnownTagIndex.PersistenceFormat:
                    case KnownTagCache.KnownTagIndex.HimetricSize:
                    case KnownTagCache.KnownTagIndex.StrokeIds:
                        {
                            localBytesDecoded = SerializationHelper.Decode(inputStream, out bytesDecodedInCurrentTag);
                            if (remainingBytesInStream < (localBytesDecoded + bytesDecodedInCurrentTag))
                            {
                                throw new ArgumentException(ISFDebugMessage("Invalid ISF data"), "inputStream");
                            }

                            remainingBytesInStream -= localBytesDecoded;

                            // Based on the isfTag figure out what information we're loading
                            switch (isfTag)
                            {
                                case KnownTagCache.KnownTagIndex.GuidTable:
                                    {
                                        // Load guid Table
                                        localBytesDecoded = guidList.Load(inputStream, bytesDecodedInCurrentTag);
                                        break;
                                    }

                                case KnownTagCache.KnownTagIndex.DrawingAttributesTable:
                                    {
                                        // Load drawing attributes table
                                        localBytesDecoded = LoadDrawAttrsTable(inputStream, guidList, bytesDecodedInCurrentTag);
                                        drawingAttributesBlockDecoded = true;
                                        break;
                                    }

                                case KnownTagCache.KnownTagIndex.DrawingAttributesBlock:
                                    {
                                        //initialize to V1 defaults, we do it this way as opposed
                                        //to dr.DrawingFlags = 0 because this was a perf hot spot
                                        //and instancing the epc first mitigates it
                                        ExtendedPropertyCollection epc = new ExtendedPropertyCollection();
                                        epc.Add(KnownIds.DrawingFlags, DrawingFlags.Polyline);
                                        DrawingAttributes dr = new DrawingAttributes(epc);
                                        localBytesDecoded = DrawingAttributeSerializer.DecodeAsISF(inputStream, guidList, bytesDecodedInCurrentTag, dr);

                                        _drawingAttributesTable.Add(dr);
                                        drawingAttributesBlockDecoded = true;
                                        break;
                                    }

                                case KnownTagCache.KnownTagIndex.StrokeDescriptorTable:
                                    {
                                        // Load stroke descriptor table
                                        localBytesDecoded = DecodeStrokeDescriptorTable(inputStream, bytesDecodedInCurrentTag);
                                        strokeDescriptorBlockDecoded = true;
                                        break;
                                    }

                                case KnownTagCache.KnownTagIndex.StrokeDescriptorBlock:
                                    {
                                        // Load a single stroke descriptor
                                        localBytesDecoded = DecodeStrokeDescriptorBlock(inputStream, bytesDecodedInCurrentTag);
                                        strokeDescriptorBlockDecoded = true;
                                        break;
                                    }

                                case KnownTagCache.KnownTagIndex.MetricTable:
                                    {
                                        // Load Metric Table
                                        localBytesDecoded = DecodeMetricTable(inputStream, bytesDecodedInCurrentTag);
                                        metricBlockDecoded = true;
                                        break;
                                    }

                                case KnownTagCache.KnownTagIndex.MetricBlock:
                                    {
                                        // Load a single Metric Block
                                        MetricBlock blk;

                                        localBytesDecoded = DecodeMetricBlock(inputStream, bytesDecodedInCurrentTag, out blk);
                                        _metricTable.Clear();
                                        _metricTable.Add(blk);
                                        metricBlockDecoded = true;
                                        break;
                                    }

                                case KnownTagCache.KnownTagIndex.TransformTable:
                                    {
                                        // Load Transform Table
                                        localBytesDecoded = DecodeTransformTable(inputStream, bytesDecodedInCurrentTag, false);
                                        transformDecoded = true;
                                        break;
                                    }

                                case KnownTagCache.KnownTagIndex.ExtendedTransformTable:
                                    {
                                        // non-double transform table should have already been loaded
                                        if (!transformDecoded)
                                        {
                                            throw new ArgumentException(ISFDebugMessage("Invalid ISF data"));
                                        }

                                        // Load double-sized Transform Table
                                        localBytesDecoded = DecodeTransformTable(inputStream, bytesDecodedInCurrentTag, true);
                                        break;
                                    }

                                case KnownTagCache.KnownTagIndex.PersistenceFormat:
                                    {
                                        uint fmt;

                                        localBytesDecoded = SerializationHelper.Decode(inputStream, out fmt);
                                        // Set the appropriate persistence information
                                        if (0 == fmt)
                                        {
                                            CurrentPersistenceFormat = PersistenceFormat.InkSerializedFormat;
                                        }
                                        else if (0x00000001 == fmt)
                                        {
                                            CurrentPersistenceFormat = PersistenceFormat.Gif;
                                        }


                                        break;
                                    }

                                case KnownTagCache.KnownTagIndex.HimetricSize:
                                    {
                                        // Loads the Hi Metric Size for Fortified GIFs
                                        int sz;

                                        localBytesDecoded = SerializationHelper.SignDecode(inputStream, out sz);
                                        if (localBytesDecoded > remainingBytesInStream)
                                            throw new ArgumentException(ISFDebugMessage("Invalid ISF data"));

                                        _himetricSize.X = (double)sz;
                                        localBytesDecoded += SerializationHelper.SignDecode(inputStream, out sz);

                                        _himetricSize.Y = (double)sz;
                                        break;
                                    }

                                case KnownTagCache.KnownTagIndex.CompressionHeader:
                                    {
#if OLD_ISF
                                        byte[] data = new byte[bytesDecodedInCurrentTag];

                                        // read the header from the stream
                                        uint bytesRead = StrokeCollectionSerializer.ReliableRead(inputStream, data, bytesDecodedInCurrentTag);
                                        if (bytesDecodedInCurrentTag != bytesRead)
                                        {
                                            throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Read different size from stream then expected"), "isfStream");
                                        }

                                        uint size = bytesDecodedInCurrentTag;
                                        compressor = new Compressor(data, ref size);
                                        // in case the actual number of bytes read by the compressor
                                        //      is less than the encoder had expected (e.g. compression
                                        //      header was encoded as 10 bytes, but only 7 bytes were read)
                                        //      then we don't want to adjust the stream position because
                                        //      there are likely other following tags that are encoded
                                        //      after the compression tag. This should never happen,
                                        //      so just fail if the compressor is broken or the ISF is
                                        //      corrupted.
                                        if (size != bytesDecodedInCurrentTag)
                                        {
                                            throw new InvalidOperationException(ISFDebugMessage("Compressor intialization reported inconsistent size"));
                                        }
#else
                                        //just advance the inputstream position, we don't need
                                        //no compression header in the new isf decoding
                                        inputStream.Seek(bytesDecodedInCurrentTag, SeekOrigin.Current);
#endif
                                        localBytesDecoded = bytesDecodedInCurrentTag;
                                        break;
                                    }

                                case KnownTagCache.KnownTagIndex.StrokeIds:
                                    {
                                        localBytesDecoded = LoadStrokeIds(inputStream, bytesDecodedInCurrentTag);
                                        break;
                                    }

                                case KnownTagCache.KnownTagIndex.Stroke:
                                    {
                                        ISFDebugTrace("   Decoding Stroke Id#(" + (strokeIndex + 1).ToString() + ")");

                                        StrokeDescriptor strokeDescriptor = null;

                                        // Load the stroke descriptor based on the index from the list of unique
                                        // stroke descriptors
                                        if (strokeDescriptorBlockDecoded)
                                        {
                                            if (oldStrokeDescriptorTableIndex != strokeDescriptorTableIndex)
                                            {
                                                if (_strokeDescriptorTable.Count <= strokeDescriptorTableIndex)
                                                    throw new ArgumentException(ISFDebugMessage("Invalid ISF data"));
                                            }

                                            strokeDescriptor = _strokeDescriptorTable[(int)strokeDescriptorTableIndex];
                                        }

                                        // use new transform if the last transform is uninit'd or has changed
                                        if (oldTransformTableIndex != transformTableIndex)
                                        {
                                            // if transform was specified in the ISF stream
                                            if (transformDecoded)
                                            {
                                                if (_transformTable.Count <= transformTableIndex)
                                                    throw new ArgumentException(ISFDebugMessage("Invalid ISF data"));

                                                // Load the transform descriptor based on the index from the list of unique
                                                // transforn descriptors
                                                currentTabletToInkTransform = LoadTransform(_transformTable[(int)transformTableIndex]);
                                            }

                                            oldTransformTableIndex = transformTableIndex; // cache the transform by remembering the index

                                            // since ISF is stored in HIMETRIC, and we want to expose packet data
                                            //      as Avalon units, we'll update the convert the transform before loading the stroke
                                            currentTabletToInkTransform.Scale(StrokeCollectionSerializer.HimetricToAvalonMultiplier, StrokeCollectionSerializer.HimetricToAvalonMultiplier);
                                        }

                                        MetricBlock metricBlock = null;

                                        // Load the metric block based on the index from the list of unique metric blocks
                                        if (metricBlockDecoded)
                                        {
                                            if (oldMetricDescriptorTableIndex != metricDescriptorTableIndex)
                                            {
                                                if (_metricTable.Count <= metricDescriptorTableIndex)
                                                    throw new ArgumentException(ISFDebugMessage("Invalid ISF data"));
                                            }

                                            metricBlock = _metricTable[(int)metricDescriptorTableIndex];
                                        }

                                        DrawingAttributes activeDrawingAttributes = null;

                                        // Load the drawing attributes based on the index from the list of unique drawing attributes
                                        if (drawingAttributesBlockDecoded)
                                        {
                                            if (oldDrawingAttributesTableIndex != drawingAttributesTableIndex)
                                            {
                                                if (_drawingAttributesTable.Count <= drawingAttributesTableIndex)
                                                    throw new ArgumentException(ISFDebugMessage("Invalid ISF data"));

                                                oldDrawingAttributesTableIndex = drawingAttributesTableIndex;
                                            }
                                            DrawingAttributes currDA = (DrawingAttributes)_drawingAttributesTable[(int)drawingAttributesTableIndex];
                                            //we always clone so we don't get strokes that share DAs, which can lead
                                            //to all sorts of unpredictable behavior (ex: see Windows OS Bugs 1450047)
                                            activeDrawingAttributes = currDA.Clone();
                                        }

                                        // if we didn't find an existing da to use, instance a new one
                                        if (activeDrawingAttributes == null)
                                        {
                                            activeDrawingAttributes = new DrawingAttributes();
                                        }

                                        // Now create the StylusPacketDescription from the stroke descriptor and metric block
                                        if (oldMetricDescriptorTableIndex != metricDescriptorTableIndex || oldStrokeDescriptorTableIndex != strokeDescriptorTableIndex)
                                        {
                                            currentStylusPointDescription = BuildStylusPointDescription(strokeDescriptor, metricBlock, guidList);
                                            oldStrokeDescriptorTableIndex = strokeDescriptorTableIndex;
                                            oldMetricDescriptorTableIndex = metricDescriptorTableIndex;
                                        }

                                        // Load the stroke
                                        Stroke localStroke;
#if OLD_ISF
                                        localBytesDecoded = StrokeSerializer.DecodeStroke(inputStream, bytesDecodedInCurrentTag, guidList, strokeDescriptor, currentStylusPointDescription, activeDrawingAttributes, currentTabletToInkTransform, compressor, out localStroke);
#else
                                        localBytesDecoded = StrokeSerializer.DecodeStroke(inputStream, bytesDecodedInCurrentTag, guidList, strokeDescriptor, currentStylusPointDescription, activeDrawingAttributes, currentTabletToInkTransform, out localStroke);
#endif

                                        if (localStroke != null)
                                        {
                                            _coreStrokes.AddWithoutEvent(localStroke);
                                            strokeIndex++;
                                        }
                                        break;
                                    }

                                default:
                                    {
                                        throw new InvalidOperationException(ISFDebugMessage("Invalid ISF tag logic"));
                                    }
                            }

                            // if this isfTag's decoded size != expected size, then error out
                            if (localBytesDecoded != bytesDecodedInCurrentTag)
                            {
                                throw new ArgumentException(ISFDebugMessage("Invalid ISF data"));
                            }

                            break;
                        }

                    case KnownTagCache.KnownTagIndex.Transform:
                    case KnownTagCache.KnownTagIndex.TransformIsotropicScale:
                    case KnownTagCache.KnownTagIndex.TransformAnisotropicScale:
                    case KnownTagCache.KnownTagIndex.TransformRotate:
                    case KnownTagCache.KnownTagIndex.TransformTranslate:
                    case KnownTagCache.KnownTagIndex.TransformScaleAndTranslate:
                        {
                            // Load a single Transform Block
                            TransformDescriptor xform;

                            bytesDecodedInCurrentTag = DecodeTransformBlock(inputStream, isfTag, remainingBytesInStream, false, out xform);
                            transformDecoded = true;
                            _transformTable.Clear();
                            _transformTable.Add(xform);
                            break;
                        }

                    case KnownTagCache.KnownTagIndex.TransformTableIndex:
                        {
                            // Load the Index into the Transform Table which will be used by the stroke following this till
                            // a next different Index is found
                            bytesDecodedInCurrentTag = SerializationHelper.Decode(inputStream, out transformTableIndex);
                            break;
                        }

                    case KnownTagCache.KnownTagIndex.MetricTableIndex:
                        {
                            // Load the Index into the Metric Table which will be used by the stroke following this till
                            // a next different Index is found
                            bytesDecodedInCurrentTag = SerializationHelper.Decode(inputStream, out metricDescriptorTableIndex);
                            break;
                        }

                    case KnownTagCache.KnownTagIndex.DrawingAttributesTableIndex:
                        {
                            // Load the Index into the Drawing Attributes Table which will be used by the stroke following this till
                            // a next different Index is found
                            bytesDecodedInCurrentTag = SerializationHelper.Decode(inputStream, out drawingAttributesTableIndex);
                            break;
                        }

                    case KnownTagCache.KnownTagIndex.InkSpaceRectangle:
                        {
                            // Loads the Ink Space Rectangle information
                            bytesDecodedInCurrentTag = DecodeInkSpaceRectangle(inputStream, remainingBytesInStream);
                            break;
                        }

                    case KnownTagCache.KnownTagIndex.StrokeDescriptorTableIndex:
                        {
                            // Load the Index into the Stroke Descriptor Table which will be used by the stroke following this till
                            // a next different Index is found
                            bytesDecodedInCurrentTag = SerializationHelper.Decode(inputStream, out strokeDescriptorTableIndex);
                            break;
                        }

                    default:
                        {
                            if ((uint)isfTag >= KnownIdCache.CustomGuidBaseIndex || ((uint)isfTag >= KnownTagCache.KnownTagCount && ((uint)isfTag < (KnownTagCache.KnownTagCount + KnownIdCache.OriginalISFIdTable.Length))))
                            {
                                ISFDebugTrace("  CUSTOM_GUID=" + guidList.FindGuid(isfTag).ToString());

                                // Loads any custom property data
                                bytesDecodedInCurrentTag = remainingBytesInStream;

                                Guid guid = guidList.FindGuid(isfTag);
                                if (guid == Guid.Empty)
                                {
                                    throw new ArgumentException(StrokeCollectionSerializer.ISFDebugMessage("Global Custom Attribute tag embedded in ISF stream does not match guid table"), "inkdata");
                                }


                                object data;

                                // load the custom property data from the stream (and decode the type)
                                localBytesDecoded = ExtendedPropertySerializer.DecodeAsISF(inputStream, bytesDecodedInCurrentTag, guidList, isfTag, ref guid, out data);
                                if (localBytesDecoded > bytesDecodedInCurrentTag)
                                {
                                    throw new ArgumentException(ISFDebugMessage("Invalid ISF data"), "inkdata");
                                }


                                // add the guid/data pair into the property collection (don't redecode the type)
                                _coreStrokes.ExtendedProperties[guid] = data;
                            }
                            else
                            {
                                // Skip objects that this library doesn't know about
                                // First read the size associated with this unknown isfTag
                                localBytesDecoded = SerializationHelper.Decode(inputStream, out bytesDecodedInCurrentTag);
                                if (remainingBytesInStream < (localBytesDecoded + bytesDecodedInCurrentTag))
                                {
                                    throw new ArgumentException(ISFDebugMessage("Invalid ISF data"));
                                }
                                else
                                {
                                    inputStream.Seek(bytesDecodedInCurrentTag + localBytesDecoded, SeekOrigin.Current);
                                }
                            }

                            bytesDecodedInCurrentTag = localBytesDecoded;
                            break;
                        }
                }
                ISFDebugTrace("    Size = " + bytesDecodedInCurrentTag.ToString());
                if (bytesDecodedInCurrentTag > remainingBytesInStream)
                {
                    throw new ArgumentException(ISFDebugMessage("Invalid ISF data"));
                }

                // update remaining ISF buffer length with decoded so far
                remainingBytesInStream -= bytesDecodedInCurrentTag;
            }
#if OLD_ISF
        }
        finally
        {
            if (null != compressor)
            {
                compressor.Dispose();
                compressor = null;
            }
        }
#endif
        if (0 != remainingBytesInStream)
            throw new ArgumentException(ISFDebugMessage("Invalid ISF data"), "inkdata");
    }
コード例 #54
0
        static void Main(string[] args)
        {
            const int maxItems = 1000000;
            const int maxLoopTest = 1000;
            var itemList = new System.Collections.Generic.List<Item>();
            itemList.Capacity = maxLoopTest;

            for (int X = 0; X < maxLoopTest; ++X)
            {
                for (int i = 0; i < maxItems / 2; ++i)
                {
                    if (i % 2 == 0)
                        itemList.Add(new Sword("Excalibur"));
                    else
                        itemList.Add(new Axe("Horned Axe"));
                }

                for (int i = 0; i < maxItems / 2; ++i)
                {
                    if (i % 2 == 0)
                        itemList.Add(new HealthPotion("Elixir"));
                    else
                        itemList.Add(new ManaPotion("Ether"));
                }
                useAllItems(itemList);
                itemList.Clear();

            }
        }
コード例 #55
0
ファイル: ElmInform.cs プロジェクト: Blyumenshteyn/UchetUSP
        public static void DeleteElementFromDB(System.Windows.Forms.DataGridView dgv)
        {
            using (WinForms.Common.InputBox InputnumberOfElements = new UchetUSP.WinForms.Common.InputBox("Удаление элементов", "Удалить", "Количество удаляемых элементов"))
            {

                if (InputnumberOfElements.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (string.Compare(InputnumberOfElements.textBox1.Text, "") != 0)
                    {
                        if (Convert.ToInt32(dgv[19, dgv.SelectedCells[0].RowIndex].Value.ToString()) >= Convert.ToInt32(InputnumberOfElements.textBox1.Text))
                        {
                            System.Collections.Generic.List<string> Parameters = new System.Collections.Generic.List<string>();

                            System.Collections.Generic.List<string> DataFromTextBox = new System.Collections.Generic.List<string>();

                            int NalichieParam = 0;

                            NalichieParam = (Convert.ToInt32(dgv[19, dgv.SelectedCells[0].RowIndex].Value.ToString()) - Convert.ToInt32(InputnumberOfElements.textBox1.Text));

                            Parameters.Add("NALICHI"); DataFromTextBox.Add(NalichieParam.ToString());
                            Parameters.Add("OBOZN"); DataFromTextBox.Add(dgv[1, dgv.SelectedCells[0].RowIndex].Value.ToString());

                            string cmd = "UPDATE DB_DATA SET NALICHI =:NALICHI WHERE OBOZN = :OBOZN";

                            if (SQLOracle.UpdateQuery(cmd, Parameters, DataFromTextBox) == true)
                            {
                                System.Windows.Forms.MessageBox.Show("ОБновление данных прошло успешно!");
                            }

                            Parameters.Clear();
                            DataFromTextBox.Clear();
                        }

                    }

                }

            }
        }