예제 #1
0
        private void cb_PoolingRulesConfigurations_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (dg_TubesGroup.SelectedItem != null)
            {
                WanTai.DataModel.TubeGroup tubeGroup    = ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem));
                PoolingRulesConfiguration  PoolingRules = ((PoolingRulesConfiguration)e.AddedItems[0]);

                ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)).PoolingRulesID          = ((PoolingRulesConfiguration)e.AddedItems[0]).PoolingRulesID;
                ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)).PoolingRulesName        = ((PoolingRulesConfiguration)e.AddedItems[0]).PoolingRulesName;
                ((WanTai.DataModel.TubeGroup)(dg_TubesGroup.SelectedItem)).PoolingRulesTubesNumber = ((PoolingRulesConfiguration)e.AddedItems[0]).TubeNumber;
                CheckBox ch_Complement = CommFuntion.FindCellControl <CheckBox>("ch_Complement", dg_TubesGroup, dg_TubesGroup.SelectedIndex, 4);

                if (ch_Complement != null)
                {
                    if ((tubeGroup.TubesPosition.Split(']').Length - 1) % PoolingRules.TubeNumber > 0)
                    {
                        ch_Complement.IsEnabled = true;
                        if (MessageBox.Show("该分组需要补液,是否补液?", "系统提示!", MessageBoxButton.YesNo) == MessageBoxResult.Yes)
                        {
                            ch_Complement.IsChecked = true;
                        }
                        else
                        {
                            ch_Complement.IsChecked = false;
                        }
                    }
                    else
                    {
                        ch_Complement.IsEnabled = false;
                        ch_Complement.IsChecked = false;
                    }
                }
            }
        }
예제 #2
0
        private void InitField()
        {
            if (!string.IsNullOrEmpty(editPoolingRuleId))
            {
                PoolingRulesConfiguration config = controller.GetPoolingRule(new Guid(editPoolingRuleId));

                name_textBox.Text       = config.PoolingRulesName;
                tubeNumber_textBox.Text = config.TubeNumber.ToString();
            }
        }
 public PoolingRulesConfiguration GetPoolingRule(Guid PoolingRulesID)
 {
     try
     {
         using (WanTaiEntities entities = new WanTaiEntities())
         {
             PoolingRulesConfiguration record = entities.PoolingRulesConfigurations.Where(c => c.PoolingRulesID == PoolingRulesID).FirstOrDefault();
             return(record);
         }
     }
     catch (Exception e)
     {
         string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace;
         LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "->GetPoolingRule", SessionInfo.ExperimentID);
         throw;
     }
 }
 public bool Create(PoolingRulesConfiguration configuration)
 {
     try
     {
         using (WanTaiEntities entities = new WanTaiEntities())
         {
             entities.AddToPoolingRulesConfigurations(configuration);
             entities.SaveChanges();
             return(true);
         }
     }
     catch (Exception e)
     {
         string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace;
         LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "->Create", SessionInfo.ExperimentID);
         return(false);
     }
 }
        public bool UpdatePoolingRuleActiveStatus(Guid PoolingRulesID, bool status)
        {
            try
            {
                using (WanTaiEntities entities = new WanTaiEntities())
                {
                    PoolingRulesConfiguration record = entities.PoolingRulesConfigurations.Where(p => p.PoolingRulesID == PoolingRulesID).FirstOrDefault();
                    record.ActiveStatus = status;

                    entities.SaveChanges();
                    return(true);
                }
            }
            catch (Exception e)
            {
                string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace;
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "->UpdatePoolingRuleActiveStatus", SessionInfo.ExperimentID);
                return(false);
            }
        }
예제 #6
0
        private void save_Click(object sender, RoutedEventArgs e)
        {
            if (!validate())
            {
                return;
            }

            PoolingRulesConfiguration config = new PoolingRulesConfiguration();

            config.PoolingRulesName = name_textBox.Text;
            config.TubeNumber       = int.Parse(tubeNumber_textBox.Text);

            bool result = false;

            if (string.IsNullOrEmpty(editPoolingRuleId))
            {
                config.PoolingRulesID = WanTaiObjectService.NewSequentialGuid();
                config.ActiveStatus   = true;
                result = controller.Create(config);
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Operate, "新建混样方式:" + config.PoolingRulesName + " " + (result == true ? "成功" : "失败"), SessionInfo.LoginName, this.GetType().ToString(), null);
            }
            else
            {
                result = controller.EditPoolingRules(new Guid(editPoolingRuleId), config);
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Operate, "修改混样方式:" + config.PoolingRulesName + " " + (result == true ? "成功" : "失败"), SessionInfo.LoginName, this.GetType().ToString(), null);
            }

            if (result)
            {
                MessageBox.Show("保存成功", "系统提示");
                this.DialogResult = true;
            }
            else
            {
                MessageBox.Show("保存失败", "系统提示");
            }

            this.Close();
        }