Classes and methods commonly used in interaction with the user
Exemplo n.º 1
0
    private void DisableStartTimesBeforeTimeOfTheDayIfTodaysDateIsSelected()
    {
        int      index       = 0;
        DateTime easternTime = ClassLibrary.RetrieveEasternTimeZoneFromUTCTime();
        TimeSpan timeOfDay   = easternTime.TimeOfDay;
        TimeSpan latestTimeToBookAnAppointment = TimeSpan.Parse(AppConstants.TimeToBookAnAppointment.LatestTimeToBookAnAppointment);

        if (timeOfDay > latestTimeToBookAnAppointment)
        {
            DDLBeginTime.Enabled = false;
        }
        else
        {
            foreach (ListItem timeSlot in DDLBeginTime.Items)
            {
                TimeSpan serviceStartTime = TimeSpan.Parse(timeSlot.Text.ToString().Trim());
                if (serviceStartTime < timeOfDay)
                {
                    timeSlot.Attributes.Add("disabled", "disabled");
                }
                else
                {
                    DDLBeginTime.SelectedIndex = index;
                    break;
                }
                index++;
            }
        }
    }
Exemplo n.º 2
0
        public byte[] GetFile(ClassLibrary.Entites.File file, long partNumber)
        {
            PNRPManager manager = PeerServiceHost.PNRPManager;
            List<ClassLibrary.Entites.Peer> foundPeers = manager.ResolveByPeerName(file.PeerName);

            if (foundPeers.Count != 0) 
            {
                ClassLibrary.Entites.Peer peer = foundPeers.FirstOrDefault();

                EndpointAddress endpointAddress = new EndpointAddress(string.Format("net.tcp://{0}:{1}/PeerToPeerClient.Services/PeerService",
                    peer.PeerHostName, ClassLibrary.Config.LocalPort));

                NetTcpBinding tcpBinding = new NetTcpBinding(SecurityMode.None);
                PeerServiceClient client = new PeerServiceClient(tcpBinding, endpointAddress);

                byte[] data = null;

                try
                {
                    data = client.TransferFile(file, partNumber);
                }
                catch
                {
                    throw new Exception("Unreachable host '" + file.PeerName);
                }

                return data;
            }

            else
            {
                throw new Exception("Unable to resolve peer " +  file.PeerName);
            }
        }
Exemplo n.º 3
0
 public void DrawDDCursor(Rectangle tabPageItemRct, string tabPageText,
     int index, ClassLibrary.Winform.UI.Controls.PluggableTabControl.ButtonState btnState)
 {
     using (Bitmap overlay = new Bitmap(tabPageItemRct.Width, tabPageItemRct.Height,
         PixelFormat.Format32bppRgb),
         overlayTransparent = new Bitmap(tabPageItemRct.Width, tabPageItemRct.Height,
         PixelFormat.Format32bppArgb))
     {
         using (Graphics g = Graphics.FromImage(overlay))
         {
             Renderer.OnRendererTabPageItem(g, new Rectangle(0, 0, overlay.Width, overlay.Height),
                 tabPageText, index, btnState);
         }
         using (Graphics g = Graphics.FromImage(overlayTransparent))
         {
             // Create an ImageAttributes object and set its color matrix
             using (ImageAttributes attributes = new ImageAttributes())
             {
                 ColorMatrix colorMatrix = new ColorMatrix();
                 colorMatrix.Matrix33 = 210 / 255f;
                 attributes.SetColorMatrix(colorMatrix);
                 g.DrawImage(overlay, new Rectangle(0, 0, overlayTransparent.Width, overlayTransparent.Height),
                     0, 0, overlay.Width, overlay.Height, GraphicsUnit.Pixel, attributes);
             }
             Cursor overlayCursor = Cursors.Hand;
             overlayCursor.Draw(g, new Rectangle(Point.Empty, overlayCursor.Size));
         }
         DDCursor = CreateCursor(overlayTransparent);
     }
 }
 //StudentModel constructor
 public StudentModel(string studentID, string studentFirstName, string studentLastName, string studentEmail)
 {
     StudentID        = studentID;
     StudentFirstName = ClassLibrary.FormatName(studentFirstName);
     StudentLastName  = ClassLibrary.FormatName(studentLastName);
     StudentEmail     = $"{studentEmail}@hillsroad.ac.uk";
     StudentPassword  = ClassLibrary.GenerateRandomPassword(10);
 }
