示例#1
0
        public string AddEmployee(EmployeeModel u)
        {
            string uid = "0";
            string msg = "用户添加失败!";

            if (HasEmployeeNo(u.FEmployeeNo, u.FID))
            {
                uid = "-2";
                msg = "员工编号已存在。";
            }
            else
            {
                uid = EmployeeDal.Instance.Insert(u);
                if (uid != "")
                {
                    msg = "添加新员工成功!";
                    LogBll <EmployeeModel> log = new LogBll <EmployeeModel>();
                    u.FID = uid;
                    log.AddLog(u);
                }
            }
            return(new JsonMessage {
                Data = uid.ToString(), Message = msg, Success = uid != ""
            }.ToString());
        }
示例#2
0
        public string EditEmployee(EmployeeModel u)
        {
            int    k;
            string msg = "用户编辑失败。";

            if (HasEmployeeNo(u.FEmployeeNo, u.FID))
            {
                k   = -2;
                msg = "员工编号已存在。";
            }
            else
            {
                var oldEmployee = EmployeeDal.Instance.Get(u.FID);
                k = EmployeeDal.Instance.Update(u);
                if (k > 0)
                {
                    msg = "员工编辑成功。";
                    LogBll <EmployeeModel> log = new LogBll <EmployeeModel>();
                    log.AddLog(u);
                }
            }
            return(new JsonMessage {
                Data = k.ToString(), Message = msg, Success = k > 0
            }.ToString());
        }
 private void LimparFormulario()
 {
     try
     {
         txtID.Text    = string.Format("{0:000000}", UsuarioBll.RetornaNovoID());
         txtNome.Text  = string.Empty;
         txtLogin.Text = string.Empty;
         txtSenha.Text = string.Empty;
         txtEmail.Text = string.Empty;
         ddlAtivoFiltro.SelectedValue = "1";
         cbAtivo.Checked      = true;
         hfTipoOperacao.Value = TipoOperacao.Create.ToString();
     }
     catch (Exception ex)
     {
         LogBll.InserirLog(new Log
         {
             Data     = DateTime.Today,
             Mensagem = ex.Message,
             Login    = this.Context.User.Identity.Name,
             Operacao = TipoOperacao.Create.ToString(),
             Tabela   = "Usuarios"
         });
         Msg.Erro(Resource.ContateAdminstrador, this);
     }
 }
示例#4
0
        /// <summary>
        /// 备份数据库
        /// </summary>
        /// <param name="context"></param>
        void BackupDb(HttpContext context)
        {
            string dbname     = ConfigHelper.GetValue("dbname");
            string backupName = StringHelper.CreateIDCode();
            string savePath   = context.Server.MapPath("~/dbase/");

            if (!Directory.Exists(savePath))
            {
                Directory.CreateDirectory(savePath);
            }

            string backupSql = "DUMP TRANSACTION {0} WITH NO_LOG; BACKUP DATABASE {0} to DISK ='{1}' ";

            backupSql = string.Format(backupSql, dbname, savePath + backupName + ".bak");
            try
            {
                //执行备份
                DbUtils.ExecuteNonQuery(backupSql, null);
                addZipEntry(backupName, savePath);

                //写入操作日志
                LogBll <object> log = new LogBll <object>();
                log.AddLog("备份数据库", "数据库备份成功,文件名:" + backupName + ".bak");

                context.Response.Write(new JsonMessage {
                    Data = "1", Message = "数据库备份成功。", Success = true
                }.ToString());
            }
            catch (Exception ex)
            {
                context.Response.Write(new JsonMessage {
                    Data = "1", Message = ex.StackTrace, Success = false
                }.ToString());
            }
        }
示例#5
0
 static void Main(string[] args)
 {
     AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(UnhandledException);
     try
     {
         ConfigBll.GetInst().LoadConfig();
         AGENT_NAME   = GlobalValues.AGENT_NAME;
         AGENT_FILTER = GlobalValues.AGENT_FILTER;
         log          = LogBll.GenLogBll(AGENT_NAME);
         testLog      = TestLogBll.GetInst();
         Thread t = new Thread(() => startListen());
         t.Start();
         for (; ;)
         {
             log.HeartBeat("I'm alive");
             Thread.Sleep(1000 * 20);
         }
     }
     catch (MongoConnectionException ex)
     {
         Console.WriteLine("无法连接到server端!请检查ip配置及网络连接后重试");
     }
     catch (SocketException ex)
     {
         Console.WriteLine("连接被中断,请检查网络连接,重启本程序!\n" + "错误信息:" + ex.Message);
     }
 }
