public ActionResult _Topic(int aid, int?sort)
        {
            int    cursort = sort == null ? 1 : (int)sort;
            Answer answer  = db.Answer.Include("Paper").Include("Student").First(a => a.AnswerID == aid);

            if (answer == null)
            {
                return(HttpNotFound());
            }
            ViewBag.answer = answer;
            Selects topic = answer.Paper.Selects.ToList()[cursort - 1];

            ViewBag.topic = topic;
            ViewBag.sort  = cursort;
            ViewBag.count = answer.Paper.Selects.ToList().Count;
            if (db.Detail.Where(d => d.AnswerID == aid && d.TopicID == topic.TopicID).Count() == 0)
            {
                Detail detail = new Detail();
                detail.AnswerID     = answer.AnswerID;
                detail.TopicID      = topic.TopicID;
                detail.DetailAnswer = "";
                db.Detail.Add(detail);
                db.SaveChanges();
            }
            Detail curdetail = db.Detail.Include("Topic").Include("Answer").First(d => d.AnswerID == aid && d.TopicID == topic.TopicID);

            return(PartialView(curdetail));
        }
        // GET: Mecanios
        public ActionResult Index()
        {
            ViewBag.sexo       = Selects.list_sexo();
            ViewBag.estado_mec = Selects.list_estado_mec();

            return(View(bd.mecanico.ToList()));
        }
Example #3
0
        public SqlFromQuery ToOutQuery(params SqlSelectItem[] selectItem)
        {
            if (selectItem == null || selectItem.Length <= 0)
            {
                throw new ArgumentException("must select some one");
            }

            foreach (var item in selectItem)
            {
                if (item.Target.Expression.Type == ExpressionType.SelectItemExpression)
                {
                    SqlSelectItemExpression si = (SqlSelectItemExpression)item.Target.Expression;
                    if (si.Owner == this)
                    {
                        SqlSelectItemExpression tar = new SqlSelectItemExpression(si.Expression, item.Target.AliasName);
                        tar.Owner = this;
                        Selects.Add(item.Target.AliasName, tar);
                    }
                    else
                    {
                        Selects.Add(item.Target.AliasName, item.Target);
                    }
                }
                else
                {
                    Selects.Add(item.Target.AliasName, item.Target);
                }
            }

            return(new SqlFromQuery(this));
        }
 public ActionResult MecanicoAdd(mecanico mecanico)
 {
     if (ModelState.IsValid)
     {
         try
         {
             bd.SP_INS_MECANICO(
                 mecanico.nombre_completo,
                 mecanico.sexo,
                 mecanico.estado,
                 mecanico.telefono,
                 mecanico.direccion,
                 mecanico.email);
             bd.SaveChanges();
             return(RedirectToAction("Index"));
         }
         catch (Exception e)
         {
             ViewBag.estado_mec = Selects.list_estado_mec();
             ViewBag.sexo       = Selects.list_sexo();
             return(View(mecanico));
         }
     }
     else
     {
         ViewBag.estado_mec = Selects.list_estado_mec();
         ViewBag.sexo       = Selects.list_sexo();
         return(View(mecanico));
     }
 }
        public ActionResult MecanicoAdd()
        {
            ViewBag.sexo       = Selects.list_sexo();
            ViewBag.estado_mec = Selects.list_estado_mec();

            return(View());
        }
Example #6
0
        public ActionResult ClientesAdd()
        {
            ViewBag.sexo   = Selects.list_sexo();
            ViewBag.estado = Selects.list_estado();

            return(View());
        }
Example #7
0
 public PrintLogSearchForm(UrlHelper url) : base(url)
 {
     SetApiUrl("PrintAPI", "PrintLog", url);
     AddSortField(new SortField("PrintId", "Id", true, true));
     Selects.Add("PrintId");
     //Rest is inherited
 }
Example #8
0
        //отображение списка компаний
        public ActionResult Index()
        {
            Selects sel = new Selects();

            ViewBag.New = sel.SelectCompanies();
            return(View());
        }
        //отображение формы добавления компании
        public ActionResult FormAddCompany()
        {
            Selects sel = new Selects();

            ViewBag.positions = sel.SelectForms();
            return(View());
        }
Example #10
0
        //отображение списка работников
        public ActionResult AllWorkers()
        {
            Selects sel = new Selects();

            ViewBag.Newsel = sel.SelectWorkers();
            return(View());
        }
Example #11
0
        void CheckedChange(string path, bool isChecked)
        {
            if (IsSelectMany == false)
            {
                Selects.Clear();
                if (isChecked)
                {
                    Selects.Add(path);
                }
                return;
            }

            if (isChecked)
            {
                if (Selects.Contains(path))
                {
                    return;
                }
                Selects.Add(path);
            }
            else
            {
                if (Selects.Contains(path) == false)
                {
                    return;
                }
                Selects.Remove(path);
            }
        }
