private void do_login() { if (textBox1.Text.Trim() == "9999" && textBox2.Text.Trim() == "9999") { Program.oper_id = "9999"; DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); //this.Hide(); //var frm = new frmMenu(); //frm.ShowDialog(); //save_exit(); } else { IBLL.IOper operBLL = new BLL.Oper(); var errMsg = ""; if (operBLL.Login(textBox1.Text.Trim(), textBox2.Text.Trim(), out errMsg)) { Program.is_login = true; DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); //this.Hide(); //var frm = new frmMenu(); //frm.ShowDialog(); //save_exit(); } else { if (errMsg != "") { new MsgForm("账号/密码错误").ShowDialog(); } else { new MsgForm("登录失败").ShowDialog(); } } } }
void IServiceBase.Request(string t, string pars, out string res) { try { ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars); var kv = r.ToDictionary(); IBLL.IOper bll = new BLL.Oper(); if (t == "login") { string oper_id = r.Read("oper_id"); string pwd = r.Read("pwd"); string oper_name; string oper_type; bll.Login(oper_id, pwd, out oper_name, out oper_type); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); w.Append("oper_name", oper_name); w.Append("oper_type", oper_type); IBLL.IMyDestop desbll = new BLL.MyDestop(); var tbs = desbll.GetAll(); w.Append("data", tbs); //我的权限 IBLL.ISys sysbll = new BLL.Sys(); tbs = sysbll.GetAllGrant(new global::Model.sa_t_oper_grant() { oper_id = oper_type }); w.Append("data2", tbs); res = w.ToString(); } else if (t == "change_pwd") { string oper_id = r.Read("oper_id"); string old_pwd = r.Read("old_pwd"); string new_pwd = r.Read("new_pwd"); bll.ChangePWD(oper_id, old_pwd, new_pwd); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); res = w.ToString(); } else if (t.Equals("add")) { WebHelper web = new WebHelper(pars); Model.sa_t_operator_i oper = web.GetObject <Model.sa_t_operator_i>(); bll.Add(oper); web.WriteSuccess(); res = web.NmJson(); } else if (t.Equals("GetMaxCode")) { WebHelper web = new WebHelper(pars); string code = bll.GetMaxCode(); web.Write("code", code); web.WriteSuccess(); res = web.NmJson(); } else if (t.Equals("GetOperType")) { WebHelper web = new WebHelper(pars); var tb = bll.GetOperType(); web.Write(tb); web.WriteSuccess(); res = web.NmJson(); } else if (t.Equals("GetOpers")) { WebHelper web = new WebHelper(pars); var tb = bll.GetOpers(); web.Write(tb); web.WriteSuccess(); res = web.NmJson(); } else if (t.Equals("Upload")) { WebHelper web = new WebHelper(pars); var oper = web.GetObject <Model.sa_t_operator_i>(); bll.Upload(oper); web.WriteSuccess(); res = web.NmJson(); } else if (t.Equals("Del")) { WebHelper web = new WebHelper(pars); var oper = web.GetObject <Model.sa_t_operator_i>(); bll.Del(oper.oper_id); web.WriteSuccess(); res = web.NmJson(); } else if (t == "reset_pwd") { string oper_id = r.Read("oper_id"); string new_pwd = r.Read("new_pwd"); bll.ResetPWD(oper_id, new_pwd); ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "0"); w.Append("errMsg", ""); res = w.ToString(); } else { WebHelper web = new WebHelper(pars); web.ReflectionMethod(bll, t); res = web.NmJson(); } } catch (Exception ex) { ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson(); w.Append("errId", "-1"); w.Append("errMsg", ex.Message); res = w.ToString(); } }