Example #1
0
        public static string GetCurrentTime(string[] exactPostTime, string[] showPostTime)
        {
            int minMaxTime, maxMinTime;
            //Taking input and processing that input:
            var TT = new TimeClass[exactPostTime.Length]; // TT stands for TestCase Time !

            for (int i = 0; i < exactPostTime.Length; i++)
            {
                TT[i] = new TimeClass(exactPostTime[i], showPostTime[i]);
                TT[i].Process();
            }
            // Now lets find the overlapping time cases
            maxMinTime = TT[0].MinTime;
            for (int i = 0; i < exactPostTime.Length; i++)
            {
                if (TT[i].MinTime > maxMinTime)
                {
                    maxMinTime = TT[i].MinTime;
                }
            }
            minMaxTime = TT[0].MaxTime;
            for (int i = 0; i < exactPostTime.Length; i++)
            {
                if (TT[i].MaxTime < minMaxTime)
                {
                    minMaxTime = TT[i].MaxTime;
                }
            }

            // Now we already have the boundary conditions.
            var result = MakeResultString(maxMinTime, minMaxTime);

            return(result);
        }
Example #2
0
    void SetLight(TimeClass time)
    {
        if (sun == null)
        {
            sun = FindObjectOfType <Light>();
        }
        float daylight   = 0.63f;
        float nightlight = 0.3f;

        //dawn
        if (time.hour >= 6 && time.hour < 7)
        {
            float point = time.hour + ((float)time.minute) / 60;
            sun.intensity = nightlight + ((point - 6) * (daylight - nightlight));
            //sunset
        }
        else if (time.hour >= 19 && time.hour < 20)
        {
            float point = time.hour + ((float)time.minute) / 60;
            sun.intensity = daylight - ((point - 19) * (daylight - nightlight));
            //daytime
        }
        else if (time.hour >= 7 && time.hour <= 19)
        {
            sun.intensity = daylight;
            //nighttime
        }
        else
        {
            sun.intensity = nightlight;
        }
    }
Example #3
0
    protected void LinkButtonStats_Click(object sender, EventArgs e)
    {
        PanelManage.Visible = false;
        PanelSearch.Visible = false;
        PanelStats.Visible = true;
        LinkButtonManage.Enabled = true;
        LinkButtonSearch.Enabled = true;
        LinkButtonStats.Enabled = false;

        DataTable dt = new DataTable();
        DataSet ds = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

        SqlDataAdapter sda = new SqlDataAdapter("sp_statsUsers", sqlConn);
        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.Fill(ds);
        dt = ds.Tables[0];

        TimeClass tc = new TimeClass();
        LabelStatsDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["UsersDate"].ToString()));

        LabelStatsUsers.Text = dt.Rows[0]["UsersCount"].ToString();
        LabelStatsGenderFemale.Text = "زن: " + dt.Rows[0]["UsersGenderFemale"].ToString();
        LabelStatsGenderMale.Text =  " مرد: " + dt.Rows[0]["UsersGenderMale"].ToString();
        LabelStatsLogin.Text = dt.Rows[0]["UsersLoginMonth"].ToString();

        sda.Dispose();
        sqlConn.Close();
    }
Example #4
0
 public override ErrorInfoWithPause ResetOutPort()
 {
     base.ResetOutPort();
     for (int i = 0; i < CELLCOUNT; i++)
     {
         UnloadPNPDataStations[i].CellData = null;
     }
     for (int i = 0; i < CellVacuums.Count; i++)
     {
         CellVacuums[i].MainPort.SetOutPortStatus(false);
         foreach (ClassAirPort vacuum in CellVacuums[i].AirPorts)
         {
             vacuum.SetOutPortStatus(false);
         }
     }
     CellBlow.SetOutPortStatus(false);
     TimeClass.Delay(200);
     if (!PNPCylinder.SetCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
     {
         return(new ErrorInfoWithPause("气缸上升错误", ErrorLevel.Error));
     }
     else
     {
         return(null);
     }
 }
    protected string ShowDate(Object SubmitDate)
    {
        DateTime  Date = Convert.ToDateTime(SubmitDate);
        TimeClass tc   = new TimeClass();

        return(tc.ConvertToIranTimeString(Date));
    }
Example #6
0
    protected void LinkButtonCoupons_Click(object sender, EventArgs e)
    {
        PanelUsers.Visible        = false;
        PanelOffers.Visible       = false;
        PanelCredit.Visible       = false;
        PanelCoupons.Visible      = true;
        LinkButtonUsers.Enabled   = true;
        LinkButtonOffers.Enabled  = true;
        LinkButtonCredit.Enabled  = true;
        LinkButtonCoupons.Enabled = false;

        DataTable     dt      = new DataTable();
        DataSet       ds      = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

        SqlDataAdapter sda = new SqlDataAdapter("sp_statsCoupons", sqlConn);

        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.Fill(ds);
        dt = ds.Tables[0];

        TimeClass tc = new TimeClass();

        LabelCouponsDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["CouponsDate"].ToString()));

        LabelOffersOffers.Text = dt.Rows[0]["CouponsCount"].ToString();
        LabelOffersActive.Text = dt.Rows[0]["CouponsActive"].ToString();
        LabelOffersPast.Text   = dt.Rows[0]["CouponsPast"].ToString();

        sda.Dispose();
        sqlConn.Close();
    }
Example #7
0
    protected void LinkButtonOffers_Click(object sender, EventArgs e)
    {
        PanelUsers.Visible = false;
        PanelOffers.Visible = true;
        PanelCredit.Visible = false;
        PanelCoupons.Visible = false;
        LinkButtonUsers.Enabled = true;
        LinkButtonOffers.Enabled = false;
        LinkButtonCredit.Enabled = true;
        LinkButtonCoupons.Enabled = true;

        DataTable dt = new DataTable();
        DataSet ds = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

        SqlDataAdapter sda = new SqlDataAdapter("sp_statsOffers", sqlConn);
        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.Fill(ds);
        dt = ds.Tables[0];

        TimeClass tc = new TimeClass();
        LabelOffersDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["OffersDate"].ToString()));

        LabelOffersOffers.Text = dt.Rows[0]["OffersCount"].ToString();
        LabelOffersActive.Text = dt.Rows[0]["OffersActive"].ToString();
        LabelOffersPast.Text = dt.Rows[0]["OffersPast"].ToString();
        LabelOffersSold.Text = dt.Rows[0]["OffersSoldCount"].ToString();
        LabelOffersAverage.Text = (Convert.ToInt32(dt.Rows[0]["OffersSoldCount"].ToString()) / Convert.ToInt32(dt.Rows[0]["OffersPast"].ToString())).ToString();

        sda.Dispose();
        sqlConn.Close();
    }
Example #8
0
    protected void LinkButtonStats_Click(object sender, EventArgs e)
    {
        PanelManage.Visible      = false;
        PanelSearch.Visible      = false;
        PanelStats.Visible       = true;
        LinkButtonManage.Enabled = true;
        LinkButtonSearch.Enabled = true;
        LinkButtonStats.Enabled  = false;

        DataTable     dt      = new DataTable();
        DataSet       ds      = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

        SqlDataAdapter sda = new SqlDataAdapter("sp_statsUsers", sqlConn);

        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.Fill(ds);
        dt = ds.Tables[0];

        TimeClass tc = new TimeClass();

        LabelStatsDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["UsersDate"].ToString()));

        LabelStatsUsers.Text        = dt.Rows[0]["UsersCount"].ToString();
        LabelStatsGenderFemale.Text = "زن: " + dt.Rows[0]["UsersGenderFemale"].ToString();
        LabelStatsGenderMale.Text   = " مرد: " + dt.Rows[0]["UsersGenderMale"].ToString();
        LabelStatsLogin.Text        = dt.Rows[0]["UsersLoginMonth"].ToString();

        sda.Dispose();
        sqlConn.Close();
    }