示例#6
0
        // GET api/contactapi/5
        public CCustContact Get(int id)
        {
            var user = (CSign)HttpContext.Current.Session[ConfigurationManager.AppSettings["AuthSaveKey"]];

            if (user == null)
            {
                throw new HttpResponseException(new SiginFailureMessage());
            }
            using (var dal = DalBuilder.CreateDal(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, 0))
            {
                CCustContact custContact;
                try
                {
                    dal.Open();
                    custContact = CustContactBll.Get(dal, id);
                    dal.Close();
                }
                catch (Exception ex)
                {
                    LogBll.Write(dal, new CLog
                    {
                        LogUser    = string.Format("{0}-{1}", user.UserCode, user.UserName),
                        LogContent = string.Format("{0}#{1}", "CustContact.Get", ex.Message),
                        LogType    = LogType.系统异常
                    });
                    throw new HttpResponseException(new SystemExceptionMessage());
                }
                if (custContact == null)
                {
                    throw new HttpResponseException(new DataNotFoundMessage());
                }
                return(custContact);
            }
        }
        protected void gvProdutos_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("Alterar"))
            {
                int index = int.Parse(e.CommandArgument.ToString());
                int ID    = int.TryParse(gvProdutos.Rows[index].Cells[1].Text, out ID) ? ID : 0;

                try
                {
                    ProdutoBll produtoBll = new ProdutoBll();
                    Produto    produto    = produtoBll.RetornaProduto(ID);

                    txtID.Text              = string.Format("{0:000000}", produto.ID);
                    txtDescricao.Text       = produto.Descricao;
                    txtPrecoQuantidade.Text = string.Format("{0:C}", produto.PrecoQuantidade);
                    txtPrecoUnitario.Text   = string.Format("{0:C}", produto.PrecoUnitario);
                    cbAtivo.Checked         = produto.Ativo.Equals(1) ? true : false;

                    hfTipoOperacao.Value = TipoOperacao.Update.ToString();
                }
                catch (Exception ex)
                {
                    LogBll.InserirLog(new Log
                    {
                        ItemID   = ID,
                        Login    = User.Identity.Name,
                        Mensagem = ex.Message,
                        Operacao = TipoOperacao.Read.ToString(),
                        Tabela   = "Produto"
                    });

                    Msg.Erro(Resource.ContateAdminstrador, this);
                }
            }
        }
