public static async Task <string> GetEventAttendees([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "getEventAttendees")] HttpRequest req, ILogger log) { try { List <string> return_results = new List <string> (); string[] fields; foreach (string member in CRUDHelper.getQuery( String.Format( "SELECT memberID FROM modestomovesdb.eventattendees WHERE eventID = '{0}'", getEventID(req.Query["eventID"]) ) )) { //Could also get the Checkin and Checkout dates here... foreach (string row in CRUDHelper.getQuery( //Get Race points and points-of-interest String.Format( //UPDATE modestomovesdb.members SET lastName = '{1}', firstName = '{2}', email = '{3}', phone = '{4}' "SELECT firstName, lastName, email, phone FROM modestomovesdb.members WHERE memberId = '{0}'", member ) )) { fields = row.Split(','); string[] event_fields = CRUDHelper.getQuery( String.Format( "SELECT checkIn, checkOut FROM modestomovesdb.eventattendees WHERE eventID = '{0}'", getEventID(req.Query["eventID"]) ) ) [0].Split(','); string medical_fields = CRUDHelper.getQuery( String.Format( "SELECT * FROM modestomovesdb.medicalinfo WHERE memberID = {0}", member ) ) [0]; return_results.Add( String.Format( "{{\"firstName\": \"{0}\", \"lastName\": \"{1}\", \"email\": \"{2}\", \"phone\": \"{3}\", \"checkIn\": \"{4}\", \"checkOut\": \"{5}\", \"medical_info\": \"{6}\" }}", fields[0], fields[1], fields[2], fields[3], event_fields[0], event_fields[1], medical_fields ) ); } } return(String.Format( "{{'members' : [{0}]}}".Replace("'", "\""), String.Join(",", return_results.ToArray()) )); } catch (Exception ex) { return(ex.ToString()); } }
protected void btnSave_Click(object sender, EventArgs e) { try { var dao = BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.IdentAtencion); IdentAtencionDTO entity = (DTO.IdentAtencionDTO)CRUDHelper.Read(Convert.ToInt32(pnlControls.Attributes["RecId"]), dao); FormsHelper.FillEntity(tblControls, entity); if (!entity.Estado && dao.ExisteAvisoEnVigencia(entity.IdentifIdentAte)) { throw new Exception("No se puede deshabilitar, ya que se encuentra en uso por un aviso vigente."); } CRUDHelper.Update(entity, BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.IdentAtencion)); pnlControls.Visible = false; RefreshGrid(gv); } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }
private bool ValidProducto(out string err) { err = string.Empty; if (ucIdentifSKU.SelectedValue == null) { err = "Debe seleccionar un producto."; return(false); } if (!((DTO.SKUDTO)CRUDHelper.Read(string.Format("IdentifSKU = '{0}'", ucIdentifSKU.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.SKU))).Activo) { err = "El producto no se encuentra Activo."; return(false); } if (rbTipoProd.SelectedItem == null) { err = "Debe seleccionar si el tipo de producto es Primario o Secundario."; return(false); } if (spCoeficiente.Value != null && (spCoeficiente.Number > 1 || spCoeficiente.Number < 0)) { err = "El 'Coeficiente' debe estar entre los valores 0 y 1."; return(false); } return(true); }
private void btnFinishOrder_Click(object sender, EventArgs e) { if (products_order_list.Count == 0) { MessageBox.Show("Siparişe ekli ürün bulunamadı."); return; } if (String.IsNullOrEmpty(tbOrderName.Text)) { MessageBox.Show("Sipariş adını giriniz."); return; } DialogResult result = MessageBox.Show("Siparişi Onaylıyormusunuz ?", null, MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { var newOrder = new Order { CreatedDate = DateTime.Now, Name = tbOrderName.Text, OrderId = Guid.NewGuid().ToString(), TotalPrice = SetTotalPrice() }; CRUDHelper.AddOrder(newOrder); products_order_list.ForEach(x => CRUDHelper.AddOrderDetails(new OrderDetails { OrderId = newOrder.OrderId, Peice = x.Piece, ProductId = x.ProductID, TotalPrice = x.TotalPrice, ProductName = x.ProductName })); gbProductInfo.Hide(); lbTotalPrice.Text = ""; products_order_list.Clear(); lwOrder.Items.Clear(); Clear(); } else { } }
public static async Task <string> GetEvent([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "getEvent")] HttpRequest req, ILogger log) { try { List <string> output = CRUDHelper.getQuery( String.Format( "SELECT name, startDate, description FROM modestomovesdb.raceEvents WHERE nameID = '{0}'", req.Query["name"] ) ); string is_ongoing = "false"; var utc = DateTime.UtcNow; TimeZoneInfo pacificZone = TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time"); var pacificTime = TimeZoneInfo.ConvertTimeFromUtc(utc, pacificZone); var format = "yyyy-MM-dd"; var stringDate = pacificTime.ToString(format); DateTime date_time = DateTime.Parse(output[0].Split(",") [1]); string formattedDate = date_time.ToString(format); if (formattedDate == stringDate) { is_ongoing = "true"; } return(String.Format( //Generate the member object "{{{0}, \"is_ongoing\": \"{1}\" }}", CRUDHelper.formatEvent(output[0].Split(",")), is_ongoing )); } catch (Exception ex) { return(ex.ToString()); } }
private void ucFrecuenciaChanged() { if (ucIdentifFrecuencia.SelectedValue != null) { DTO.FrecuenciaDTO frecuencia = CRUDHelper.Read(string.Format("IdentifFrecuencia = '{0}'", ucIdentifFrecuencia.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.Frecuencia)); trDia.Visible = (frecuencia.SemMes.Trim().ToUpper() == MES); trDiaSemana.Visible = (frecuencia.SemMes.Trim().ToUpper() == SEMANA); } else { trDia.Visible = false; trDiaSemana.Visible = false; } if (!trDia.Visible) //Si no se muestra, va en NULL. { spDia.Value = null; } if (!trDiaSemana.Visible) //Si no se muestra, va en NULL. { clDiaSemana.SelectedItem = null; } }
public void ProductEkle() { string productId = Guid.NewGuid().ToString(); string productName = tbxProductName.Text; string barkodNo = tbxBarkodNo.Text; decimal unitPrice = Convert.ToDecimal(tbxUnitPrice.Text); int quantity = Convert.ToInt32(tbxQuantity.Text); DateTime additionDate = DateTime.Now; CRUDHelper.AddProduct(new Product { ProductId = productId, ProductName = productName, BarkodNo = barkodNo, Quantity = quantity, UnitPrice = unitPrice, AdditionDate = additionDate }); foreach (var item in lbCategory.SelectedItems) { CRUDHelper.AddProductCategory(new ProductsCategories { ProductID = productId, CategoryID = (item as Categories).CategoryId, }); } MessageBox.Show("tamam"); }
protected void btnSave_Click(object sender, EventArgs e) { string err = string.Empty; try { if (Valid(out err)) { var entity = CRUDHelper.Read(Convert.ToInt32(pnlControls.Attributes["RecId"]), DAO); FormsHelper.FillEntity(tblControls, entity); if (!trDuracion.Visible) { (entity as DTO.PiezasArteDTO).Duracion = null; } Business.PiezasArte.Update(entity, Productos); pnlControls.Visible = false; RefreshGrid(gv); } else { throw new Exception(err); } } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }
void gvABM_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e) { e.Cancel = true; CRUDHelper.Delete(Convert.ToInt32(e.Keys[0]), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.FrecuenciaDet)); RefreshAbmGrid(gvABM); }
/// <summary> ///根据数据库获取所有数据表 /// </summary> /// <param name="context"></param> /// <returns></returns> private string GetTableByDataBase(HttpContext context) { crudHelper = new CRUDHelper <object>(HttpContext.Current.Session["strConnection"]?.ToString(), HttpContext.Current.Session["strType"]?.ToString()); // crudHelper = new CRUDHelper<object>(globalVar.strConnection, globalVar.strType); int page = Convert.ToInt32(context.Request.Params["page"]); int rows = Convert.ToInt32(context.Request.Params["rows"]); return(crudHelper.SelectPageToJSONBySQL("user_tab_comments", page, rows, "TABLE_NAME")); }
public static int getEventID(string eventName) // Gets eventID with the name of the event { return(int.Parse(CRUDHelper.getQuery( String.Format( "SELECT eventID FROM modestomovesdb.raceEvents WHERE nameID = '{0}'", eventName ) ) [0])); }
private void TipoDeEspacioChanged() { DTO.TipoEspacioDTO espacio = CRUDHelper.Read(string.Format("IdentifTipoEsp='{0}'", ucIdentifTipoEsp.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.TipoEspacio)); trFrecuencia.Visible = espacio.Frecuencia; trHoraInicio.Visible = espacio.Hora; trHoraFin.Visible = espacio.Hora; trIntervalo.Visible = espacio.Intervalo; UpdatePanel1.Update(); }
/* * * * * * * * * * */ /* Helping Functions */ /* * * * * * * * * * */ public static bool checkUser(string table, string condition, string id) // Check if the Google ID exists in the DB { return(CRUDHelper.getQuery( String.Format( "SELECT * FROM {0} WHERE {1} = '{2}';", table, condition, id ) ).Count != 0); //true if user exists }
public static int getMemberID(string googleID) // Gets member ID { List <string> query_result = CRUDHelper.getQuery( String.Format( "SELECT memberID FROM modestomovesdb.members WHERE googleID = '{0}'", googleID ) ); return(int.Parse(query_result[0])); }
public static async Task <string> GetAuth([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "getAuth")] HttpRequest req, ILogger log) { try { // Check if google id is in admin table or participant table... return("Done: " + CRUDHelper.executeNonQuery( "DELETE FROM modestomovesdb.employees" )); } catch (Exception ex) { return(ex.ToString()); } }
public static async Task <string> GetMembers([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "getMembers")] HttpRequest req, ILogger log) { try { string result = ""; foreach (string row in CRUDHelper.getQuery("SELECT * FROM modestomovesdb.members")) { result += row + "\n"; } return(result); } catch (Exception ex) { return(ex.ToString()); } }
public static async Task <string> DeleteEvent([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "deleteEvent")] HttpRequest req, ILogger log) { try { return(CRUDHelper.executeNonQuery( // Delete an event in the database String.Format( "DELETE FROM modestomovesdb.raceEvents WHERE nameID = '{0}'", req.Query["name"] ) ) + " Deleted " + req.Query["name"]); } catch (Exception ex) { return(ex.ToString()); } }
private void SetupDependencyDTO() { var builder = new ContainerBuilder(); DIHelper.RegisterServices(builder); var container = builder.Build(); var mapper = container.Resolve <IMapper>(); var crudHelper = new CRUDHelper(this.DBContext, mapper); this.DependencyDTO = new DependencyDTO(mapper, this.DBContext, crudHelper); }
private void btnAdd_Click(object sender, EventArgs e) { string userName = tbxUserName.Text; string password = tbxPassword.Text; CRUDHelper.AddManager(new Manager { UserName = userName, Password = password, }); MessageBox.Show("Tamam"); }
protected void detailGrid_DataSelect(object sender, EventArgs e) { ASPxGridView gvDetail = (ASPxGridView)sender; gvDetail.DataSource = CRUDHelper.ReadAll(string.Format("IdentifFrecuencia = '{0}'", gvDetail.GetMasterRowFieldValues("IdentifFrecuencia")), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.FrecuenciaDet)); gvDetail.Columns["IdentifFrecuencia"].Visible = false; string semMes = Convert.ToString(gvDetail.GetMasterRowFieldValues("SemMes")); gvDetail.Columns["DiaSemana"].Visible = (semMes.Trim().ToLower() == "semana"); gvDetail.Columns["Dia"].Visible = (semMes.Trim().ToLower() != "semana"); }
public static async Task <string> RegisterForEvent([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "registerForEvent")] HttpRequest req, ILogger log) { try { CRUDHelper.executeNonQuery( String.Format( "INSERT INTO modestomovesdb.eventattendees (eventID, memberID) VALUES ({0}, {1})", getEventID(req.Query["eventID"]), getMemberID(req.Query["googleID"]) ) ); return("Register Success"); } catch (Exception ex) { return(ex.ToString()); } }
public static async Task <string> UpdatePosition([HttpTrigger(AuthorizationLevel.Anonymous, "post", Route = "updatePosition")] HttpRequest req, ILogger log) { try { return(CRUDHelper.executeNonQuery( String.Format( /* double check */ "UPDATE modestomovesdb.eventattendees SET xCoord = {0}, yCoord = {1} WHERE eventID = {2} AND memberID = {3}", req.Query["lat"], req.Query["lng"], getEventID(req.Query["eventID"]), getMemberID(req.Query["googleID"]) ) ) + " Changed. " + req.Query["lat"] + " , " + req.Query["lng"] + ", " + getEventID(req.Query["eventID"]) + ", " + getMemberID(req.Query["googleID"])); } catch (Exception ex) { return(ex.ToString()); } }
public void CategoryEkle() { string categoryId = tempcategoryID == null?Guid.NewGuid().ToString() : tempcategoryID; string categoryName = tbxCategoryName.Text; string description = tbxDescription.Text; CRUDHelper.AddCategory(new Categories { CategoryId = categoryId, CategoryName = categoryName, Description = description, CreatedDate = DateTime.Now }); MessageBox.Show("Kayit oldu"); }
protected void btnAdd_Click(object sender, EventArgs e) { try { var entity = new DTO.IdentAtencionDTO(); FormsHelper.FillEntity(tblControls, entity); CRUDHelper.Create(entity, BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.IdentAtencion)); pnlControls.Visible = false; RefreshGrid(gv); } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }
void Pieza_SelectedIndexChanged(object sender, EventArgs e) { DTO.PiezasArteDTO pieza = CRUDHelper.Read( string.Format("IdentifPieza = '{0}'", ucIdentifPieza.SelectedValue), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.PiezasArte)); if ((pieza != null && pieza.Duracion.HasValue && pieza.Duracion > 0)) { trDuracion.Visible = true; spDuracion.Value = pieza.Duracion; } else { trDuracion.Visible = false; spDuracion.Value = null; } }
protected void btnDelete_Click(object sender, EventArgs e) { try { if (pnlControls.Attributes["RecId"] != null) { CRUDHelper.Delete(Convert.ToInt32(pnlControls.Attributes["RecId"]), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.EspacioCont)); pnlControls.Visible = false; RefreshGrid(gv); } } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }
public static async Task <string> GetRacePoints([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "getRacePoints")] HttpRequest req, ILogger log) { try { List <string> return_results = new List <string> (); string[] fields; foreach (string row in CRUDHelper.getQuery( //Get Race points and points-of-interest String.Format( "SELECT lat, long, pointType FROM modestomovesdb.eventmap WHERE name = '{0}'", req.Query["name"] ) )) { fields = row.Split(','); return_results.Add( String.Format( "{{\"lat\": {0}, \"lng\": {1}, \"type\": \"{2}\" }}", fields[0], fields[1], fields[2] ) ); } foreach (string row in CRUDHelper.getQuery( //Get user's positions who are checked into race String.Format( "SELECT xCoord, yCoord FROM modestomovesdb.eventattendees WHERE eventID = {0} AND xCoord IS NOT NULL AND yCoord IS NOT NULL", getEventID(req.Query["name"]) ) )) { fields = row.Split(','); return_results.Add( String.Format( "{{\"lat\": {0}, \"lng\": {1}, \"type\": \"{2}\" }}", fields[0], fields[1], "Person" //** TODO: replace "person" with what type of person they are (look-up google id and check if mentor, coach (requires same "Auth" endpoint as enabling editting of events)) **// ) ); } return(String.Format( "{{'points' : [{0}]}}".Replace("'", "\""), String.Join(",", return_results.ToArray()) )); } catch (Exception ex) { return(ex.ToString()); } }
public static async Task <string> GetCalendarEvents([HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "getCalendarEvents")] HttpRequest req, ILogger log) { try { return(String.Format( //Generate the member object "{{'events' : [{0}]}}".Replace("'", "\""), String.Join( ",", CRUDHelper.getQuery( "SELECT name, startDate, description FROM modestomovesdb.raceEvents" ).Select( x => "{" + CRUDHelper.formatEvent(x.Split(',')) + "}" ).ToArray() ) )); } catch (Exception ex) { return(ex.ToString()); } }
protected void btnSave_Click(object sender, EventArgs e) { try { var entity = CRUDHelper.Read(Convert.ToInt32(pnlControls.Attributes["RecId"]), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.Frecuencia)); FormsHelper.FillEntity(tblControls, entity); Business.Frecuencias.Update(entity, Detalles); pnlControls.Visible = false; RefreshGrid(gv); } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }
protected void btnSave_Click(object sender, EventArgs e) { string err = string.Empty; try { if (Valid(out err)) { var entity = CRUDHelper.Read(Convert.ToInt32(pnlControls.Attributes["RecId"]), BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.EspacioCont)); FormsHelper.FillEntity(tblControls, entity); if (!trIntervalo.Visible) { entity.IdentifIntervalo = null; } if (!trFrecuencia.Visible) { entity.IdentifFrecuencia = null; } if (!trHoraFin.Visible || !trHoraInicio.Visible) { entity.HoraFin = null; entity.HoraInicio = null; } CRUDHelper.Update(entity, BusinessMapper.GetDaoByEntity(BusinessMapper.eEntities.EspacioCont)); pnlControls.Visible = false; RefreshGrid(gv); } else { throw new Exception(err); } } catch (Exception ex) { FormsHelper.MsgError(lblError, ex); } }