Example #9
0
    protected void LinkButtonStatsRefresh_Click(object sender, EventArgs e)
    {
        StatsRefresh sr = new StatsRefresh();

        sr.refreshStats("Users");

        ImageStatsRefresh.ImageUrl = "~/images/icons/check16.png";

        DataTable     dt      = new DataTable();
        DataSet       ds      = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

        SqlDataAdapter sda = new SqlDataAdapter("sp_statsUsers", sqlConn);

        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.Fill(ds);
        dt = ds.Tables[0];

        TimeClass tc = new TimeClass();

        LabelStatsDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["UsersDate"].ToString()));

        LabelStatsUsers.Text        = dt.Rows[0]["UsersCount"].ToString();
        LabelStatsGenderFemale.Text = "زن: " + dt.Rows[0]["UsersGenderFemale"].ToString();
        LabelStatsGenderMale.Text   = " مرد: " + dt.Rows[0]["UsersGenderMale"].ToString();
        LabelStatsLogin.Text        = dt.Rows[0]["UsersLoginMonth"].ToString();

        sda.Dispose();
        sqlConn.Close();
    }
Example #10
0
        protected override void OnClick()
        {
            IMxDocument pMxDoc           = ArcMap.Document;
            IMap        pMap             = pMxDoc.FocusMap;
            string      sampeMapFileName = "BasicHurricanes.mxd";

            if (pMap.LayerCount < 1)
            {
                MessageBox.Show("Before running this sample, load the associated file \'" + sampeMapFileName + "\'");
                return;
            }
            if (pMap.get_Layer(0).Name != "atlantic_hurricanes_2000")
            {
                MessageBox.Show("Before running this sample, load the associated file \'" + sampeMapFileName + "\'");
                return;
            }

            ITimeZoneFactory pTZFac = new TimeZoneFactoryClass();
            //making the first layer of the focused map time-aware
            IFeatureLayer pFLyr     = pMap.get_Layer(0) as IFeatureLayer;
            ITimeData     pTimeData = pFLyr as ITimeData;

            String         localTimeZoneId = pTZFac.QueryLocalTimeZoneWindowsID();
            ITimeReference timeRef         = pTZFac.CreateTimeReferenceFromWindowsID(localTimeZoneId);

            if (pTimeData.SupportsTime)
            {
                pTimeData.UseTime = true;
                ITimeTableDefinition pTimeDataDef = pFLyr as ITimeTableDefinition;
                pTimeDataDef.StartTimeFieldName = "Date_Time";

                pTimeDataDef.TimeReference = timeRef;
                ITimeDataDisplay pTimeAnimProp = pFLyr as ITimeDataDisplay;
                pTimeAnimProp.TimeIntervalUnits = esriTimeUnits.esriTimeUnitsHours;
                pTimeAnimProp.TimeInterval      = 12.0;
            }

            //
            IActiveView    pActiveView    = pMap as IActiveView;
            IScreenDisplay pScreenDisplay = pActiveView.ScreenDisplay;
            ITimeDisplay   pTimeDisplay   = pScreenDisplay as ITimeDisplay;

            pTimeDisplay.TimeReference = timeRef;

            ITime pStartTime = new TimeClass();

            pStartTime.Year = 2000; pStartTime.Month = 9; pStartTime.Day = 25;
            ITime pEndTime = new TimeClass();

            pEndTime.Year = 2000; pEndTime.Month = 9; pEndTime.Day = 30;

            ITimeExtent pTimeExt = new TimeExtentClass();

            pTimeExt.StartTime     = pStartTime;
            pTimeExt.EndTime       = pEndTime;
            pTimeDisplay.TimeValue = pTimeExt as ITimeValue;

            pActiveView.ContentsChanged();
        }
 void Awake()
 {
     killCounter     = GameObject.FindGameObjectWithTag(Tags.killCounter).GetComponent <Text>();
     powerup         = GameObject.FindGameObjectWithTag(Tags.powerUP).GetComponent <PowerSpawner>();
     dyingScreenAnim = GameObject.FindGameObjectWithTag(Tags.dyingScreen).GetComponent <Animator>();
     timer           = GameObject.FindGameObjectWithTag(Tags.HUD).GetComponent <TimeClass>();
     scoreManager    = GetComponentInChildren <ScoreManager>();
 }
Example #12
0
 void SetWakeUp(TimeClass when)
 {
     if (world == null)
     {
         world = FindObjectOfType <World>();
     }
     //set up the event
     world.time.WakeUpAt(this, when);
 }
Example #13
0
    void Awake()
    {
        anim            = GetComponent <Animator> ();
        enemyAudio      = GetComponent <AudioSource> ();
        hitParticles    = GetComponentInChildren <ParticleSystem> ();
        capsuleCollider = GetComponent <CapsuleCollider> ();
        timer           = GameObject.FindGameObjectWithTag(Tags.HUD).GetComponent <TimeClass>();

        currentHealth = startingHealth;
    }
Example #14
0
        public void GetNowStringisRight()
        {
            var    test    = new TimeClass();
            string result1 = test.GetNowString();
            string expect  = DateTime.Now.AddMilliseconds(-1).ToString("yyyy/MM/dd HH:mm:ss fff");

            //string expect = "2017/06/06 00:00:00 000";

            Assert.AreEqual(expect, result1);
        }
Example #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool             AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Blog");

        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }


        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
            case "Edit":
            {
                PanelEdit.Visible = true;
                Page.Title        = "Salestan : بلاگ";

                DataTable     dt      = new DataTable();
                DataSet       ds      = new DataSet();
                SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                SqlDataAdapter sda = new SqlDataAdapter("sp_blogInfo", sqlConn);
                sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                sda.SelectCommand.Parameters.Add("@BlogId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["BlogId"]);
                sda.Fill(ds);
                dt = ds.Tables[0];

                if (dt.Rows.Count == 0)         //news doesn't exist
                {
                    //LabelName.Text = "خبری با این شناسه موجود نمی باشد!";
                }
                else         //news exists
                {
                    TimeClass tc = new TimeClass();
                    LabelDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["SubmitDate"].ToString()));

                    TextBoxTitle.Text     = dt.Rows[0]["Title"].ToString();
                    TextBoxBrief.Text     = dt.Rows[0]["Brief"].ToString();
                    TextBoxBody.Text      = dt.Rows[0]["Body"].ToString();
                    TextBoxPhotoLink.Text = dt.Rows[0]["PhotoLink"].ToString();
                    //Location
                    DropDownListLanguage.SelectedValue = dt.Rows[0]["Language"].ToString();
                }
                sda.Dispose();
                sqlConn.Close();

                break;
            }
            }
        }
    }