Exemplo n.º 5
0
        //protected void Btn1ClickHere_Click(object sender, EventArgs e)
        //{
        //    var Fahrenheit = new ConvertLibrary();
        //    int TempC = Int32.Parse(tbTempC.Text);
        //    int Answer = Fahrenheit.ConvertCtoF(TempC);
        //    tbTempF.Text = Answer.ToString();
        //}

        protected void btn2ClickHere_Click(object sender, EventArgs e)
        {
            var Celsius = new ClassLibrary();
            int TempF   = Int32.Parse(tbTempF.Text);
            int Answer  = Celsius.ConvertFtoC(TempF);

            tbTempC.Text = Answer.ToString();
        }
Exemplo n.º 6
0
        public IActionResult Result(ClassLibrary data)
        {
            data.Calculate();

            Result result = data.Rachet();

            return(View());
        }
Exemplo n.º 7
0
        protected void btn1ClickHere_Click(object sender, EventArgs e)
        {
            var Fahrenheit = new ClassLibrary();
            int TempC      = Int32.Parse(tbTempC.Text);
            int Answer     = Fahrenheit.ConvertCtoF(TempC);

            tbTempF.Text = Answer.ToString();
        }
Exemplo n.º 8
0
 //Constructor used to build a new StaffModel
 public StaffModel(string staffFirstName, string staffLastName, string staffEmail)
 {
     //StaffID is handled by the database
     StaffFirstName = ClassLibrary.FormatName(staffFirstName);
     StaffLastName  = ClassLibrary.FormatName(staffLastName);
     StaffEmail     = staffEmail;
     StaffPassword  = ClassLibrary.GenerateRandomPassword(10);
 }
Exemplo n.º 9
0
        public void AddFile(ClassLibrary.Entites.File file)
        {
            SuperPeerServiceClient ssc = new SuperPeerServiceClient();

            List<ClassLibrary.Entites.File> tempList =  new List<ClassLibrary.Entites.File>();
            tempList.Add(file);

            ssc.AddFiles(tempList);
        }
Exemplo n.º 10
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         TxtAppointmentSummary.Text = ClassLibrary.RetrieveEasternTimeZoneFromUTCTime().ToShortDateString();
         PopulateGridWithAppointmentData(TxtAppointmentSummary.Text.Trim());
         /*Filling up the checkboxlist, services, names and times dropdownlist*/
         LoadServicesAndStylistForAppointmentBooking();
         TxtAppointmentDate.Text = ClassLibrary.RetrieveEasternTimeZoneFromUTCTime().ToShortDateString();
         DetermineWhetherDateForBookingAppointmentSelectedIsToday();
     }
 }
Exemplo n.º 11
0
 private void DetermineWhetherDateForBookingAppointmentSelectedIsToday()
 {
     if (TxtAppointmentDate.Text.Trim() != "")
     {
         DateTime dateSelected = Convert.ToDateTime(TxtAppointmentDate.Text.ToString().Trim());
         DateTime easternTime  = ClassLibrary.RetrieveEasternTimeZoneFromUTCTime();
         if (dateSelected.Date == easternTime.Date)
         {
             DisableStartTimesBeforeTimeOfTheDayIfTodaysDateIsSelected();
         }
         else
         {
             DDLBeginTime.Enabled       = true;
             DDLBeginTime.SelectedIndex = 0;
         }
     }
 }
Exemplo n.º 12
0
 public void DataPortal_Fetch(ClassLibrary.SLIdentity.CredentialsCriteria criteria)
 {
   if (criteria.Username == "TestUser" && criteria.Password == "1234")
   {
     this.Roles = new MobileList<string>(criteria.Roles.Split(';'));
     this.IsAuthenticated = true;
     this.Name = criteria.Username;
     this.AuthenticationType = "Custom";
   }
   else
   {
     this.Roles = new MobileList<string>();
     this.IsAuthenticated = false;
     this.Name = string.Empty;
     this.AuthenticationType = "";
   }
 }
Exemplo n.º 13
0
    protected void OutBusinessHours_ServerValidation(object source, ServerValidateEventArgs args)
    {
        DateTime dateSelected = Convert.ToDateTime(TxtAppointmentDate.Text.ToString().Trim());
        DateTime easternTime  = ClassLibrary.RetrieveEasternTimeZoneFromUTCTime();

        if (dateSelected.Date == easternTime.Date)
        {
            TimeSpan timeOfDay = easternTime.TimeOfDay;
            TimeSpan latestTimeToBookAnAppointment = TimeSpan.Parse(AppConstants.TimeToBookAnAppointment.LatestTimeToBookAnAppointment);
            if (timeOfDay > latestTimeToBookAnAppointment)
            {
                args.IsValid = false;
            }
            else
            {
                args.IsValid = true;
            }
        }
    }
