public bool EditOperation(Guid operationID, OperationConfiguration item)
        {
            try
            {
                using (WanTaiEntities entities = new WanTaiEntities())
                {
                    OperationConfiguration record = entities.OperationConfigurations.Where(p => p.OperationID == operationID).FirstOrDefault();
                    record.OperationName     = item.OperationName;
                    record.OperationType     = item.OperationType;
                    record.OperationSequence = item.OperationSequence;
                    record.SubOperationIDs   = item.SubOperationIDs;
                    record.DisplayFlag       = item.DisplayFlag;
                    record.ScriptFileName    = item.ScriptFileName;
                    record.RunTime           = item.RunTime;

                    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() + "->EditConfiguration", SessionInfo.ExperimentID);
                return(false);
            }
        }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            UserInfo user        = userInfoController.GetUserByName(SessionInfo.LoginName);
            string   prePassword = txtPrePassword.Password.Trim();
            string   password    = txtPassword.Password.Trim();
            string   passwordTwo = txtPasswordTwo.Password.Trim();

            if (password == string.Empty)
            {
                MessageBox.Show("密码不能为空!", "系统提示");
                return;
            }
            if (prePassword != user.LoginPassWord)
            {
                MessageBox.Show("旧密码输入错误。", "系统提示");
                return;
            }

            if (password != passwordTwo)
            {
                MessageBox.Show("确认密码错误。", "系统提示");
                return;
            }
            user.LoginPassWord = password;
            user.UpdateTime    = DateTime.Now;
            string message;

            userInfoController.Update(user, out message);
            LogInfoController.AddLogInfo(LogInfoLevelEnum.Operate, "修改密码 " + message, SessionInfo.LoginName, this.GetType().Name, SessionInfo.ExperimentID);
            MessageBox.Show(message, "系统提示");
            this.Close();
        }
Beispiel #3
0
        private void SendRespons(string m_OriginMsgGUID, EVOApiErrorMsg.ErrorResponseOption Response)
        {
            //response to an error, depends on button options for each EVOware error message
            EVOApiErrorMsg.ErrorResponseOption iResponse;
            //Indicate the error display will be handled by the client application or EVOware
            EVOApiErrorMsg.ErrorControlModes iMode;
            //response message object
            EVOApiErrorMsg.XmlMsgResponse xmlMsg;
            iResponse = Response;
            //Error Control Mode whether let’s EVOware handling display the error, in this sample EVOware does
            //not need to display the error window
            if (Response == ErrorResponseOption.NONE)
            {
                iMode = EVOApiErrorMsg.ErrorControlModes.EvowareControled;
            }
            else
            {
                iMode = EVOApiErrorMsg.ErrorControlModes.RemotelyControled;
            }
            //Instantiate new response message
            // the OriginMsgGUID is the MsgGUID of the message that we want to answer (required since
            // EVOApiErrorMessage V2.2.0.2, see example above)
            xmlMsg = new XmlMsgResponse(iMode, iResponse, m_OriginMsgGUID);
            //Sending response back to EVOware
            int MCSID = m_mcsErrorWrapper.SendingXmlMsg(m_clientID, xmlMsg, m_mcsReceiver,
                                                        MSGChannels.MsgResponseChannel, 0);

            if (onSendErrorResponse != null)
            {
                onSendErrorResponse();
            }

            LogInfoController.AddLogInfo(LogInfoLevelEnum.Debug, "Send Reponse to EVO", SessionInfo.LoginName, this.GetType().ToString() + "->" + "SendRespons()", SessionInfo.ExperimentID);
        }
