public void ShowFunctionsList() { wsSEC.IwsSECClient client = new wsSEC.IwsSECClient(); try { baseForm.SetCursor(); DataSet ds = client.GetFunctionsRecords(baseForm.CurrentContextInfo, QueryParameters.ToArray<MESParameterInfo>()); this.gridFunctionsList.SetDataBinding(ds.Tables[0],""); if (ds.Tables[0].Rows.Count < 1) { this.ucToolbarFunctionsList.SetToolbarWithoutRows(); } else { this.ucToolbarFunctionsList.SetToolbarWithRows(); } this.ucStatusBarFunctionsList.ShowText1(UtilCulture.GetString("Msg.R00006") + ": " + ds.Tables[0].Rows.Count.ToString()); } catch (Exception ex) { throw ex; } finally { baseForm.ResetCursor(); baseForm.CloseWCF(client); } }
public DataTable GetAllFunctions() { wsSEC.IwsSECClient client = new wsSEC.IwsSECClient(); try { baseForm.SetCursor(); DataSet ds = client.GetFunctionsRecords(baseForm.CurrentContextInfo, (new List<MESParameterInfo>()).ToArray<MESParameterInfo>()); return ds.Tables[0]; } catch (Exception ex) { throw ex; } finally { baseForm.ResetCursor(); baseForm.CloseWCF(client); } }
private void DoLogon() { wsSEC.IwsSECClient client = new wsSEC.IwsSECClient(); wsMDL.IwsMDLClient clientMDL = new wsMDL.IwsMDLClient(); try { baseForm.SetCursor(); baseForm.ValidateData(this); if (this.chkLogonToBasis.Checked) baseForm.CurrentContextInfo.MiscValue1 = "Modeling"; else baseForm.CurrentContextInfo.MiscValue1 = "WIP Client"; client.Logon(baseForm.CurrentContextInfo, this.cmbUser.Text, UtilSecurity.EncryptPassword(txtPassword.Text)); #region Set public variables Parameter.LOGON_USER = this.cmbUser.Text.Trim(); Parameter.SHIFT = (this.cmbShift.SelectedItem as ValueInfo).ValueField; Parameter.SESSION_ID = GENLSYS.MES.Common.Function.GetGUID(); Parameter.LANGUAGE = (this.cmbLanguage.SelectedItem as ValueInfo).ValueField; // Parameter.WORKGROUP = "G1";//getWorkGroupByIP InitResourceFile(Parameter.LANGUAGE); string machine = Dns.GetHostName(); baseForm.CurrentContextInfo.SessionId = Parameter.SESSION_ID; baseForm.CurrentContextInfo.CurrentUser = Parameter.LOGON_USER; baseForm.CurrentContextInfo.WorkGroup = Parameter.WORKGROUP; client.UpdateLogonTime(baseForm.CurrentContextInfo, Parameter.SESSION_ID, this.cmbUser.Text, machine, Parameter.SHIFT); //get authorization Parameter.ALL_FUNCTIONS = client.GetFunctionsRecords(baseForm.CurrentContextInfo, (new List<MESParameterInfo>()).ToArray<MESParameterInfo>()).Tables[0]; Parameter.USER_FUNCTIONS = client.GetFunctionsByUserId(baseForm.CurrentContextInfo, Parameter.LOGON_USER).Tables[0]; //get user object List<tsecuser> lstUser = client.GetUserList(baseForm.CurrentContextInfo, new List<MESParameterInfo>() { new MESParameterInfo(){ ParamName ="userid", ParamValue=Parameter.LOGON_USER } }.ToArray<MESParameterInfo>()).ToList<tsecuser>(); if (lstUser.Count > 0) { Parameter.CURRENT_USER_OBJECT = lstUser[0]; } //get employee object List<tmdlemployee> lstEmployee = clientMDL.GetEmployeeList(baseForm.CurrentContextInfo, new List<MESParameterInfo>() { new MESParameterInfo(){ ParamName ="employeeid", ParamValue=lstUser[0].employeeid } }.ToArray()).ToList(); // if (lstEmployee.Count > 0) // { // Parameter.WORKGROUP = lstEmployee[0].workgroup; // baseForm.CurrentContextInfo.WorkGroup = Parameter.WORKGROUP; // } //get system config if (Parameter.CURRENT_SYSTEM_CONFIG == null) { Parameter.CURRENT_SYSTEM_CONFIG = baseForm.GetAllSystemConfig(); baseForm.SetParameter(); } //get static value if (Parameter.CURRENT_STATIC_VALUE == null) Parameter.CURRENT_STATIC_VALUE = baseForm.GetAllStaticValue(); //set host name as work group string host = Dns.GetHostName(); string lineGroup = "unknow"; foreach (tsysstaticvalue item in baseForm.GetStaticValue(MES_StaticValue_Type.LineGroup)) { if (item.svtext == host) { lineGroup = item.svvalue; break; } } Parameter.WORKGROUP = lineGroup; baseForm.CurrentContextInfo.WorkGroup = Parameter.WORKGROUP; //update user profile UpdateUserProfile(); #endregion ShowModeling(false); Parameter.LOGON_FORM = this; this.Hide(); } catch (Exception ex) { switch (ExceptionParser.Parse(ex)) { case "-300001": errorCount++; baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00011")); break; case "-300002": errorCount++; baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00012")); break; case "-300003": errorCount++; baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00013")); break; case "-300004": errorCount++; baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00014")); break; case "-300005": errorCount++; baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00046")); break; default: baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, ExceptionParser.Parse(ex)); break; } if (errorCount >= 5) { baseForm.CreateMessageBox(Public_MessageBox.Error, MessageBoxButtons.OK, null, UtilCulture.GetString("Msg.R00122")); this.Dispose(); } } finally { baseForm.ResetCursor(); if (client.State == System.ServiceModel.CommunicationState.Opened) baseForm.CloseWCF(client); } }