Exemplo n.º 14
0
        static void Main(string[] args)
        {
            Console.WriteLine("Factorial:");
            Console.WriteLine($"0! = {ClassLibrary.Factorial(0)}");
            Console.WriteLine($"1! = {ClassLibrary.Factorial(1)}");
            Console.WriteLine($"3! = {ClassLibrary.Factorial(3)}");
            Console.WriteLine($"5! = {ClassLibrary.Factorial(5)}");


            Console.WriteLine("\nPow:");
            Console.WriteLine($"2^0 = {ClassLibrary.Pow(2, 0)}");
            Console.WriteLine($"2^2 = {ClassLibrary.Pow(2, 2)}");
            Console.WriteLine($"2^5 = {ClassLibrary.Pow(2, 5)}");
            Console.WriteLine($"3^2 = {ClassLibrary.Pow(3, 2)}");
            Console.WriteLine($"5^5 = {ClassLibrary.Pow(5, 5)}");


            Console.ReadKey();
        }
        private static void SaveContent(IClassMetadata classmeta, string projectDirectory, StaticContent content, StaticContent _content, string fullProjectNamespace, string filePath)
        {
            if (content.CreateGeneratedCounterpart)
            {
                //Get genertaed filename and path
                string generatedFileName = ClassLibrary.ComposeGeneratedFilename(content.FileName);
                string generatedFilePath = string.Format(@"{0}\{1}{2}", projectDirectory, classmeta.ClassFilePath, generatedFileName);

                //Get Generated template and inject the correct namespace
                string customClassContent = Core.ResourceFileHelper.ConvertStreamResourceToUTF8String(typeof(ClassLibrary), "Chucksoft.Entities.Templates.Custom.template");
                customClassContent = SetNamespaceAndClass(customClassContent, fullProjectNamespace);

                //write both files out
                File.WriteAllText(generatedFilePath, _content.Content.ToString());
                File.WriteAllText(filePath, customClassContent);
            }
            else
            {
                File.WriteAllText(filePath, _content.Content.ToString());
            }
        }
Exemplo n.º 16
0
    private static DataTable BuildServicesSchedule(AppointmentDetails appointmentData, DataTable dtTblServicesDuration)
    {
        //Datable with services to be performed and proposed schedule
        var dtTblServicesToBeBooked = CreateDataTableForServicesToBeBooked();

        ProjectStructs.TimeSlotsStartingAndEndingTimes currentTimeSlotService;
        currentTimeSlotService.serviceStartTime = TimeSpan.ParseExact(appointmentData.StartingTime, "g", null);
        currentTimeSlotService.serviceEndTime   = TimeSpan.Zero;

        foreach (char c in appointmentData.Services)
        {
            byte    serviceNumber   = (byte)Char.GetNumericValue(c);
            DataRow drService       = dtTblServicesDuration.Rows.Find(serviceNumber);
            int     serviceDuration = ReturnServiceDurationAccordingToHairLenght(appointmentData, drService);

            TimeSpan minutesServiceDuration            = new TimeSpan(0, serviceDuration, 0);
            int      totalSlotsToCreateForSameCustomer = (int)minutesServiceDuration.TotalMinutes / AppConstants.ScheduleTimeSlot.TimeSlotToDisplayInScheduleInMinutes;
            for (int timeSlotCounter = 1; timeSlotCounter <= totalSlotsToCreateForSameCustomer; timeSlotCounter++)
            {
                //Calculate end time based on services duration time
                currentTimeSlotService.serviceEndTime = currentTimeSlotService.serviceStartTime + new TimeSpan(0, AppConstants.ScheduleTimeSlot.TimeSlotToDisplayInScheduleInMinutes, 0);
                appointmentData.StartingTime          = string.Format("{0:D2}:{1:D2}", currentTimeSlotService.serviceStartTime.Hours, currentTimeSlotService.serviceStartTime.Minutes);
                appointmentData.EndingTime            = string.Format("{0:D2}:{1:D2}", currentTimeSlotService.serviceEndTime.Hours, currentTimeSlotService.serviceEndTime.Minutes);
                //Add services details row to datable
                dtTblServicesToBeBooked.Rows.Add(appointmentData.DesiredDate, appointmentData.StartingTime,
                                                 appointmentData.EndingTime, serviceNumber, appointmentData.HairStylist,
                                                 (int)appointmentData.CustomerHairLength, appointmentData.IdCustomer,
                                                 ClassLibrary.RetrieveEasternTimeZoneFromUTCTime(), appointmentData.RegisteredBy, appointmentData.Cancelled,
                                                 appointmentData.CancellationReason);
                currentTimeSlotService.serviceStartTime = currentTimeSlotService.serviceEndTime;
            }

            SetupStartingTimeForNextServiceToBeBooked(currentTimeSlotService, drService);
        }
        return(dtTblServicesToBeBooked);
    }