Beispiel #4
0
        /// <summary>
        /// ReagentAndSuppliesConfiguration of one rotation
        /// </summary>
        /// <param name="operationsOrders"></param>
        /// <returns></returns>
        public List <ReagentAndSuppliesConfiguration> GetReagentAndSuppliesNeeded(Dictionary <short, bool> operationsOrders, FormulaParameters formulaParameters)
        {
            List <ReagentAndSuppliesConfiguration> list = new List <ReagentAndSuppliesConfiguration>();

            try
            {
                using (WanTaiEntities wanTaiEntites = new WanTaiEntities())
                {
                    list = wanTaiEntites.ReagentAndSuppliesConfigurations.Where(c => c.ActiveStatus == true).ToList();
                }
                foreach (ReagentAndSuppliesConfiguration r in list)
                {
                    double volumne = CalcVolume(r.CalculationFormula, operationsOrders, formulaParameters);
                    r.NeedVolume = r.ItemType >= 100 ? Math.Ceiling(volumne) : volumne;
                    if (r.ItemType == DiTiType.DiTi200 || r.ItemType == DiTiType.DiTi1000)
                    {
                        r.ActualSavedVolume = volumne;
                        r.NeedVolume        = Math.Ceiling(volumne / 96 * 10) / 10;
                    }
                }
            }
            catch (Exception ex)
            {
                string errorMessage = ex.Message + System.Environment.NewLine + ex.StackTrace;
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().Name, SessionInfo.ExperimentID);
                throw;
            }
            return(list);
        }
        public bool Delete(Guid experimentId)
        {
            try
            {
                string connectionString = WanTai.Common.Configuration.GetConnectionString();
                ///todo: add control,each role user only can see the specific experiments
                string commandText = "Delete_Experiment";

                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();

                    using (SqlCommand cmd = new SqlCommand(commandText, conn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@experimentId", experimentId);

                        cmd.ExecuteNonQuery();
                    }
                }

                return true;
            }
            catch (Exception e)
            {
                string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace;
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "->Delete", SessionInfo.ExperimentID);
                return false;
            }
        }
Beispiel #6
0
        public bool EditConfiguration(Guid itemId, ReagentAndSuppliesConfiguration item)
        {
            try
            {
                using (WanTaiEntities entities = new WanTaiEntities())
                {
                    ReagentAndSuppliesConfiguration record = entities.ReagentAndSuppliesConfigurations.Where(p => p.ItemID == itemId).FirstOrDefault();
                    record.EnglishName        = item.EnglishName;
                    record.DisplayName        = item.DisplayName;
                    record.Position           = item.Position;
                    record.Grid               = item.Grid;
                    record.Unit               = item.Unit;
                    record.ItemType           = item.ItemType;
                    record.CalculationFormula = item.CalculationFormula;
                    record.ContainerName      = item.ContainerName;
                    record.BarcodePrefix      = item.BarcodePrefix;
                    record.Color              = item.Color;

                    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() + "->EditConfiguration", SessionInfo.ExperimentID);
                return(false);
            }
        }
Beispiel #7
0
        public bool DeleteRotationPCRTestResult(Guid rotationId)
        {
            try
            {
                string connectionString = WanTai.Common.Configuration.GetConnectionString();
                string commandText      = "DELETE FROM  PCRTestResult WHERE RotationID=@RotationID";
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();

                    using (SqlCommand cmd = new SqlCommand(commandText, conn))
                    {
                        cmd.Parameters.AddWithValue("@RotationID", rotationId);

                        cmd.ExecuteNonQuery();
                        return(true);
                    }
                }
            }
            catch (Exception e)
            {
                string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace;
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "->DeleteRotationPCRTestResult", SessionInfo.ExperimentID);
                return(false);
            }
        }
        public bool EditByTypeId(List <SystemFluidConfiguration> recordList, short typeId)
        {
            try
            {
                using (WanTaiEntities entities = new WanTaiEntities())
                {
                    var records = entities.SystemFluidConfigurations.Where(p => p.ItemType == typeId);
                    foreach (SystemFluidConfiguration record in records)
                    {
                        entities.DeleteObject(record);
                    }

                    foreach (SystemFluidConfiguration record in recordList)
                    {
                        record.ItemID = WanTaiObjectService.NewSequentialGuid();
                        entities.AddToSystemFluidConfigurations(record);
                    }

                    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() + "." + MethodBase.GetCurrentMethod(), SessionInfo.ExperimentID);
                return(false);
            }
        }
Beispiel #9
0
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            string userName = txtUserName.Text.Trim();
            string password = txtPassword.Password.Trim();

            if (userName == string.Empty)
            {
                MessageBox.Show("用户名不允许为空", "系统提示");
                return;
            }
            if (password == string.Empty)
            {
                MessageBox.Show("密码不允许为空", "系统提示");
                return;
            }
            if (System.Text.Encoding.Default.GetByteCount(userName) > 255)
            {
                MessageBox.Show("用户名最大长度为127个汉字。", "系统提示");
                return;
            }


            string passwordTwo = txtPasswordTwo.Password.Trim();

            if (System.Text.Encoding.Default.GetByteCount(password) > 255)
            {
                MessageBox.Show("密码最大长度为127个汉字。", "系统提示");
                return;
            }
            if (password == passwordTwo)
            {
                if (userInfoController.GetUserByName(userName) != null)
                {
                    MessageBox.Show("用户名[" + userName + "]已经存在。", "系统提示");
                }
                else
                {
                    UserInfo userInfo = new UserInfo()
                    {
                        UserID        = WanTaiObjectService.NewSequentialGuid(),
                        CreateName    = SessionInfo.LoginName,
                        LoginName     = userName,
                        LoginPassWord = password,
                        CreateTime    = DateTime.Now,
                        RoleName      = comboRole.SelectedValue.ToString()
                    };
                    string message;
                    userInfoController.Add(userInfo, out message);
                    LogInfoController.AddLogInfo(LogInfoLevelEnum.Operate, "添加用户 成功", SessionInfo.LoginName, this.GetType().Name, SessionInfo.ExperimentID);
                    MessageBox.Show(message, "系统提示");
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("两次输入密码不一致!请重新输入。", "系统提示");
            }
        }
