Beispiel #1
0
 private void Lighting(object state)
 {
     if (_currentworkindex < 0 || _currentworkindex >= items.Count)
     {
         return;
     }
     try
     {
         ucDynamicStepItem si = items[_currentworkindex];
         if (si != null)
         {
             if (_lighting)
             {
                 if (_lightingfactor >= 0.5F)
                 {
                     _lighting = false;
                 }
                 else
                 {
                     _lightingfactor += 0.05F;
                 }
             }
             else
             {
                 if (_lightingfactor <= -0.4F)
                 {
                     _lighting = true;
                 }
                 else
                 {
                     _lightingfactor -= 0.05F;
                 }
             }
             Color c = ucDynamicStepItem.Lightness(_currentcolor, _lightingfactor);
             si.BodyColor = c;
             si.Refresh();
         }
     }
     catch
     { }
 }
Beispiel #2
0
        public Result Read()
        {
            timer1.Enabled    = false;
            _currentworkindex = -1;
            _currentworkid    = -1;
            _currentcolor     = Color.Yellow;

            Result r = null;

            #region Calling to Server
            r = _remote.Connection.Call(_remote.User.UserNo
                                        , 108, 108301, _tableprivselect
                                        , new object[] { _typecode, _typeid, _stepid });
            if (r.ResultNo != 0 || r.Data.Tables.Count <= 0)
            {
                return(r);
            }
            #endregion

            DataTable dt = r.Data.Tables[0];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                #region Field Values
                int      itemid      = ISM.Lib.Static.ToInt(dt.Rows[i]["stepitemid"]);
                string   itemname    = ISM.Lib.Static.ToStr(dt.Rows[i]["name"]);
                string   itemdesc    = ISM.Lib.Static.ToStr(dt.Rows[i]["note"]);
                int      owner       = ISM.Lib.Static.ToInt(dt.Rows[i]["owner"]);
                string   userfname   = ISM.Lib.Static.ToStr(dt.Rows[i]["userfname"]);
                string   userlname   = ISM.Lib.Static.ToStr(dt.Rows[i]["userlname"]);
                string   position    = ISM.Lib.Static.ToStr(dt.Rows[i]["position"]);
                double   performance = ISM.Lib.Static.ToDouble(dt.Rows[i]["performance"]);
                DateTime started     = ISM.Lib.Static.ToDate(dt.Rows[i]["started"]);
                DateTime finished    = ISM.Lib.Static.ToDate(dt.Rows[i]["finished"]);
                int      status      = ISM.Lib.Static.ToInt(dt.Rows[i]["status"]);
                #endregion
                #region Checking item exists
                ucDynamicStepItem si = null;
                if (items.Count < i + 1)
                {
                    si = Add(itemid, itemname, itemdesc, Color.OrangeRed);
                }
                else
                {
                    si = items[i];
                }
                #endregion
                #region Collecting Informations
                if (!string.IsNullOrEmpty(userlname))
                {
                    userfname = string.Format("{0}.{1}", userlname.Substring(0, 1), userfname);
                }
                if (!string.IsNullOrEmpty(position))
                {
                    position = string.Format("{0}, ", position);
                }
                #endregion
                #region Checking Performance Color

                string desc = "";
                if (performance == 100)
                {
                    si.BodyColor = Color.YellowGreen;
                    desc         = string.Format("{0}, {1}{2}%\r\nЭхэлсэн {3}", userfname, position, performance, started.ToString("yyyy.MM.dd"));
                }
                else if (started > DateTime.MinValue)
                {
                    si.BodyColor = Color.Yellow;
                    desc         = string.Format("{0}, {1}{2}%\r\nЭхэлсэн {3}", userfname, position, performance, started.ToString("yyyy.MM.dd"));
                    if (_currentworkindex < 0)
                    {
                        _currentworkindex = i;
                        _currentworkid    = itemid;
                        _currentcolor     = si.BodyColor;
                    }
                }
                else
                {
                    si.BodyColor = Color.OrangeRed;
                    desc         = "Ажил эхлээгүй...";
                    if (_currentworkindex < 0)
                    {
                        _currentworkindex = i;
                        _currentworkid    = itemid;
                        _currentcolor     = si.BodyColor;
                    }
                }

                #endregion
                #region Setting Values to Control

                si.TypeCode    = _typecode;
                si.TypeId      = _typeid;
                si.StepId      = _stepid;
                si.StepItemId  = itemid;
                si.Owner       = owner;
                si.OwnerName   = userfname;
                si.Performance = performance;
                si.Started     = started;
                si.Finished    = finished;
                si.Status      = status;

                si.ItemIndex               = i;
                si.Title                   = string.Format("{0}. {1}", i + 1, itemname);
                si.Description             = desc;
                si.lblName.ToolTipTitle    = si.Title;
                si.lblName.ToolTip         = string.Format("{0}\r\n{1}", itemdesc, desc);
                si.lblName.ToolTipIconType = DevExpress.Utils.ToolTipIconType.Information;
                si.Refresh();
                #endregion
            }

            timer1.Enabled = true;

            return(r);
        }