Exemplo n.º 17
0
 public IEnumerable <SearchResult> Search(ClassLibrary lib, string text, bool ignoreCase = false, CancellationToken cancellationToken = default)
 {
     return(this.searchAlgorithm.Search(lib, text, ignoreCase, cancellationToken));
 }
Exemplo n.º 18
0
 //Get services selected in a string - calling a method in ClassLibrary
 public void DetermineServicesToBePerformed(CheckBoxList checkboxesList)
 {
   Services = ClassLibrary.SelectedServicesAppendedString(checkboxesList);
 }
Exemplo n.º 19
0
    void main()
    {
        ClassLibrary myCL = new ClassLibrary();

        myCL.myOtherCl.DeviceAttached += new EventHandler(myCl_deviceAttached);
    }
Exemplo n.º 20
0
        public int TemperatureTOC(int TempC)
        {
            var Celsius = new ClassLibrary();

            return(Celsius.ConvertFtoC(TempC));
        }
Exemplo n.º 21
0
 private void BeginDragDrop(NeoTabPage tabItem,
     Rectangle itemRectangle,
     ClassLibrary.Winform.UI.Controls.PluggableTabControl.ButtonState itemState,
     int itemIndex)
 {
     if (draggingStyle == DragDropStyle.PageEffect)
     {
         Size ps = DisplayRectangle.Size;
         if (ps.Width > 180)
             ps.Width = 180;
         if (ps.Height > 180)
             ps.Height = 180;
         using (Bitmap bm = new Bitmap(ps.Width, ps.Height))
         {
             myDdCursor = new DDPaintCursor();
             using (Graphics gr = Graphics.FromImage(bm))
             {
                 Point pt = PointToScreen(DisplayRectangle.Location);
                 gr.CopyFromScreen(pt.X, pt.Y,
                     0, 0, ps);
             }
             myDdCursor.DrawDDCursor(bm);
         }
     }
     else
     {
         myDdCursor = new DDPaintCursor(renderer);
         myDdCursor.DrawDDCursor(itemRectangle,
             String.IsNullOrEmpty(tabItem.Text) ? tabItem.Name : tabItem.Text,
             itemIndex, itemState);
     }
     DoDragDrop(tabItem, DragDropEffects.Move);
 }
Exemplo n.º 22
0
 public void Download(ClassLibrary.Entites.SearchFile fileSearchResult)
 {
     Action<object> downloadAction = new Action<object>(StartDownload);
     Task downloadActionTask = new Task(downloadAction, fileSearchResult);
     downloadActionTask.Start();
 }
Exemplo n.º 23
0
        /// <summary>
        /// Gets the NeoTabPage control at the specified point if it exists in the collection.
        /// </summary>
        /// <param name="pt">Mouse point coordinate</param>
        /// <param name="rectangle">NeoTabPage item rectangle</param>
        /// <param name="state">NeoTabPage item button state</param>
        /// <param name="tabPageIndex">The index of the tab page</param>
        /// <returns>It returns an existing NeoTabPage control if the collection contains the tab page at the specified point; otherwise, null.</returns>
        public NeoTabPage GetHitTest(Point pt, out Rectangle rectangle,
            out ClassLibrary.Winform.UI.Controls.PluggableTabControl.ButtonState state, out int tabPageIndex)
        {
            int i = -1;
            foreach (KeyValuePair<Rectangle, ClassLibrary.Winform.UI.Controls.PluggableTabControl.ButtonState> current in tpItemRectangles)
            {
                i++;

                if (!current.Key.Contains(pt))
                    continue;

                tabPageIndex = i;
                state = current.Value;
                rectangle = current.Key;
                NeoTabPage RetVal = TabPages[i] as NeoTabPage;
                return RetVal;
            }

            tabPageIndex = -1;
            state = ClassLibrary.Winform.UI.Controls.PluggableTabControl.ButtonState.Normal;
            rectangle = Rectangle.Empty;
            return null;
        }