Beispiel #10
0
        private void OnLogClick(object sender, RoutedEventArgs e)
        {
            Guid   RotatioID  = new Guid((sender as TextBlock).Uid);
            string LogContent = LogInfoController.GetRotationLog(RotatioID);

            LogContentView logView = new LogContentView();

            logView.SetLogContent(LogContent);
            logView.ShowDialog();
        }
Beispiel #11
0
        private void SettingEVOApiTestInitialState()
        {
            m_clientCookie = m_mcsErrorWrapper.Connect(m_clientName, (MCSLib.IReceiveMsg) this);

            if (m_clientCookie == null)
            {
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, "m_clientCookie is null, can not connect to MCS", SessionInfo.LoginName, this.GetType().ToString() + "->" + "SettingEVOApiTestInitialState()", SessionInfo.ExperimentID);
                return;
            }

            m_clientID = m_clientCookie.PartnerID;
            m_mcsErrorWrapper.Subscribe(m_clientID, MSGChannels.MsgErrorsChannel);
            LogInfoController.AddLogInfo(LogInfoLevelEnum.Info, "Successful connect to MCS", SessionInfo.LoginName, this.GetType().ToString() + "->" + "SettingEVOApiTestInitialState()", SessionInfo.ExperimentID);
        }
Beispiel #12
0
        private void ErrorEvent(DateTime StartTime, DateTime EndTime, string Device, string Macro, string Object, string Message, short Status, string ProcessName, int ProcessID, string MacroID)
        {
            string msgError;

            msgError = string.Format(WanTai.Common.Resources.WanTaiResource.EVOAPI_EVENTLOG,
                                     StartTime, EndTime, Device, Macro, Object, Message, Status, ProcessName, ProcessID, MacroID);

            LogInfoController.AddLogInfo(LogInfoLevelEnum.EVORunTime, "msg:" + msgError, SessionInfo.LoginName, this.GetType().ToString() + "->" + "ErrorEvent()", SessionInfo.ExperimentID);

            if (errorList != null)
            {
                errorList.Add(Message);
            }
        }
Beispiel #13
0
        public int GetTotalCount(string experimentName, LogInfoLevelEnum logLevel)
        {
            int count = 0;

            try
            {
                string connectionString = WanTai.Common.Configuration.GetConnectionString();
                ///todo: add control,each role user only can see the specific experiments
                string commandText = "SELECT count(LogID) FROM LogInfo left join ExperimentsInfo on LogInfo.ExperimentID = ExperimentsInfo.ExperimentID";
                commandText = commandText + " WHERE LogInfo.LogLevel = " + (int)logLevel;
                if (!string.IsNullOrEmpty(experimentName))
                {
                    commandText = commandText + " AND ExperimentsInfo.ExperimentName like '%" + experimentName + "%'";
                }
                UserInfoController userInfoController = new UserInfoController();
                RoleInfo           userRole           = userInfoController.GetRoleByUserName(SessionInfo.LoginName);
                if (userInfoController.GetAuthorize(AccessAuthority.LogInfo) == AccessAuthority.All)
                {
                    commandText = commandText + @" AND (LogInfo.LoginName IS NULL or LogInfo.LoginName in 
                    (SELECT LoginName FROM UserInfo u left join roleinfo r on r.RoleName=u.RoleName WHERE r.RoleLevel<=" + userRole.RoleLevel + " ))";
                }
                else
                {
                    commandText = commandText + " AND LogInfo.LoginName='" + SessionInfo.LoginName + "'";
                }
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();

                    using (SqlCommand cmd = new SqlCommand(commandText, conn))
                    {
                        using (SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default))
                        {
                            if (reader.Read())
                            {
                                count = (int)reader.GetValue(0);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace;
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "->GetTotalCount", SessionInfo.ExperimentID);
                throw;
            }

            return(count);
        }
 public OperationConfiguration GetOperation(Guid operationID)
 {
     try
     {
         using (WanTaiEntities entities = new WanTaiEntities())
         {
             OperationConfiguration record = entities.OperationConfigurations.Where(c => c.OperationID == operationID).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() + "->GetOperation", SessionInfo.ExperimentID);
         throw;
     }
 }
