private void dgvConexoes_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex == 1) { DALConexao cx = new DALConexao(DadosDaConexao.StringDaConexao); BLLLog blllog = new BLLLog(cx); blllog.Excluir(idUsuario, dgvConexoes.Rows[e.RowIndex].Cells[0].Value.ToString()); CaregaDGV(); } }
private void LogoffToolStripMenuItem_Click(object sender, EventArgs e) { this.Text = "Soluções DaDo Bier"; this.BloqueioTela(0); lbUsuarioLogado.Text = "Usuario"; DALConexao cx = new DALConexao(DadosDaConexao.StringDaConexao); BLLUsuario bllu = new BLLUsuario(cx); BLLLog blllog = new BLLLog(cx); blllog.Excluir(Convert.ToInt32(txtId.Text), bllu.IpLocal()); this.Loga(); }
public void ProcessRequest(HttpContext context) { //string openid = context.Request["openid"]; string phone = context.Request["phone"]; string code = context.Request["code"]; string msg = ""; if (!bllUser.SmsLogin(phone, code, out msg)) { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = msg; bllUser.ContextResponse(context, apiResp); return; } string unionid = context.Request["unionid"]; string websiteOwner = bllUser.WebsiteOwner; UserInfo user = bllUser.GetUserInfoByPhone(phone, websiteOwner); if (user == null) { user = new UserInfo(); user.UserID = user.UserID = string.Format("Phone{0}", Guid.NewGuid().ToString()); user.Phone = phone; user.Password = ZentCloud.Common.Rand.Str_char(12); user.UserType = 2; user.WebsiteOwner = websiteOwner; user.Regtime = DateTime.Now; user.RegIP = ZentCloud.Common.MySpider.GetClientIP(); } string oUnionid = user.WXUnionID; string oNickname = user.WXNickname; bool hasOther = (user.AutoID != 0 && oUnionid != unionid); string password = context.Request["password"]; string city = context.Request["city"]; string country = context.Request["country"]; string headimgurl = context.Request["headimgurl"]; string nickname = context.Request["nickname"]; string privilege = context.Request["privilege"]; string province = context.Request["province"]; string sex = context.Request["sex"]; user.Password = password.Trim(); if (string.IsNullOrWhiteSpace(user.Password)) { user.Password = ZentCloud.Common.Rand.Str_char(6); } user.WXCity = city; user.WXCountry = country; user.WXHeadimgurl = headimgurl; user.WXNickname = nickname; user.WXPrivilege = ZentCloud.Common.JSONHelper.ObjectToJson(privilege); user.WXProvince = province; user.WXSex = Convert.ToInt32(sex); user.WXUnionID = unionid; user.LastLoginIP = ZentCloud.Common.MySpider.GetClientIP(); user.LastLoginDate = DateTime.Now; user.LoginTotalCount = user.LoginTotalCount + 1; bool status = false; if (user.AutoID == 0) { //更新微信授权信息 status = bllUser.Add(user); } else { status = bllUser.Update(user); } if (status) { if (hasOther) { BLLLog bllLog = new BLLLog(); string rmk = string.Format("账号({0})绑定信息变更,微信UnionID:[{1}-{2}],昵称:[{3}-{4}]", user.AutoID, oUnionid, unionid, oNickname, nickname); bllLog.Add(ZentCloud.BLLJIMP.Enums.EnumLogType.OAuthBind, ZentCloud.BLLJIMP.Enums.EnumLogTypeAction.SignIn, user.UserID, rmk); } context.Session[SessionKey.UserID] = user.UserID; context.Session[SessionKey.LoginStatu] = 1; context.Response.Cookies.Add(bllUser.CreateLoginCookie(user.UserID, user.WXOpenId, user.WXNickname)); apiResp.status = true; apiResp.code = (int)APIErrCode.IsSuccess; apiResp.msg = "授权绑定手机完成"; } else { apiResp.code = (int)APIErrCode.OperateFail; apiResp.msg = "授权绑定手机失败"; } bllUser.ContextResponse(context, apiResp); }
private void Loga() { this.BloqueioTela(Convert.ToInt32(0)); frmLogin log = new frmLogin(); log.ShowDialog(); log.Dispose(); int idusuario = 0; int idunidade = 0; int nvusuario = 0; try { idusuario = Convert.ToInt32(log.IdUsuarioLogado); } catch { } try { idunidade = Convert.ToInt32(log.UnidadeUsuarioLogado); } catch { } try { nvusuario = Convert.ToInt32(log.NvUsuarioLogado); } catch { } if (idusuario.ToString() != "") { #region Se Login Adm if (log.IdUsuarioLogado == -1) { txtId.Text = idusuario.ToString(); txtUsuario.Text = "Administrador"; txtLogin.Text = "Admin"; txtSenha.Text = ""; txtIniciais.Text = "Adm"; txtUnidade.Text = "99"; txtPermissao.Text = "4"; txtEmail.Text = ""; txtNomeUnidade.Text = "Admin"; this.PreencheCampos(); } #endregion #region Se login normal else { txtId.Text = idusuario.ToString(); txtUsuario.Text = log.NomeUsuarioLogado.ToString(); txtLogin.Text = log.LoginUsuarioLogado.ToString(); txtSenha.Text = log.SenhaUsuarioLogado.ToString(); txtIniciais.Text = log.IniciaisUsuarioLogado.ToString(); txtUnidade.Text = idunidade.ToString(); txtPermissao.Text = nvusuario.ToString(); txtEmail.Text = log.EmailUsuarioLogado.ToString(); txtNomeUnidade.Text = log.NomeUnidade.ToString(); this.PreencheCampos(); //Se login automático salva ip DTOLog dtolog = new DTOLog(); DALConexao cx = new DALConexao(DadosDaConexao.StringDaConexao); BLLLog blllog = new BLLLog(cx); if (log.LembrarSenha != "") { try { try { blllog.Excluir(Convert.ToInt32(txtId.Text), log.LembrarSenha); } catch {} finally { dtolog.IdUsuario = Convert.ToInt32(txtId.Text); dtolog.CodLog = log.LembrarSenha; blllog.Incluir(dtolog); } } catch { MessageBox.Show("Erro ao salvar suas credenciais."); } } } #endregion log = null; } }