Exemplo n.º 24
0
 public void DeleteFile(ClassLibrary.Entites.File file)
 {
     SuperPeerServiceClient ssc = new SuperPeerServiceClient();
     ssc.DeleteFile(file);
 }
Exemplo n.º 25
0
        /// <summary>
        /// 保存用户信息
        /// </summary>
        /// <param name="userInfo">用户对象</param>
        /// <returns>
        /// 保存是否成功
        /// </returns>
        public bool SaveUser(ClassLibrary.UserInfo userInfo)
        {
            bool result = false;

            try
            {
                if (GSetting.DataServ.ModifyUser(userInfo))
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                Global.Log(ex);
            }

            return result;
        }
Exemplo n.º 26
0
        /// <summary>
        /// Sets the MSG.
        /// </summary>
        /// <param name="endoscopeTemp">The endoscope clean temporary.</param>
        public void SetMsg(ClassLibrary.EndoscopeTemp endoscopeTemp)
        {
            try
            {
                var washTime = new TimeSpan();
                this.txtEndoscopeNo.Text = endoscopeTemp.EndoscopeSn;
                this.txtEndoscopeSIM.Text = endoscopeTemp.EndoscopeSim;
                this.txtWasherNo.Text = endoscopeTemp.WasherNo;
                this.txtWasherName.Text = endoscopeTemp.WasherName;

                // 一次清洗
                if (string.Equals(endoscopeTemp.CleanType.Trim(), "1"))
                {
                    if (!GSetting.PortMapDict.Keys.Contains(endoscopeTemp.AutoCleanNo))
                    {
                        return;
                    }

                    if (string.Equals(GSetting.PortMapDict[endoscopeTemp.AutoCleanNo].MarkText, "自动清洗机"))
                    {
                        this.cleanGroBox.Values.Description = endoscopeTemp.AutoCleanNo + "号自动清洗机";
                    }
                    else
                    {
                        this.cleanGroBox.Values.Description = "手动清洗";
                    }

                    this.cleanGroBox.Values.Description += string.Format("({0})", endoscopeTemp.WashDate.Value.ToLongDateString());
                    this.cleanGroBox.Enabled = true;
                    this.secGroBox.Enabled = false;
                    this.secGroBox.Values.Heading = string.Empty;
                    this.secGroBox.Values.Description = string.Empty;
                    #region 一次清洗

                    // 刷洗
                    try
                    {
                        washTime = endoscopeTemp.BrushWashEnd.Value - endoscopeTemp.BrushWashBegin.Value;
                    }
                    catch (Exception)
                    {
                        endoscopeTemp.BrushWashEnd = null;
                        endoscopeTemp.BrushWashBegin = null;
                    }

                    if (washTime.TotalSeconds >= Convert.ToInt32(GSetting.StepTime["ManualWash"]))
                    {
                        this.labIsPass.Values.Image = global::ProxyClient.Properties.Resources.right;
                        this.manualWashTime.ForeColor = Color.Green;
                    }
                    else
                    {
                        this.labIsPass.Values.Image = global::ProxyClient.Properties.Resources.wrong;
                        this.manualWashTime.ForeColor = Color.Red;
                    }

                    this.manualWashEnd.Text = endoscopeTemp.BrushWashEnd.Value.ToString();
                    this.manualWashBegin.Text = endoscopeTemp.BrushWashBegin.Value.ToString();
                    this.manualWashTime.Text = washTime > TimeSpan.Zero ? washTime.ToSafeString() : TimeSpan.Zero.ToSafeString();

                    // 初洗
                    try
                    {
                        washTime = new TimeSpan();
                        washTime = endoscopeTemp.FirstWashEnd.Value - endoscopeTemp.FirstWashBegin.Value;
                    }
                    catch (Exception)
                    {
                        endoscopeTemp.FirstWashEnd = null;
                        endoscopeTemp.FirstWashBegin = null;
                    }

                    if (washTime.TotalSeconds >= Convert.ToInt32(GSetting.StepTime["FirstWash"]))
                    {
                        this.firstWashIsPss.Values.Image = global::ProxyClient.Properties.Resources.right;
                        this.firstWashTime.ForeColor = Color.Green;
                    }
                    else
                    {
                        this.firstWashIsPss.Values.Image = global::ProxyClient.Properties.Resources.wrong;
                        this.firstWashTime.ForeColor = Color.Red;
                    }

                    this.firstWashBegin.Text = endoscopeTemp.FirstWashBegin.Value.ToString();
                    this.firstWashEnd.Text = endoscopeTemp.FirstWashEnd.Value.ToString();
                    this.firstWashTime.Text = washTime > TimeSpan.Zero ? washTime.ToSafeString() : TimeSpan.Zero.ToSafeString();

                    // 酶洗
                    try
                    {
                        washTime = new TimeSpan();
                        washTime = endoscopeTemp.EnzymeWashEnd.Value - endoscopeTemp.EnzymeWashBegin.Value;
                    }
                    catch (Exception)
                    {
                        endoscopeTemp.EnzymeWashBegin = null;
                        endoscopeTemp.EnzymeWashEnd = null;
                    }

                    if (washTime.TotalSeconds >= Convert.ToInt32(GSetting.StepTime["EnzymeWash"]))
                    {
                        this.enzymeWashIsPass.Values.Image = global::ProxyClient.Properties.Resources.right;
                        this.manualWashTime.ForeColor = Color.Green;
                    }
                    else
                    {
                        this.enzymeWashIsPass.Values.Image = global::ProxyClient.Properties.Resources.wrong;
                        this.firstWashTime.ForeColor = Color.Red;
                    }

                    this.enzymeWashTime.Text = washTime > TimeSpan.Zero ? washTime.ToSafeString() : TimeSpan.Zero.ToSafeString();
                    this.enzymeWashBegin.Text = endoscopeTemp.EnzymeWashBegin.Value.ToString();
                    this.enzymeWashEnd.Text = endoscopeTemp.EnzymeWashEnd.Value.ToString();

                    // 次洗
                    try
                    {
                        washTime = new TimeSpan();
                        washTime = endoscopeTemp.CleanOutEnd.Value - endoscopeTemp.CleanOutBegin.Value;
                    }
                    catch (Exception)
                    {
                        endoscopeTemp.CleanOutEnd = null;
                        endoscopeTemp.CleanOutBegin = null;
                    }

                    if (washTime.TotalSeconds >= Convert.ToInt32(GSetting.StepTime["Cleanout"]))
                    {
                        this.cleanOutWashIsPass.Values.Image = global::ProxyClient.Properties.Resources.right;
                        this.manualWashTime.ForeColor = Color.Green;
                    }
                    else
                    {
                        this.cleanOutWashIsPass.Values.Image = global::ProxyClient.Properties.Resources.wrong;
                        this.firstWashTime.ForeColor = Color.Red;
                    }

                    this.cleanOutWashTime.Text = washTime > TimeSpan.Zero ? washTime.ToSafeString() : TimeSpan.Zero.ToSafeString();
                    this.cleanOutWashBegin.Text = endoscopeTemp.CleanOutBegin.Value.ToString();
                    this.cleanOutWashEnd.Text = endoscopeTemp.CleanOutEnd.Value.ToString();

                    // 消毒
                    try
                    {
                        washTime = new TimeSpan();
                        washTime = endoscopeTemp.DipInEnd.Value - endoscopeTemp.DipInBegin.Value;
                    }
                    catch (Exception)
                    {
                        endoscopeTemp.DipInEnd = null;
                        endoscopeTemp.DipInBegin = null;
                    }

                    if (washTime.TotalSeconds >= Convert.ToInt32(GSetting.StepTime["DipIn"]))
                    {
                        this.dipInBeginIsPass.Values.Image = global::ProxyClient.Properties.Resources.right;
                        this.manualWashTime.ForeColor = Color.Green;
                    }
                    else
                    {
                        this.dipInBeginIsPass.Values.Image = global::ProxyClient.Properties.Resources.wrong;
                        this.firstWashTime.ForeColor = Color.Red;
                    }

                    this.dipInBegin.Text = endoscopeTemp.DipInBegin.Value.ToString();
                    this.dipInEnd.Text = endoscopeTemp.DipInEnd.Value.ToString();
                    this.dipInTime.Text = washTime > TimeSpan.Zero ? washTime.ToSafeString() : TimeSpan.Zero.ToSafeString();

                    // 末洗
                    try
                    {
                        washTime = new TimeSpan();
                        washTime = endoscopeTemp.LastWashEnd.Value - endoscopeTemp.LastWashBegin.Value;
                    }
                    catch (Exception)
                    {
                        endoscopeTemp.LastWashEnd = null;
                        endoscopeTemp.LastWashBegin = null;
                    }

                    if (washTime.TotalSeconds >= Convert.ToInt32(GSetting.StepTime["LastWash"]))
                    {
                        this.lastWashIsPass.Values.Image = global::ProxyClient.Properties.Resources.right;
                        this.manualWashTime.ForeColor = Color.Green;
                    }
                    else
                    {
                        this.lastWashIsPass.Values.Image = global::ProxyClient.Properties.Resources.wrong;
                        this.firstWashTime.ForeColor = Color.Red;
                    }

                    this.lastWashBegin.Text = endoscopeTemp.LastWashBegin.Value.ToString();
                    this.lastWashEnd.Text = endoscopeTemp.LastWashEnd.Value.ToString();
                    this.lastWashTime.Text = washTime > TimeSpan.Zero ? washTime.ToSafeString() : TimeSpan.Zero.ToSafeString();
                    #endregion
                }

                // 二次清洗
                if (endoscopeTemp.CleanType.Trim() == "2")
                {
                    if (GSetting.PortMapDict.Keys.Contains(endoscopeTemp.AutoCleanNo))
                    {
                        if (GSetting.PortMapDict[endoscopeTemp.AutoCleanNo].MarkText == "自动清洗机")
                        {
                            this.secGroBox.Values.Description = endoscopeTemp.AutoCleanNo + "号自动清洗机";
                        }
                        else
                        {
                            this.secGroBox.Values.Description = "手动清洗";
                        }
                    }

                    this.secGroBox.Values.Description += string.Format("({0})", endoscopeTemp.WashDate.Value.ToLongDateString());
                    this.cleanGroBox.Values.Heading = string.Empty;
                    this.cleanGroBox.Values.Description = string.Empty;

                    // 设置软件类型为手洗工作站 AutoClean=2时 为机洗,机洗和手洗的差别在于二次清洗浸泡消毒的时间长短。
                    if (GSetting.AutoClean == "1")
                    {
                        this.cleanGroBox.Enabled = false;
                        this.secGroBox.Enabled = true;

                        // 二次消毒
                        try
                        {
                            washTime = new TimeSpan();
                            washTime = endoscopeTemp.DipInSecEnd.Value - endoscopeTemp.DipInSecBegin.Value;
                        }
                        catch (Exception)
                        {
                            endoscopeTemp.DipInSecBegin = null;
                            endoscopeTemp.LastWashEnd = null;
                        }

                        if (washTime.TotalSeconds >= Convert.ToInt32(GSetting.StepTime["DipInSec"]))
                        {
                            this.dipInSecIsPass.Values.Image = global::ProxyClient.Properties.Resources.right;
                            this.manualWashTime.ForeColor = Color.Green;
                        }
                        else
                        {
                            this.dipInSecIsPass.Values.Image = global::ProxyClient.Properties.Resources.wrong;
                            this.firstWashTime.ForeColor = Color.Red;
                        }

                        this.dipInSecBegin.Text = endoscopeTemp.DipInSecBegin.Value.ToString();
                        this.dipInSecEnd.Text = endoscopeTemp.DipInSecEnd.Value.ToString();
                        this.dipInSecTime.Text = washTime > TimeSpan.Zero ? washTime.ToSafeString() : TimeSpan.Zero.ToSafeString();

                        // 二次末洗
                        try
                        {
                            washTime = new TimeSpan();
                            washTime = endoscopeTemp.LastWashSecEnd.Value - endoscopeTemp.LastWashSecBegin.Value;
                        }
                        catch (Exception)
                        {
                            endoscopeTemp.LastWashSecEnd = null;
                            endoscopeTemp.LastWashSecBegin = null;
                        }

                        if (washTime.TotalSeconds >= Convert.ToInt32(GSetting.StepTime["LastWashSec"]))
                        {
                            this.lastWashSecIsPass.Values.Image = global::ProxyClient.Properties.Resources.right;
                            this.manualWashTime.ForeColor = Color.Green;
                        }
                        else
                        {
                            this.lastWashSecIsPass.Values.Image = global::ProxyClient.Properties.Resources.wrong;
                            this.firstWashTime.ForeColor = Color.Red;
                        }

                        this.lastWashSecBegin.Text = endoscopeTemp.LastWashSecBegin.Value.ToString();
                        this.lastWashSecEnd.Text = endoscopeTemp.LastWashSecEnd.Value.ToString();
                        this.lastWashSecTime.Text = washTime > TimeSpan.Zero ? washTime.ToSafeString() : TimeSpan.Zero.ToSafeString();
                    }
                    else
                    {
                        this.cleanGroBox.Enabled = false;
                        this.secGroBox.Enabled = true;

                        // 二次消毒
                        try
                        {
                            washTime = new TimeSpan();
                            washTime = endoscopeTemp.DipInSecEnd.Value - endoscopeTemp.DipInSecBegin.Value;
                        }
                        catch (Exception)
                        {
                            endoscopeTemp.DipInSecEnd = null;
                            endoscopeTemp.DipInSecBegin = null;
                        }

                        if (washTime.TotalSeconds >= Convert.ToInt32(GSetting.StepTime["DipInSecAuto"]))
                        {
                            this.dipInSecIsPass.Values.Image = global::ProxyClient.Properties.Resources.right;
                            this.manualWashTime.ForeColor = Color.Green;
                        }
                        else
                        {
                            this.dipInSecIsPass.Values.Image = global::ProxyClient.Properties.Resources.wrong;
                            this.firstWashTime.ForeColor = Color.Red;
                        }

                        this.dipInSecBegin.Text = endoscopeTemp.DipInSecBegin.Value.ToString();
                        this.dipInSecEnd.Text = endoscopeTemp.DipInSecEnd.Value.ToString();
                        this.dipInSecTime.Text = washTime > TimeSpan.Zero ? washTime.ToSafeString() : TimeSpan.Zero.ToSafeString();

                        // 二次末洗
                        try
                        {
                            washTime = new TimeSpan();
                            washTime = endoscopeTemp.LastWashSecEnd.Value - endoscopeTemp.LastWashSecBegin.Value;
                        }
                        catch (Exception)
                        {
                            endoscopeTemp.LastWashSecEnd = null;
                            endoscopeTemp.LastWashSecBegin = null;
                        }

                        if (washTime.TotalSeconds >= Convert.ToInt32(GSetting.StepTime["LastWashSecAuto"]))
                        {
                            this.lastWashSecIsPass.Values.Image = global::ProxyClient.Properties.Resources.right;
                            this.manualWashTime.ForeColor = Color.Green;
                        }
                        else
                        {
                            this.lastWashSecIsPass.Values.Image = global::ProxyClient.Properties.Resources.wrong;
                            this.firstWashTime.ForeColor = Color.Red;
                        }

                        this.lastWashSecBegin.Text = endoscopeTemp.LastWashSecBegin.Value.ToString();
                        this.lastWashSecEnd.Text = endoscopeTemp.LastWashSecEnd.Value.ToString();
                        this.lastWashSecTime.Text = washTime > TimeSpan.Zero ? washTime.ToSafeString() : TimeSpan.Zero.ToSafeString();
                    }
                }
            }
            catch (Exception)
            {
            }
        }