Beispiel #15
0
 public bool CheckRotationHasPCRTestResult(Guid rotationId, Guid experimentId)
 {
     try
     {
         using (WanTaiEntities entities = new WanTaiEntities())
         {
             var records = entities.PCRTestResults.Where(c => c.RotationID == rotationId && c.ExperimentID == experimentId);
             return(records.Count() > 0 ? true : false);
         }
     }
     catch (Exception e)
     {
         string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace;
         LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "->CheckRotationHasPCRTestResult", SessionInfo.ExperimentID);
         throw;
     }
 }
 public List <OperationConfiguration> GetAllOperations()
 {
     try
     {
         using (WanTaiEntities entities = new WanTaiEntities())
         {
             var records = entities.OperationConfigurations.OrderBy(c => c.OperationSequence);
             return(records.ToList <OperationConfiguration>());
         }
     }
     catch (Exception e)
     {
         string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace;
         LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "->GetAllOperations", SessionInfo.ExperimentID);
         throw;
     }
 }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            string experimentName = txtExperimentName.Text.Trim();

            if (experimentName == string.Empty)
            {
                errInfo.Text = "实验名称不能为空。";
                return;
            }
            else if (System.Text.Encoding.Default.GetByteCount(experimentName) > 255)
            {
                errInfo.Text = "实验名称允许最大长度为127个汉字";
                return;
            }

            ExperimentController controller = new ExperimentController();

            if (controller.ExperimentNameExists(experimentName))
            {
                errInfo.Text = "实验名称\"" + txtExperimentName.Text + "\"已存在。";
                return;
            }
            ExperimentsInfo experimentsInfo = new ExperimentsInfo();

            experimentsInfo.ExperimentID       = WanTaiObjectService.NewSequentialGuid();
            experimentsInfo.ExperimentName     = experimentName;
            experimentsInfo.LoginName          = txtOrperatorName.Text;
            experimentsInfo.Remark             = txtRemark.Text;
            experimentsInfo.StartTime          = DateTime.Now;
            experimentsInfo.State              = (short)ExperimentStatus.Create;;
            SessionInfo.CurrentExperimentsInfo = experimentsInfo;
            if (controller.CreateExperiment(experimentsInfo))
            {
                SessionInfo.ExperimentID = experimentsInfo.ExperimentID;
                SessionInfo.RotationFormulaParameters = new Dictionary <Guid, FormulaParameters>();
                SessionInfo.PraperRotation            = null;
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Operate, "新建实验 成功", SessionInfo.LoginName, this.GetType().Name, SessionInfo.ExperimentID);
                this.DialogResult = true;
                this.Close();
            }
            else
            {
                errInfo.Text = "添加实验失败。";
            }
        }
Beispiel #18
0
        public string GetBarcodePrefix(short itemType)
        {
            string barcodePrefix = null;

            using (WanTaiEntities entities = new WanTaiEntities())
            {
                ReagentAndSuppliesConfiguration reagentConfig = entities.ReagentAndSuppliesConfigurations.FirstOrDefault(P => P.ItemType == itemType);
                if (reagentConfig != null)
                {
                    barcodePrefix = reagentConfig.BarcodePrefix;
                }
                else
                {
                    LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, itemType.ToString() + "doesn't exist ein ReagentAndSuppliesConfiguration", "", this.GetType().Name, null);
                }
            }
            return(barcodePrefix);
        }