Example #16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Blog");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }


        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
                case "Edit":
                    {
                        PanelEdit.Visible = true;
                        Page.Title = "Salestan : بلاگ";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_blogInfo", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@BlogId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["BlogId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        if (dt.Rows.Count == 0) //news doesn't exist
                        {
                            //LabelName.Text = "خبری با این شناسه موجود نمی باشد!";
                        }
                        else //news exists
                        {
                            TimeClass tc = new TimeClass();
                            LabelDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["SubmitDate"].ToString()));

                            TextBoxTitle.Text = dt.Rows[0]["Title"].ToString();
                            TextBoxBrief.Text = dt.Rows[0]["Brief"].ToString();
                            TextBoxBody.Text = dt.Rows[0]["Body"].ToString();
                            TextBoxPhotoLink.Text = dt.Rows[0]["PhotoLink"].ToString();
                            //Location
                            DropDownListLanguage.SelectedValue = dt.Rows[0]["Language"].ToString();
                        }
                        sda.Dispose();
                        sqlConn.Close();

                        break;
                    }
            }
        }
    }
Example #17
0
    public void StartCallBack(float AliveTime, float DelayTime, Action callback)
    {
        TimeClass item = new TimeClass {
            StartTime = AliveTime,
            DelayTime = DelayTime,
            callback  = callback
        };

        this.m_TimeList.Add(item);
        this.TimeCount = this.m_TimeList.Count;
    }
    protected override void OnClick()
    {
      IMxDocument pMxDoc = ArcMap.Document;
      IMap pMap = pMxDoc.FocusMap;
      string sampeMapFileName = "BasicHurricanes.mxd";

      if (pMap.LayerCount < 1)
      {
        MessageBox.Show("Before running this sample, load the associated file \'" + sampeMapFileName + "\'");
        return;
      }
      if (pMap.get_Layer(0).Name != "atlantic_hurricanes_2000")
      {
        MessageBox.Show("Before running this sample, load the associated file \'" + sampeMapFileName + "\'");
        return;
      }

      ITimeZoneFactory pTZFac = new TimeZoneFactoryClass();
      //making the first layer of the focused map time-aware
      IFeatureLayer pFLyr = pMap.get_Layer(0) as IFeatureLayer;
      ITimeData pTimeData = pFLyr as ITimeData;

      String localTimeZoneId = pTZFac.QueryLocalTimeZoneWindowsID();
      ITimeReference timeRef = pTZFac.CreateTimeReferenceFromWindowsID(localTimeZoneId);
      if (pTimeData.SupportsTime)
      {
        pTimeData.UseTime = true;
        ITimeTableDefinition pTimeDataDef = pFLyr as ITimeTableDefinition;
        pTimeDataDef.StartTimeFieldName = "Date_Time";

        pTimeDataDef.TimeReference = timeRef;
        ITimeDataDisplay pTimeAnimProp = pFLyr as ITimeDataDisplay;
        pTimeAnimProp.TimeIntervalUnits = esriTimeUnits.esriTimeUnitsHours;
        pTimeAnimProp.TimeInterval = 12.0;
      }

      //
      IActiveView pActiveView = pMap as IActiveView;
      IScreenDisplay pScreenDisplay = pActiveView.ScreenDisplay;
      ITimeDisplay pTimeDisplay = pScreenDisplay as ITimeDisplay;
      pTimeDisplay.TimeReference = timeRef;

      ITime pStartTime = new TimeClass();
      pStartTime.Year = 2000; pStartTime.Month = 9; pStartTime.Day = 25;
      ITime pEndTime = new TimeClass();
      pEndTime.Year = 2000; pEndTime.Month = 9; pEndTime.Day = 30;

      ITimeExtent pTimeExt = new TimeExtentClass();
      pTimeExt.StartTime = pStartTime;
      pTimeExt.EndTime = pEndTime;
      pTimeDisplay.TimeValue = pTimeExt as ITimeValue;

      pActiveView.ContentsChanged();
    }
Example #19
0
 private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!e.Cancel)
     {
         //ClassBaseWorkZone.ActionEnable = false;
         CommonFunction.SysPublisher.notifyStopEventSubscribers(null, new StateEventArgs("停止", "程序退出"));
         TimeClass.Delay(3000);
         CommonFunction.SysPublisher.notifyProgramExitEventSubscribers(null, new StateEventArgs("程序退出", ""));
         ClassCommonSetting.CommonRelease();
         HardwarePool.SystemHardware.instance.Release();
     }
 }
Example #20
0
        public static bool CheckErrPosTimeOut(Func <bool> action, int timeout = ClassErrorHandle.TIMEOUT)
        {
            bool      res;
            TimeClass timer = new TimeClass();

            timer.StartAlarmClock(timeout);
            do
            {
                res = action();
                Application.DoEvents();
            } while (!res && !timer.TimeOut);
            return(res);
        }
Example #21
0
 private void Beep(int SoundTime, int SilenceTime, int Repeat = 1)
 {
     if (BeepDisable)
     {
         return;
     }
     for (int i = 0; i < Repeat; i++)
     {
         ThisOutport(EnumOutportName.FrameBuzz).SetOutput(true);
         TimeClass.Delay(SoundTime);
         ThisOutport(EnumOutportName.FrameBuzz).SetOutput(false);
         TimeClass.Delay(SilenceTime);
     }
 }
Example #22
0
 public static void CloseCDIVision()
 {
     timer.StopTimer();
     TimeClass.Delay(100);
     SocketToAOI.DisConnect();
     if (AOIProcess != null)
     {
         if (!AOIProcess.HasExited)
         {
             AOIProcess.CloseMainWindow();
         }
     }
     AOIProcess = null;
 }
Example #23
0
    void Start()
    {
        survivalDefaultColor = GameObject.FindGameObjectWithTag(Tags.survival).GetComponent <Image>().color;
        normalDefaultColor   = GameObject.FindGameObjectWithTag(Tags.normal).GetComponent <Image>().color;
        survivalImage        = GameObject.FindGameObjectWithTag(Tags.survival).GetComponent <Image>();
        normalImage          = GameObject.FindGameObjectWithTag(Tags.normal).GetComponent <Image>();
        timer = GameObject.FindGameObjectWithTag(Tags.HUD).GetComponent <TimeClass>();

        menuHUD   = GameObject.FindGameObjectWithTag(Tags.menu);
        player    = GameObject.FindGameObjectWithTag(Tags.player);
        pauseMenu = GameObject.FindGameObjectWithTag(Tags.pauseMenu);
        mainLight = GameObject.FindGameObjectWithTag(Tags.mainLight).GetComponentInChildren <Light>();
        anim      = menuHUD.GetComponent <Animator>();
        GI        = GetComponent <GameInstructions>();
    }
Example #24
0
 public void Open()
 {
     if (!IsSimulation)
     {
         GetSerialPort(HardwareSerialPortName.LoadInBarcode).OwnerPort.PortOpen(true);
         GetSerialPort(HardwareSerialPortName.OutlineMeasLightController).OwnerPort.PortOpen(true);
         GetSerialPort(HardwareSerialPortName.ThicknessSensorLeft).OwnerPort.PortOpen(true, ThicknessPortOnOpen);
         GetSerialPort(HardwareSerialPortName.ThicknessSensorMid).OwnerPort.PortOpen(true, ThicknessPortOnOpen);
         GetSerialPort(HardwareSerialPortName.ThicknessSensorRight).OwnerPort.PortOpen(true, ThicknessPortOnOpen);
         foreach (BaseIOSys iosys in m_IOSysList)
         {
             TimeClass.Delay(12);
             iosys.StartInputAcquisition();
         }
     }
 }