示例#8
0
        public ActionResult Jogo([Bind(Include = "ID,Data,Hora,LocalJogoID,AdversarioID,Adversario,CalendarioID,Calendario,SituacaoJogo,MotivoCancelamento")] Jogo jogo)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    JogoBll jogoBll = new JogoBll();

                    if (jogo.ID > 0)
                    {
                        jogoBll.Atualizar(jogo);
                        LogBll.GravarInformacao(string.Format(Resources.Jogos.AtualizacaoLog, jogo.ID), "", User.Identity.Name);
                        return(RedirectToAction("Index").ComMensagem(Resources.Jogos.JogoSalvo, TipoMensagem.Sucesso));
                    }
                    else
                    {
                        jogoBll.Criar(jogo);
                        LogBll.GravarInformacao(string.Format(Resources.Calendario.CriacaoLog, jogo.ID), "", User.Identity.Name);
                        return(RedirectToAction("Index").ComMensagem(Resources.Jogos.JogoSalvo, TipoMensagem.Sucesso));
                    }
                }

                return(View(jogo));
            }
            catch (Exception exception)
            {
                LogBll.GravarErro(exception, User.Identity.Name);
                return(RedirectToAction("Index").ComMensagem(Resources.Geral.ContateAdministrador, TipoMensagem.Erro));
            }
        }
        private void ExcluirUsuario()
        {
            int contador = 0;

            try
            {
                foreach (GridViewRow row in gvUsuarios.Rows)
                {
                    CheckBox chkSelecionado = (CheckBox)row.FindControl("chkSelecionar");

                    if (chkSelecionado.Checked.Equals(true))
                    {
                        int ID = int.TryParse(row.Cells[1].Text, out ID) ? ID : 0;

                        Usuario    usuario    = new Usuario();
                        UsuarioBll usuarioBll = new UsuarioBll();

                        usuario = usuarioBll.RetornaUsuario(ID);

                        usuarioBll.RemoverUsuario(usuario);

                        contador++;

                        LogBll.InserirLog(new Log
                        {
                            ItemID   = usuario.ID,
                            Login    = Context.User.Identity.Name,
                            Operacao = TipoOperacao.Delete.ToString(),
                            Tabela   = "Usuario",
                            Data     = DateTime.Now
                        });
                    }
                }

                if (contador > 0)
                {
                    Msg.Sucesso(string.Format(Resource.ItemExcluidoSucesso, contador), this);
                }
                else
                {
                    Msg.Warning(Resource.ItemSelecioneExclusao, this);
                }

                LimparFormulario();
                BindarGrid();
            }
            catch (Exception ex)
            {
                LogBll.InserirLog(new Log
                {
                    Data     = DateTime.Now,
                    Login    = Context.User.Identity.Name,
                    Mensagem = ex.Message,
                    Operacao = TipoOperacao.Delete.ToString(),
                    Tabela   = "Usuario"
                });

                Msg.Erro(Resource.ContateAdminstrador, this);
            }
        }
示例#10
0
        public ActionResult Adversario([Bind(Include = "ID,Nome,NomeContato,Telefone,Ativo")] Adversario adversario)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    AdversarioBll adversarioBll = new AdversarioBll();

                    if (adversario.ID > 0)
                    {
                        adversarioBll.Atualizar(adversario);
                        LogBll.GravarInformacao(string.Format(Resources.Adversario.AtualizacaoLog, adversario.ID), "", User.Identity.Name);
                        return(RedirectToAction("Index").ComMensagem(Resources.Adversario.AdversarioSalvo, TipoMensagem.Sucesso));
                    }
                    else
                    {
                        adversarioBll.Criar(adversario);
                        LogBll.GravarInformacao(string.Format(Resources.Calendario.CriacaoLog, adversario.ID), "", User.Identity.Name);
                        return(RedirectToAction("Index").ComMensagem(Resources.Adversario.AdversarioSalvo, TipoMensagem.Sucesso));
                    }
                }

                return(View(adversario));
            }
            catch (Exception exception)
            {
                LogBll.GravarErro(exception, User.Identity.Name);
                return(RedirectToAction("Index").ComMensagem(Resources.Geral.ContateAdministrador, TipoMensagem.Erro));
            }
        }
示例#11
0
        public string EditAppUser(AppUserModel u)
        {
            int    k;
            string msg = "用户编辑失败。";

            if (HasAppUserNo(u.PHONE, u.FID))
            {
                k   = -2;
                msg = "手机号码已存在。";
            }
            else
            {
                var oldAppUser = AppUserDal.Instance.Get(u.FID);
                k = AppUserDal.Instance.Update(u);
                if (k > 0)
                {
                    msg = "编辑APP用户成功。";
                    LogBll <AppUserModel> log = new LogBll <AppUserModel>();
                    log.AddLog(u);
                }
            }
            return(new JsonMessage {
                Data = k.ToString(), Message = msg, Success = k > 0
            }.ToString());
        }
