public async Task <IActionResult> PutRegulation(int id, Regulation regulation) { if (id != regulation.Id) { return(BadRequest()); } _context.Entry(regulation).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!RegulationExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutAsync(Guid id, [FromBody] RegulationInputModel model) { if (default(Guid).Equals(id)) { AddNotification("O Id do regulamento não foi informado."); return(ResponseInvalid()); } if (ModelState.IsValid) { var regulation = new Regulation(model.Description); await _regulationService.UpdateAsync(id, regulation); if (ValidOperation()) { return(NoContent()); } return(ResponseInvalid()); } NotifyModelStateError(); return(ResponseInvalid()); }
public RegulationsPage1() { CurrentRegulation = new Regulation(); InitializeComponent(); // //datePicker1.SelectedDateChanged += new EventHandler<SelectionChangedEventArgs>(datePicker1_SelectedDateChanged); }
private void InitailControl() { IList <Regulation> ips = Regulation.List(iSabayaContext); ComboRegulation.ValueType = typeof(int); ComboRegulation.Items.Clear(); foreach (Regulation c in ips) { ComboRegulation.Items.Add(c.Code, c.RegulationID); } ComboRegulation.SelectedIndex = 0; if (IsRequiredField) { ComboRegulation.ValidationSettings.ValidationGroup = ValidationGroup; ComboRegulation.ValidationSettings.SetFocusOnError = true; ComboRegulation.ValidationSettings.ErrorText = "ErrorText"; ComboRegulation.ValidationSettings.ValidateOnLeave = true; ComboRegulation.ValidationSettings.ErrorImage.Height = Unit.Pixel(16); ComboRegulation.ValidationSettings.ErrorImage.Width = Unit.Pixel(16); ComboRegulation.ValidationSettings.ErrorImage.AlternateText = "Error"; ComboRegulation.ValidationSettings.ErrorImage.Url = "~/Images/iconError.png"; ComboRegulation.ValidationSettings.RequiredField.IsRequired = true; ComboRegulation.ValidationSettings.RequiredField.ErrorText = "กรุณากรอกข้อมูล"; ComboRegulation.ValidationSettings.ErrorFrameStyle.ForeColor = System.Drawing.Color.Red; ComboRegulation.ValidationSettings.ErrorFrameStyle.Paddings.Padding = Unit.Pixel(0); ComboRegulation.ValidationSettings.ErrorFrameStyle.Paddings.PaddingLeft = Unit.Pixel(0); ComboRegulation.ValidationSettings.ErrorFrameStyle.BackgroundImage.ImageUrl = "~/Images/bgError.png"; ComboRegulation.ValidationSettings.ErrorFrameStyle.Border.BorderColor = System.Drawing.ColorTranslator.FromHtml("#FD4D3E"); ComboRegulation.ValidationSettings.ErrorFrameStyle.Border.BorderStyle = System.Web.UI.WebControls.BorderStyle.Solid; ComboRegulation.ValidationSettings.ErrorFrameStyle.Border.BorderWidth = Unit.Pixel(0); ComboRegulation.ValidationSettings.ErrorFrameStyle.ErrorTextPaddings.PaddingRight = Unit.Pixel(0); } }
public IEnumerable <Regulation> GetRegulation(Regulation regulation) { using (DemsifyEntities dataContext = new DemsifyEntities()) { ObjectParameter totalPageCount = new ObjectParameter("TotalPageCount", typeof(int)); ObjectParameter totalRecord = new ObjectParameter("TotalRecord", typeof(int)); var regulations = dataContext.RegulationGet(regulation.RegulationId, Utility.TrimString(regulation.SearchText), regulation.IsActive, regulation.PageNumber, regulation.PageSize, regulation.IsPagingRequired, Utility.TrimString(regulation.OrderBy), Utility.TrimString(regulation.OrderByDirection), totalPageCount, totalRecord).ToList(); var regulationList = new List <Regulation>(); foreach (var regulationDetail in regulations) { regulationList.Add(new Regulation() { RegulationId = regulationDetail.Regulationid, RegulationName = regulationDetail.Regulationname, RegulationNumber = regulationDetail.Regulationnumber, Year = regulationDetail.Year, PublicationDate = regulationDetail.PublicationDate, IsActive = regulationDetail.Isactive, TotalPageCount = Convert.ToInt32(totalPageCount.Value), TotalRecord = Convert.ToInt32(totalRecord.Value) }); } return(regulationList); } }
public async Task <ActionResult <Regulation> > PostRegulation(Regulation regulation) { _context.Regulations.Add(regulation); await _context.SaveChangesAsync(); return(CreatedAtAction("GetRegulation", new { id = regulation.Id }, regulation)); }
/// <summary>Initializes and returns a new instance using the specified parameters.</summary> /// <param name="regulation">The <see cref="T:InitialMargin.Core.Regulation"/> to use on post side.</param> /// <returns>A new instance of <see cref="T:InitialMargin.Core.RegulationsInfo"/> initialized with the specified parameters.</returns> /// <exception cref="T:System.ArgumentException">Thrown when <paramref name="regulation">regulation</paramref> is undefined.</exception> public static RegulationsInfo OfPost(Regulation regulation) { return(Of((new List <Regulation>(0)), (new List <Regulation>(1) { regulation }))); }
public static void AddElementToDataTable(ref System.Data.DataTable Dt, Regulation element) { DataRow dtrow = Dt.NewRow(); dtrow.SetField(CONSTANTS.Constants.Order, element.Order); dtrow.SetField(CONSTANTS.Constants.CrmId, element.CrmId); dtrow.SetField(CONSTANTS.Constants.ParentCrmId, element.ParentCrmId); dtrow.SetField(CONSTANTS.Constants.UniqueId, element.UniqueId); dtrow.SetField(CONSTANTS.Constants.Type, element.Type); dtrow.SetField(CONSTANTS.Constants.Label, element.Label); dtrow.SetField(CONSTANTS.Constants.Text, element.TextEnglish); dtrow.SetField(CONSTANTS.Constants.TextFrench, element.TextFrench); dtrow.SetField(CONSTANTS.Constants.HistoricalNote, element.HistoricalNote); dtrow.SetField(CONSTANTS.Constants.AdditionalMetadata, element.AdditionalMetadata); dtrow.SetField(CONSTANTS.Constants.JusticeId, element.JusticeId); dtrow.SetField(CONSTANTS.Constants.JusticeFId, element.JusticeFId); dtrow.SetField(CONSTANTS.Constants.InforceStartDate, element.InforceStartDate); dtrow.SetField(CONSTANTS.Constants.PitDate, element.PitDate); dtrow.SetField(CONSTANTS.Constants.Lang, element.Lang); dtrow.SetField(CONSTANTS.Constants.LastAmendedDate, element.LastAmendedDate); dtrow.SetField(CONSTANTS.Constants.CurrentDate, element.CurrentDate); dtrow.SetField(CONSTANTS.Constants.GazettePart, element.GazettePart); dtrow.SetField(CONSTANTS.Constants.RegulationType, element.RegulationType); foreach (var flag in element.DataFlags) { dtrow.SetField(flag.Key, flag.Value.ToString()); //todo: no check = dangerous } Dt.Rows.Add(dtrow); }
public IList <Regulation> GetRegulations(int regulationID, int categoryID, string regulationNo, string regulationName, string version, string fileNo, string titleRemark, DateTime issueDate, DateTime executeDate, int status, string url, string memo, int startRowIndex, int maximumRows, string orderBy) { IList <Regulation> regulations = new List <Regulation>(); Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "USP_REGULATION_S"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); db.AddInParameter(dbCommand, "p_start_row_index", DbType.Int32, startRowIndex); db.AddInParameter(dbCommand, "p_page_size", DbType.Int32, maximumRows); db.AddInParameter(dbCommand, "p_order_by", DbType.String, GetMappingOrderBy(orderBy)); db.AddOutParameter(dbCommand, "p_count", DbType.Int32, 4); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { Regulation regulation = CreateModelObject(dataReader); regulations.Add(regulation); } } _recordCount = Convert.ToInt32(db.GetParameterValue(dbCommand, "p_count")); return(regulations); }
public static byte[] CreateTDGProvisionWorkbook() { SetupBasicLogging(); //don't need act rn var actFraXml = LegApiClient.GetActFromJustice("fra"); var tdgFraActs = XML.XMLFunctions.ParseRegs(actFraXml, "Body", "441564"); var actXml = LegApiClient.GetActFromJustice(); var regXml = LegApiClient.GetRegulationFromJustice(); //XML to "Regulation" class //act = XMLFunctions.ParseRegs(actXml, "Body", "452135"); tdgr = XMLFunctions.ParseRegs(regXml, "Body", "1227365"); schedule1 = XMLFunctions.ParseRegs(regXml, "Schedule", "1230876"); schedule2 = XMLFunctions.ParseRegs(regXml, "Schedule", "1230890"); schedule3 = XMLFunctions.ParseRegs(regXml, "Schedule", "1231645"); //flag data we're interested in //TODO: can be added in the parsing to avoid an extra sweep act.PopulateDataFlags(); tdgr.PopulateDataFlags(); schedule1.PopulateDataFlags(); schedule2.PopulateDataFlags(); schedule3.PopulateDataFlags(); //output List of Regulations to JSON XMLFunctions.SerializeRegulationsToFile(act, actFileName); XMLFunctions.SerializeRegulationsToFile(tdgr, regFileName); XMLFunctions.SerializeRegulationsToFile(schedule1, schedule1FileName); XMLFunctions.SerializeRegulationsToFile(schedule2, schedule2FileName); XMLFunctions.SerializeRegulationsToFile(schedule3, schedule3FileName); return(CreateExcelWorkbook()); }
public async Task TestRegulations() { ViziVault vault = new ViziVault(new Uri(baseUrl)).WithApiKey(apiKey).WithDecryptionKey(decryptionKey).WithEncryptionKey(encryptionKey); Regulation regulation = new Regulation() { Name = "Regulation Name", Key = "RegulationKey" }; AttributeDefinition attributeDef = new AttributeDefinition("TestAttribute1"); await vault.StoreAttributeDefinitionAsync(attributeDef); ConjunctiveRule rootRule = new ConjunctiveRule(); rootRule.AddRule(new AttributeRule(new List <string> { attributeDef.Name }, AttributeRule.AttributeListOperator.Any)); rootRule.AddRule(new UserRule(attributeDef.Name, UserRule.UserValuePredicate.Eq, "Test Attribute Value")); regulation.Rule = rootRule; await vault.StoreRegulationAsync(regulation); Regulation receivedRegulation = await vault.GetRegulationAsync(regulation.Key); Assert.Equal(regulation.Name, receivedRegulation.Name); Assert.Contains(await vault.GetRegulationsAsync(), (r) => r.Name.Equals(regulation.Name)); await vault.DeleteRegulationAsync(regulation.Key); Assert.DoesNotContain(await vault.GetRegulationsAsync(), (r) => r.Name.Equals(regulation.Name)); }
public IActionResult Delete(Regulation regulation) { context.Regulations.Remove(regulation); context.SaveChanges(); TempData["successMessage"] = "Regulation deleted successfully"; return(RedirectToAction("List")); }
private RegulationEditViewModel GetEditViewModel(Regulation j, string action) => new RegulationEditViewModel { Regulation = j, RegulationRequirements = context.RegulationRequirements.ToList(), Action = action };
public static Dictionary <string, DataTable> SetBusinessDataTable <T>(T t, string TableName, string objectName, string Upstream, out string DJBH) where T : class { var sql = string.Empty; DataTable tb = null; Dictionary <string, object> ListName = null; DJBH = string.Empty; switch (objectName) { #region //库存调整单 case "Regulation": //库存 { Regulation retail = t as Regulation; if (string.IsNullOrWhiteSpace(retail.DM2_1)) { retail.DM2_1 = InvoicesManage.GetCKKW(retail.DM2); //仓库库位 } if (string.IsNullOrEmpty(retail.BYZD12)) { retail.BYZD12 = "0.0000"; } if (string.IsNullOrEmpty(retail.QDDM)) { retail.QDDM = InvoicesManage.GetCANGKUValue("QDDM", retail.DM2); } if (string.IsNullOrWhiteSpace(retail.DJBH)) { retail.DJBH = InvoicesManage.GetNewDJBH(TableName, retail.QDDM, retail.DM2, retail.YDJH); } retail.BYZD1 = InvoicesManage.GetJGSD(InvoicesManage.GetCANGKUValue("JGSD", retail.DM2)).ToString(); retail.DM1 = "000"; retail.DJXZ = "0"; retail.YGDM = InvoicesManage.GetCANGKUValue("YGDM", retail.DM2); retail.BYZD5 = retail.BYZD1; retail.JZ = "0"; retail.RQ_4 = DateTime.Now; retail.SHRQ = retail.RQ.ToString(); retail.YSRQ = retail.RQ.ToString(); retail.YGDM = InvoicesManage.GetCANGKUValue("YGDM", retail.DM2); DJBH = retail.DJBH; ListName = RequestBuilder.getProperties <Regulation>(retail, objectName); break; } #endregion } tb = InvoicesManage.SetDataTable(ListName, TableName); if ("SG_Gathering".Equals(objectName)) { tb.PrimaryKey = new DataColumn[] { tb.Columns["vMBillID"] } } ; else { tb.PrimaryKey = new DataColumn[] { tb.Columns["DJBH"] } }; sql = InvoicesManage.SetSQLValue(ListName, TableName, "", objectName); Dictionary <string, DataTable> dic = new Dictionary <string, DataTable>(); dic.Add(sql, tb); return(dic); }
public IList <Regulation> GetRegulations(string regulationName, string regulationNo, int status) { IList <Regulation> regulations = new List <Regulation>(); Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "USP_REGULATION_F"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); db.AddInParameter(dbCommand, "p_regulation_name", DbType.String, regulationName); db.AddInParameter(dbCommand, "p_regulation_no", DbType.String, regulationNo); db.AddInParameter(dbCommand, "p_status", DbType.Int32, status); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { Regulation regulation = CreateModelObject(dataReader); regulations.Add(regulation); } } return(regulations); }
public IList <Regulation> GetRegulations() { IList <Regulation> regulations = new List <Regulation>(); Database db = DatabaseFactory.CreateDatabase(); string sqlCommand = "USP_REGULATION_S"; DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand); db.AddInParameter(dbCommand, "p_order_by", DbType.String, GetMappingOrderBy("regulationid")); db.AddOutParameter(dbCommand, "p_count", DbType.Int32, 4); using (IDataReader dataReader = db.ExecuteReader(dbCommand)) { while (dataReader.Read()) { Regulation regulation = CreateModelObject(dataReader); regulations.Add(regulation); } } _recordCount = Convert.ToInt32(db.GetParameterValue(dbCommand, "p_count")); return(regulations); }
public IActionResult Edit(int id, [Bind("Id,Name,Description")] Regulation regulation) { if (id != regulation.Id) { return(NotFound()); } if (ModelState.IsValid) { try { ApiConsumer.Put <List <Regulation> >(regulation, _options.Value.ApiUrl + "regulation/{id}"); } catch (DbUpdateConcurrencyException) { if (!RegulationExists(regulation.Id)) { return(NotFound()); } throw; } return(RedirectToAction(nameof(Index))); } return(View(regulation)); }
private static List <Regulation> GetProduction(SyntaxTree syntaxTree) { // <Production> ::= <Vn> "::=" <Canditate> <RightPartList> ; List <Regulation> result = new List <Regulation>(); if (syntaxTree.NodeType.Type == ContextfreeGrammarTreeNodeType.__Production) { Vn left = GetVn(syntaxTree.Children[0]); TreeNodeType leftNode = left.GetTreeNodeType(); { Candidate candidate = GetCandidate(syntaxTree.Children[2]); var regulation = new Regulation(leftNode, (from item in candidate select item.GetTreeNodeType()).ToArray()); result.Add(regulation); } RightPartList rightPartList = GetRightPartList(syntaxTree.Children[3]); foreach (var candidate in rightPartList) { var regulation = new Regulation(leftNode, (from item in candidate select item.GetTreeNodeType()).ToArray()); result.Add(regulation); } } return(result); }
public IHttpActionResult UpdateRegulation(UpdateRegulationRequest updateRegulationRequest) { var responses = new Responses(); try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (Utility.UserId < 0) { return(BadRequest(Utility.INVALID_USER)); } var regulation = new Regulation() { RegulationId = updateRegulationRequest.RegulationId, RegulationName = updateRegulationRequest.RegulationName, RegulationNumber = updateRegulationRequest.RegulationNumber, Year = updateRegulationRequest.Year, PublicationDate = updateRegulationRequest.PublicationDate, ModifiedBy = Utility.UserId }; int result = iRegulation.UpdateRegulation(regulation); switch (result) { case 1: responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "Regulation updated successfully."; break; case -2: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Regulation already exists."; break; case -3: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Regulation doesn't exist."; break; default: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while updating regulation."; break; } } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while updating regulation."; Utility.WriteLog("UpdateRegulation", updateRegulationRequest, "Error while updating regulation. (RegulationAdminController)", ex.ToString()); } return(Ok(responses)); }
//method, 메소드 private Curve fromSurroundingsRegulation(Apartment agOut) { //initial settings Polyline outline; agOut.Plot.Boundary.TryGetPolyline(out outline); List <Line> lines = outline.GetSegments().ToList(); Regulation regulation = new Regulation(agOut.ParameterSet.Stories); //offset distance List <double> offsetDists = new List <double>(); for (int i = 0; i < agOut.Plot.Surroundings.Length; i++) { if (agOut.Plot.Surroundings[i] == 0) { offsetDists.Add(regulation.DistanceFromPlot); } else { offsetDists.Add(regulation.DistanceFromRoad); } } //offset lines and add the first to last(for intersect lineline operation) List <Line> linesTemp = new List <Line>(); for (int i = 0; i < lines.Count; i++) { Vector3d vec = lines[i].UnitTangent; vec.Rotate(-Math.PI / 2, Vector3d.ZAxis);//inside direction Line lineTemp = lines[i]; lineTemp.Transform(Transform.Translation(vec * offsetDists[i])); linesTemp.Add(lineTemp); } linesTemp.Add(linesTemp[0]); lines = new List <Line>(linesTemp); //intersection points List <Point3d> ptsNew = new List <Point3d>(); for (int i = 0; i < lines.Count - 1; i++) { double a, b; bool check = Rhino.Geometry.Intersect.Intersection.LineLine(lines[i], lines[i + 1], out a, out b); if (check) { ptsNew.Add(lines[i].PointAt(a)); } else { ptsNew.Add(lines[i].PointAt(1)); } } ptsNew.Add(ptsNew[0]); return(new Polyline(ptsNew).ToNurbsCurve()); }
public PartialViewResult DeleteConfirmed(int id) { Regulation regulation = db.Regulations.Find(id); db.Regulations.Remove(regulation); db.SaveChanges(); //return RedirectToAction("Index"); return(PartialView("~/Views/Admin/Regulations.cshtml", db.Regulations.ToList())); }
protected Regulation ReadNextElement(SqlDataReader reader) { Regulation element = new Regulation(); element.Timestamp = reader.GetDateTime(1); element.Status = reader.GetBoolean(2); return(element); }
// GET: Regulations/Edit/5 public PartialViewResult Edit() { Regulation regulation = db.Regulations.FirstOrDefault(); if (regulation == null) { } return(PartialView(regulation)); }
public PartialViewResult Create([Bind(Include = "RegulationID,Rule")] Regulation regulation) { if (ModelState.IsValid) { db.Regulations.Add(regulation); db.SaveChanges(); return(PartialView("~/Views/Admin/Regulations.cshtml", db.Regulations.ToList())); } return(PartialView()); }
public IActionResult View(int id) { var r = context.RegulationRequirements.Where(r => r.RegulationId == id).ToList(); Regulation regulation = context.Regulations.Where(r => r.RegulationId == id).FirstOrDefault(); RegulationListViewModel vm = new RegulationListViewModel { Regulation = regulation, RegulationRequirements = r }; return(View(vm)); }
/// <summary>Initializes and returns a new instance using the specified parameters.</summary> /// <param name="collectRegulation">The <see cref="T:InitialMargin.Core.Regulation"/> to use on collect side.</param> /// <param name="postRegulation">The <see cref="T:InitialMargin.Core.Regulation"/> to use on post side.</param> /// <returns>A new instance of <see cref="T:InitialMargin.Core.RegulationsInfo"/> initialized with the specified parameters.</returns> /// <exception cref="T:System.ArgumentException">Thrown when <paramref name="collectRegulation">collectRegulation</paramref> is undefined or when <paramref name="postRegulation">postRegulation</paramref> is undefined.</exception> public static RegulationsInfo Of(Regulation collectRegulation, Regulation postRegulation) { return(Of((new List <Regulation>(1) { collectRegulation }), (new List <Regulation>(1) { postRegulation }))); }
public IActionResult Create([Bind("Id,Name,Description")] Regulation regulation) { if (ModelState.IsValid) { ApiConsumer.Post <Regulation>(regulation, _options.Value.ApiUrl + "regulation"); return(RedirectToAction(nameof(Index))); } return(View(regulation)); }
public static void SerializeRegulationsToFile(Regulation regs, string filename = "TDG-REGS") { var whereAmI = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); var json = JsonConvert.SerializeObject(regs, Formatting.Indented); var now = DateTime.Now.ToString("yyyy-MM-dd"); File.WriteAllText(Path.Combine(whereAmI, $"{filename}-{now}.json"), json); }
public async Task AddRegulation(string collection, Regulation item) { try { await _context.Regulations(collection).InsertOneAsync(item); } catch (Exception ex) { throw ex; } }
public int Post(Regulation value) { using (SqlConnection conn = new SqlConnection(_connectionString)) using (SqlCommand cmd = new SqlCommand(Insert, conn)) { conn.Open(); cmd.Parameters.AddWithValue("@Status", value.Status); cmd.Parameters.AddWithValue("@Timestamp", value.Timestamp); return(cmd.ExecuteNonQuery()); } }