Example #25
0
    void SortIn(Pair <TimeClass, Awakeable> item)
    {
        LinkedListNode <Pair <TimeClass, Awakeable> > node = wakeUpQueue.First;

        while (node != null)
        {
            TimeClass nodetime = node.Value.First;
            if (item.First < nodetime)
            {
                wakeUpQueue.AddBefore(node, new LinkedListNode <Pair <TimeClass, Awakeable> >(item));
                return;
            }
            node = node.Next;
        }
        wakeUpQueue.AddLast(new LinkedListNode <Pair <TimeClass, Awakeable> >(item));
    }
Example #26
0
    void Awake()
    {
        DevMode = developerMode;

        starterLayer = LayerMask.NameToLayer("Starter");
        timer        = GetComponent <TimeClass>();
        lastTimer    = GetComponent <TimeClass>();
        enemyManager = GameObject.FindGameObjectWithTag(Tags.enemyManager);
        em           = enemyManager.GetComponents <EnemyManager>();
        powerSpawner = GameObject.FindGameObjectWithTag(Tags.powerUP).GetComponent <PowerSpawner>();
        playerHealth = GameObject.FindGameObjectWithTag(Tags.player).GetComponent <PlayerHealth>();
        enemies      = GameObject.FindGameObjectsWithTag(Tags.enemy);
        scoreManager = GetComponentInChildren <ScoreManager>();

        EnableEnemies(false);
        timer.enabled = false;
    }
 public ErrorInfoWithPause ActionOneCCDMeas(EnumCellIndex cellindex, DataComp NeedComp)
 {
     if (CCDMeasDataStations[cellindex].CellData != null)
     {
         if (ClassWorkFlow.Instance.WorkMode != EnumWorkMode.空跑)
         {
             Comps[(int)cellindex] = NeedComp;
             SnapShot((int)cellindex, CCDMeasDataStations[cellindex].CellData.Barcode);
         }
         else
         {
             TimeClass.Delay(400);
             MeasDone[(int)cellindex] = true;
         }
     }
     return(null);
 }
Example #28
0
        public ErrorInfoWithPause ActionCylinderTest()
        {
            ErrorInfoWithPause res = null;

            isCylinderTest = !isCylinderTest;
            for (int i = 0; i < CELLCOUNT; i++)
            {
                if (ThicknessDataStations[i].CellData == null)
                {
                    ThicknessDataStations[i].CellData = ClassDataInfo.NewCellData();
                }
            }
            while (isCylinderTest)
            {
                res = AllCyDown();
                if (res != null)
                {
                    isCylinderTest = false; break;
                }
                if (!isCylinderTest)
                {
                    break;
                }
                TimeClass.Delay(ClassCommonSetting.SysParam.ThicknessMeasDelayTime);
                if (!isCylinderTest)
                {
                    break;
                }
                res = AllCyUp();
                if (res != null)
                {
                    isCylinderTest = false; break;
                }
                if (!isCylinderTest)
                {
                    break;
                }
                TimeClass.Delay(ClassCommonSetting.SysParam.ThicknessMeasDelayTime);
                if (!isCylinderTest)
                {
                    break;
                }
            }
            return(res);
        }