示例#12
0
        private void LimparFormulario()
        {
            try
            {
                txtID.Text = string.Format("{0:000000}", ClienteBll.RetornaNovoID());
            }
            catch (Exception ex)
            {
                LogBll.InserirLog(new Log
                {
                    Login    = User.Identity.Name,
                    Mensagem = ex.Message,
                    Operacao = TipoOperacao.Read.ToString(),
                    Tabela   = "Cliente"
                });
                Msg.Erro(Resource.ContateAdminstrador, this);
            }

            txtBairro.Text            = string.Empty;
            txtCelular.Text           = string.Empty;
            txtCep.Text               = string.Empty;
            txtCidade.Text            = string.Empty;
            txtComplemento.Text       = string.Empty;
            txtCPFCNPJ.Text           = string.Empty;
            txtEmail.Text             = string.Empty;
            txtEndereco.Text          = string.Empty;
            txtInscricaoEstadual.Text = string.Empty;
            txtNomeFantasia.Text      = string.Empty;
            txtNumero.Text            = string.Empty;
            txtRazaoSocial.Text       = string.Empty;
            txtTelefone.Text          = string.Empty;
            cbAtivo.Checked           = true;

            hfTipoOperacao.Value = TipoOperacao.Create.ToString();
        }
示例#13
0
        public string AddBrand(TB_BrandModel u)
        {
            string uid = "0";
            string msg = "厂家品牌添加失败!";

            if (HasBrandNo(u.FNAME, u.FID))
            {
                uid = "";
                msg = "厂家品牌已存在。";
            }
            else
            {
                if (HasBrandNumber(u.FNUMBER, u.FID))
                {
                    uid = "";
                    msg = "厂家品牌代码已存在。";
                }
                else
                {
                    uid = TB_BrandDal.Instance.Insert(u);
                    if (uid != "")
                    {
                        msg = "添加厂家品牌成功!";
                        LogBll <TB_BrandModel> log = new LogBll <TB_BrandModel>();
                        u.FID = uid;
                        log.AddLog(u);
                    }
                }
            }
            return(new JsonMessage {
                Data = uid.ToString(), Message = msg, Success = uid != ""
            }.ToString());
        }
示例#14
0
        // GET api/logapi
        public IEnumerable <CLog> Get(int page)
        {
            var user = (CSign)HttpContext.Current.Session[ConfigurationManager.AppSettings["AuthSaveKey"]];

            if (user == null)
            {
                throw new HttpResponseException(new SiginFailureMessage());
            }
            using (var dal = DalBuilder.CreateDal(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, 0))
            {
                CLog[] logs;
                try
                {
                    dal.Open();
                    logs = LogBll.List(dal, page);
                    dal.Close();
                }
                catch (Exception ex)
                {
                    LogBll.Write(dal, new CLog
                    {
                        LogUser    = string.Format("{0}-{1}", user.UserCode, user.UserName),
                        LogContent = string.Format("{0}#{1}", "Log.List", ex.Message),
                        LogType    = LogType.系统异常
                    });
                    throw new HttpResponseException(new SystemExceptionMessage());
                }
                if (logs == null)
                {
                    throw new HttpResponseException(new DataNotFoundMessage());
                }
                return(logs);
            }
        }
示例#15
0
        public string AddAppUser(AppUserModel u)
        {
            string uid = "0";
            string msg = "用户添加失败!";

            if (HasAppUserNo(u.PHONE, u.FID))
            {
                uid = "-2";
                msg = "手机号码已存在。";
            }
            else
            {
                uid = AppUserDal.Instance.Insert(u);
                if (uid != "")
                {
                    msg = "添加APP用户成功!";
                    LogBll <AppUserModel> log = new LogBll <AppUserModel>();
                    u.FID = uid;
                    log.AddLog(u);
                }
            }
            return(new JsonMessage {
                Data = uid.ToString(), Message = msg, Success = uid != ""
            }.ToString());
        }
示例#16
0
        public string AddGoods(GoodsModel u)
        {
            string uid = "0";
            string msg = "商品添加失败!";

            if (HasGoodsNo(u.GOODS_NAME, u.FID))
            {
                uid = "-2";
                msg = "商品已存在。";
            }
            else
            {
                uid = GoodsDal.Instance.Insert(u);
                if (uid != "")
                {
                    msg = "添加商品成功!";
                    LogBll <GoodsModel> log = new LogBll <GoodsModel>();
                    u.FID = uid;
                    log.AddLog(u);
                }
            }
            return(new JsonMessage {
                Data = uid.ToString(), Message = msg, Success = uid != ""
            }.ToString());
        }
        public ActionResult LogOn(string email, string senha, string returnUrl)
        {
            try
            {
                IntegranteBll integranteBll = new IntegranteBll();

                Integrante integrante = integranteBll.LogOn(email, senha);

                if (integrante != null)
                {
                    FormsAuthentication.SetAuthCookie(email, false);

                    if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") &&
                        !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                    {
                        return(Redirect(returnUrl));
                    }
                    else
                    {
                        return(RedirectToAction("Index", "Mensalidades"));
                    }
                }
                else
                {
                    return(View().ComMensagem(Resources.Geral.EmailSenhaInvalidos, TipoMensagem.Aviso));
                }
            }
            catch (Exception exception)
            {
                LogBll.GravarErro(exception, "LogOn");
                return(View().ComMensagem(Resources.Geral.ContateAdministrador, TipoMensagem.Erro));
            }
        }
