Ejemplo n.º 1
0
        public void zybutton_Click(object sender, EventArgs e)
        {
            string name = getUserInfo("username");
            string pwd  = getUserInfo("password");
            //MES_LoginINFO loginfo = ServicModel.MES_Login.Login(getUserInfo("username"), getUserInfo("password"), "", "", 0, 1, 0);
            MES_SY_TYPEMX TYPEMX = new MES_SY_TYPEMX();

            TYPEMX.TYPEID = 26;
            TYPEMX.MXNAME = ini.IniReadValue(ini.Section_UserInfo, "langu");
            MES_SY_TYPEMXLIST[] languArr = ServicModel.SY_TYPEMX.SELECT_NOPTOKEN(TYPEMX);
            int languID = 0;

            if (languArr.Length == 1)
            {
                languID = languArr[0].ID;
            }
            MES_LoginINFO loginfo = ServicModel.MES_Login.Login_language(name, pwd, "", "", 0, 1, 0, languID);

            CRM_JURISDICTION_GROUP[] list = loginfo.JURISDICTION_GROUP;

            if (list.Length > 0)
            {
                List <CRM_JURISDICTION_GROUP> nodes = new List <CRM_JURISDICTION_GROUP>();
                for (int i = 0; i < list.Length; i++)
                {
                    CRM_HG_RIGHTGROUP node = list[i].CRM_HG_RIGHTGROUP;
                    if (node.RGROUPID == 11)
                    {
                        nodes.Add(list[i]);
                        list = nodes.ToArray();
                        break;
                    }
                }
            }
            Sonluk.UI.Model.MES.MES_LoginService.MES_RETURN msg = loginfo.MES_RETURN;
            if (msg.TYPE.Equals("E"))
            {
                //MessageBox.Show(msg.MESSAGE, "消息框");
                ShowMeg(msg.MESSAGE);
            }
            else
            {
                frmAction form = new frmAction(list);
                push(form, this);
            }
        }
Ejemplo n.º 2
0
        private void login()
        {
            MsgReturn res = VerifyLoginInfo();

            if (res.Pass == false)
            {
                //MessageBox.Show(res.Msg, "消息框");
                ShowMeg(res.Msg);
                return;
            }
            #region 登录请求相关信息
            MES_SY_TYPEMX TYPEMX = new MES_SY_TYPEMX();
            TYPEMX.TYPEID = 26;
            TYPEMX.MXNAME = Convert.ToString(langucomboBox.SelectedValue);
            MES_SY_TYPEMXLIST[] languArr = ServicModel.SY_TYPEMX.SELECT_NOPTOKEN(TYPEMX);
            int languID = 0;
            if (languArr.Length == 1)
            {
                languID = languArr[0].ID;
            }
            MES_LoginINFO loginfo = ServicModel.MES_Login.Login_language(userTextBox.Text.Trim(), pwdTextBox.Text.Trim(), "", "", 0, 1, 0, languID);



            CRM_JURISDICTION_GROUP[] list = loginfo.JURISDICTION_GROUP;
            if (list != null)
            {
                if (list.Length > 0)
                {
                    List <CRM_JURISDICTION_GROUP> nodes = new List <CRM_JURISDICTION_GROUP>();
                    for (int i = 0; i < list.Length; i++)
                    {
                        CRM_HG_RIGHTGROUP node = list[i].CRM_HG_RIGHTGROUP;
                        if (node.RGROUPID == 11)
                        {
                            nodes.Add(list[i]);
                            list = nodes.ToArray();
                            break;
                        }
                    }
                }
            }



            Sonluk.UI.Model.MES.MES_LoginService.MES_RETURN msg = loginfo.MES_RETURN;
            if (msg.TYPE.Equals("E"))
            {
                //MessageBox.Show(msg.MESSAGE, "消息框");
                ShowMeg(msg.MESSAGE);
                Clear();
            }
            else
            {
                if (list == null || list.Length == 0)
                {
                    ShowMeg(userTextBox.Text + q(Msg_Type.roleisnull));
                    return;
                }
                //if (list.Length == 0)
                //{
                //    ShowMeg("帐号" + userTextBox.Text + "没有对应的权限,请维护");
                //    return;
                //}

                TokenInfo tokenInfo = loginfo.TokenInfo;
                Common.token = tokenInfo.access_token;
                ini.IniWriteValue(ini.Section_UserInfo, "username", userTextBox.Text.Trim());
                ini.IniWriteValue(ini.Section_UserInfo, "password", pwdTextBox.Text.Trim());
                ini.IniWriteValue(ini.Section_UserInfo, "staffid", tokenInfo.STAFFID.ToString());
                ini.IniWriteValue(ini.Section_UserInfo, "langu", Convert.ToString(langucomboBox.SelectedValue));
                frmAction form = new frmAction(list);
                push(form, this);
            }
            #endregion
        }