Example #29
0
    protected void LinkButtonStats_Click(object sender, EventArgs e)
    {
        PanelUsers.Visible         = false;
        PanelManage.Visible        = false;
        PanelLog.Visible           = false;
        PanelStats.Visible         = true;
        PanelRequests.Visible      = false;
        LinkButtonUsers.Enabled    = true;
        LinkButtonManage.Enabled   = true;
        LinkButtonLog.Enabled      = true;
        LinkButtonStats.Enabled    = false;
        LinkButtonRequests.Enabled = true;

        DataTable     dt      = new DataTable();
        DataSet       ds      = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

        SqlDataAdapter sda = new SqlDataAdapter("sp_statsCredit", sqlConn);

        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.Fill(ds);
        dt = ds.Tables[0];

        PanelManageUser.Visible = true;
        LabelMessage.Visible    = false;

        TimeClass tc = new TimeClass();

        LabelStatsDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["CreditDate"].ToString()));

        LabelStatsActiveCredit.Text = dt.Rows[0]["CreditSum"].ToString();
        LabelStatsGiftCredit.Text   = dt.Rows[0]["CreditGiftCredit"].ToString();
        LabelStatsSpentCredit.Text  = dt.Rows[0]["CreditSpent"].ToString();
        LabelStatsSpentGift.Text    = dt.Rows[0]["CreditGiftSpent"].ToString();

        LabelStatsActiveCreditAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditSum"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString();
        LabelStatsGiftCreditAverage.Text   = (Convert.ToInt32(dt.Rows[0]["CreditGiftCredit"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString();
        LabelStatsSpentCreditAverage.Text  = (Convert.ToInt32(dt.Rows[0]["CreditSpent"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString();
        LabelStatsSpentGiftAverage.Text    = (Convert.ToInt32(dt.Rows[0]["CreditGiftSpent"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString();

        sda.Dispose();
        sqlConn.Close();
    }
Example #30
0
    // Use this for initialization
    void Start()
    {
        player     = GameObject.Find("Player").GetComponent <PlayerBehavior>();
        background = GameObject.Find("Background").GetComponent <BackgroundBehavior>();
        spawner    = GameObject.Find("Spawner");
        canvas     = GameObject.Find("Canvas").GetComponent <Canvas>();

        gameOverPanel = canvas.transform.Find("Panel").GetComponent <RectTransform>();
        respawnButton = gameOverPanel.transform.Find("RespawnButton").GetComponent <Button>();
        abilityButton = canvas.transform.Find("AbilityButton").GetComponent <Button>();

        abilityButton.onClick.AddListener(delegate { player.CastOrb(); });
        respawnButton.onClick.AddListener(delegate { RestartScene(); });

        startTime = Time.time;

        GlobalClock  = new TimeClass("TimeText", canvas, this);
        AbilityClock = new TimeClass("AbilityTimeText", canvas, this);
    }
Example #31
0
 public void Release()
 {
     //for (int i = 0; i < 64; i++)
     //{
     //    m_IOSysList[i / 16].GetOutPort(i % 16).SetOutput(false);
     //}
     //for (int i = 0; i < 64; i++)
     //{
     //    m_IOSysList[4].GetOutPort(i).SetOutput(false);
     //}
     for (int i = 0; i < m_IOSysList.Length; i++)
     {
         m_IOSysList[i].StopInputAcquisition();
     }
     TimeClass.Delay(200);
     for (int i = 0; i < 4; i++)
     {
         m_MotionCards[i].Release();
     }
 }
Example #32
0
        public override ErrorInfoWithPause ResetOutPort()
        {
            ErrorInfoWithPause res = null;
            string             err = "";

            base.ResetOutPort();
            for (int i = 0; i < CellVacuums.Count; i++)
            {
                CellVacuums[i].MainPort.SetOutPortStatus(false);
                foreach (ClassAirPort vacuum in CellVacuums[i].AirPorts)
                {
                    vacuum.SetOutPortStatus(false);
                }
            }
            CellBlow.SetOutPortStatus(false);
            TimeClass.Delay(200);
            PNPCylinder[EnumCellIndex.左电芯].SetCylinderState(CYLIND_UP, 0, false);
            PNPCylinder[EnumCellIndex.中电芯].SetCylinderState(CYLIND_UP, 0, false);
            PNPCylinder[EnumCellIndex.右电芯].SetCylinderState(CYLIND_UP, 0, false);
            if (!PNPCylinder[EnumCellIndex.左电芯].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
            {
                err += "左气缸 ";
            }
            if (!PNPCylinder[EnumCellIndex.中电芯].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
            {
                err += "中气缸 ";
            }
            if (!PNPCylinder[EnumCellIndex.右电芯].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
            {
                err += "右气缸 ";
            }
            if (err != "")
            {
                res = new ErrorInfoWithPause("气缸上升错误: " + err.Trim(), ErrorLevel.Error);
            }
            return(res);
        }
Example #33
0
    void FixedUpdate()
    {
        //Check first thing in the queue
        if (wakeUpQueue.Count < 1)
        {
            return;
        }
        TimeClass earliest = wakeUpQueue.First.Value.First;

        while (time >= earliest)
        {
            //Debug.Log(time + ": waking up " + wakeUpQueue.First.Value.Second);
            wakeUpQueue.First.Value.Second.WakeUp();
            wakeUpQueue.RemoveFirst();
            if (wakeUpQueue.Count > 0)
            {
                earliest = wakeUpQueue.First.Value.First;
            }
            else
            {
                return;
            }
        }
    }
Example #34
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Charity");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }


        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
                case "NewsAdd":
                    {
                        PanelNews.Visible = true;
                        Page.Title = "Salestan : اخبار خیریه";
                        ImageButtonNewsSubmit.ImageUrl = "~/images/Buttons/add-off.png";

                        LabelDate.Text = DateTime.Now.ToShortDateString();
                        break;
                    }
                case "OrganizationsAdd":
                    {
                        PanelOrganizations.Visible = true;
                        Page.Title = "Salestan : موسسات خیریه";
                        ImageButtonOrganizations.ImageUrl = "~/images/Buttons/add-off.png";
                        break;
                    }
                case "NewsEdit":
                    {
                        PanelNews.Visible = true;
                        Page.Title = "Salestan : اخبار خیریه";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_charityNewsInfo", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@NewsId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["NewsId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        if (dt.Rows.Count == 0) //news doesn't exist
                        {
                            //LabelName.Text = "خبری با این شناسه موجود نمی باشد!";
                        }
                        else //news exists
                        {
                            TimeClass tc = new TimeClass();
                            LabelDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["SubmitDate"].ToString()));

                            TextBoxNewsSubject.Text = dt.Rows[0]["Subject"].ToString();
                            TextBoxNewsBrief.Text = dt.Rows[0]["Brief"].ToString();
                            TextBoxNewsBody.Text = dt.Rows[0]["Body"].ToString();
                            //Location
                            DropDownListLanguage.SelectedValue = dt.Rows[0]["Language"].ToString();
                            ImageButtonNewsSubmit.ImageUrl = "~/images/Buttons/edit-off.png";
                        }
                        sda.Dispose();
                        sqlConn.Close();

                        break;
                    }
                case "OrganizationsEdit":
                    {
                        PanelOrganizations.Visible = true;
                        Page.Title = "Salestan : موسسات خیریه";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_charityOrganizationsInfo", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@OrganizationId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["OrganizationId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        if (dt.Rows.Count == 0) //news doesn't exist
                        {
                            //LabelName.Text = "موسسه ای با این شناسه موجود نمی باشد!";
                        }
                        else //news exists
                        {
                            TextBoxName.Text = dt.Rows[0]["Name"].ToString();
                            TextBoxAbout.Text = dt.Rows[0]["About"].ToString();
                            TextBoxEmail.Text = dt.Rows[0]["Email"].ToString();
                            TextBoxWebsite.Text = dt.Rows[0]["Website"].ToString();
                            TextBoxPhone.Text = dt.Rows[0]["Phone"].ToString();
                            TextBoxFax.Text = dt.Rows[0]["Fax"].ToString();
                            TextBoxAddress.Text = dt.Rows[0]["Address"].ToString();
                            ImageButtonOrganizations.ImageUrl = "~/images/Buttons/edit-off.png";
                            //Location
                        }
                        sda.Dispose();
                        sqlConn.Close();

                        break;
                    }
            }
        }
    }
Example #35
0
 static string Time()
 {
     TimeClass time = new TimeClass();
     return time.ShowTime();
 }
        /// <summary>
        /// Build the Builder Item which includes the function raster dataset and its footprint 
        /// given the ItemURI.
        /// </summary>
        /// <param name="pItemURI">ItemURi to use to build the Builder Item.</param>
        /// <returns>The builder item.</returns>
        public IBuilderItem Build(IItemURI pItemURI)
        {
            try
            {
                // Create a new parser object and builder item.
                DiMapParser myDimParser = new DiMapParser(pItemURI.Key);
                IBuilderItem currItem = new BuilderItemClass();

                // Set Category and URI
                currItem.Category = esriRasterCatalogItemCategory.esriRasterCatalogItemCategoryPrimary;
                currItem.URI = pItemURI;

                // Set FunctionRasterDataset
                IFunctionRasterDataset inputFrd = GetFRD(myDimParser, pItemURI);
                currItem.Dataset = inputFrd;
                // Set band information for the function dataset including names, wavelengths and stats if available.
                SetBandProperties((IDataset)inputFrd, myDimParser);

                // Set Footprint
                IGeoDataset geoDset = (IGeoDataset)inputFrd;
                // Set it to the current raster extent first. If the raster has no 
                // spatial reference, the extents will be in pixel space.
                currItem.Footprint = (IGeometry)geoDset.Extent;
                // The get the footprint from the dim file is it exists.
                currItem.Footprint = GetFootprint(myDimParser);

                // Set Properties. These properties are used to fill the Auxiliary Fields 
                // defined earlier and also key properties if the names are correct.
                IPropertySet propSet = currItem.Dataset.Properties;
                if (null == propSet)
                    propSet = new PropertySetClass();
                double sunAzimuth = Convert.ToDouble(myDimParser.SunAzimuth);
                double sunElevation = Convert.ToDouble(myDimParser.SunElevation);
                double sensorAzimuth = Convert.ToDouble(myDimParser.SensorAzimuth);
                double sensorElevation = 180 - Convert.ToDouble(myDimParser.IncidenceAngle);
                string acqDate = myDimParser.AcquisitionDate;
                string acqTime = myDimParser.AcquisitionTime;
                // Create a time object from the provided date and time.
                ITime acqDateTimeObj = new TimeClass();
                acqDateTimeObj.SetFromTimeString(esriTimeStringFormat.esriTSFYearThruSubSecondWithDash,
                    acqDate + " " + acqTime);
                // and obtain a DateTime object to set as value of the property. This ensures the 
                // field displays the value correctly.
                DateTime acqDateTimeFieldVal = acqDateTimeObj.QueryOleTime();

                propSet.SetProperty("AcquisitionDate", acqDateTimeFieldVal);
                propSet.SetProperty("SensorName", myDimParser.MetadataProfile);
                propSet.SetProperty("SunAzimuth", sunAzimuth);
                propSet.SetProperty("SunElevation", sunElevation);
                propSet.SetProperty("SatAzimuth", sensorAzimuth);
                propSet.SetProperty("SatElevation", sensorElevation);
                currItem.Dataset.Properties = propSet;

                return currItem;
            }
            catch (Exception exc)
            {
                throw exc;
            }
        }
Example #37
0
        public ErrorInfoWithPause ActionSortPNPStartPlaceNG(CallBackCommonFunc AfterActionSortPNPPlaceNG)
        {
            ErrorInfoWithPause res = null;

            //Check vacuum
            res = CheckVacuumStatus();
            if (res != null)
            {
                return(res);
            }
            bool NeedCylinderDown;

            //res = UpdateRow();
            //if (res != null) return res;
            if (ClassWorkFlow.Instance.UnloadMode != EnumUnloadMode.全NG)
            {
                for (int i = 0; i < CELLCOUNT; i++)
                {
                    if (CheckCellIsNG(SortNGDataStations[i].CellData))
                    {
                        if (IsUseBackNGBox)
                        {
                            if (SortNGDataStations[i].CellData.ThicknessNG)
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox1;
                            }
                            else
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox2;
                            }
                        }
                        else
                        {
                            if (SortNGDataStations[i].CellData.ThicknessNG)
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox3;
                            }
                            else
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox4;
                            }
                        }
                        NGBoxCellCount[CurrentNGBoxRow, i]++;
                        string NGData = SortNGDataStations[i].CellData.NGDataInfoString;
                        if (NGData != "")
                        {
                            NGBoxDataInfoString[CurrentNGBoxRow, i] += NGData + Environment.NewLine;
                        }
                        NeedCylinderDown = CheckIfNeedCylinder(NGBoxCellCount[CurrentNGBoxRow, i]);

                        //PNP Y move away
                        res = ActionMove((EnumPointPNPY)CurrentNGBoxRow);
                        if (res != null)
                        {
                            return(res);
                        }
                        if (NeedCylinderDown)
                        {
                            //PNP Z down
                            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, 1 + NGBoxCellCount[CurrentNGBoxRow, i] * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                            //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                            {
                                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                                if (res != null)
                                {
                                    return(res);
                                }
                            }
                            //Cylinder down
                            while (!PNPCylinder[i].SetCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT))
                            //return new ErrorInfoWithPause("NG挑选PNP气缸下移超时错。", ErrorLevel.Error);
                            {
                                res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸下移超时错");
                                if (res != null)
                                {
                                    return(res);
                                }
                            }
                        }
                        else
                        {
                            //PNP Z down
                            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, -100 + 1 + GetMaxCount() * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                            //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                            {
                                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                                if (res != null)
                                {
                                    return(res);
                                }
                            }
                        }
                        //Open blow
                        AirControl((EnumCellIndex)i, EnumAirControl.Blow);
                        //AirControl((EnumCellIndex)i, EnumAirControl.Close);
                        //Delay
                        TimeClass.Delay(400);
                        //Cylinder up
                        while (!PNPCylinder[i].SetCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                        //return new ErrorInfoWithPause("NG挑选PNP气缸上移超时错。", ErrorLevel.Error);
                        {
                            res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸上移超时错");
                            if (res != null)
                            {
                                return(res);
                            }
                        }
                        //Close blow
                        AirControl((EnumCellIndex)i, EnumAirControl.Close);
                    }
                }
            }
            else
            {
                for (int i = 0; i < CELLCOUNT; i++)
                {
                    if (CheckCellIsNG(SortNGDataStations[i].CellData))
                    {
                        NGBoxCellCount[CurrentNGBoxRow, i]++;
                    }
                }
                NeedCylinderDown = CheckIfNeedCylinder(GetMaxCount());

                //PNP Y move away
                res = ActionMove((EnumPointPNPY)CurrentNGBoxRow);
                if (res != null)
                {
                    return(res);
                }
                if (NeedCylinderDown)
                {
                    //PNP Z down
                    while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, 1 + GetMaxCount() * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                    //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                    {
                        res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                        if (res != null)
                        {
                            return(res);
                        }
                    }
                    //Cylinder down
                    PNPCylinder[0].SetCylinderState(CYLIND_DOWN, 0, false);
                    PNPCylinder[1].SetCylinderState(CYLIND_DOWN, 0, false);
                    PNPCylinder[2].SetCylinderState(CYLIND_DOWN, 0, false);
                    while (!PNPCylinder[0].WaitCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT) || !PNPCylinder[1].WaitCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT) || !PNPCylinder[2].WaitCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT))
                    //return new ErrorInfoWithPause("NG挑选PNP气缸下移超时错。", ErrorLevel.Error);
                    {
                        res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸下移超时错");
                        if (res != null)
                        {
                            return(res);
                        }
                    }
                }
                else
                {
                    //PNP Z down
                    while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, -100 + 1 + GetMaxCount() * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                    //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                    {
                        res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                        if (res != null)
                        {
                            return(res);
                        }
                    }
                }
                //Open blow
                AirControl(EnumAirControl.Blow, EnumAirControl.Blow, EnumAirControl.Blow);
                //AirControl(EnumAirControl.Close, EnumAirControl.Close, EnumAirControl.Close);
                //Delay
                TimeClass.Delay(400);
                //Cylinder up
                PNPCylinder[0].SetCylinderState(CYLIND_UP, 0, false);
                PNPCylinder[1].SetCylinderState(CYLIND_UP, 0, false);
                PNPCylinder[2].SetCylinderState(CYLIND_UP, 0, false);
                while (!PNPCylinder[0].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT) || !PNPCylinder[1].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT) || !PNPCylinder[2].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                //return new ErrorInfoWithPause("NG挑选PNP气缸上移超时错。", ErrorLevel.Error);
                {
                    res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸上移超时错");
                    if (res != null)
                    {
                        return(res);
                    }
                }
                //Close blow
                AirControl(EnumAirControl.Close, EnumAirControl.Close, EnumAirControl.Close);
            }

            //PNP Z up
            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Up)) //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
            {
                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
                if (res != null)
                {
                    return(res);
                }
            }
            DoUpdateNGBox();
            //PNP Y move away
            while (!AxisSortingPNPY.MoveTo(EnumPointPNPY.Pick)) //return DispMotionError(AxisSortingPNPY, EnumPointPNPY.Pick);
            {
                res = DispMotionError(AxisSortingPNPY, EnumPointPNPZ.Pick);
                if (res != null)
                {
                    return(res);
                }
            }
            if (AfterActionSortPNPPlaceNG != null)
            {
                AfterActionSortPNPPlaceNG();
            }
            NGBoxFullErrorHandler(this.Name, "", ErrorDialogResult.OK);
            return(null);
        }