示例#18
0
        private void LimparFormulario()
        {
            try
            {
                txtID.Text = string.Format("{0:000000}", ProdutoBll.RetornaNovoID());
            }
            catch (Exception ex)
            {
                LogBll.InserirLog(new Log
                {
                    Login    = User.Identity.Name,
                    Mensagem = ex.Message,
                    Operacao = TipoOperacao.Read.ToString(),
                    Tabela   = "Produto"
                });
                Msg.Erro(Resource.ContateAdminstrador, this);
            }

            ddlFornecedor.SelectedValue = "0";
            txtDescricao.Text           = string.Empty;
            txtPrecoQuantidade.Text     = string.Empty;
            txtPrecoUnitario.Text       = string.Empty;
            txtQuantidadeReposicao.Text = string.Empty;
            cbAtivo.Checked             = true;

            hfTipoOperacao.Value = TipoOperacao.Create.ToString();
        }
示例#19
0
        public ActionResult Mensalidade(int?CalendarioID, int?IntegranteID)
        {
            try
            {
                List <Calendario> calendarios = CalendarioBll.ListarCalendarios().ToList();
                List <Integrante> integrantes = IntegranteBll.RetornarIntegrantesAtivos().ToList();

                ViewBag.Calendarios = calendarios;
                ViewBag.Integrantes = integrantes;
                ViewBag.Integrantes = integrantes;

                IList <MensalidadeIntegrante> mensalidades = new List <MensalidadeIntegrante>();

                if (calendarios.Count > 0 && IntegranteID > 0)
                {
                    mensalidades = MensalidadeIntegranteBll.RetornarMensalidadesSeremBaixadas(IntegranteID, CalendarioID).ToList();
                }

                return(View(mensalidades));
            }
            catch (Exception exception)
            {
                LogBll.GravarErro(exception, this.User.Identity.Name);
                return(View().ComMensagem(Resources.Geral.ContateAdministrador, TipoMensagem.Erro));
            }
        }
示例#20
0
        private void BindarGrid()
        {
            try
            {
                UsuarioBll usuarioBll = new UsuarioBll();

                string[] filtro = new string[2];

                filtro[0] = txtFiltro.Text;
                filtro[1] = ddlAtivoFiltro.SelectedValue;

                gvUsuarios.DataSource = usuarioBll.BuscarUsuarios(filtro);
                gvUsuarios.DataBind();
            }
            catch (Exception ex)
            {
                LogBll.InserirLog(new Log
                {
                    Data     = DateTime.Today,
                    Mensagem = ex.Message,
                    Login    = this.Context.User.Identity.Name,
                    Operacao = TipoOperacao.Read.ToString(),
                    Tabela   = "Usuarios"
                });
                Msg.Erro(Resource.ContateAdminstrador, this);
            }
        }
示例#21
0
        public string EditFranchisee(FranchiseeModel u)
        {
            int    k;
            string msg = "加盟商编辑失败。";

            if (HasFranchiseeNo(u.COMPANY_NAME, u.FID))
            {
                k   = -2;
                msg = "加盟商已存在。";
            }
            else
            {
                var oldFranchisee = FranchiseeDal.Instance.Get(u.FID);
                k = FranchiseeDal.Instance.Update(u);
                if (k > 0)
                {
                    msg = "编辑加盟商成功。";
                    LogBll <FranchiseeModel> log = new LogBll <FranchiseeModel>();
                    log.AddLog(u);
                }
            }
            return(new JsonMessage {
                Data = k.ToString(), Message = msg, Success = k > 0
            }.ToString());
        }
