public string PostLogin(FormDataCollection body) { string username = body.Get("username"); string password = body.Get("password"); using(var session = store.OpenSession()) { var profile = session.Load<Profile>("profiles/" + username); if(profile.Password == password) { var defaultPrincipal = new ClaimsPrincipal( new ClaimsIdentity(new[] {new Claim(MyClaimTypes.ProfileKey, profile.Id)}, "Application" // this is important. if it's null or empty, IsAuthenticated will be false )); var principal = FederatedAuthentication.FederationConfiguration.IdentityConfiguration. ClaimsAuthenticationManager.Authenticate( Request.RequestUri.AbsoluteUri, // this, or any other string can be available // to your ClaimsAuthenticationManager defaultPrincipal); AuthenticationManager.EstablishSession(principal); return "login ok"; } return "login failed"; } }
public string Edit(FormDataCollection form) { var retVal = string.Empty; var operation = form.Get("oper"); var id = form.Get("Id").Split(',')[0].ToInt32(); if (string.IsNullOrEmpty(operation)) return retVal; PackageFeeEduInfo info; switch (operation) { case "edit": info = CatalogRepository.GetInfo<PackageFeeEduInfo>(id); if (info != null) { info.Name = form.Get("Name"); CatalogRepository.Update(info); } break; case "add": info = new PackageFeeEduInfo { Name = form.Get("Name") }; CatalogRepository.Create(info); break; case "del": CatalogRepository.Delete<PackageFeeEduInfo>(id); break; } StoreData.ReloadData<PackageFeeEduInfo>(); return retVal; }
public IHttpActionResult AddToCalendar(FormDataCollection form) { string message = "success"; try { CylorDbEntities context = this.getContext(); string ThisDay = form.Get("ThisDay"); string sSelectUserId = form.Get("sSelectUserId"); int nCalendarUserListId; if (int.TryParse(sSelectUserId, out nCalendarUserListId) && DateFunctions.IsValidDate(ThisDay)) { CalendarItem instance = new CalendarItem(); instance.CalendarDate = DateTime.Parse(ThisDay); instance.CalendarUserListId = nCalendarUserListId; instance.EnteredDate = DateTime.Now.Date; context.CalendarItems.Add(instance); context.SaveChanges(); } } catch (Exception ex) { message = ex.Message; } dynamic json = new ExpandoObject(); json.message = message; return Json(json); }
public void CreateFromUri() { FormDataCollection form = new FormDataCollection(new Uri("http://foo.com/?x=1&y=2")); Assert.Equal("1", form.Get("x")); Assert.Equal("2", form.Get("y")); }
private TreeNodeCollection AddFiles(string folder, FormDataCollection queryStrings) { var pickerApiController = new FileSystemPickerApiController(); //var str = queryStrings.Get("startfolder"); if (string.IsNullOrWhiteSpace(folder)) return null; var filter = queryStrings.Get("filter").Split(',').Select(a => a.Trim().EnsureStartsWith(".")).ToArray(); var path = IOHelper.MapPath(folder); var rootPath = IOHelper.MapPath(queryStrings.Get("startfolder")); var treeNodeCollection = new TreeNodeCollection(); foreach (FileInfo file in pickerApiController.GetFiles(folder, filter)) { string nodeTitle = file.Name; string filePath = file.FullName.Replace(rootPath, "").Replace("\\", "/"); //if (file.Extension.ToLower() == ".gif" || file.Extension.ToLower() == ".jpg" || file.Extension.ToLower() == ".png") //{ // nodeTitle += "<div><img src=\"/umbraco/backoffice/FileSystemPicker/FileSystemThumbnailApi/GetThumbnail?width=150&imagePath="+ HttpUtility.UrlPathEncode(filePath) +"\" /></div>"; //} TreeNode treeNode = CreateTreeNode(filePath, path, queryStrings, nodeTitle, "icon-document", false); treeNodeCollection.Add(treeNode); } return treeNodeCollection; }
public IEnumerable<Households> PostHouseholdAdd(FormDataCollection form) { string name = form.Get("Name"); string house = form.Get("HouseholdId"); return db.Database.SqlQuery<Households>("EXEC AddHousehold @householdId, @name", new SqlParameter("householdId", house), new SqlParameter("name", name)); }
public string PostInviteToHousehold(FormDataCollection form) { string user = form.Get("UserId"); string email = form.Get("Email"); return Sql.NonQuery("InvitationSent", new SqlParameter("email", email), new SqlParameter("user", user)); }
public void IndexerIsEquivalentToGet() { FormDataCollection form = new FormDataCollection(new Uri("http://foo.com/?x=1&y=2")); Assert.Equal("1", form.Get("x")); Assert.Equal(form["x"], form.Get("x")); Assert.Equal(form[null], form.Get(null)); }
public string CheckDuplicate(FormDataCollection form) { string mobile1 = form.Get("mobile1"); string mobile2 = form.Get("mobile2"); string tel = form.Get("tel"); string email = form.Get("email"); int duplicateId = CheckDuplicateProvider.Instance().IsDuplicate(mobile1, mobile2, tel, email, string.Empty); return duplicateId.ToString(); }
public IHttpActionResult GetImageCount(FormDataCollection form) { string imageGroup = form.Get("imageGroup"); string path = form.Get("path"); var mappedPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Images/MouseTrailerPics/" + path + "/"); List<string> directoryFiles = new List<string>(Directory.GetFiles(mappedPath, "*" + imageGroup + "*")); return Json(directoryFiles.Count); }
public double CalcDistance(FormDataCollection data) { int x1 = int.Parse(data.Get("x1")); int y1 = int.Parse(data.Get("y1")); int x2 = int.Parse(data.Get("x2")); int y2 = int.Parse(data.Get("y2")); Point startPoint = new Point { X = x1, Y = y1 }; Point endPoint = new Point { X = x2, Y = y2 }; return Math.Sqrt( Math.Pow(endPoint.X - startPoint.X, 2) + Math.Pow(endPoint.Y - startPoint.Y, 2)); }
public void CreateFromPairs() { Dictionary<string, string> pairs = new Dictionary<string,string> { { "x", "1"}, { "y" , "2"} }; var form = new FormDataCollection(pairs); Assert.Equal("1", form.Get("x")); Assert.Equal("2", form.Get("y")); }
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) { if (!string.IsNullOrWhiteSpace(queryStrings.Get("startfolder"))) { string folder = id == "-1" ? queryStrings.Get("startfolder") : id; folder = folder.EnsureStartsWith("/"); TreeNodeCollection tempTree = AddFolders(folder, queryStrings); tempTree.AddRange(AddFiles(folder, queryStrings)); return tempTree; } return AddFolders(id == "-1" ? "" : id, queryStrings); }
// POST api/<controller> public HttpResponseMessage Post(FormDataCollection form) { var command = new InboundMail(); command.Sender = form.Get("sender"); command.Body = form.Get("body-plain"); command.Stripped = form.Get("stripped-text"); string token; using (var db = new UsersContext()) { var user = db.UserProfiles.FirstOrDefault(u => u.UserName.ToLower() == command.Sender.ToLower()); if (user == null) return Request.CreateResponse(HttpStatusCode.BadRequest); if (user.BasecampCredentials == null || string.IsNullOrWhiteSpace(user.BasecampCredentials.AccessToken)) return Request.CreateResponse(HttpStatusCode.BadRequest); token = user.BasecampCredentials.AccessToken; } var basecamp = new BasecampClient(); var lookfor = "I will complete"; var rx = new Regex(@"(\S.+?[.!?])(?=\s+|$)"); foreach (Match match in rx.Matches(command.Body)) { var index = match.Value.IndexOf(lookfor); if (index >= 0) { var msg = match.Value.Replace(lookfor, "Complete"); var notice = "task created ok"; try { basecamp.CreateTask(msg, token); } catch (System.Exception e) { notice = e.ToString(); } // SendSimpleMessage(command.Sender, notice); break; } } return Request.CreateResponse(HttpStatusCode.Accepted); }
public string Edit(FormDataCollection form) { var retVal = string.Empty; var operation = form.Get("oper"); var id = ConvertHelper.ToInt32(form.Get("Id").Split(',')[0]); WebServiceConfigInfo info; switch (operation) { case "edit": info = WebServiceConfigRepository.GetInfo(id); if (info != null) { info.Value = form.Get("Value"); info.Type = form.Get("Type").ToInt32(); info.BranchId = form.Get("BranchId").ToInt32(); WebServiceConfigRepository.Update(info); } break; case "add": info = new WebServiceConfigInfo { Value = form.Get("Value"), Type = form.Get("Type").ToInt32(), BranchId = form.Get("BranchId").ToInt32(), }; WebServiceConfigRepository.Create(info); break; case "del": WebServiceConfigRepository.Delete(id); break; } StoreData.ListWebServiceConfig = WebServiceConfigRepository.GetAll(); return retVal; }
public HttpResponseMessage Post(FormDataCollection form) { bool isadmin = WindowsIdentityStore.IsUserAdmin(Session["username"]); if (isadmin && !PrintProxy.IsRegistered) { switch (form.Get("Action")) { case "RegisterProxy": return Register(); case "GetAuthCode": return GetAuthCode(form.Get("Email")); } } return Forbidden(); }
public IHttpActionResult RemoveStudent(FormDataCollection form) { /* * clear coordinates in seating chart for the student after delete button click. */ string message = "success"; try { string sStudentId = form.Get("sStudentId"); int nStudentId; if (int.TryParse(sStudentId, out nStudentId)) { CylorDbEntities context = this.getContext(); DragDropStudent student = context.DragDropStudents.Find(nStudentId); context.DragDropStudents.Attach(student); student.Left = string.Empty; student.Top = string.Empty; context.SaveChanges(); } } catch (Exception ex) { message = ex.Message; } dynamic json = new ExpandoObject(); json.message = message; return Json(json); }
public string ClearDraft(FormDataCollection form) { try { var employeeTypeType = (EmployeeType)form.Get("employeeTypeId").ToInt32(); ContactRepository.ContactUpdateClearDraft(employeeTypeType); // Update Account Draft var account = new UserDraftInfo { IsDraftConsultant = false, IsDraftCollabortor = false, CreatedDate = DateTime.Now, BranchId = UserContext.GetDefaultBranch(), UserId = UserContext.GetCurrentUser().UserID, }; UserDraftRepository.Update(account); // Return return "Xóa draft thành công"; } catch { return "Xóa draft không thành công"; } }
public IHttpActionResult AuthenticateUser(FormDataCollection userDetails) { bool isAuthenticated = false; var userId = userDetails.Get("userId"); var password = userDetails.Get("password"); var passwordEncrypted = password.ToCryptoStringAES(CITConstants.CRYPTO_AES_KEY.GetStringFromByteArray(), CITConstants.CRYPTI_AES_IV.GetStringFromByteArray()); isAuthenticated = db.Users.Where(u => u.UserId.Equals(userId) && u.Password.Equals(passwordEncrypted)).ToList().Count > 0; if (isAuthenticated) return Ok("success"); else return Unauthorized(); }
public HttpResponseMessage CreateDocument(FormDataCollection postData) { SampleConfiguration config = new SampleConfiguration(); esNode = new Uri(config.ElasticsearchServerHost); connectionSettings = new ConnectionSettings(esNode, defaultIndex: postData.Get("indexName")); esClient = new ElasticClient(connectionSettings); var product = new Product(Convert.ToInt32(postData.Get("id")), postData.Get("title"), postData.Get("brand"), Convert.ToDouble(postData.Get("price"))); IIndexResponse indexResponse = esClient.Index(product); return Request.CreateResponse(HttpStatusCode.Created, indexResponse.Created); }
public List<CasecAccountInfo> Provide(FormDataCollection form) { var contactId = form.Get("contactId").ToInt32(); var list = CasecAccountRepository.Provide(contactId); if (!list.IsNullOrEmpty()) { foreach (var item in list) { item.DateTimeString = item.DateTime.ToString("dd/MM/yyyy"); item.CreatedDateString = item.CreatedDate.ToString("dd/MM/yyyy"); item.StatusString = ObjectExtensions.GetEnumDescription((StatusCasecType)item.StatusCasecAccountId); // Call WS if (item.StatusCasecAccountId == (int) StatusCasecType.Used) { var result = (new HelpUtils()).SendCasecAccount(item); if (result.Code == 0) { ContactLevelInfoRepository.UpdateHasCasecAccount(contactId, true); } } } return list; } return null; }
public HttpResponseMessage Post(FormDataCollection form) { bool isadmin = WindowsIdentityStore.IsUserAdmin(Session["username"]); if (isadmin) { switch (form.Get("Action")) { case "Delete": return Delete(form); case "AddUsers": return AddUsers(form.Get("UserId"), CSVToList(form.Get("Usernames"))); case "AddUserId": return AddUserId(form.Get("UserId"), CSVToList(form.Get("Usernames"))); } } return Forbidden(); }
public IHttpActionResult GetImageCount(FormDataCollection form) { string imageScheme = form.Get("imageScheme"); var mappedPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Images/Schemes/" + imageScheme + "/"); List<string> directoryFiles = new List<string>(Directory.GetFiles(mappedPath, "*texture_*")); return Json(directoryFiles.Count); }
//public string CreateTemplate(string subject, int typeEmail, string content) //{ // var res = string.Empty; // EmailRepository.Create(subject,typeEmail,content); // return res; //} public string CreateTemplate(FormDataCollection form) { var res = string.Empty; var subject = form.Get("Subject"); int typeEmail = Int32.Parse(form.Get("TypeEmail")); var content = form.Get("Content"); var entity = new EmailInfo { Content = content, Subject = subject, EmailType = typeEmail, }; EmailRepository.Create(entity); return res; }
public string Edit(FormDataCollection form) { var retVal = string.Empty; var operation = form.Get("oper"); var id = ConvertHelper.ToInt32(form.Get("BranchId")); if (!string.IsNullOrEmpty(operation)) { BranchInfo info; switch (operation) { case "edit": info = BranchRepository.GetInfo(id); if (info != null) { info.Code = form.Get("Code"); info.Name = form.Get("Name"); info.LocationID = ConvertHelper.ToInt32(form.Get("LocationName")); info.Description = form.Get("Description"); //info.Status = form.Get("Status"); info.ChangedBy = UserRepository.GetCurrentUserInfo().UserID; BranchRepository.Update(info); } break; case "add": info = new BranchInfo { Code = form.Get("Code"), Name = form.Get("Name"), LocationID = ConvertHelper.ToInt32(form.Get("LocationName")), Description = form.Get("Description"), //Status = form.Get("Status"), CreatedBy = UserRepository.GetCurrentUserInfo().UserID }; BranchRepository.Create(info); break; case "del": BranchRepository.Delete(id,UserRepository.GetCurrentUserInfo().UserID); break; } } StoreData.ListBranch = BranchRepository.GetAll(); return retVal; }
public dynamic Post(FormDataCollection data) { var iceCreamId = data.Get("iceCreamId"); var ice = _mongoDb.FindById<IceCream>(iceCreamId, "IceCreams"); if (ice == null) throw new HttpResponseException(HttpStatusCode.ExpectationFailed); try { ice.Quantity--; if(ice.Quantity < 0) throw new HttpResponseException(HttpStatusCode.Conflict); _mongoDb.Save(ice, "IceCreams"); _mongoDb.Insert(new Purchase() { Price = ice.Price.ToInt(), Buyer = int.Parse(data.Get("buyer")), Time = DateTime.UtcNow, IceCreamId = iceCreamId}, "Purchases"); } catch (MongoException e) { return new { success = false, errorMessage = e.Message }; } return new {success = true, errorMessage = string.Empty, quantity = ice.Quantity}; }
public int ChangeContainer(FormDataCollection form) { var typeIds = form.Get("typeIds"); var levelIds = form.Get("levelIds"); var importIds = form.Get("importIds"); var statusIds = form.Get("statusIds"); var channelIds = form.Get("channelIds"); var containerIds = form.Get("containerIds"); var branchId = UserContext.GetDefaultBranch(); var channelAmounts = form.Get("channelAmounts"); var createdBy = UserContext.GetCurrentUser().UserID; var productSellId = form.Get("productSellId").ToInt32(); var containerTargerId = form.Get("containerTargerId").ToInt32(); return ContactRepository.UpdateChangeContainer(branchId, typeIds, levelIds, importIds, statusIds, containerIds, channelIds, channelAmounts, containerTargerId, productSellId, createdBy); }
public string EditConsultant(FormDataCollection form) { var retVal = string.Empty; var operation = form.Get("oper"); var id = ConvertHelper.ToInt32(form.Get("GroupId")); if (!string.IsNullOrEmpty(operation)) { GroupInfo info; switch (operation) { case "edit": info = GroupRepository.GetInfo(id); if (info != null) { info.Name = form.Get("Name"); info.Description = form.Get("Description"); info.LeaderId = form.Get("LeaderId").ToInt32(); info.BranchId = UserContext.GetDefaultBranch(); info.EmployeeTypeId = (int)EmployeeType.Consultant; GroupRepository.Update(info); } break; case "add": info = new GroupInfo { Name = form.Get("Name"), CreatedDate = DateTime.Now, Description = form.Get("Description"), LeaderId = form.Get("LeaderId").ToInt32(), BranchId = UserContext.GetDefaultBranch(), EmployeeTypeId = (int)EmployeeType.Consultant, CreatedBy = UserContext.GetCurrentUser().UserID, }; GroupRepository.Create(info); break; case "del": GroupRepository.Delete(id); break; } StoreData.ReloadData<GroupInfo>(); } return retVal; }
public void Put(FormDataCollection form) { // Manually parse up the form b/c of the muni & county split stuff // TODO: make a custom formatter int projectVersionId = Convert.ToInt32(form.Get("ProjectVersionId")); string year = form.Get("Year"); //Get the existing model from the datagbase LocationModel model = SurveyRepository.GetProjectLocationModel(projectVersionId, year); //Update values model.Limits = form.Get("Limits"); model.FacilityName = form.Get("FacilityName"); int testOut = 0; Int32.TryParse(form.Get("RouteId"), out testOut); model.RouteId = testOut; //parse out the county & muni shares stuff... var nvc = form.ReadAsNameValueCollection(); Dictionary<int, CountyShareModel> countyShares = ControllerBase.ExtractCountyShares(nvc); Dictionary<int, MunicipalityShareModel> muniShares = ControllerBase.ExtractMuniShares(nvc); //Send updates to repo try { SurveyRepository.UpdateProjectLocationModel(model, projectVersionId); SurveyRepository.CheckUpdateStatusId(SurveyRepository.GetProjectBasics(projectVersionId)); //Update the county shares foreach (CountyShareModel m in countyShares.Values) { SurveyRepository.UpdateCountyShare(m); } //Update the muni shares foreach (MunicipalityShareModel m in muniShares.Values) { SurveyRepository.UpdateMunicipalityShare(m); } //Ok, we're good. } catch (Exception ex) { Logger.WarnException("Could not update Survey Location", ex); throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.ExpectationFailed) { ReasonPhrase = ex.Message }); } }
private TreeNodeCollection AddFiles(string folder, FormDataCollection queryStrings) { var pickerApiController = new FilePickerApiController(); //var str = queryStrings.Get("startfolder"); if (string.IsNullOrWhiteSpace(folder)) return null; var filter = queryStrings.Get("filter").Split(',').Select(a=>a.Trim().EnsureStartsWith(".")).ToArray(); var path = IOHelper.MapPath(folder); var rootPath = IOHelper.MapPath(queryStrings.Get("startfolder")); var treeNodeCollection = new TreeNodeCollection(); treeNodeCollection.AddRange(pickerApiController.GetFiles(folder, filter) .Select(file => CreateTreeNode(file.FullName.Replace(rootPath, "").Replace("\\", "/"), path, queryStrings, file.Name, "icon-document", false))); return treeNodeCollection; }
public HttpResponseMessage InsertTask(FormDataCollection form) { var values = form.Get("values"); var newTask = new CustomEditorsTask(); JsonConvert.PopulateObject(values, newTask); Validate(newTask); if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState.GetFullErrorMessage())); } _context.Tasks.Add(newTask); _context.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.Created, newTask)); }
public HttpResponseMessage Post(FormDataCollection form) { var values = form.Get("values"); var order = new Order(); JsonConvert.PopulateObject(values, order); Validate(order); if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState.GetFullErrorMessage())); } _db.Orders.Add(order); _db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.OK)); }
public HttpResponseMessage Post(FormDataCollection form) { var values = form.Get("values"); var sales = new tb_sales_transactions(); JsonConvert.PopulateObject(values, sales); sales.UserPosted = "kris"; Validate(sales); if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } db.tb_sales_transactions.Add(sales); db.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.Created)); }
public HttpResponseMessage Post(FormDataCollection form, int ID = 0) { var model = new SalesOrderLine(); var values = JsonConvert.DeserializeObject <IDictionary>(form.Get("values")); model.SalesOrderId = ID; PopulateModel(model, values); Validate(model); if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, GetFullErrorMessage(ModelState))); } var result = _context.SalesOrderLines.Add(model); _context.SaveChanges(); return(Request.CreateResponse(HttpStatusCode.Created, result.SalesOrderLineId)); }
public async Task <HttpResponseMessage> Post(FormDataCollection form) { var model = new P__EFMigrationsHistory(_uow); var viewModel = new P__EFMigrationsHistoryViewModel(); var values = JsonConvert.DeserializeObject <IDictionary>(form.Get("values")); PopulateViewModel(viewModel, values); Validate(viewModel); if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, GetFullErrorMessage(ModelState))); } CopyToModel(viewModel, model); await _uow.CommitChangesAsync(); return(Request.CreateResponse(HttpStatusCode.Created, model.MigrationId)); }
//// POST api/getintegrarates //public void Post([FromBody]string value) //{ //} // POST api/getintegrarates public string Post(FormDataCollection form) { string test2 = form.Get("test2"); string myString = ""; //GetIntegraRatesModel model = new GetIntegraRatesModel(); //model.testFunc(ref myString); Intermodal.testStaticFunc(ref myString); return("value was " + myString); /*IntermodalRater ir = new IntermodalRater(); * List<string[]> results = new List<string[]>(); * * int QuoteID = 0; * results = ir.GetIntermodalRate(username, password, pickupDate, originZip, destinationZip, additionalServices, ref QuoteID); */ }
public HttpResponseMessage Post(FormDataCollection form) { getModelData = new BusinessLayer(); var values = form.Get("values"); var newData = new DataModel(); JsonConvert.PopulateObject(values, newData); Validate(newData); if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, string.Join("; ", ModelState.Values .SelectMany(x => x.Errors) .Select(x => x.ErrorMessage)))); } getModelData.Save(newData); return(Request.CreateResponse(HttpStatusCode.Created)); }
// POST api/event public HttpResponseMessage PostEvent(FormDataCollection value) { var events = Mandrill.JSON.Parse <List <Mandrill.WebHookEvent> >(value.Get("mandrill_events")); MandrillApi api = new MandrillApi(Settings.Default.MandrillApiKey); foreach (var evt in events) { if (HardBounceOrUnsubscribeFromMailChimpList(evt)) { UnsubscribeEmailfromMailChimpList(evt); } else if (HardBounceSentFromPeachtreeDataDomain(evt)) { CreateAndSendEmailMessageFromTemplate(evt); } } return(Request.CreateErrorResponse(HttpStatusCode.OK, "Received")); }
public bool IsGameActive(FormDataCollection formData) { if (formData != null) { string gameIDString = formData.Get("GameID"); int GameID = Convert.ToInt32(gameIDString); if (GameID > 0) { Game game = db.Games.Find(GameID); if (game == null) { return(true); } if (game.GameState == "ACTIVE") { return(true); } } } return(false); }
public HttpResponseMessage CreateDecisionType(FormDataCollection form) { try { var values = form.Get("values"); var newDecisionType = new DecisionType(); JsonConvert.PopulateObject(values, newDecisionType); Validate(newDecisionType); if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } _DecisionTypeBLL.Insert(newDecisionType); //newDecisionType = _DecisionTypeBLL.GetById(newDecisionType.Id); return(Request.CreateResponse(HttpStatusCode.Created, newDecisionType)); } catch (Exception ex) { throw ex; } }
public HttpResponseMessage Put(FormDataCollection form) { Impuesto impuesto = new Impuesto(); impuesto.Codigo1 = form.Get("Codigo"); impuesto.CodigoTarifa1 = form.Get("CodTarifa"); impuesto.Tarifa1 = Convert.ToDecimal(form.Get("Tarifa")); impuesto.FactorIVA1 = Convert.ToDecimal(form.Get("FactorIVA")); impuesto.Monto1 = Convert.ToDecimal(form.Get("Monto")); impuesto.MontoExportacion1 = Convert.ToDecimal(form.Get("MontoExportacion")); string[] respuesta = new string[2]; respuesta[0] = impuesto.Insert_Impuesto(); respuesta[1] = form.Get("Codigo"); HttpResponseMessage response = Request.CreateResponse <string[]>(HttpStatusCode.Created, respuesta); return(response); }
public HttpResponseMessage CreateMainCategory(FormDataCollection form) { try { var values = form.Get("values"); var newMainCategory = new MainCategory(); JsonConvert.PopulateObject(values, newMainCategory); Validate(newMainCategory); if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } _mainCategoryBLL.Insert(newMainCategory); newMainCategory = _mainCategoryBLL.GetById(newMainCategory.Id); return(Request.CreateResponse(HttpStatusCode.Created, newMainCategory)); } catch (Exception ex) { throw ex; } }
public HttpResponseMessage Put(FormDataCollection form) { Persona persona = new Persona(); persona.Nombre1 = form.Get("NombrePersona"); Identificacion identificacion = new Identificacion(); identificacion.Numero1 = form.Get("IdentificacionPersona"); persona.IdentificacionNumero1 = identificacion; persona.NombreComercial1 = form.Get("NombreComercial"); Ubicacion ubicacionid = new Ubicacion(); ubicacionid.ID1 = Convert.ToInt32(form.Get("UbicacionPersona")); persona.UbicacionID1 = ubicacionid; TelefonoFax telefono = new TelefonoFax(); telefono.NumTelefono1 = Convert.ToInt32(form.Get("TelefonoPersona")); persona.TelefonoNumero1 = telefono; TelefonoFax fax = new TelefonoFax(); fax.NumTelefono1 = Convert.ToInt32(form.Get("FaxPersona")); persona.FaxNumero1 = fax; persona.CorreoElectronico1 = form.Get("CorreoPersona"); string[] respuesta = new string[2]; respuesta[0] = persona.Insert_Persona(); respuesta[1] = form.Get("IdentificacionPersona"); HttpResponseMessage response = Request.CreateResponse <string[]>(HttpStatusCode.Created, respuesta); return(response); }
public HttpResponseMessage Put(FormDataCollection form) { Ubicacion ubicacion = new Ubicacion(); ubicacion.Provincia1 = form.Get("Provincia"); ubicacion.Canton1 = form.Get("Canton"); ubicacion.Distrito1 = form.Get("Distrito"); ubicacion.Barrio1 = form.Get("Barrio"); ubicacion.OtrasSenas1 = form.Get("OtrasSenas"); ubicacion.ID1 = Convert.ToInt32(form.Get("ID")); string[] respuesta = new string[2]; respuesta[0] = ubicacion.Insert_Ubicacion(); respuesta[1] = form.Get("ID"); HttpResponseMessage response = Request.CreateResponse <string[]>(HttpStatusCode.Created, respuesta); return(response); }
public string Edit(FormDataCollection form) { var retVal = string.Empty; var operation = form.Get("oper"); var id = ConvertHelper.ToInt32(form.Get("Id").Split(',')[0]); WebServiceConfigInfo info; switch (operation) { case "edit": info = WebServiceConfigRepository.GetInfo(id); if (info != null) { info.Value = form.Get("Value"); info.Type = form.Get("Type").ToInt32(); info.BranchId = form.Get("BranchId").ToInt32(); WebServiceConfigRepository.Update(info); } break; case "add": info = new WebServiceConfigInfo { Value = form.Get("Value"), Type = form.Get("Type").ToInt32(), BranchId = form.Get("BranchId").ToInt32(), }; WebServiceConfigRepository.Create(info); break; case "del": WebServiceConfigRepository.Delete(id); break; } //StoreData.ListWebServiceConfig = WebServiceConfigRepository.GetAll(); return(retVal); }
public List <TopicaAccountInfo> Provide(FormDataCollection form) { var contactId = form.Get("contactId").ToInt32(); string linkTopicaSystem = ConfigurationManager.AppSettings["TopicaEnglishSystem"].ToString(); WebClient client = new WebClient(); client.Headers["Content-type"] = "application/json"; //string a = "http://tracnghiem.topicanative.edu.vn/webservice/rest/server.php?wstoken="+ token +"&wsfunction="+ function + "&moodlewsrestformat=json&contactid=" + contactId; // invoke the REST method byte[] data = client.DownloadData( linkTopicaSystem + "?wstoken=" + token + "&wsfunction=" + function + "&moodlewsrestformat=json&contactid=" + contactId); // put the downloaded data in a memory stream MemoryStream ms = new MemoryStream(); ms = new MemoryStream(data); // deserialize from json DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(TopicaAccountInfo)); TopicaAccountInfo result = ser.ReadObject(ms) as TopicaAccountInfo; var list = TopicaAccountRepository.UpdateTopicaAccount(contactId, result.username, result.password); ContactLevelInfoRepository.UpdateHasTopicaAccount(contactId, true); if (!list.IsNullOrEmpty()) { foreach (var item in list) { item.DateTimeString = item.DateTime.ToString("dd/MM/yyyy"); item.CreatedDateString = item.CreatedDate.ToString("dd/MM/yyyy"); item.StatusString = ObjectExtensions.GetEnumDescription((StatusTopicaType)item.StatusTopicaAccountId); } return(list); } return(null); }
public Result CancelSchedule(FormDataCollection form) { var contactId = form.Get("contactId").ToInt32(); var entityDbs = AppointmentInterviewRepository.GetAllByContactId(contactId) ?? new List <AppointmentInterviewInfo>(); var entity = entityDbs.OrderBy(c => c.Id).LastOrDefault(); if (entity != null) { var result = (new HelpUtils()).SendCancelInterview(entity.ContactId); if (result.Code == 0) { entity.StatusInterviewId = (int)StatusInterviewType.HocVienHuyPhongVan; AppointmentInterviewRepository.Update(entity); ContactLevelInfoRepository.UpdateHasAppointmentInterview(entity.ContactId, false); } return(result); } return(new Result { Code = 1, Description = "Lịch không tồn tại, bạn phải đặt lịch trước khi hủy lịch" }); }
/// <summary> /// Helper method to create a root model for a tree /// </summary> /// <returns></returns> protected virtual TreeNode CreateRootNode(FormDataCollection queryStrings) { var getChildNodesUrl = Url.GetTreeUrl(GetType(), RootNodeId, queryStrings); var isDialog = queryStrings.GetValue <bool>(TreeQueryStringParameters.DialogMode); //var node = new TreeNode(RootNodeId, BackOfficeRequestContext.RegisteredComponents.MenuItems, jsonUrl) var node = new TreeNode(RootNodeId, getChildNodesUrl) { HasChildren = true, //THIS IS TEMPORARY UNTIL WE FIGURE OUT HOW WE ARE LOADING STUFF (I.E. VIEW NAMES, ACTION NAMES, DUNNO) EditorUrl = queryStrings.HasKey(TreeQueryStringParameters.OnNodeClick) //has a node click handler? ? queryStrings.Get(TreeQueryStringParameters.OnNodeClick) //return node click handler : isDialog //is in dialog mode without a click handler ? ? "#" //return empty string, otherwise, return an editor URL: : "mydashboard", Title = RootNodeDisplayName }; //add the tree type to the root node.AdditionalData.Add("treeType", GetType().FullName); ////add the tree-root css class //node.Style.AddCustom("tree-root"); //node.AdditionalData.Add("id", node.HiveId.ToString()); //node.AdditionalData.Add("title", node.Title); AddQueryStringsToAdditionalData(node, queryStrings); //check if the tree is searchable and add that to the meta data as well if (this is ISearchableTree) { node.AdditionalData.Add("searchable", "true"); } return(node); }
public HttpResponseMessage UpdateEmployee(FormDataCollection frm) { HttpResponseMessage response = new HttpResponseMessage(); try { int empID = Convert.ToInt32(frm.Get("empID")); string empFirstName = frm.Get("empFirstName"); string empLastName = frm.Get("empLastName"); string empDesignation = frm.Get("empDesignation"); string empLatLong = frm.Get("empLatLong"); string empPassword = frm.Get("empPassword"); string empImage = frm.Get("empImage"); int result = objEmp.UpdateEmployee(empFirstName, empLastName, empDesignation, empLatLong, empPassword, empImage, empID); response = this.Request.CreateResponse(HttpStatusCode.OK, new { IsSaved = Convert.ToString(result) }); } catch (Exception e) { throw; } return(response); }
public HttpResponseMessage Post(FormDataCollection form) //le llegan las funciones de la pagina que conectan con el visual y luego las envia a la clase que le corresponde { switch (form.Get("op")) { case "Insertar": { Models.Clase_Usuario.Insertar_Usuario(form.Get("NOMBRE"), form.Get("CORREO"), form.Get("CONTRA"), Convert.ToInt32(form.Get("TIPO"))); break; } case "Modificar": { Models.Clase_Usuario.Modificar_Usuario(form.Get("NOMBRE"), form.Get("CORREO"), form.Get("CONTRA"), Convert.ToInt32(form.Get("TIPO"))); break; } case "Eliminar": { Models.Clase_Usuario.Eliminar_Usuario(form.Get("NOMBRE")); break; } case "Login": { HttpResponseMessage response = Request.CreateResponse <int>(HttpStatusCode.Created, Models.Clase_Usuario.Login(form.Get("NOMBRE"), form.Get("CONTRA"))); return(response); break; } case "listar": { List <Models.Clase_Usuario> LISTAVACIA = new List <Models.Clase_Usuario>(); HttpResponseMessage response = Request.CreateResponse <List <Models.Clase_Usuario> >(HttpStatusCode.Created, Models.Clase_Usuario.Todos_los_usuarios()); return(response); } } HttpResponseMessage Response = Request.CreateResponse <int>(HttpStatusCode.Created, 1); return(Response); }
public HttpResponseMessage Put(FormDataCollection form) { InformacionReferencia informacionreferencia = new InformacionReferencia(); informacionreferencia.TipoDoc1 = form.Get("TipoDoc"); informacionreferencia.Numero1 = form.Get("Numero"); informacionreferencia.FechaEmision1 = Convert.ToDateTime(form.Get("FechaEmisionReferencia")); informacionreferencia.Codigo1 = form.Get("Codigo"); informacionreferencia.Razon1 = form.Get("Razon"); Factura clave = new Factura(); clave.Clave1 = form.Get("Clave"); informacionreferencia.Clave1 = clave; string[] respuesta = new string[2]; respuesta[0] = informacionreferencia.Insert_InformacionReferencia(); respuesta[1] = form.Get("Clave"); HttpResponseMessage response = Request.CreateResponse <string[]>(HttpStatusCode.Created, respuesta); return(response); }
public string Edit(FormDataCollection form) { string retVal = string.Empty; string operation = form.Get("oper"); int id = ConvertHelper.ToInt32(form.Get("RoleId")); RoleInfo info = null; if (!string.IsNullOrEmpty(operation)) { switch (operation) { case "edit": info = RoleRepository.GetInfo(id); if (info != null) { info.Name = form.Get("Name"); info.Description = form.Get("Description"); info.ChangedBy = UserRepository.GetCurrentUserInfo().UserID; RoleRepository.Update(info); } break; case "add": info = new RoleInfo { Name = form.Get("Name"), Description = form.Get("Description"), CreatedBy = UserRepository.GetCurrentUserInfo().UserID }; RoleRepository.Insert(info); break; case "del": RoleRepository.Delete(id, UserRepository.GetCurrentUserInfo().UserID); break; default: break; } } return(retVal); }
public string Edit(FormDataCollection form) { var retVal = string.Empty; var operation = form.Get("oper"); var id = form.Get("Id").Split(',')[0].ToInt32(); if (string.IsNullOrEmpty(operation)) { return(retVal); } TimeSlotInfo info; switch (operation) { case "edit": info = CatalogRepository.GetInfo <TimeSlotInfo>(id); if (info != null) { info.Name = form.Get("Name"); info.OrderTime = form.Get("OrderTime").ToInt32(); CatalogRepository.Update(info); } break; case "add": info = new TimeSlotInfo { Name = form.Get("Name"), OrderTime = form.Get("OrderTime").ToInt32() }; CatalogRepository.Create(info); break; case "del": CatalogRepository.Delete <TimeSlotInfo>(id); break; } StoreData.ReloadData <TimeSlotInfo>(); return(retVal); }
public string Edit(FormDataCollection form) { var retVal = string.Empty; var operation = form.Get("oper"); var id = ConvertHelper.ToInt32(form.Get("EducationLevelId")); var curUserInfo = UserRepository.GetCurrentUserInfo(); if (!string.IsNullOrEmpty(operation)) { EducationLevelInfo info = null; switch (operation) { case "edit": info = EducationLevelRepository.GetInfo(id); if (info != null) { info.Name = form.Get("Name"); info.Description = form.Get("Description"); EducationLevelRepository.Update(info); } break; case "add": info = new EducationLevelInfo { Name = form.Get("Name"), Description = form.Get("Description"), CreatedBy = curUserInfo.UserID, CreatedDate = DateTime.Now }; EducationLevelRepository.Create(info); break; case "del": EducationLevelRepository.Delete(id); break; } } //StoreData.ListEducationLevel = EducationLevelRepository.GetAll(); return(retVal); }
public PaginatedItems ComingSoon(FormDataCollection formData) { AccountService service = new AccountService(db, UserManager); Member member = null; int MemberId = 0; int GameID = 0; int PageNo = 1; int _PAGE_LIMIT = 50; if (this.User.Identity != null) { member = service.findMember(this.User.Identity.Name); } if (member != null) { MemberId = member.MemberID; } if (formData != null) { string pageNumberString = formData.Get("Page"); if (pageNumberString != null) { PageNo = Convert.ToInt32(pageNumberString); } string gameIDString = formData.Get("GameID"); if (gameIDString != null) { GameID = Convert.ToInt32(gameIDString); } } GameService gameService = new GameService(db); List <Game> ComingSoonList = gameService.FindComingSoonGames(MemberId).ToList(); if (ComingSoonList.Count() == 0) { ComingSoonList = gameService.findGlobalGames(MemberId).ToList(); } if (GameID > 0) { PageNo = 1; ComingSoonList = new List <Game>(); // This gets ANY game, not just a coming soon game as per requirement change - 2014-11-27 Game foundGame = db.Games.Find(GameID); if (foundGame != null) { ComingSoonList.Add(foundGame); } } // build models/mobile/Items collection as per requirement. PaginatedItems paginatedItems = new PaginatedItems(); // Add Banner Adverts paginatedItems.BannerAdverts = new List <BannerAdvert>(); // Add items / coming soon / global games paginatedItems.Items = new List <Item>(); int pageCounter = 0; if (ComingSoonList.Count() > 0) { if (ComingSoonList.Count() >= ((_PAGE_LIMIT * PageNo) - _PAGE_LIMIT)) { foreach (Game ComingSoongame in ComingSoonList) { pageCounter++; int currentPage = Math.Abs((_PAGE_LIMIT + pageCounter) / _PAGE_LIMIT); if (currentPage == PageNo) { Item item = new Item(); item.GameCode = ComingSoongame.GameCode; ComingSoongame.Global = (ComingSoongame.Global == null) ? false : (bool)ComingSoongame.Global; { item.GameCountry = (((bool)ComingSoongame.Global) == true) ? "Global" : "South Africa"; } item.GameCurrency = ComingSoongame.ProductInGames.FirstOrDefault().Currency.CurrencyCode; item.GameDescription = ComingSoongame.GameDescription; item.GameExpiryDateTime = ComingSoongame.GameRules.Where(x => x.GameRuleCode.ToUpper() == "RESOLVEACTUALWINNERS").FirstOrDefault().ExcecuteTime.ToString(); item.GameUnlockDateTime = ComingSoongame.GameRules.Where(x => x.GameRuleCode.ToUpper() == "STARTGAME").FirstOrDefault().ExcecuteTime.AddMinutes(-5).ToString(); item.GamePrepareDateTime = ComingSoongame.GameRules.Where(x => x.GameRuleCode.ToUpper() == "PREPAREGAMERULE").FirstOrDefault().ExcecuteTime.ToString(); item.GameResolveWinnersDateTime = ComingSoongame.GameRules.Where(x => x.GameRuleCode.ToUpper() == "RESOLVEACTUALWINNERS").FirstOrDefault().ExcecuteTime.ToString(); item.GameID = ComingSoongame.GameID.ToString(); item.GameName = ComingSoongame.GameName; item.GamePrice = ComingSoongame.ProductInGames.FirstOrDefault().PriceInGame.ToString(); item.GameStatus = ComingSoongame.MemberSubscriptionType1.MemberSubscriptionTypeDescription; switch (item.GameStatus.ToLower().Trim()) { case "bronze": item.GameStatusColor = "#5b4839"; break; case "silver": item.GameStatusColor = "#505054"; break; case "gold": item.GameStatusColor = "#AC882F"; break; case "platinum": item.GameStatusColor = "#424A5B"; break; } item.GameType = ComingSoongame.GameType.GameTypeName; item.LastUpdated = ComingSoongame.DateUpdated.ToString(); // Requirement - 2014-11-27 - Add <FiveMinDeal> Boolean tag if has a five min deal, added NextGame??? properties for futureproofing. item.FiveMinDeal = "0"; if (ComingSoongame.NextGameID != null) { Game nextGame = db.Games.Find(ComingSoongame.NextGameID); item.FiveMinDeal = (nextGame.GameType.GameTypeName.ToLower().Contains("fiveminute")) ? "1" : "0"; item.NextGameID = nextGame.GameID.ToString(); item.NextGameType = nextGame.GameType.GameTypeName; item.NextGameTypeID = nextGame.GameType.GameTypeID.ToString(); } foreach (ProductInGame productInGame in ComingSoongame.ProductInGames) { Product product = productInGame.Product; item.ProductID = product.ProductID.ToString(); item.ProductName = product.ProductName; item.ProductDescription = product.ProductDescription; item.ProductPrice = ((productInGame.ReferencePrice != null) ? (decimal)productInGame.ReferencePrice : 0).ToString(); item.ProductTerms = (product.terms != null) ? product.terms : ""; item.ProductWebsite = ""; // loop through product categories.... because one product can live in multiple categories!!! // I'm only taking the first one at this point. foreach (ProductInCategory productInCategory in product.ProductInCategories) { ProductCategory productCategory = productInCategory.ProductCategory; item.ProductCategory = productCategory.ProductCategoryName; break; } item.ProductImages = new List <ProductImage>(); foreach (Imagedetail image in product.Imagedetails) { ProductImage productImage = new ProductImage(); productImage.ImageID = image.ImageID.ToString(); item.ProductImages.Add(productImage); } } item.TerritoryFlag = "/Content/Images/Flags/South-Africa.png"; if (item.GameCountry.ToLower() == "global") { item.TerritoryFlag = "/Content/Images/Flags/world.png"; } item.TerritoryName = ""; paginatedItems.Items.Add(item); } } } } return(paginatedItems); }
public string GetItemsInGamesByMember(FormDataCollection formData) { if (formData != null) { string memberIDString = formData.Get("MemberID"); string returnLimitString = formData.Get("ReturnLimit"); int MemberID = Convert.ToInt32(memberIDString); int ReturnLimit = Convert.ToInt32(returnLimitString); if (MemberID > 0 && ReturnLimit > 0) { IQueryable <MemberInGame> memberInGames = db.MemberInGames.Include("Game.ProductInGames.Product.Imagedetails").Include("Game.GameType").Include("Game.GameRules").Where(x => x.MemberID == MemberID).Take(ReturnLimit); List <MemberInGameItem> memberInGameItems = new List <MemberInGameItem>(); foreach (MemberInGame memberInGame in memberInGames) { MemberInGameItem memberInGameItem = new MemberInGameItem(); // This should happen in the constructor of MemberInGameItem. memberInGameItem.GameDateTime = DateTime.MinValue; memberInGameItem.DateTimeInserted = DateTime.MinValue; memberInGameItem.DateTimeUpdated = DateTime.MinValue; Game game = memberInGame.Game; // Set Game properties memberInGameItem.GameID = game.GameID; memberInGameItem.GameCode = game.GameCode; memberInGameItem.GameDescription = game.GameDescription; memberInGameItem.GameName = game.GameName; memberInGameItem.GameTypeName = game.GameType.GameTypeName; //memberInGameItem.GameDateTime = ; comes from game rules where state = ? //memberInGameItem.GamePrice = ; //memberInGameItem.GameStatus = ; //memberInGameItem.GameStatusColor = ; // set product properties - this needs to be a collection in the MemberInGameItem class, it's not a 1:1 relationship, 1 game can have * products. // I'm only taking the first one at this point. foreach (ProductInGame productInGame in game.ProductInGames) { Product product = productInGame.Product; memberInGameItem.ProductID = product.ProductID; memberInGameItem.ProductName = product.ProductName; memberInGameItem.ProductDescription = product.ProductDescription; memberInGameItem.ProductPrice = (product.ProductPrice != null) ? (decimal)product.ProductPrice : 0; memberInGameItem.OwnerID = product.OwnerID; // loop through product categories.... because one product can live in multiple categories!!! // I'm only taking the first one at this point. foreach (ProductInCategory productInCategory in product.ProductInCategories) { ProductCategory productCategory = productInCategory.ProductCategory; memberInGameItem.ProductCategory = productCategory.ProductCategoryName; break; } //Quick hack to get the 1st image Imagedetail image = db.Imagedetails.Where(x => x.ProductId == product.ProductID).First(); memberInGameItem.ProductImage = image.ImageID.ToString(); break; } memberInGameItems.Add(memberInGameItem); } // string returnJSONResult = ""; /*using (MemoryStream memoryStream = new MemoryStream()) * { * DataContractJsonSerializer dataContractJsonSerializer = new DataContractJsonSerializer(typeof(MemberInGameItem)); * dataContractJsonSerializer.WriteObject(memoryStream, memberInGameItems); * * memoryStream.Position = 0; * var sr = new StreamReader(memoryStream); * returnJSONResult = sr.ReadToEnd(); * } * return returnJSONResult; */ System.Web.Mvc.JsonResult json = new System.Web.Mvc.JsonResult { Data = memberInGameItems }; string son = new JavaScriptSerializer().Serialize(json.Data); return(son); } } return(""); }
// POST: api/Reports public IHttpActionResult PostSearch([FromBody] FormDataCollection form) { Debug.WriteLine(form.Get("year")); Debug.WriteLine(form.Get("month")); ReportSearch search = new ReportSearch() { year = Convert.ToInt32(form["year"]), month = Convert.ToInt32(form["month"]) }; if (search == null) { return(ResponseMessage(Request.CreateResponse(HttpStatusCode.BadRequest))); } //int fiscalYearId = convertYearToId(search.year.ToString()); int fiscalYearId = search.year; var numOpen = (from openStatus in db.ClientModel where openStatus.StatusOfFile.StatusOfFile == "Open" && openStatus.Month == search.month && openStatus.FiscalYearId == fiscalYearId select openStatus).Count(); var numClosed = (from openStatus in db.ClientModel where openStatus.StatusOfFile.StatusOfFile == "Closed" && openStatus.Month == search.month && openStatus.FiscalYearId == fiscalYearId select openStatus).Count(); var numReOpened = (from openStatus in db.ClientModel where openStatus.StatusOfFile.StatusOfFile == "Reopened" && openStatus.Month == search.month && openStatus.FiscalYearId == fiscalYearId select openStatus).Count(); var programCrisis = (from crisis in db.ClientModel where crisis.Program.Program == "Crisis" && crisis.Month == search.month && crisis.FiscalYearId == fiscalYearId select crisis).Count(); var programCourt = (from crisis in db.ClientModel where crisis.Program.Program == "Court" && crisis.Month == search.month && crisis.FiscalYearId == fiscalYearId select crisis).Count(); var programSmart = (from crisis in db.ClientModel where crisis.Program.Program == "SMART" && crisis.Month == search.month && crisis.FiscalYearId == fiscalYearId select crisis).Count(); var programDVU = (from crisis in db.ClientModel where crisis.Program.Program == "DVU" && crisis.Month == search.month && crisis.FiscalYearId == fiscalYearId select crisis).Count(); var programMCFD = (from crisis in db.ClientModel where crisis.Program.Program == "MCFD" && crisis.Month == search.month && crisis.FiscalYearId == fiscalYearId select crisis).Count(); var genderMale = (from gender in db.ClientModel where gender.Gender == "M" && gender.Month == search.month && gender.FiscalYearId == fiscalYearId select gender).Count(); var genderFemale = (from gender in db.ClientModel where gender.Gender == "F" && gender.Month == search.month && gender.FiscalYearId == fiscalYearId select gender).Count(); var genderTrans = (from gender in db.ClientModel where gender.Gender == "Trans" && gender.Month == search.month && gender.FiscalYearId == fiscalYearId select gender).Count(); var ageAdult = (from age in db.ClientModel where age.Age.Age == "Adult(>24<65)" && age.Month == search.month && age.FiscalYearId == fiscalYearId select age).Count(); var ageTween = (from age in db.ClientModel where age.Age.Age == "Youth(>12<19)" && age.Month == search.month && age.FiscalYearId == fiscalYearId select age).Count(); var ageYouth = (from age in db.ClientModel where age.Age.Age == "Youth(>18<25)" && age.Month == search.month && age.FiscalYearId == fiscalYearId select age).Count(); var ageChild = (from age in db.ClientModel where age.Age.Age == "Child(<13)" && age.Month == search.month && age.FiscalYearId == fiscalYearId select age).Count(); var ageSenior = (from age in db.ClientModel where age.Age.Age == "Senior(>64)" && age.Month == search.month && age.FiscalYearId == fiscalYearId select age).Count(); // put results into object ReportSearchReply success = new ReportSearchReply() { status = JObject.Parse("{ 'open' : '" + numOpen + "', 'closed': '" + numClosed + "', 'reopened': '" + numReOpened + "' }"), program = JObject.Parse("{ 'crisis' : '" + programCrisis + "', 'court': '" + programCourt + "', 'smart': '" + programSmart + "', 'dvu': '" + programDVU + "', 'mcfd': '" + programMCFD + "' }"), gender = JObject.Parse("{ 'female': '" + genderFemale + "', 'male' : '" + genderMale + "', 'trans': '" + genderTrans + "' }"), age = JObject.Parse("{ 'adult': '" + ageAdult + "', 'youth1825': '" + ageTween + "', 'youth1219': '" + ageYouth + "', 'child': '" + ageChild + "', 'senior': '" + ageSenior + "' }") }; return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK, success))); }
public HttpResponseMessage Post(FormDataCollection form) { switch (form.Get("op")) { case "insertar": { SEabyvisual.Diagnostico item = new SEabyvisual.Diagnostico(); item._IDDIAGNOSTICO = form.Get("_IDDIAGNOSTICO"); SEabyvisual.Medico med = new SEabyvisual.Medico(); med._IDMEDICO = form.Get("_IDMEDICO"); item._IDMEDICO = med; SEabyvisual.Paciente pac = new SEabyvisual.Paciente(); pac._IDPACIENTE = form.Get("_IDPACIENTE"); item._IDPACIENTE = pac; item._DESCRIPCION = form.Get("_DESCRIPCION"); item._SEGUIMIENTO = form.Get("_SEGUIMIENTO"); item._DIA = form.Get("_DIA"); item._MES = form.Get("_MES"); item._ANNO = form.Get("_ANNO"); HttpResponseMessage response = Request.CreateResponse <int>(HttpStatusCode.Created, item.InsertarDiagnostico()); return(response); break; } case "modificar": { SEabyvisual.Diagnostico item = new SEabyvisual.Diagnostico(); item._IDDIAGNOSTICO = form.Get("_IDDIAGNOSTICO"); SEabyvisual.Medico med = new SEabyvisual.Medico(); med._IDMEDICO = form.Get("_IDMEDICO"); item._IDMEDICO = med; SEabyvisual.Paciente pac = new SEabyvisual.Paciente(); pac._IDPACIENTE = form.Get("_IDPACIENTE"); item._IDPACIENTE = pac; item._DESCRIPCION = form.Get("_DESCRIPCION"); item._SEGUIMIENTO = form.Get("_SEGUIMIENTO"); item._DIA = form.Get("_DIA"); item._MES = form.Get("_MES"); item._ANNO = form.Get("_ANNO"); HttpResponseMessage response = Request.CreateResponse <int>(HttpStatusCode.Created, item.ActualizarDiagnostico()); return(response); break; } case "eliminar": { SEabyvisual.Diagnostico item = new SEabyvisual.Diagnostico(); item._IDDIAGNOSTICO = form.Get("_IDDIAGNOSTICO"); HttpResponseMessage response = Request.CreateResponse <int>(HttpStatusCode.Created, item.EliminarDiagnostico()); return(response); break; } case "listar": { HttpResponseMessage response = Request.CreateResponse <List <SEabyvisual.Diagnostico> >(SEabyvisual.Diagnostico.Seleccionar()); return(response); break; } default: { HttpResponseMessage response = Request.CreateResponse <int>(HttpStatusCode.Created, 0); return(response); break; } } }
public string Edit(FormDataCollection form) { var retVal = string.Empty; var operation = form.Get("oper"); var id = ConvertHelper.ToInt32(form.Get("ImportExcelId")); if (!string.IsNullOrEmpty(operation)) { ImportExcelInfo info; switch (operation) { case "edit": info = ImportExcelRepository.GetInfo(id); if (info != null) { /* * * info.ImportId = form.Get("ImportId"); * * info.UserId = form.Get("UserId"); * * info.TypeId = form.Get("TypeId"); * * info.ChannelId = form.Get("ChannelId"); * * info.CollectorId = form.Get("CollectorId"); * * info.BranchId = form.Get("BranchId"); * * info.Status = form.Get("Status"); * * info.FilePath = form.Get("FilePath"); * * info.TotalRow = form.Get("TotalRow"); * * info.CheckCount = form.Get("CheckCount"); * * info.ErrorCount = form.Get("ErrorCount"); * * info.DuplicateCount = form.Get("DuplicateCount"); * * info.ImportedDate = form.Get("ImportedDate"); * * ImportExcelRepository.Update(info); */ } break; case "add": info = new ImportExcelInfo(); /* * * info.ImportId = form.Get("ImportId"); * * info.UserId = form.Get("UserId"); * * info.TypeId = form.Get("TypeId"); * * info.ChannelId = form.Get("ChannelId"); * * info.CollectorId = form.Get("CollectorId"); * * info.BranchId = form.Get("BranchId"); * * info.Status = form.Get("Status"); * * info.FilePath = form.Get("FilePath"); * * info.TotalRow = form.Get("TotalRow"); * * info.CheckCount = form.Get("CheckCount"); * * info.ErrorCount = form.Get("ErrorCount"); * * info.DuplicateCount = form.Get("DuplicateCount"); * * info.ImportedDate = form.Get("ImportedDate"); * */ ImportExcelRepository.Create(info); break; case "del": ImportExcelRepository.Delete(id); break; } } return(retVal); }
public static string getPackageAPI_XML_Rate(ref FormDataCollection form) { #region Variables string url = "", referrer, contentType, accept, method, doc = ""; //url = "https://wwwcie.ups.com/ups.app/xml/ShipAccept"; //url = "https://onlinetools.ups.com/ups.app/xml/ShipAccept"; //url = "https://wwwcie.ups.com/ups.app/xml/Rate"; url = "https://onlinetools.ups.com/ups.app/xml/Rate"; referrer = ""; //contentType = "application/xml"; contentType = "text/xml; charset=utf-8"; method = "POST"; //accept = "text/xml"; accept = "*/*"; #endregion #region Post Data // string data = string.Concat("<?xml version=\"1.0\"?>", //"<AccessRequest xml:lang=\"en-US\">", // "<AccessLicenseNumber></AccessLicenseNumber>", // "<UserId></UserId>", // "<Password></Password>", //"</AccessRequest>", //"<?xml version=\"1.0\"?>", //"<RatingServiceSelectionRequest xml:lang=\"en-US\">", // "<Request>", // "<TransactionReference>", // "<CustomerContext>Rating and Service</CustomerContext>", // "<XpciVersion>1.0</XpciVersion>", // "</TransactionReference>", // "<RequestAction>Rate</RequestAction>", // "<RequestOption>Rate</RequestOption>", // "<ShipmentRatingOptions><NegotiatedRatesIndicator /></ShipmentRatingOptions>", // "</Request>", // //"<PickupType>", // //"<Code>07</Code>", // //"<Description>Rate</Description>", // //"</PickupType>", // "<Shipment>", // "<Description>Rate Description</Description>", // "<Shipper>", // "<Name>Name</Name>", // "<PhoneNumber>1234567890</PhoneNumber>", // "<ShipperNumber></ShipperNumber>", // "<Address>", // "<AddressLine1>Address Line</AddressLine1>", // "<City>SANTA FE SPRINGS</City>", // "<StateProvinceCode>CA</StateProvinceCode>", // "<PostalCode>90670</PostalCode>", // "<CountryCode>US</CountryCode>", // "</Address>", // "</Shipper>", // "<ShipTo>", // "<CompanyName>Company Name</CompanyName>", // "<PhoneNumber>1234567890</PhoneNumber>", // "<Address>", // "<AddressLine1>Address Line</AddressLine1>", // "<City>HIGH POINT</City>", // "<StateProvinceCode>NC</StateProvinceCode>", // "<PostalCode>27260</PostalCode>", // "<CountryCode>US</CountryCode>", // "</Address>", // "</ShipTo>", // "<ShipFrom>", // "<CompanyName>Company Name</CompanyName>", // "<AttentionName>Attention Name</AttentionName>", // "<PhoneNumber>1234567890</PhoneNumber>", // "<FaxNumber>1234567890</FaxNumber>", // "<Address>", // "<AddressLine1>Address Line</AddressLine1>", // "<City>SANTA FE SPRINGS</City>", // "<StateProvinceCode>CA</StateProvinceCode>", // "<PostalCode>90670</PostalCode>", // "<CountryCode>US</CountryCode>", // "</Address>", // "</ShipFrom>", // "<Service>", // "<Code>03</Code>", // "</Service>", // "<PaymentInformation>", // "<Prepaid>", // "<BillShipper>", // "<AccountNumber></AccountNumber>", // "</BillShipper>", // "</Prepaid>", // "</PaymentInformation>", // "<Package>", // "<PackagingType>", // "<Code>02</Code>", // "<Description>Customer Supplied</Description>", // "</PackagingType>", // "<Description>Rate</Description>", // "<PackageWeight>", // "<UnitOfMeasurement>", // "<Code>LBS</Code>", // "</UnitOfMeasurement>", // "<Weight>65</Weight>", // "</PackageWeight>", // "<Dimensions>", // "<UnitOfMeasurement>", // "<Code>IN</Code>", // "</UnitOfMeasurement>", // "<Length>29</Length>", // "<Width>29</Width>", // "<Height>42</Height>", // "</Dimensions>", // "</Package>", // //"<ShipmentServiceOptions>", // // "<OnCallAir>", // // "<Schedule>", // // "<PickupDay>02</PickupDay>", // // "<Method>02</Method>", // // "</Schedule>", // // "</OnCallAir>", // //"</ShipmentServiceOptions>", // "<RateInformation><NegotiatedRatesIndicator /></RateInformation>", // "</Shipment>", //"</RatingServiceSelectionRequest>"); #endregion HelperFuncs.writeToSiteErrors("getPackageAPI_XML_Rate request xml", form.Get("data")); doc = (string)HelperFuncs.generic_http_request("string", null, url, referrer, contentType, accept, method, form.Get("data"), false); HelperFuncs.writeToSiteErrors("getPackageAPI_XML_Rate response xml", doc); string[] tokens = new string[4]; tokens[0] = "<NegotiatedRates>"; tokens[1] = "<MonetaryValue>"; tokens[2] = ">"; tokens[3] = "<"; string strNegotiatedRate = HelperFuncs.scrapeFromPage(tokens, doc); HelperFuncs.writeToSiteErrors("getPackageAPI_XML_Rate strNegotiatedRate", strNegotiatedRate); double negotiatedRate = 0.0; if (!double.TryParse(strNegotiatedRate, out negotiatedRate)) { HelperFuncs.writeToSiteErrors("getPackageAPI_XML_Rate", string.Concat("negotiated rate not parsed to double, value was: ", strNegotiatedRate)); return("-1"); } return(strNegotiatedRate); }