Beispiel #19
0
 public bool Create(ReagentAndSuppliesConfiguration configuration)
 {
     try
     {
         using (WanTaiEntities entities = new WanTaiEntities())
         {
             entities.AddToReagentAndSuppliesConfigurations(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 Create(SystemFluidConfiguration record)
 {
     try
     {
         using (WanTaiEntities entities = new WanTaiEntities())
         {
             entities.AddToSystemFluidConfigurations(record);
             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() + "." + MethodBase.GetCurrentMethod(), SessionInfo.ExperimentID);
         return(false);
     }
 }
Beispiel #21
0
        private void btnEdit_Click(object sender, RoutedEventArgs e)
        {
            string      message;
            DataRowView rowView = (DataRowView)dgUsers.SelectedItem;
            UserInfo    user    = usersList.FirstOrDefault(P => P.UserID == (Guid)rowView["UserID"]);

            user.LoginPassWord = rowView["LoginPassWord"].ToString();
            if (user.LoginPassWord == string.Empty)
            {
                MessageBox.Show("密码不允许为空!", "系统提示");
                return;
            }
            user.RoleName   = ((ComboBox)dgUsers.Columns[3].GetCellContent(rowView)).SelectedValue.ToString();
            user.UpdateTime = DateTime.Now;
            userInfoController.Update(user, out message);
            LogInfoController.AddLogInfo(LogInfoLevelEnum.Operate, "修改用户 " + message, SessionInfo.LoginName, this.GetType().Name, SessionInfo.ExperimentID);
            MessageBox.Show(message, "系统提示");
        }
        public List <RotationInfo> GetFinishedRotation(Guid experimentId)
        {
            List <RotationInfo> recordList = new List <RotationInfo>();

            try
            {
                string connectionString = WanTai.Common.Configuration.GetConnectionString();
                string commandText      = "SELECT distinct RotationInfo.RotationID, RotationInfo.RotationName"
                                          + " FROM Plates LEFT JOIN RotationInfo on Plates.RotationID = RotationInfo.RotationID"
                                          + " WHERE Plates.PlateType=@PlateType and Plates.ExperimentID=@ExperimentID and RotationInfo.State=@RotationState";
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();

                    using (SqlCommand cmd = new SqlCommand(commandText, conn))
                    {
                        cmd.Parameters.AddWithValue("@PlateType", PlateType.PCR_Plate);
                        cmd.Parameters.AddWithValue("@ExperimentID", experimentId);
                        cmd.Parameters.AddWithValue("@RotationState", RotationInfoStatus.Finish);

                        using (SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default))
                        {
                            while (reader.Read())
                            {
                                RotationInfo info = new RotationInfo();
                                info.RotationID   = (Guid)reader.GetValue(0);
                                info.RotationName = reader.GetValue(1).ToString();
                                recordList.Add(info);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace;
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "->GetFinishedRotation", experimentId);
                throw;
            }

            return(recordList);
        }
        public Dictionary <int, DataRow> GetPCRPositionsByPlateID(Guid PCRPlateID, Guid experimentId)
        {
            DataTable dataTable = new DataTable();
            Dictionary <int, DataRow> result = new Dictionary <int, DataRow>();

            try
            {
                string connectionString = WanTai.Common.Configuration.GetConnectionString();
                string commandText      = "SELECT TubeNumber, TestName, TubeType, PCRPosition FROM View_Tubes_PCRPlatePosition"
                                          + " WHERE PCRPlateID=@PCRPlateID order by PCRPosition";
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();

                    using (SqlCommand cmd = new SqlCommand(commandText, conn))
                    {
                        cmd.Parameters.AddWithValue("@PCRPlateID", PCRPlateID);

                        using (SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default))
                        {
                            dataTable.Load(reader);
                        }
                    }
                }

                foreach (DataRow row in dataTable.Rows)
                {
                    if (!result.ContainsKey((int)row["PCRPosition"]))
                    {
                        result.Add((int)row["PCRPosition"], row);
                    }
                }
            }
            catch (Exception e)
            {
                string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace;
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "->GetPCRPositionsByPlateID", experimentId);
                throw;
            }

            return(result);
        }
        public bool Delete(Guid operationID)
        {
            try
            {
                using (WanTaiEntities entities = new WanTaiEntities())
                {
                    var record = entities.OperationConfigurations.Where(c => c.OperationID == operationID).FirstOrDefault();
                    entities.DeleteObject(record);

                    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() + "->Delete", SessionInfo.ExperimentID);
                return(false);
            }
        }
Beispiel #25
0
        public bool UpdateActiveStatus(Guid itemId, bool status)
        {
            try
            {
                using (WanTaiEntities entities = new WanTaiEntities())
                {
                    ReagentAndSuppliesConfiguration record = entities.ReagentAndSuppliesConfigurations.Where(p => p.ItemID == itemId).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() + "->UpdateActiveStatus", SessionInfo.ExperimentID);
                return(false);
            }
        }
        public List <SystemFluidConfiguration> GetAllLiquidConfiguration()
        {
            List <SystemFluidConfiguration> recordList = null;

            try
            {
                using (WanTaiEntities entities = new WanTaiEntities())
                {
                    var records = entities.SystemFluidConfigurations;
                    recordList = records.ToList <SystemFluidConfiguration>();
                }
            }
            catch (Exception e)
            {
                string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace;
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "." + MethodBase.GetCurrentMethod(), SessionInfo.ExperimentID);
            }

            return(recordList);
        }
Beispiel #27
0
        private void save_Click(object sender, RoutedEventArgs e)
        {
            if (!validate())
            {
                return;
            }

            TestingItemConfiguration config = new TestingItemConfiguration();

            config.TestingItemName  = name_textBox.Text;
            config.TestingItemColor = color_Control.Background.ToString();
            config.DisplaySequence  = short.Parse(displaySequence_textBox.Text);
            config.WorkListFileName = workListFileName_textBox.Text;

            bool result = false;

            if (string.IsNullOrEmpty(editTestItemId))
            {
                config.TestingItemID = WanTaiObjectService.NewSequentialGuid();
                config.ActiveStatus  = true;
                result = controller.Create(config);
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Operate, "新建检测项目:" + config.TestingItemName + " " + (result == true ? "成功" : "失败"), SessionInfo.LoginName, this.GetType().ToString(), null);
            }
            else
            {
                result = controller.EditTestingItems(new Guid(editTestItemId), config);
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Operate, "修改检测项目:" + config.TestingItemName + " " + (result == true ? "成功" : "失败"), SessionInfo.LoginName, this.GetType().ToString(), null);
            }

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

            this.Close();
        }