示例#22
0
        public ActionResult LocalJogo([Bind(Include = "ID,Nome,ValorJogo,Ativo")] LocalJogo localJogo)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    LocalJogoBll localJogoBll = new LocalJogoBll();

                    if (localJogo.ID > 0)
                    {
                        localJogoBll.Atualizar(localJogo);
                        LogBll.GravarInformacao(string.Format(Resources.LocalJogo.AtualizacaoLog, localJogo.ID), "", User.Identity.Name);
                        return(RedirectToAction("Index").ComMensagem(Resources.LocalJogo.LocalJogoSalvo, TipoMensagem.Sucesso));
                    }
                    else
                    {
                        localJogoBll.Criar(localJogo);
                        LogBll.GravarInformacao(string.Format(Resources.LocalJogo.CriacaoLog, localJogo.ID), "", User.Identity.Name);
                        return(RedirectToAction("Index").ComMensagem(Resources.LocalJogo.LocalJogoSalvo, TipoMensagem.Sucesso));
                    }
                }

                return(View(localJogo));
            }
            catch (Exception exception)
            {
                LogBll.GravarErro(exception, User.Identity.Name);
                return(RedirectToAction("Index").ComMensagem(Resources.Geral.ContateAdministrador, TipoMensagem.Erro));
            }
        }
示例#23
0
        public string EditGoods(GoodsModel u)
        {
            int    k;
            string msg = "商品编辑失败。";

            if (HasGoodsNo(u.GOODS_NAME, u.FID))
            {
                k   = -2;
                msg = "商品已存在。";
            }
            else
            {
                var oldGoods = GoodsDal.Instance.Get(u.FID);
                k = GoodsDal.Instance.Update(u);
                if (k > 0)
                {
                    msg = "编辑商品成功。";
                    LogBll <GoodsModel> log = new LogBll <GoodsModel>();
                    log.AddLog(u);
                }
            }
            return(new JsonMessage {
                Data = k.ToString(), Message = msg, Success = k > 0
            }.ToString());
        }
示例#24
0
        public string AddMaster(MasterModel u)
        {
            string uid = "0";
            string msg = "技师添加失败!";

            if (HasMasterNo(u.PHONE, u.FID))
            {
                uid = "-2";
                msg = "手机号码已存在。";
                return(new JsonMessage {
                    Data = uid.ToString(), Message = msg, Success = false
                }.ToString());
            }
            else
            {
                u.MASTER_NO = MasterDal.Instance.GetNewNo();
                uid         = MasterDal.Instance.Insert(u);
                if (uid != "")
                {
                    msg = "添加APP技师成功!";
                    LogBll <MasterModel> log = new LogBll <MasterModel>();
                    u.FID = uid;
                    log.AddLog(u);
                }
            }
            return(new JsonMessage {
                Data = uid.ToString(), Message = msg, Success = (uid != "")
            }.ToString());
        }
示例#25
0
        // GET api/menuapi
        public IEnumerable <CMenuCategory> Get()
        {
            var user =
                (CSign)HttpContext.Current.Session[ConfigurationManager.AppSettings["AuthSaveKey"]];

            if (user == null)
            {
                throw new HttpResponseException(new SiginFailureMessage());
            }
            using (var dal = DalBuilder.CreateDal(ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString, 0))
            {
                try
                {
                    dal.Open();
                }
                catch (Exception ex)
                {
                    LogBll.Write(dal, new CLog
                    {
                        LogUser    = string.Format("{0}-{1}", user.UserCode, user.UserName),
                        LogContent = string.Format("{0}#{1}", "Menu.List", ex.Message),
                        LogType    = LogType.系统异常
                    });
                    throw new HttpResponseException(new SystemExceptionMessage());
                }
                var menus = FunctionBll.LoadMenu(dal, user.GroupCode);
                if (menus == null)
                {
                    throw new HttpResponseException(new DataNotFoundMessage());
                }
                return(menus);
            }
        }
