コード例 #1
0
ファイル: HomeController.cs プロジェクト: plebani/mobilecrm
        public bool connectar()
        {
            //Usuario novaTarega = new Usuario();
            //novaTarega.Nome = "Ivan";
            //novaTarega.Sobrenome = "Filagrana";
            //novaTarega.Senha = "000";

            CRMEntities dbContext = new CRMEntities();
            //var x = dbContext.Usuarios.Where(p => p.Nome == ).SingleOrDefault();
            //x.Nome = "Ivan Filagrana";

            //teste.SaveChanges();

            //var te = teste.Usuarios.Select(p => p.Handle == 2);

            //teste.AddToUsuarios(novaTarega);
            //teste.SaveChanges();

            var xConnectionStrings = ConfigurationManager.ConnectionStrings["mobileCRM"];

            // Create a connection string for the sample database
            SqlConnectionStringBuilder connString2Builder;
            connString2Builder = new SqlConnectionStringBuilder();
            connString2Builder.ConnectionString = xConnectionStrings.ConnectionString;
            connString2Builder.Encrypt = true;
            connString2Builder.TrustServerCertificate = true;

            return true;
        }
コード例 #2
0
ファイル: LoginController.cs プロジェクト: plebani/mobilecrm
        public ActionResult Index(FormCollection collection)
        {
            CRMEntities ctx = new CRMEntities();

            string nome = string.Empty;
            string password = string.Empty;

            if (collection.Count > 0)
            {
                nome     = collection["nome"];
                password = collection["password"];

                var user = ctx.Usuarios.Where(p => p.Nome == nome && p.Senha == password).SingleOrDefault();

                if (user != null)
                {
                    Session["usuario"] = user;
                    ViewBag.informacao = "Logando...";
                    ViewBag.usuario = string.Format("{0} {1}", user.Nome, user.Sobrenome);

                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    ViewBag.informacao = "Usuário/Senha incorretos.";
                }
            }

            return View();
        }
コード例 #3
0
ファイル: VisitaController.cs プロジェクト: plebani/mobilecrm
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                Usuario user = (Usuario)Session["usuario"];

                Visita visita = new Visita();

                if (!string.IsNullOrEmpty(collection["tipoTarefa"]))
                {
                    visita.TipoTarefa = Convert.ToInt32(collection["tipoTarefa"]);
                }
                if (!string.IsNullOrEmpty(collection["tipoCliente1"]))
                {
                    visita.ClienteBase = Convert.ToInt32(collection["tipoCliente1"]);
                }
                if (!string.IsNullOrEmpty(collection["clientes"]))
                {
                    visita.IDCliente = Convert.ToInt32(collection["clientes"]);
                }
                if (!string.IsNullOrEmpty(collection["assunto"]))
                {
                    visita.Assunto = collection["assunto"];
                }
                if (!string.IsNullOrEmpty(collection["dataInicio"]))
                {
                    visita.DataInicio = Convert.ToDateTime(collection["dataInicio"]);
                }
                if (!string.IsNullOrEmpty(collection["dataConclusao"]))
                {
                    visita.DataConclusao = Convert.ToDateTime(collection["dataConclusao"]);
                }
                if (!string.IsNullOrEmpty(collection["descricao"]))
                {
                    visita.Descricao = collection["descricao"];
                }
                if (user != null)
                {
                    visita.IDUsuario = user.Handle;
                }

                CRMEntities dbContext = new CRMEntities();
                dbContext.AddToVisitas(visita);
                dbContext.SaveChanges();

                return RedirectToAction("Index");
            }
            catch
            {
                return View();
            }
        }
コード例 #4
0
ファイル: VisitaRepository.cs プロジェクト: plebani/mobilecrm
 public VisitaRepository()
 {
     db = new CRMEntities();
 }
コード例 #5
0
ファイル: TarefaRepository.cs プロジェクト: plebani/mobilecrm
 public TarefaRepository()
 {
     db = new CRMEntities();
 }