Example #12
0
 public static void AdicionarHistorico(int cd, string alteracao, string artigo, string tabela, int id = 0)
 {
     try
     {
         string mensagem = char.ToUpper(alteracao[0]) + alteracao.Substring(1) +
                           " " + artigo + " " + tabela;
         if (id != 0)
         {
             mensagem += " nº " + id;
         }
         using (var mConn = Connect.LiteString())
         {
             mConn.Open();
             if (mConn.State == ConnectionState.Open)
             {
                 var           s       = Connect.LiteConnection(Selects.SelectUsuarioLogin(cd));
                 string        cmdText = "insert into tbHistorico values (null,@ds,@dt,@hr,@id)";
                 SQLiteCommand cmd     = new SQLiteCommand(cmdText, mConn);
                 cmd.Parameters.AddWithValue("@ds", mensagem);
                 cmd.Parameters.AddWithValue("@dt", DateTime.Today);
                 cmd.Parameters.AddWithValue("@hr", DateTime.Now.TimeOfDay);
                 cmd.Parameters.AddWithValue("@id", s.Rows[0].ItemArray[0].ToString());
                 cmd.ExecuteNonQuery();
             }
         }
     }
     catch (Exception ex)
     {
         Error.Erro(ex);
     }
 }
Example #13
0
        public string BuildSqlString()
        {
            if (Selects.Count == 0)
            {
                throw new InvalidOperationException("A query must have a select part");
            }

            foreach (var qs in Simplifications)
            {
                if (qs.CanSimplify(this))
                {
                    return(qs.Simplify(this));
                }
            }

            var countOperator = ResultOperators.FirstOrDefault(it => it is CountResultOperator || it is LongCountResultOperator);

            if (countOperator != null)
            {
                return(BuildCountQuery(countOperator));
            }

            var sb = new StringBuilder();

            sb.Append("SELECT ");
            sb.Append(string.Join(@", 
	"    , Selects.Select(it => it.Sql))).AppendLine();
            sb.Append(GetFromPart());
            sb.Append(GetWherePart());
            sb.Append(GetOrderPart());

            ProcessResultOperators(sb);

            return(sb.ToString());
        }
        public ActionResult Repu_servicio(int id)
        {
            List <SelectListItem> lista_repu = Selects.Armar_Select_Repuestos();

            ViewBag.repuestos   = lista_repu;
            ViewBag.servicio_id = id;
            return(View());
        }
        //删除试卷表考题
        public ActionResult Deletes(int id)
        {
            Selects selects = db.Selects.Find(id);

            db.Selects.Remove(selects);
            db.SaveChanges();
            return(RedirectToAction("Index", "Paper"));
        }
Example #16
0
        //отображение формы добавления работника
        public ActionResult FormAddWorker()
        {
            Selects sel = new Selects();

            ViewBag.positions = sel.SelectPositions();
            ViewBag.companies = sel.SelectCompanies();
            return(View());
        }
        public ActionResult MecanicoUpdt(int id)
        {
            mecanico mecanico = bd.mecanico.Find(id);

            ViewBag.estado_mec = new SelectList(Selects.list_estado_mec(), "Value", "Text", mecanico.estado);
            ViewBag.sexo       = new SelectList(Selects.list_sexo(), "Value", "Text", mecanico.sexo);
            return(View(mecanico));
        }
Example #18
0
        public ActionResult ClientesUpdt(int id)
        {
            cliente cliente = bd.cliente.Find(id);

            ViewBag.estado = new SelectList(Selects.list_estado(), "Value", "Text", cliente.estado);
            ViewBag.sexo   = new SelectList(Selects.list_sexo(), "Value", "Text", cliente.sexo);
            return(View(cliente));
        }
        public ActionResult VehiculoUpdt(int id)
        {
            vehiculo vehiculo           = bd.vehiculo.Find(id);
            List <SelectListItem> lista = Selects.Armar_Select_Clientes();

            ViewBag.propietario = lista;
            return(View(vehiculo));
        }
        public ActionResult VehiculoAdd()
        {
            ClientesController    ClientesController = new ClientesController();
            List <SelectListItem> lista = Selects.Armar_Select_Clientes();

            ViewBag.propietario = lista;

            return(View());
        }
Example #21
0
    protected void Page_Load(object sender, EventArgs e)
    {
        Selects pageSelects = getRegions();

        regionmenu.InnerHtml         = pageSelects.menu;
        autorenewContainer.InnerHtml = pageSelects.autoRenew;
        manageSelect.InnerHtml       = pageSelects.manageSelects;
        subManageSelect.InnerHtml    = pageSelects.subManageSelects;
        messageSelect.InnerHtml      = pageSelects.messageSelects;
    }
Example #22
0
 private void Awake()
 {
     if (Selects.instance == null)
     {
         Selects.instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
 }
Example #23
0
        /// <summary>
        /// Determines if select statement can be wildcard. This is the case when all columns are selected and no aliases are defined.
        /// </summary>
        private bool DetermineIfSelectCanBeWildcard()
        {
            var hasUnselectedColumns = Selects.Any(c => !c.IsSelected);
            var hasAliases           = false;

            if (!hasUnselectedColumns)
            {
                hasAliases = Selects.Any(c => !string.IsNullOrWhiteSpace(c.Alias));
            }

            return(!hasUnselectedColumns && !hasAliases);
        }
        public ActionResult ServicioAdd()
        {
            List <SelectListItem> lista_Vehi = Selects.Armar_Select_Vehiculos();

            ViewBag.vehiculo = lista_Vehi;
            List <SelectListItem> lista_Meca = Selects.Armar_Select_Mecanicos();

            ViewBag.mecanico = lista_Meca;
            ViewBag.estado   = new SelectList(Selects.list_estado(), "Value", "Text");

            return(View());
        }
        public ActionResult ServicioAdd(servicio servicio, HttpPostedFileBase file)
        {
            if (ModelState.IsValid && file != null && file.ContentLength > 0)
            {
                try
                {
                    byte[] imagenData = null;
                    using (var foto_vehiculo = new BinaryReader(file.InputStream))
                    {
                        imagenData = foto_vehiculo.ReadBytes(file.ContentLength);
                    }
                    servicio.foto = imagenData;


                    bd.SP_INS_SERVICIO(
                        servicio.vehiculo_id,
                        servicio.descripcion_danno,
                        servicio.mecanico_id,
                        servicio.presupuesto_arreglo,
                        servicio.estimacion_tiempo_hrs,
                        servicio.estimacion_precio,
                        servicio.precio_mano_obra,
                        servicio.foto,
                        servicio.fecha_ingreso,
                        servicio.fecha_salida,
                        servicio.estado
                        );
                    bd.SaveChanges();
                    return(RedirectToAction("Index"));
                }
                catch (Exception e)
                {
                    List <SelectListItem> lista_Vehi = Selects.Armar_Select_Vehiculos();
                    ViewBag.vehiculo = lista_Vehi;
                    List <SelectListItem> lista_Meca = Selects.Armar_Select_Mecanicos();
                    ViewBag.mecanico = lista_Meca;
                    ViewBag.estado   = new SelectList(Selects.list_estado(), "Value", "Text");

                    return(View(servicio));
                }
            }
            else
            {
                List <SelectListItem> lista_Vehi = Selects.Armar_Select_Vehiculos();
                ViewBag.vehiculo = lista_Vehi;
                List <SelectListItem> lista_Meca = Selects.Armar_Select_Mecanicos();
                ViewBag.mecanico = lista_Meca;
                ViewBag.estado   = new SelectList(Selects.list_estado(), "Value", "Text");

                return(View(servicio));
            }
        }
 public void AdicionarResultadoAgregado(Agregadores agregador, string campo)
 {
     if (agregador == Agregadores.Count)
     {
         Selects.Add(" " + agregador + ((campo == null)
                                 ? "(*)"
                                 : "(distinct [" + campo + "])as[" + campo + "]"));
     }
     else
     {
         Selects.Add(" " + agregador + "([" + campo + "])as[" + campo + "]");
     }
 }
Example #27
0
        public ActionResult FormUpCompany(int id, string name_of, string company_size, string legal_form_id)
        {
            Selects sel = new Selects();

            ViewBag.positions = sel.SelectForms();

            ViewBag.id_c      = id;
            ViewBag.name_of_c = name_of;
            ViewBag.size_c    = company_size;
            ViewBag.form_c    = legal_form_id;

            return(View());
        }
Example #28
0
        public void TestFieldSearchValidCases(ResourceId resourceId, Selects.ValidSelect validSelect)
        {
            var fieldHandler = new FieldManager();
            var request      = new List <KeyValuePair <string, string> >();

            AddDefaultRequestValue(resourceId, request);
            request.AddRange(Selects.SelectMapperValue[validSelect]);
            var response = fieldHandler.GetFieldGuid(request, HttpMethod.GET.ToNetHttpMethod());

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), $"Read a field operation was not successful. HTTP response code is {response.HttpStatusCode}");
            PrAssert.That(response.Result.Result, PrIs.Not.Empty.Or.Null, "The search result is empty");
            Selects.VerifyContainExpectedSelect(response.Result, new[] { validSelect });
        }
 private void ConstruirSelectPadrao(Dicionario dicionario)
 {
     if (dicionario == null)
     {
         Selects.Add("[" + _tabela + "].*");
     }
     else
     {
         foreach (var item in dicionario.Itens)
         {
             Selects.Add("[" + item.Nome + "]" + ConsultarAliasDoCampo(item));
         }
     }
 }
Example #30
0
        public void ValidTests(ResourceId resourceId, FieldType fieldType)
        {
            var request = new Dictionary <string, object>
            {
                [Selects.IdParam]     = PrepareField.Data[$"{resourceId}_{fieldType}_{NumberOfField-1}"].Guid.ToString(),
                [Selects.SelectParam] = Selects.Select.Alias.GetEnumStringValue()
            };
            var manager  = new DefaultManager();
            var response = manager.Send <FieldDetailsResponse>(Endpoint, request.ToJson(), HttpMethod.POST);

            PrAssert.That(response, PrIs.SuccessfulResponse().And.HttpCode(System.Net.HttpStatusCode.OK), "Can not read field");
            // Verify response data
            Selects.VerifyContainExpectedSelect(response.Result, Selects.ValidSelect.Alias);
        }