Example #1
0
        private void CheckHeaterScanResult(DataTable dtScan)
        {
            if (dtScan.Rows.Count == 0)
            {
                return;
            }
            string str1 = "+";
            string str2 = "-";

            List <PlateBase> PCRLiquidTups = ViewPlates.FindAll(P => (P.ItemType > 0 && P.ItemType < 100 && P.ItemType % 5 == 0));

            foreach (PlateBase tub in PCRLiquidTups)
            {
                string liquidName = tub.EnglishName.Replace(str1, string.Empty).Replace(str2, string.Empty);
                ReagentSuppliesType liquidType = reagentSuppliesType.FirstOrDefault(P => P.TypeId == tub.ItemType.ToString());
                if (liquidType != null)
                {
                    liquidName = liquidType.TypeName + " " + liquidName;
                }
                if (dtScan.Columns.Contains(liquidName))
                {
                    double columnValue = saveConvertion.GetSafeDouble(dtScan.Rows[0][liquidName]);
                    tub.FirstAddVolume = columnValue;
                    tub.Correct        = tub.FirstAddVolume >= (tub.NeedVolume + tub.CurrentVolume);
                    ReagentAndSuppliesConfiguration reagent = reagentAndSupplies.FirstOrDefault(P => P.BarcodePrefix == tub.BarcodePrefix);
                    if (reagent != null)
                    {
                        reagent.FirstAddVolume += tub.FirstAddVolume;
                    }
                }
            }
        }
        private void save_Click(object sender, RoutedEventArgs e)
        {
            if (!validate())
            {
                return;
            }

            ReagentAndSuppliesConfiguration configuration = new ReagentAndSuppliesConfiguration();

            configuration.EnglishName = name_textBox.Text;
            configuration.DisplayName = displayName_textBox.Text;
            configuration.Position    = int.Parse(position_textBox.Text);
            configuration.Grid        = int.Parse(grid_textBox.Text);
            configuration.Unit        = unit_label.Content.ToString();
            ComboBoxItem        selectedItem = type_comboBox.SelectedItem as ComboBoxItem;
            ReagentSuppliesType type         = (ReagentSuppliesType)selectedItem.DataContext;

            configuration.ItemType           = short.Parse(type.TypeId);
            configuration.CalculationFormula = calculation_textBox.Text;
            ComboBoxItem carrier_selectedItem = carrier_comboBox.SelectedItem as ComboBoxItem;

            configuration.ContainerName = carrier_selectedItem.Content.ToString();
            configuration.BarcodePrefix = barcode_textBox.Text;
            configuration.Color         = color_Control.Background.ToString();
            bool result = false;

            if (string.IsNullOrEmpty(editedItemId))
            {
                configuration.ItemID       = WanTaiObjectService.NewSequentialGuid();
                configuration.ActiveStatus = true;
                result = controller.Create(configuration);
                WanTai.Controller.LogInfoController.AddLogInfo(LogInfoLevelEnum.Operate, "新建试剂耗材:" + configuration.EnglishName + " " + (result == true ? "成功" : "失败"), SessionInfo.LoginName, this.GetType().ToString(), null);
            }
            else
            {
                result = controller.EditConfiguration(new Guid(editedItemId), configuration);
                WanTai.Controller.LogInfoController.AddLogInfo(LogInfoLevelEnum.Operate, "修改试剂耗材:" + configuration.EnglishName + " " + (result == true ? "成功" : "失败"), SessionInfo.LoginName, this.GetType().ToString(), null);
            }

            if (result)
            {
                MessageBox.Show("保存成功", "系统提示");
            }
            else
            {
                MessageBox.Show("保存失败", "系统提示");
            }
            this.Close();
        }