Beispiel #28
0
        public List <RotationInfo> GetPCRResultRotation()
        {
            List <RotationInfo> recordList = new List <RotationInfo>();

            try
            {
                string connectionString = WanTai.Common.Configuration.GetConnectionString();
                //string commandText = "  select RotationID, RotationName from  RotationInfo"+
                //    " where RotationID in ( select distinct RotationID FROM PCRTestResult WHERE ExperimentID = @ExperimentID)";
                string commandText = "  select RotationID, RotationName from  RotationInfo" +
                                     " where ExperimentID = @ExperimentID";
                using (SqlConnection conn = new SqlConnection(connectionString))
                {
                    conn.Open();

                    using (SqlCommand cmd = new SqlCommand(commandText, conn))
                    {
                        cmd.Parameters.AddWithValue("@ExperimentID", SessionInfo.ExperimentID);

                        using (SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.Default))
                        {
                            while (reader.Read())
                            {
                                RotationInfo info = new RotationInfo();
                                info.RotationID   = (Guid)reader.GetValue(0);
                                info.RotationName = reader.GetValue(1).ToString();
                                recordList.Add(info);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace;
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "->GetPCRResultRotation", SessionInfo.ExperimentID);
                throw;
            }

            return(recordList);
        }
Beispiel #29
0
        public List <ReagentAndSuppliesConfiguration> GetAllActived()
        {
            List <ReagentAndSuppliesConfiguration> recordList = null;

            try
            {
                using (WanTaiEntities entities = new WanTaiEntities())
                {
                    var records = entities.ReagentAndSuppliesConfigurations.Where(c => c.ActiveStatus == true);
                    recordList = records.ToList <ReagentAndSuppliesConfiguration>();
                }
            }
            catch (Exception e)
            {
                string errorMessage = e.Message + System.Environment.NewLine + e.StackTrace;
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Error, errorMessage, SessionInfo.LoginName, this.GetType().ToString() + "->GetAll", SessionInfo.ExperimentID);
                throw;
            }

            return(recordList);
        }
Beispiel #30
0
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            string loginName = (string)(((DataRowView)dgUsers.CurrentItem)["LoginName"]);

            if (loginName == SessionInfo.LoginName)
            {
                MessageBox.Show("无法删除正在登陆的用户,请退出后再删除", "系统提示");
                return;
            }
            MessageBoxResult msResult = MessageBox.Show("确认要删除用户吗?", "系统提示", MessageBoxButton.YesNo);

            if (msResult == MessageBoxResult.Yes)
            {
                string message;
                Guid   userID = (Guid)(((DataRowView)dgUsers.CurrentItem)["UserID"]);
                userInfoController.Delete(userID, out message);
                LogInfoController.AddLogInfo(LogInfoLevelEnum.Operate, "删除用户 " + message, SessionInfo.LoginName, this.GetType().Name, SessionInfo.ExperimentID);
                MessageBox.Show(message, "系统提示");
                BindUserInfo();
            }
        }