private string GetErrRsn(ProcID aProcID) { string strProc = ""; switch (aProcID) { case ProcID.AddUserProc: strProc = "\n" + loadStr("IDS_SUGGEST_ITEM") + "\n" + loadStr("IDS_DELETE_EXISTED_USER_ID") + "\n" + loadStr("IDS_ADD_USER_AGAIN"); break; case ProcID.DelUserProc: strProc = "\n" + loadStr("IDS_SUGGEST_ITEM") + "\n" + loadStr("IDS_CHECK_USER_ID"); break; case ProcID.ConnectServers: strProc = "\n" + loadStr("IDS_SUGGEST_ITEM") + "\n" + loadStr("IDS_XSERVER_SHUT_DOWN") + "\n" + loadStr("IDS_XSERVER_RESTART") + "\n" + loadStr("IDS_CHECK_PRODUCT_ID") + "\n" + loadStr("IDS_CHECK_PORT_NUMBER"); break; case ProcID.CheckXSDevHandle: strProc = "\n" + loadStr("IDS_SUGGEST_ITEM") + "\n" + loadStr("IDS_MISSING_DLL") + "\n" + loadStr("IDS_CHECK_DLL_EXISTED"); break; case ProcID.EnrollByPwdProc: strProc = "\n" + loadStr("IDS_SUGGEST_ITEM") + "\n" + loadStr("IDS_ADD_ENROLL_FINGERS_AGAIN"); break; case ProcID.GetEnrolledFingers: strProc = "\n" + loadStr("IDS_SUGGEST_ITEM") + "\n" + loadStr("IDS_CHECK_USER_EXIST") + "\n" + loadStr("IDS_IS_USER_FINGER_EXIST"); break; case ProcID.FPAuthenDlg: strProc = "\n" + loadStr("IDS_SUGGEST_ITEM") + "\n" + loadStr("IDS_USE_VALID_ENROLL_FINGERS_AGAIN"); break; case ProcID.FPIdentify: strProc = "\n" + loadStr("IDS_SUGGEST_ITEM") + "\n" + loadStr("IDS_CHECK_USER_EXIST") + "\n" + loadStr("IDS_IS_USER_FINGER_EXIST"); break; case ProcID.UnknowErr: strProc = "\n" + loadStr("IDS_SUGGEST_ITEM") + "\n" + loadStr("IDS_CONTACT_VENDOR"); break; } return(strProc); }
private void button1_Click(object sender, EventArgs e) //Add process { if ((radioButton1.Checked == true) || (radioButton2.Checked == true) || (radioButton3.Checked == true) || (radioButton6.Checked == true)) { Priority_box.Text = "0"; } if ((radioButton1.Checked == true) || (radioButton2.Checked == true) || (radioButton3.Checked == true) || (radioButton4.Checked == true) || (radioButton5.Checked == true)) { Quantum_box.Text = "0"; } if ((ProcID.Text == "") || (Arrival_time_box.Text == "") || (Burst_time_box.Text == "") || (Priority_box.Text == "") || (Quantum_box.Text == "")) { MessageBox.Show("Add process info."); } else { Process p = new Process(ProcID.Text, int.Parse(Arrival_time_box.Text), int.Parse(Burst_time_box.Text), int.Parse(Priority_box.Text)); processes.Add(p); Quantum = int.Parse(Quantum_box.Text); ProcID.Clear(); ProcID.Focus(); Arrival_time_box.Clear(); Arrival_time_box.Focus(); Burst_time_box.Clear(); Burst_time_box.Focus(); Priority_box.Clear(); Priority_box.Focus(); Quantum_box.Clear(); Quantum_box.Focus(); } }
/// <summary> /// Exception throw /// </summary> /// <param name="aProcID">Operation Action enum</param> /// <param name="aIsRaise">Throw the exception or not</param> private void ProcErr(ProcID aProcID, bool aIsRaise) { _LastErrCode = _ResultCode; _LastErrMsg = getErrMsg(aProcID); _LastErrReason = GetErrRsn(aProcID); if (aIsRaise) { throw new TrustLinkGeneralException(); } }
/// <summary> /// Exception throw /// </summary> /// <param name="aProcID">Operation Action enum</param> /// <param name="aIsRaise">Throw the exception or not</param> private void ProcErr(ProcID aProcID, bool aIsRaise) { _LastErrCode = _ResultCode; _LastErrMsg = getErrMsg(aProcID); _LastErrReason = GetErrRsn(aProcID); //TempLog.Info("亚略特自带错误处理-》_LastErrCode->" + _LastErrCode.ToString() + "\r\n_LastErrMsg->" + _LastErrMsg + "\r\n_LastErrReason->"+_LastErrReason); if (aIsRaise) { throw new TrustLinkGeneralException(); } }
public void SwitchProc(ProcID proc) { if (curProcID != ProcID.None) { ProcBase preProc = GetProc(curProcID); preProc.OnLeave(); } ProcBase curProc = GetProc(proc); curProc.OnEnter(); curProcID = proc; }
/// <summary> /// Post Back Event /// </summary> /// <param name="eventArgument">Process type and Fingerprint template data</param> void IPostBackEventHandler.RaisePostBackEvent(string eventArgument) { int iResultCode = SUCCESSED; string strLastErrMsg = ""; string strLastErrReason = ""; string strResultMessage = ""; try { string[] strArgs = eventArgument.Split(','); ProcID intAction = (ProcID)(Convert.ToInt32(strArgs[0].ToString())); string strTemplateData = strArgs[1].ToString(); // int i = TempLog.Info("start ExecutePacket"); begin = DateTime.Now; lock (synObjPacket) { iResultCode = ExecutePacket(strTemplateData); //end = DateTime.Now; Thread.Sleep(50); Log("ExecutePacket"); //TempLog.Info("end ExecutePacket:"+(DateTime.Now.Millisecond-i)); } if (iResultCode == SUCCESSED) { //if the process type is fingerprint Identify, then Get the Identify user message if (intAction == ProcID.FPIdentify) { strResultMessage = BK_FPGetUser(); } } else { strLastErrMsg = getErrMsg(intAction); strLastErrReason = GetErrRsn(intAction); strResultMessage = strLastErrMsg + strLastErrReason; } } catch { iResultCode = ERR_UNKNOWN; strLastErrMsg = getErrMsg(ProcID.UnknowErr); strLastErrReason = GetErrRsn(ProcID.UnknowErr); strResultMessage = strLastErrMsg + strLastErrReason; } //execute the Event trigger process DoOperDlgPostEvent(iResultCode, strResultMessage); }
/// <summary> /// Post Back Event /// </summary> /// <param name="eventArgument">Process type and Fingerprint template data</param> void IPostBackEventHandler.RaisePostBackEvent(string eventArgument) { int iResultCode = SUCCESSED; string strLastErrMsg = ""; string strLastErrReason = ""; string strResultMessage = ""; try { string[] strArgs = eventArgument.Split(','); ProcID intAction = (ProcID)(Convert.ToInt32(strArgs[0].ToString())); string strTemplateData = strArgs[1].ToString(); lock (synObj) { iResultCode = ExecutePacket(strTemplateData); } //log.Debug(string.Format("iResultCode:{0},templateDate:{1}",iResultCode,strTemplateData)); if (iResultCode == SUCCESSED) { //if the process type is fingerprint Identify, then Get the Identify user message if (intAction == ProcID.FPIdentify) { strResultMessage = BK_FPGetUser(); // log.Debug(string.Format("BK_FPGetUser--strResultMessage:{0}", strResultMessage)); } //Disconnect(); } else { strLastErrMsg = getErrMsg(intAction); strLastErrReason = GetErrRsn(intAction); strResultMessage = strLastErrMsg + strLastErrReason; } } catch { iResultCode = ERR_UNKNOWN; strLastErrMsg = getErrMsg(ProcID.UnknowErr); strLastErrReason = GetErrRsn(ProcID.UnknowErr); strResultMessage = strLastErrMsg + strLastErrReason; } //execute the Event trigger process DoOperDlgPostEvent(iResultCode, strResultMessage); }
/// <summary> /// Return the error message /// </summary> /// <param name="aProcID">Action number of enum ProcID</param> /// <returns>Return the error message</returns> private string getErrMsg(ProcID aProcID) { string strProc = ""; switch (aProcID) { case ProcID.AddUserProc: strProc = loadStr("IDS_ADD_USER_FAILED"); break; case ProcID.DelUserProc: strProc = loadStr("IDS_DELETE_USER_FAILED"); break; case ProcID.ConnectServers: strProc = loadStr("IDS_XSERVER_CONNECT_FAILED"); break; case ProcID.CheckXSDevHandle: strProc = loadStr("IDS_LOAD_DLL_FAILED"); break; case ProcID.EnrollByPwdProc: strProc = loadStr("IDS_ENROLL_FINGERS_FAILED"); break; case ProcID.GetEnrolledFingers: strProc = loadStr("IDS_GET_ENROLL_FINGER_ERROR"); break; case ProcID.FPAuthenDlg: strProc = loadStr("IDS_FPAUTHEN_ERROR"); break; case ProcID.FPIdentify: strProc = loadStr("IDS_FPIDENT_ERROR"); break; case ProcID.UnknowErr: strProc = loadStr("IDS_UNKNOW_ERROR"); break; } return(strProc); }
/// <summary> /// This is the server side method that gets called when the client clicks the create PROC button. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Btn_CreatePROC_Click(object sender, EventArgs e) { // check to make sure that controls are not empty. if (Tbox_PROC_Percent.Text == string.Empty) { return; } // check to make sure that controls are not empty. if (Tbox_PROC_investment.Text == string.Empty) { return; } // check to make sure that controls are not empty. if (Cal_BeginDate.SelectedDate == DateTime.MinValue) { return; } // check to make sure that controls are not empty. if (Cal_EndDate.SelectedDate == DateTime.MinValue) { return; } OrderedDictionary Dict = new OrderedDictionary(); Dict.Add("proc_begin_date", Cal_BeginDate.SelectedDate); Dict.Add("proc_end_date", Cal_EndDate.SelectedDate); Dict.Add("profit_percentage", Convert.ToInt32(Tbox_PROC_Percent.Text)); Dict.Add("amount_invested", Convert.ToInt32(Tbox_PROC_investment.Text)); // call method to make our PROC then relate that proc to our Investor create_PROC(UserID, InvestorID, ProjectID, Dict); // take our client to the page where they can see thier PROC Response.Redirect("ViewPROC/" + ProcID.ToString()); }
public ProcBase GetProc(ProcID proc) { return(procs[(int)proc]); }
private string GetErrRsn(ProcID aProcID) { string strProc = ""; switch (aProcID) { case ProcID.AddUserProc: strProc = "\\n" + loadStr("IDS_SUGGEST_ITEM") + "\\n" + loadStr("IDS_DELETE_EXISTED_USER_ID") + "\\n" + loadStr("IDS_ADD_USER_AGAIN"); break; case ProcID.DelUserProc: strProc = "\\n" + loadStr("IDS_SUGGEST_ITEM") + "\\n" + loadStr("IDS_CHECK_USER_ID"); break; case ProcID.ConnectServers: strProc = "\\n" + loadStr("IDS_SUGGEST_ITEM") + "\\n" + loadStr("IDS_XSERVER_SHUT_DOWN") + "\\n" + loadStr("IDS_XSERVER_RESTART") + "\\n" + loadStr("IDS_CHECK_PRODUCT_ID") + "\\n" + loadStr("IDS_CHECK_PORT_NUMBER"); break; case ProcID.CheckXSDevHandle: strProc = "\\n" + loadStr("IDS_SUGGEST_ITEM") + "\\n" + loadStr("IDS_MISSING_DLL") + "\\n" + loadStr("IDS_CHECK_DLL_EXISTED"); break; case ProcID.EnrollByPwdProc: strProc = "\\n" + loadStr("IDS_SUGGEST_ITEM") + "\\n" + loadStr("IDS_ADD_ENROLL_FINGERS_AGAIN"); break; case ProcID.GetEnrolledFingers: strProc = "\\n" + loadStr("IDS_SUGGEST_ITEM") + "\\n" + loadStr("IDS_CHECK_USER_EXIST") + "\\n" + loadStr("IDS_IS_USER_FINGER_EXIST"); break; case ProcID.FPAuthenDlg: strProc = "\\n" + loadStr("IDS_SUGGEST_ITEM") + "\\n" + loadStr("IDS_USE_VALID_ENROLL_FINGERS_AGAIN"); break; case ProcID.FPIdentify: strProc = "\\n" + loadStr("IDS_SUGGEST_ITEM") + "\\n" + loadStr("IDS_CHECK_USER_EXIST") + "\\n" + loadStr("IDS_IS_USER_FINGER_EXIST"); break; case ProcID.UnknowErr: strProc = "\\n" + loadStr("IDS_SUGGEST_ITEM") + "\\n" + loadStr("IDS_CONTACT_VENDOR"); break; } return strProc; }
/// <summary> /// Return the error message /// </summary> /// <param name="aProcID">Action number of enum ProcID</param> /// <returns>Return the error message</returns> private string getErrMsg(ProcID aProcID) { string strProc = ""; switch (aProcID) { case ProcID.AddUserProc: strProc = loadStr("IDS_ADD_USER_FAILED"); break; case ProcID.DelUserProc: strProc = loadStr("IDS_DELETE_USER_FAILED"); break; case ProcID.ConnectServers: strProc = loadStr("IDS_XSERVER_CONNECT_FAILED"); break; case ProcID.CheckXSDevHandle: strProc = loadStr("IDS_LOAD_DLL_FAILED"); break; case ProcID.EnrollByPwdProc: strProc = loadStr("IDS_ENROLL_FINGERS_FAILED"); break; case ProcID.GetEnrolledFingers: strProc = loadStr("IDS_GET_ENROLL_FINGER_ERROR"); break; case ProcID.FPAuthenDlg: strProc = loadStr("IDS_FPAUTHEN_ERROR"); break; case ProcID.FPIdentify: strProc = loadStr("IDS_FPIDENT_ERROR"); break; case ProcID.UnknowErr: strProc = loadStr("IDS_UNKNOW_ERROR"); break; } return strProc; }
/// <summary> /// Exception throw /// </summary> /// <param name="aProcID">Operation Action enum</param> /// <param name="aIsRaise">Throw the exception or not</param> private void ProcErr(ProcID aProcID, bool aIsRaise) { _LastErrCode = _ResultCode; _LastErrMsg = getErrMsg(aProcID); _LastErrReason = GetErrRsn(aProcID); //TempLog.Info("�������Դ�������-��_LastErrCode->" + _LastErrCode.ToString() + "\r\n_LastErrMsg->" + _LastErrMsg + "\r\n_LastErrReason->"+_LastErrReason); if (aIsRaise) { throw new TrustLinkGeneralException(); } }