Example #38
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();
        DataTable dtPervious = new DataTable();
        DataTable dtNext = new DataTable();
        DataTable dtComments = new DataTable();
        DataSet ds = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

        SqlDataAdapter sda = new SqlDataAdapter("sp_blogInfo", sqlConn);
        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.SelectCommand.Parameters.Add("@BlogId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["BlogId"]);
        sda.Fill(ds);
        dt = ds.Tables[0];
        dtPervious = ds.Tables[1];
        dtNext = ds.Tables[2];
        dtComments = ds.Tables[3];

        if (dt.Rows.Count == 0) //news doesn't exist
        {
            sda.Dispose();
            sqlConn.Close();
            Response.Redirect("~/Blog.aspx");
        }
        else //blog exists
        {
            TimeClass tc = new TimeClass();
            LabelDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["SubmitDate"].ToString()));

            LabelTitle.Text = dt.Rows[0]["Title"].ToString();
            LabelCategory.Text = dt.Rows[0]["CategoryName"].ToString();
            LabelBody.Text = dt.Rows[0]["Body"].ToString();
            ImageImage.ImageUrl = dt.Rows[0]["PhotoLink"].ToString();
            Page.Title = "Salestan : بلاگ : " + dt.Rows[0]["Title"].ToString();


            HyperLinkShareFacebook.NavigateUrl = "http://www.facebook.com/share.php?u=" + Request.Url.AbsoluteUri + "&t=" + dt.Rows[0]["Title"].ToString();
            HyperLinkShareTwitter.NavigateUrl = "http://twitter.com/home?status=" + dt.Rows[0]["Title"].ToString() + " " + Request.Url.AbsoluteUri;
            HyperLinkShareEmail.NavigateUrl = "mailto:?subject=" + dt.Rows[0]["Title"].ToString() + "&body=" + Request.Url.AbsoluteUri;
        }

        if (dtPervious.Rows.Count != 0) //news doesn't exist
        {
            PanelPervious.Visible = true;
            HyperLinkPervious.NavigateUrl = "~/ShowBlog.aspx?BlogId=" + dtPervious.Rows[0]["BlogId"].ToString() + "&Title=" + dtPervious.Rows[0]["BrowserTitle"].ToString();
            HyperLinkPervious.Text = dtPervious.Rows[0]["Title"].ToString();
        }

        if (dtNext.Rows.Count != 0) //news doesn't exist
        {
            PanelNext.Visible = true;
            HyperLinkNext.NavigateUrl = "~/ShowBlog.aspx?BlogId=" + dtNext.Rows[0]["BlogId"].ToString() + "&Title=" + dtNext.Rows[0]["BrowserTitle"].ToString();
            HyperLinkNext.Text = dtNext.Rows[0]["Title"].ToString();
        }

        //Comment
        StringBuilder sb3 = new StringBuilder();
        if (dtComments.Rows.Count != 0)
        {
            for (int i = 0; i < dtComments.Rows.Count; i++)
            {
                sb3.AppendLine("<br/>");
                sb3.AppendLine("<div class='FormLabel' style='direction:rtl;'>");
                sb3.AppendLine(dtComments.Rows[i]["Comment"].ToString());
                if (dtComments.Rows[i]["Answer"].ToString() != "")
                {
                    sb3.AppendLine("<br/><br/>");
                    sb3.AppendLine("<img alt='' height='20' src='images/logosmall.png' width='60' /><br/>");
                    sb3.AppendLine("<strong>" + dtComments.Rows[i]["Answer"].ToString() + "</strong>");
                }
                sb3.AppendLine("</div>");
                sb3.AppendLine("<br/>");
                sb3.AppendLine("<hr style='color:#CAE1E6' />");
            }
            LiteralComments.Text = sb3.ToString();
        }

        sda.Dispose();
        sqlConn.Close();
    }