示例#26
0
        public string EditMaster(MasterModel u)
        {
            int    k;
            string msg = "技师编辑失败。";

            if (HasMasterNo(u.PHONE, u.FID))
            {
                k   = -2;
                msg = "手机号码已存在。";
                return(new JsonMessage {
                    Data = "", Message = msg, Success = false
                }.ToString());
            }
            else
            {
                var oldMaster = MasterDal.Instance.Get(u.FID);
                k = MasterDal.Instance.Update(u);
                if (k > 0)
                {
                    msg = "编辑APP技师成功。";
                    LogBll <MasterModel> log = new LogBll <MasterModel>();
                    log.AddLog(u);
                }
            }
            return(new JsonMessage {
                Data = k.ToString(), Message = msg, Success = k > 0
            }.ToString());
        }
示例#27
0
        public string EditBrand(TB_BrandModel u)
        {
            int    k;
            string msg = "厂家品牌编辑失败。";

            if (HasBrandNo(u.FNAME, u.FID))
            {
                k   = -2;
                msg = "厂家品牌已存在。";
            }
            else
            {
                if (HasBrandNumber(u.FNUMBER, u.FID))
                {
                    k   = -2;
                    msg = "厂家品牌代码已存在。";
                }
                else
                {
                    var oldBrand = TB_BrandDal.Instance.Get(u.FID);
                    k = TB_BrandDal.Instance.Update(u);
                    if (k > 0)
                    {
                        msg = "编辑厂家品牌成功。";
                        LogBll <TB_BrandModel> log = new LogBll <TB_BrandModel>();
                        log.AddLog(u);
                    }
                }
            }
            return(new JsonMessage {
                Data = k.ToString(), Message = msg, Success = k > 0
            }.ToString());
        }
示例#28
0
        /// <summary>
        /// GetStats
        /// </summary>
        /// <returns></returns>
        public string GetStats()
        {
            var data = LogBll.GetStats();
            var str  = JsonConvert.SerializeObject(new { DatabaseStats = data.Item1, CollectionStats = data.Item2 });

            //return Json(new { DatabaseStats = data.Item1, CollectionStats = data.Item2 }, JsonRequestBehavior.AllowGet);
            return(str);
        }
示例#29
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     LogBll.Jobs();
 }
示例#30
0
        private void AlterarCliente()
        {
            int ID = int.TryParse(txtID.Text, out ID) ? ID : 0;

            try
            {
                ClienteBll clienteBll = new ClienteBll();
                Cliente    cliente    = clienteBll.RetornarCliente(ID);

                cliente.Ativo       = cbAtivo.Checked;
                cliente.Bairro      = txtBairro.Text;
                cliente.Celular     = txtCelular.Text;
                cliente.Cep         = txtCep.Text;
                cliente.Cidade      = txtCidade.Text;
                cliente.Complemento = txtComplemento.Text;
                cliente.CPFCNPJ     = txtCPFCNPJ.Text;
                cliente.Email       = txtEmail.Text;
                //TODO: desenvolver conceito de empresa
                //cliente.EmpresaID
                cliente.Endereco = txtEndereco.Text;
                //TODO: Inserir campo estado
                //cliente.Estado =
                cliente.InscricaoEstadual = txtInscricaoEstadual.Text;
                cliente.NomeFantasia      = txtNomeFantasia.Text;
                cliente.Numero            = txtNumero.Text;
                cliente.RazaoSocial       = txtRazaoSocial.Text;
                cliente.Telefone          = txtTelefone.Text;

                clienteBll.AlterarCliente(cliente);

                LimparFormulario();

                LogBll.InserirLog(new Log
                {
                    ItemID   = ID,
                    Login    = Context.User.Identity.Name,
                    Operacao = TipoOperacao.Update.ToString(),
                    Tabela   = "Cliente"
                });

                Msg.Sucesso(Resource.ItemSalvoSucesso, this);
            }
            catch (Exception ex)
            {
                LogBll.InserirLog(new Log
                {
                    ItemID   = ID,
                    Login    = Context.User.Identity.Name,
                    Mensagem = ex.Message,
                    Operacao = TipoOperacao.Update.ToString(),
                    Tabela   = "Cliente"
                });

                Msg.Erro(Resource.ContateAdminstrador, this);
            }
        }