Exemplo n.º 27
0
        public int TemperatureTOF(int TempF)
        {
            var Fahrenheit = new ClassLibrary();

            return(Fahrenheit.ConvertCtoF(TempF));
        }
Exemplo n.º 28
0
 public byte[] TransferFile(ClassLibrary.Entites.File file, long partNumber)
 {
     string filePath = Config.SharedFolder + @"\" + file.FileName;
     return FileUtility.ReadFilePart(filePath, partNumber);
 }
Exemplo n.º 29
0
        /// <summary>
        /// The result value is: 0 ( SmartCloseButton ), 1 ( SmartDropDownButton ), -1 ( Not Found ).
        /// </summary>
        /// <param name="pt">Mouse point coordinate</param>
        /// <param name="rectangle">Smart button rectangle</param>
        /// <param name="state">Smart button state</param>
        /// <param name="result">-1, 0 or 1.</param>
        public void GetSmartButtonHitTest(Point pt, out Rectangle rectangle,
            out ClassLibrary.Winform.UI.Controls.PluggableTabControl.ButtonState state, out int result)
        {
            int i = -1;
            rectangle = Rectangle.Empty;
            foreach (KeyValuePair<Rectangle, ClassLibrary.Winform.UI.Controls.PluggableTabControl.ButtonState> current in smartButtonRectangles)
            {
                i++;
                rectangle = current.Key;
                if (!rectangle.Contains(pt))
                    continue;

                state = current.Value;
                result = i;
                return;
            }
            state = ClassLibrary.Winform.UI.Controls.PluggableTabControl.ButtonState.Disabled;
            result = -1;
        }