Example #39
0
 protected string ShowDate(Object SubmitDate)
 {
     DateTime Date = Convert.ToDateTime(SubmitDate);
     TimeClass tc = new TimeClass();
     return tc.ConvertToIranTimeString(Date);
 }
Example #40
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Users");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
                case "Info":
                    {
                        PanelInfo.Visible = true;
                        Page.Title = "Salestan : مشخصات کاربر";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_userInfo", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@UserId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["UserId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        if (dt.Rows.Count == 0) //admin doesn't exist
                        {
                            LabelMessage.Text = "کاربری با این شناسه موجود نمی باشد!";
                            LabelMessage.CssClass = "ErrorMessage";
                            LabelMessage.Visible = true;
                            PanelUserInfo.Visible = false;
                        }
                        else //user exists
                        {

                            LabelMessage.Visible = false;
                            PanelUserInfo.Visible = true;

                            LabelUserIdValue.Text = Request.QueryString["UserId"].ToString();
                            LabelEmailValue.Text = dt.Rows[0]["Email"].ToString();
                            LabelFirstNameValue.Text = dt.Rows[0]["FirstName"].ToString();
                            LabelLastNameValue.Text = dt.Rows[0]["LastName"].ToString();
                            LabelBirthValue.Text = dt.Rows[0]["BirthDate"].ToString();
                            ImageGender.ImageUrl = "~/images/icons/gender24" + dt.Rows[0]["Gender"].ToString() + ".png";
                            LabelJobValue.Text = dt.Rows[0]["Job"].ToString();
                            LabelEducationValue.Text = dt.Rows[0]["Education"].ToString();
                            LabelHomePhoneValue.Text = dt.Rows[0]["HomeTel"].ToString();
                            LabelWorkPhoneValue.Text = dt.Rows[0]["WorkTel"].ToString();
                            LabelMobileValue.Text = dt.Rows[0]["Mobile"].ToString();
                            LabelAddressValue.Text = dt.Rows[0]["Address"].ToString();
                            LabelCredit.Text = dt.Rows[0]["Credit"].ToString();
                            LabelGiftCredit.Text = dt.Rows[0]["GiftCredit"].ToString();
                            LabelSpentCredit.Text = dt.Rows[0]["SpentCredit"].ToString();
                            LabelSpendGift.Text = dt.Rows[0]["SpentGift"].ToString();
                            LabelStatsOffersPurchased.Text = dt.Rows[0]["PurchasedOffersCount"].ToString();
                            LabelStatsUsersInvite.Text = dt.Rows[0]["InvitedUsersCount"].ToString();
                            DropDownListStatus.SelectedValue = dt.Rows[0]["Status"].ToString();

                            TimeClass tc = new TimeClass();
                            LabelMemberSinceValue.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["MemberSince"].ToString()));
                            LabelLastLoginValue.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["LastLogin"].ToString()));
                        }
                        sda.Dispose();
                        sqlConn.Close();

                        break;
                    }
            }
        }
    }