Example #3
0
        public static List <ReagentSuppliesType> GetReagentSuppliesTypes()
        {
            List <ReagentSuppliesType>       typeList = null;
            ReagentSuppliesTypeConfigSection section  = (ReagentSuppliesTypeConfigSection)ConfigurationManager.GetSection("ReagentSuppliesTypeSettings");

            if (section != null)
            {
                typeList = new List <ReagentSuppliesType>();
                foreach (ReagentSuppliesTypeElement element in section.ReagentSuppliesTypeItems)
                {
                    ReagentSuppliesType type = new ReagentSuppliesType();
                    type.TypeName = element.TypeName;;
                    type.TypeId   = element.TypeId;
                    type.Unit     = element.Unit;
                    typeList.Add(type);
                }
            }
            return(typeList);
        }
        private void type_comboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBoxItem        selectedItem = (ComboBoxItem)type_comboBox.SelectedItem;
            ReagentSuppliesType type         = (ReagentSuppliesType)selectedItem.DataContext;

            if (type != null)
            {
                if (!string.IsNullOrEmpty(type.Unit))
                {
                    unit_label.Content = type.Unit;
                }
                else
                {
                    unit_label.Content = "";
                }
            }
            else
            {
                unit_label.Content = "";
            }
        }
        private void InitField()
        {
            if (!string.IsNullOrEmpty(editedItemId))
            {
                ReagentAndSuppliesConfiguration item = controller.GetConfiguration(new Guid(editedItemId));
                this.name_textBox.Text        = item.EnglishName;
                this.displayName_textBox.Text = item.DisplayName;
                foreach (ComboBoxItem comboxItem in type_comboBox.Items)
                {
                    ReagentSuppliesType reagentSuppliesType = (ReagentSuppliesType)comboxItem.DataContext;
                    if (reagentSuppliesType.TypeId == item.ItemType.ToString())
                    {
                        comboxItem.IsSelected = true;
                        break;
                    }
                }

                this.barcode_textBox.Text = item.BarcodePrefix;

                foreach (ComboBoxItem comboxItem in carrier_comboBox.Items)
                {
                    if (comboxItem.Content.ToString() == item.ContainerName)
                    {
                        comboxItem.IsSelected = true;
                        break;
                    }
                }

                this.grid_textBox.Text        = item.Grid.ToString();
                this.position_textBox.Text    = item.Position.ToString();
                this.color_Control.Background = new SolidColorBrush()
                {
                    Color = (Color)ColorConverter.ConvertFromString(item.Color)
                };
                this.unit_label.Content       = item.Unit;
                this.calculation_textBox.Text = item.CalculationFormula;
            }
        }
Example #6
0
 private void BindRelatedControls()
 {
     foreach (PlateBase plate in ViewPlates)
     {
         if (plate.ItemType == 0)
         {
             BindRelatedControls(dgReagent, plate);
         }
         else if (plate.ItemType < 100 && plate.ItemType % 5 == 0)
         {
             List <ReagentSuppliesType> reagentSuppliesType = Common.Configuration.GetReagentSuppliesTypes();
             ReagentSuppliesType        reagentType         = reagentSuppliesType.FirstOrDefault(P => P.TypeId == plate.ItemType.ToString());
             if (reagentType != null && dataGridDictionary.ContainsKey(reagentType.TypeName))
             {
                 BindRelatedControls(dataGridDictionary[reagentType.TypeName], plate);
             }
         }
         else
         {
             BindRelatedControls(dgSupplies, plate);
         }
     }
 }
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     foreach (PlateBase plate in viewPlates)
     {
         if (plate.ItemType == 0)
         {
             BindRelatedControls(dgReagent, plate);
         }
         else if (plate.ItemType < 100 && plate.ItemType % 5 == 0)
         {
             List <ReagentSuppliesType> reagentSuppliesType = Common.Configuration.GetReagentSuppliesTypes();
             ReagentSuppliesType        reagentType         = reagentSuppliesType.FirstOrDefault(P => P.TypeId == plate.ItemType.ToString());
             if (reagentType != null && dataGridDictionary.ContainsKey(Convert.ToInt32(reagentType.TypeId)))
             {
                 BindRelatedControls(dataGridDictionary[Convert.ToInt32(reagentType.TypeId)], plate);
             }
         }
     }
     foreach (CarrierBase carrier in carrierBases)
     {
         carrier.UpdatePlate(viewPlates.FindAll(P => P.ContainerName == carrier.CarrierName));
         carrier.Scan();
     }
 }