Beispiel #1
0
        public static void InitCMB_Employee_Valid(ComboBox cmd)
        {
            cmd.Items.Clear();
            cmd.DisplayMember = "DisplayField";
            cmd.ValueMember = "ValueField";

            wsMDL.IwsMDLClient client = new wsMDL.IwsMDLClient();

            try
            {
                List<MESParameterInfo> lstParameters = new List<MESParameterInfo>();
                lstParameters.Add(new MESParameterInfo()
                {
                    ParamName = "employeestatus",
                    ParamValue = MES_Flag.Valid.ToString(),
                    ParamType = "string"
                });

                List<tmdlemployee> lseEmployee = client.GetEmployeeList((new BaseForm()).CurrentContextInfo, lstParameters.ToArray<MESParameterInfo>()).ToList<tmdlemployee>();
                var q = from p in lseEmployee orderby p.employeeid ascending select p;
                for (int i = 0; i < q.Count(); i++)
                {
                    cmd.Items.Add(new ValueInfo()
                    {
                        DisplayField = q.ElementAt(i).employeeid + "(" + q.ElementAt(i).employeename + ")",
                        ValueField = q.ElementAt(i).employeeid
                    });
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                baseForm.CloseWCF(client);
            }
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
        public static ValueListItem[] GetValueList_Employee()
        {
            List<ValueListItem> lstVL = new List<ValueListItem>();
            ValueListItem emptyitem = new ValueListItem()
            {
                DisplayText = " ",
                DataValue = ""
            };
            lstVL.Add(emptyitem);

            wsMDL.IwsMDLClient client = new wsMDL.IwsMDLClient();

            try
            {
                List<MESParameterInfo> lstParameters = new List<MESParameterInfo>();
                //lstParameters.Add(new MESParameterInfo()
                //{
                //    ParamName = "employeestatus",
                //    ParamValue = MES_Flag.Valid.ToString(),
                //    ParamType = "string"
                //});
                List<tmdlemployee> lstEmployee = client.GetEmployeeList((new BaseForm()).CurrentContextInfo, lstParameters.ToArray<MESParameterInfo>()).ToList<tmdlemployee>();
                var q = from p in lstEmployee orderby p.employeename ascending select p;
                for (int i = 0; i < q.Count(); i++)
                {
                    ValueListItem item = new ValueListItem()
                    {
                        DisplayText = q.ElementAt(i).employeename.Trim(),
                        DataValue = q.ElementAt(i).employeeid
                    };
                    lstVL.Add(item);
                }

                return lstVL.ToArray<ValueListItem>();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                baseForm.CloseWCF(client);
            }
        }
Beispiel #4
0
        public static ValueListItem[] GetValueList_Employee(string employeeType)
        {
            List<ValueListItem> lstVL = new List<ValueListItem>();
            ValueListItem emptyitem = new ValueListItem()
            {
                DisplayText = " ",
                DataValue = ""
            };
            lstVL.Add(emptyitem);

            wsMDL.IwsMDLClient client = new wsMDL.IwsMDLClient();

            try
            {
                List<MESParameterInfo> lstParameters = new List<MESParameterInfo>();
                lstParameters.Add(new MESParameterInfo()
                {
                    ParamName = "employeetypeid",
                    ParamValue = employeeType,
                    ParamType = "string"
                });
                List<tmdlemployee> lstEmployee = client.GetEmployeeList((new BaseForm()).CurrentContextInfo, lstParameters.ToArray<MESParameterInfo>()).ToList<tmdlemployee>();

                for (int i = 0; i < lstEmployee.Count; i++)
                {
                    ValueListItem item = new ValueListItem()
                    {
                        DisplayText = lstEmployee[i].employeename.Trim(),
                        DataValue = lstEmployee[i].employeeid
                    };
                    lstVL.Add(item);
                }

                return lstVL.ToArray<ValueListItem>();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                baseForm.CloseWCF(client);
            }
        }