Example #41
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //check premissions
        AdminPremissions ap = new AdminPremissions();
        bool AdminPremission = ap.getAdminPremissions(Convert.ToInt32(Session["UserId"]), "Offers");
        if (!AdminPremission)
        {
            Response.Redirect("~/Error.aspx?Code=404");
        }

        if (!IsPostBack)
        {
            switch (Request.QueryString["Mode"])
            {
                case "Edit":
                    {
                        PanelEdit.Visible = true;
                        Page.Title = "Salestan : تغییر مشخصات پیشنهاد";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_offerInfo", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@OfferId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["OfferId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        //Descriptions
                        StringBuilder sbDescriptions = new StringBuilder(HttpUtility.HtmlEncode(dt.Rows[0]["Descriptions"].ToString()));
                        sbDescriptions.Replace("<", "&lt;");
                        sbDescriptions.Replace(">", "&gt;");
                        string descriptions = sbDescriptions.ToString();
                        //Highlights
                        StringBuilder sbHighlights = new StringBuilder(HttpUtility.HtmlEncode(dt.Rows[0]["Highlights"].ToString()));
                        sbHighlights.Replace("<", "&lt;");
                        sbHighlights.Replace(">", "&gt;");
                        string highlights = sbHighlights.ToString();
                        //Details
                        StringBuilder sbDetails = new StringBuilder(HttpUtility.HtmlEncode(dt.Rows[0]["Details"].ToString()));
                        sbDetails.Replace("<", "&lt;");
                        sbDetails.Replace(">", "&gt;");
                        string details = sbDetails.ToString();


                        DropDownListCompany.SelectedValue = dt.Rows[0]["CompanyId"].ToString();
                        TextBoxTitle.Text = dt.Rows[0]["Title"].ToString();
                        TextBoxBrowserTitle.Text = dt.Rows[0]["BrowserTitle"].ToString();
                        DropDownListCategory.SelectedValue = dt.Rows[0]["CategoryId"].ToString();
                        TextBoxHighlights.Text = highlights;
                        TextBoxDetails.Text = details;
                        TextBoxDescriptions.Text = descriptions;
                        TextBoxPriceOffer.Text = dt.Rows[0]["PriceOffer"].ToString();
                        TextBoxPriceNormal.Text = dt.Rows[0]["PriceNormal"].ToString();
                        TextBoxPriceGift.Text = dt.Rows[0]["PriceGift"].ToString();
                        TextBoxPriceOurs.Text = dt.Rows[0]["PriceOurs"].ToString();
                        TextBoxPricePercent.Text = dt.Rows[0]["PriceDiscountPercent"].ToString();
                        TextBoxMinBuy.Text = dt.Rows[0]["MinBuy"].ToString();
                        TextBoxMaxBuy.Text = dt.Rows[0]["MaxBuy"].ToString();
                        TextBoxMinUser.Text = dt.Rows[0]["MinUser"].ToString();
                        TextBoxMaxUser.Text = dt.Rows[0]["MaxUser"].ToString();
                        LabelShowDateValue.Text = dt.Rows[0]["ShowDate"].ToString();
                        LabelEndDateValue.Text = dt.Rows[0]["EndDate"].ToString();
                        DropDownListLanguage.SelectedValue = dt.Rows[0]["Language"].ToString();
                        TextBoxLink1Name.Text = dt.Rows[0]["Link1Name"].ToString();
                        TextBoxLink1Url.Text = dt.Rows[0]["Link1Url"].ToString();
                        TextBoxLink2Name.Text = dt.Rows[0]["Link2Name"].ToString();
                        TextBoxLink2Url.Text = dt.Rows[0]["Link2Url"].ToString();
                        //locations
                        for (int i = 0; i < CheckBoxListLocations.Items.Count; i++)
                        {
                            if (dt.Rows[0]["Locations"].ToString().Contains(CheckBoxListLocations.Items[i].Value + ","))
                            {
                                CheckBoxListLocations.Items[i].Selected = true;
                            }
                        }

                        sda.Dispose();
                        sqlConn.Dispose();

                        break;
                    }
                case "Buyers":
                    {
                        PanelBuyers.Visible = true;
                        Page.Title = "Salestan : فهرست خریداران پیشنهاد";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_offerBuyers", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@OfferId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["OfferId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        LabelBuyersCompanyName.Text = dt.Rows[0]["Name"].ToString();
                        LabelBuyersCompanyId.Text = dt.Rows[0]["CompanyId"].ToString();
                        LabelBuyersOfferId.Text = Request.QueryString["OfferId"];
                        LabelBuyersTitle.Text = dt.Rows[0]["Title"].ToString();
                        LabelBuyersSold.Text = dt.Rows[0]["PurchasedCount"].ToString();

                        TimeClass tc = new TimeClass();
                        LabelBuyersDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["ShowDate"].ToString()));

                        sda.Dispose();
                        sqlConn.Dispose();

                        break;
                    }
                case "Photos":
                    {
                        PanelPhotos.Visible = true;
                        Page.Title = "Salestan : تصاویر پیشنهاد";

                        DataTable dt = new DataTable();
                        DataSet ds = new DataSet();
                        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

                        SqlDataAdapter sda = new SqlDataAdapter("sp_offersPhotos", sqlConn);
                        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
                        sda.SelectCommand.Parameters.Add("@OfferId", SqlDbType.Int).Value = Convert.ToInt32(Request.QueryString["OfferId"]);
                        sda.Fill(ds);
                        dt = ds.Tables[0];

                        LabelPhotosCompanyName.Text = dt.Rows[0]["Name"].ToString();
                        LabelPhotosCompanyId.Text = dt.Rows[0]["CompanyId"].ToString();
                        LabelPhotosOfferId.Text = Request.QueryString["OfferId"];
                        LabelPhotosOfferTitle.Text = dt.Rows[0]["Title"].ToString();

                        if (dt.Rows[0]["MainPhoto"].ToString() == "0")
                        {
                            ImageMainPhoto.ImageUrl = "NoPhoto.jpg"; 
                        }
                        else
                        {
                            ImageMainPhoto.ImageUrl = "~/Files/Photos/" + dt.Rows[0]["MainPhoto"].ToString() + ".jpg";
                        }

                        sda.Dispose();
                        sqlConn.Dispose();

                        break;
                    }
            }
        }
    }
 public static ITime ParseUTCMilliseconds(long utcTime)
 {
     DateTime dateTime = new DateTime(1970, 1, 1, 0, 0, 0, 0);
     dateTime = dateTime.AddMilliseconds(utcTime);
     ITime result = new TimeClass();
     result.Year = (short)dateTime.Year;
     result.Month = (short)dateTime.Month;
     result.Day = (short)dateTime.Day;
     result.Hour = (short)dateTime.Hour;
     result.Minute = (short)dateTime.Minute;
     result.Second = (short)dateTime.Second;
     return result;
 }
Example #43
0
    protected void LinkButtonStatsRefresh_Click(object sender, EventArgs e)
    {
        StatsRefresh sr = new StatsRefresh();
        sr.refreshStats("Users");

        ImageStatsRefresh.ImageUrl = "~/images/icons/check16.png";

        DataTable dt = new DataTable();
        DataSet ds = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

        SqlDataAdapter sda = new SqlDataAdapter("sp_statsUsers", sqlConn);
        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.Fill(ds);
        dt = ds.Tables[0];

        TimeClass tc = new TimeClass();
        LabelStatsDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["UsersDate"].ToString()));

        LabelStatsUsers.Text = dt.Rows[0]["UsersCount"].ToString();
        LabelStatsGenderFemale.Text = "زن: " + dt.Rows[0]["UsersGenderFemale"].ToString();
        LabelStatsGenderMale.Text = " مرد: " + dt.Rows[0]["UsersGenderMale"].ToString();
        LabelStatsLogin.Text = dt.Rows[0]["UsersLoginMonth"].ToString();

        sda.Dispose();
        sqlConn.Close();
    }
Example #44
0
    protected void LinkButtonStatsRefresh_Click(object sender, EventArgs e)
    {
        StatsRefresh sr = new StatsRefresh();
        sr.refreshStats("Credit");

        ImageStatsRefresh.ImageUrl = "~/images/icons/check16.png";

        DataTable dt = new DataTable();
        DataSet ds = new DataSet();
        SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["ShopConnectionString"].ConnectionString);

        SqlDataAdapter sda = new SqlDataAdapter("sp_statsCredit", sqlConn);
        sda.SelectCommand.CommandType = CommandType.StoredProcedure;
        sda.Fill(ds);
        dt = ds.Tables[0];

        PanelManageUser.Visible = true;
        LabelMessage.Visible = false;

        TimeClass tc = new TimeClass();
        LabelStatsDate.Text = tc.ConvertToIranTimeString(Convert.ToDateTime(dt.Rows[0]["CreditDate"].ToString()));

        LabelStatsActiveCredit.Text = dt.Rows[0]["CreditSum"].ToString();
        LabelStatsGiftCredit.Text = dt.Rows[0]["CreditGiftCredit"].ToString();
        LabelStatsSpentCredit.Text = dt.Rows[0]["CreditSpent"].ToString();
        LabelStatsSpentGift.Text = dt.Rows[0]["CreditGiftSpent"].ToString();

        LabelStatsActiveCreditAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditSum"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString();
        LabelStatsGiftCreditAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditGiftCredit"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString();
        LabelStatsSpentCreditAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditSpent"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString();
        LabelStatsSpentGiftAverage.Text = (Convert.ToInt32(dt.Rows[0]["CreditGiftSpent"].ToString()) / Convert.ToInt32(dt.Rows[0]["UsersCount"].ToString())).ToString();

        sda.Dispose();
        sqlConn.Close();
    }