public ADDataProvider(IADDataReader reader, DataMapping mapping) { reader.AssertNotNull("reader"); mapping.AssertNotNull("mapping"); this.reader = reader; this.mapping = mapping; }
void Lines4_1() { StockInfo[] stocks = Load(); chart1.DataSource = stocks; DataMapping<StockInfo> mapping = new DataMapping(); mapping.XMapping = stock => stock.Time; mapping.XAxis = dateTimeAxis; mapping.YAxis = stock => stock.Open; chart1.DataMapping = mapping; }
public void TestString() { string[] samples = new string[] { "test 1", "čšýáířřží", "پاکستان", "is our country" }; DataMapping mapping = new DataMapping(); byte[] data = new byte[200]; foreach (var str in samples) { Array.Clear(data, 0, 200); mapping.Data = data; mapping.SetString(0, 200, str); Assert.AreEqual(str, mapping.GetString(0, 200)); } }
public async Task <IActionResult> Get(int id) { var question = await _questionStore.GetQuestionAsync(id); if (question == null) { return(HttpNotFound()); } if (!await _authorizationService.AuthorizeAsync(User, question.Survey, Operations.Update)) { return(new HttpStatusCodeResult((int)HttpStatusCode.Forbidden)); } return(new ObjectResult(DataMapping._questionToDto(question))); }
static void Main(string[] args) { Source s = new Source(); // Simple mapping DestinationBase db = DataMapping.Map(s); Debug.Assert(db.VALUE == s.CVALUE && s.CVALUE == 42); // Mapping to inherited class // I want this as simple as possible (!!!!) // without double mapping, DI, ... DestinationDerived dd = DataMapping.Map <DestinationDerived>(s); Debug.Assert(db.VALUE == s.CVALUE && s.CVALUE == 42); }
public async Task <IActionResult> Get(int id) { var survey = await _surveyStore.GetSurveyAsync(id); if (survey == null) { return(NotFound()); } // The AuthorizationService uses the policies in the Tailspin.Surveys.Security project if (!await _authorizationService.AuthorizeAsync(User, survey, Operations.Read)) { return(StatusCode(403)); } return(Ok(DataMapping._surveyToDto(survey))); }
public async Task <IActionResult> Get(int id) { var question = await _questionStore.GetQuestionAsync(id); if (question == null) { return(NotFound()); } if (!(await _authorizationService.AuthorizeAsync(User, question.Survey, Operations.Update)).Succeeded) { return(StatusCode(403)); } return(Ok(DataMapping._questionToDto(question))); }
protected void dataList_Members_ItemDataBound(object sender, DataListItemEventArgs e) { Affectation affectation = (Affectation)e.Item.DataItem; Member member = DataMapping.GetMemberByNim(affectation.nim); Image Image1 = (Image)e.Item.FindControl("Image1"); if (member != null) { Image1.ImageUrl = member.GetPhoto(); } else { Image1.ImageUrl = Const.MEMBERS_NOPHOTO_H; } Label LBL_Club = (Label)e.Item.FindControl("LBL_Club"); LBL_Club.Text = DataMapping.GetClub(affectation.cric).name; Label LBL_Nom = (Label)e.Item.FindControl("LBL_Nom"); LBL_Nom.Text = affectation.name; HyperLink HL_Contact = (HyperLink)e.Item.FindControl("HL_Contact"); if (member != null) { PortalSettings ps = PortalController.GetCurrentPortalSettings(); if (ps.UserInfo.Roles != null && ps.UserInfo.Roles.Count() > 0) { HL_Contact.NavigateUrl = "javascript:dnnModal.show('/AIS/contact.aspx?id=" + member.id + "&popUp=true',false,350,850,false);"; } else { HL_Contact.NavigateUrl = "javascript:dnnModal.show('/AIS/contact.aspx?id=" + member.id + "&popUp=true',false,350,500,false);"; } if (member.IsWoman() == true) { HL_Contact.Text = "La contacter"; } } else { HL_Contact.Visible = false; } }
private void LoadDvbS(ChannelList list, string path) { if (!File.Exists(path)) { return; } var data = File.ReadAllBytes(path); if (data.Length < 4) { return; } var checksum = BitConverter.ToUInt32(data, data.Length - 4); var crcObj = new Crc32(false, Crc32.NormalPoly); var crc = ~crcObj.CalcCrc32(data, 0, data.Length - 4); if (checksum != crc) { throw new FileLoadException("Invalid CRC32 in " + path); } int recordSize = BitConverter.ToInt32(data, 4); int recordCount = BitConverter.ToInt32(data, 8); // 12 bytes header, then a "next/prev" table, then the service records, then a CRC32 // the "next/prev" table is a ring-list, every entry consists of 2 ushorts with the next and previous channel, wrapping around on the ends if (data.Length != 12 + recordCount * 4 + recordCount * recordSize + 4) { throw new FileLoadException("Unsupported file content: " + path); } this.dataFilePaths.Add(path); var dvbStringDecoder = new DvbStringDecoder(this.DefaultEncoding); var mapping = new DataMapping(this.ini.GetSection("service.dat_entry")); mapping.SetDataPtr(data, 12 + recordCount * 4); for (int i = 0; i < recordCount; i++, mapping.BaseOffset += recordSize) { var ch = LoadDvbsChannel(list, mapping, i, dvbStringDecoder); this.DataRoot.AddChannel(list, ch); } }
/// <summary> /// Permet d'exporter le GridView en CSV /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BT_Export_CSV_Click(object sender, EventArgs e) { List <DataTable> liste = new List <DataTable>(); DataSet ds = DataMapping.ExecSql("SELECT nim as NIM, section as Section, surname as Nom, name as Prenom, job as Poste, cric as Cric, club as 'Nom du club', [description] as 'Description' FROM " + Const.TABLE_PREFIX + "drya WHERE rotary_year = '" + rbl_rotaryYear.SelectedValue + "' order by section, rank"); liste.Add(ds.Tables[0]); Media media = DataMapping.ExportDataTablesToXLS(liste, "Organigramme District " + rbl_rotaryYear.SelectedValue + "-" + (1 + int.Parse(rbl_rotaryYear.SelectedValue)) + ".csv", Aspose.Cells.SaveFormat.CSV); List <DataTable> liste2 = new List <DataTable>(); DataSet dsCom = DataMapping.ExecSql("SELECT name as 'Nom de la commission', memberName as Membre, job as 'Poste' FROM " + Const.TABLE_PREFIX + "commission where rotary_year ='" + rbl_rotaryYear.SelectedValue + "' order by name"); dsCom.Tables[0].TableName = "Commissions"; liste2.Add(dsCom.Tables[0]); Media media2 = DataMapping.ExportDataTablesToXLS(liste2, "Commission " + rbl_rotaryYear.SelectedValue + "-" + (1 + int.Parse(rbl_rotaryYear.SelectedValue)) + ".csv", Aspose.Cells.SaveFormat.CSV); Media media3 = new Media(); media3.content_size = media.content_size + media2.content_size; media3.content = new byte[media3.content_size]; for (int i = 0; i < media3.content_size; i++) { if (i < media.content_size) { media3.content[i] = media.content[i]; } else { media3.content[i] = media2.content[i - media.content_size]; } } media3.dt = media.dt; media3.name = media.name; string guid = Guid.NewGuid().ToString(); Session[guid] = media3; Response.Redirect(Const.MEDIA_DOWNLOAD_URL + "?id=" + guid); }
protected void BT_Supprimer_Click(object sender, EventArgs e) { if (!DataMapping.DeleteNews(HF_id.Value)) { return; } if (HF_Photo.Value != "") { try { if (Functions.CurrentCric == 0) { File.Delete(Server.MapPath(PortalSettings.HomeDirectory + Const.DISTRICT_PREFIX + Const.IMG_PREFIX + HF_Photo.Value)); } else { File.Delete(Server.MapPath(PortalSettings.HomeDirectory + Const.CLUBS_PREFIX + Functions.CurrentClub.name.Replace(" ", "-").Replace("'", "-").ToLower() + "/" + Const.IMG_PREFIX + HF_Photo.Value)); } } catch (Exception ee) { Functions.Error(ee); } } if (HL_Url.Text != "") { try { if (Functions.CurrentCric == 0) { File.Delete(Server.MapPath(PortalSettings.HomeDirectory + Const.DISTRICT_PREFIX + Const.DOCUMENT_PREFIX + HL_Url.Text)); } else { File.Delete(Server.MapPath(PortalSettings.HomeDirectory + Const.CLUBS_PREFIX + Functions.CurrentClub.name.Replace(" ", "-").Replace("'", "-").ToLower() + "/" + Const.DOCUMENT_PREFIX + HL_Url.Text)); } } catch (Exception ee) { Functions.Error(ee); } } RefreshGrid(); pnl_grid.Visible = true; pnl_form.Visible = false; }
public DigitalChannel(int slot, SignalSource signalSource, DataMapping data, DataRoot dataRoot, IDictionary <int, decimal> transpFreq, FavoritesIndexMode sortedFavorites, IDictionary <int, string> providerNames) : base(data, sortedFavorites) { this.InitCommonData(slot, signalSource & ~SignalSource.MaskTvRadioData, data); if (!this.InUse) { return; } // "InUse" and "IsDeleted" are not always guessed correctly. If PrNr=0, the channel contains garbage if (this.OldProgramNr == 0) { this.InUse = false; return; } this.InitDvbData(data, providerNames); decimal freq = 0; int transp = data.GetByte(_ChannelOrTransponder); if (dataRoot.Transponder.TryGetValue(transp, out var tp)) { this.Polarity = tp.Polarity; } freq = transpFreq.TryGet(transp); if (freq == 0 && tp != null) { freq = tp.FrequencyInMhz; } if (freq == 0) { if ((this.SignalSource & SignalSource.Antenna) != 0) { freq = transp * 8 + 306; } else if ((this.SignalSource & SignalSource.Cable) != 0) { freq = transp * 8 + 106; } } this.ChannelOrTransponder = transp.ToString(); this.FreqInMhz = freq; }
/// <summary> /// Get All Possible Characters Combination /// </summary> /// <param name="number"></param> /// <returns></returns> public string GetAllCombinations(int number) { try { var stringFromNumber = DataMapping.GetCharactersByNumber(number); //Convert the string into a character array var charArray = stringFromNumber.ToCharArray(); CreateCombination(charArray, 0, charArray.Length - 1); return(_stringResult.ToString()); } catch (Exception exception) { return(exception.Message); } }
/// <summary> /// Cherche l'ID de l'enfant d'un domaine /// </summary> /// <param name="dom">Domain parent</param> /// <returns>ID du domaine enfant</returns> public int idEnfant(Domain dom) { if (!enfantOuParent(dom, "enfant")) { throw new Exception("Pas d'enfants"); } List <Domain> listeDom = DataMapping.GetListDomain(dom.domain, ""); for (int i = 0; i < listeDom.Count; i++) {// On parcourt la liste de domaines. Dès qu'on trouve l'ID de l'enfant, on s'arrête et on la retourne if (listeDom[i].parent == dom.id) { return(listeDom[i].id); } } throw new Exception("ID introuvable"); }
private void SaveDvbCTChannels(ChannelList list, string path) { if (!ReadAndValidateChannellibFile(path, out var data, out var recordSize, out _)) { return; } int baseOffset; DataMapping mapping; if (chanLstBin.VersionMajor <= 11) { mapping = new DataMapping(this.ini.GetSection("CableDigSrvTable_entry")); baseOffset = 20; } else { mapping = new DataMapping(this.ini.GetSection("Map45_CableDb.bin_entry")); baseOffset = 12; } mapping.SetDataPtr(data, baseOffset); foreach (var ch in list.Channels) { if (ch.IsProxy) { continue; } mapping.BaseOffset = baseOffset + (int)ch.RecordIndex * recordSize; mapping.SetWord("offProgNr", ch.NewProgramNr); mapping.SetByte("offLocked", ch.Lock ? 1 : 0); mapping.SetByte("offIsFav", ch.Favorites == 0 ? 0 : 1); if (chanLstBin.VersionMajor <= 11) { mapping.SetDword("offChecksum", 0); var crc = FaultyCrc32(data, mapping.BaseOffset, recordSize); mapping.SetDword("offChecksum", crc); } else if (chanLstBin.VersionMajor >= 25 && chanLstBin.VersionMajor <= 45) { mapping.SetWord("offServiceEdit", 1); } } File.WriteAllBytes(path, data); }
protected void InitCommonData(int slot, SignalSource signalSource, DataMapping data) { this.RecordIndex = slot; var nr = data.GetWord(_ProgramNr); this.SignalSource = signalSource | ((nr & 0x4000) == 0 ? SignalSource.Tv : SignalSource.Radio); this.OldProgramNr = (nr & 0x3FFF); this.ParseNames(); this.Favorites = (Favorites)((data.GetByte(_Favorites2) & 0x3C) >> 2); this.Lock = data.GetFlag(_Lock); this.Skip = data.GetFlag(_Skip); this.Hidden = data.GetFlag(_Hide); this.Encrypted = data.GetFlag(_Encrypted); this.IsDeleted = data.GetFlag(_Deleted); }
protected void InitCommonData(int slot, SignalSource signalSource, DataMapping data) { this.InUse = data.GetFlag(_InUse, true); this.RecordIndex = slot; this.RecordOrder = slot; this.SignalSource = signalSource; this.OldProgramNr = (short)data.GetWord(_ProgramNr); this.Name = data.GetString(_Name, data.Settings.GetInt("lenName")); this.Favorites = this.ParseRawFavorites(); this.Lock = data.GetFlag(_Lock); this.Encrypted = data.GetFlag(_Encrypted); this.IsDeleted = data.GetFlag(_Deleted, false) || !data.GetFlag(_IsActive, true); if (this.IsDeleted) { this.OldProgramNr = -1; } }
public string ListeNews(int cric, string categorie, string tags_inclus, string tags_excluded, string top, string tri, int index, int max, bool onlyvisible, string date, string device, string version, string fonction) { DateTime dt = DateTime.Now; string comment = ""; string code = "ok"; List <News> lm = new List <News>(); List <Nouvelle> ln = new List <Nouvelle>(); try { lm = AIS.DataMapping.ListNewsMobile(cric, categorie, tags_inclus, tags_excluded, top, tri, index, max, onlyvisible, date); //envoyerTest(fonction); foreach (News m in lm) { m.photo = HttpContext.Current.Server.MapPath(m.GetPhoto()); //m.url = HttpContext.Current.Server.MapPath(m.GetUrl()); m.PhotoString64 = GetPhotoNew(m.photo, device, version, fonction); string url = "" + m.GetUrl(); if (!string.IsNullOrEmpty(url)) { m.url = GetBaseUrl() + HttpContext.Current.Server.UrlPathEncode(m.GetUrl()); //m.url = HttpContext.Current.Request.Url.Scheme + "://" + HttpContext.Current.Request.Url.Authority + HttpContext.Current.Server.UrlPathEncode(m.GetUrl()); } m.urlNews = GetBaseUrl() + urlNews + "?newsid=" + m.id + "&cric=" + m.cric; } foreach (News m in lm) { ln.Add(newsToNouvelle(m)); } } catch (Exception ee) { code = "erreur"; comment = ee.ToString(); Functions.Error(ee); } string output = JsonConvert.SerializeObject(ln, Formatting.Indented); DataMapping.InsertLogWS(os, device, version, getIP(), dt, getDuree(dt), fonction, code, comment, ""); return(output); }
/// <summary> /// Cherche l'ID de l'enfant d'un domaine /// </summary> /// <param name="dom">Domain parent</param> /// <returns>ID du domaine enfant</returns> public int idEnfant(Domain dom) { if (!aUnEnfant(dom)) //On vérifie que le domaine a bien un enfant { throw new Exception("Pas d'enfants"); } List <Domain> listeDom = DataMapping.GetListDomain(dom.domain, ""); for (int i = 0; i < listeDom.Count; i++) {//On parcourt la liste jusqu'à trouver l'ID de l'enfant if (listeDom[i].parent == dom.id) { return(listeDom[i].id); } } throw new Exception("ID introuvable"); }
protected void Page_Load(object sender, EventArgs e) { if (IsPostBack) { return; } List <Club> clubs = DataMapping.ListClubs(sort: tri.Value + " " + sens.Value); RB_Dept.Items.Clear(); var counts = from c in clubs orderby c.zip group c by c.zip.Substring(0, 2).Replace("04", "06") into g select new { Cp = g.Key, Count = g.Count() }; RB_Dept.Items.Add(new ListItem("Tous (" + clubs.Count + ")", "") { Selected = true }); foreach (var o in counts) { switch (o.Cp) { case "06": RB_Dept.Items.Add(new ListItem("Alpes-Maritimes (" + o.Count + ")", o.Cp)); break; case "20": RB_Dept.Items.Add(new ListItem("Corse (" + o.Count + ")", o.Cp)); break; case "83": RB_Dept.Items.Add(new ListItem("Var (" + o.Count + ")", o.Cp)); break; case "98": RB_Dept.Items.Add(new ListItem("Monaco (" + o.Count + ")", o.Cp)); break; } } GridView1.DataSource = clubs; GridView1.DataBind(); }
public void RefreshGrid() { List <Member> membres = DataMapping.GetListRotaryImport(""); string dateMaj = "" + membres[0].base_dtupdate; string [] splits = dateMaj.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries); lbl_derniereMaj.Text = splits[0]; membres = DataMapping.GetListRotaryImport("", gvw_importRotarien.PageIndex, gvw_importRotarien.PageSize); if (tbx_filtre.Text != "") { membres = DataMapping.GetListRotaryImport("nim like '" + tbx_filtre.Text + "' OR surname like '%" + tbx_filtre.Text + "%' OR name like '%" + tbx_filtre.Text + "%'"); } gvw_importRotarien.DataSource = membres; gvw_importRotarien.DataBind(); }
public void TestWord() { DataMapping mapping = new DataMapping(); byte[] data = new byte[12]; for (ushort i = ushort.MinValue; i < ushort.MaxValue; i++) { Array.Clear(data, 0, 12); mapping.Data = data; mapping.SetWord(0, i); Assert.AreEqual(i, mapping.GetWord(0)); } Array.Clear(data, 0, 12); mapping.Data = data; mapping.SetWord(0, ushort.MaxValue); Assert.AreEqual(ushort.MaxValue, mapping.GetWord(0)); }
public void TestByte() { DataMapping mapping = new DataMapping(); byte[] data = new byte[12]; for (byte i = byte.MinValue; i < byte.MaxValue; i++) { Array.Clear(data, 0, 12); mapping.Data = data; mapping.SetByte(0, i); Assert.AreEqual(i, mapping.GetByte(0)); } Array.Clear(data, 0, 12); mapping.Data = data; mapping.SetByte(0, byte.MaxValue); Assert.AreEqual(byte.MaxValue, mapping.GetByte(0)); }
protected void gvw_com_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "GEdit") { Commission com = DataMapping.GetListCommission("id = '" + e.CommandArgument + "'").FirstOrDefault(); tbx_job.Text = com.job; tbx_membre.Text = com.memberName; btn_validate.CommandArgument = com.name; pnl_add.Visible = true; hfd_id.Value = "" + com.id; Panel1.Visible = false; } else if (e.CommandName == "GDelete") { DataMapping.DeleteCommission(int.Parse("" + e.CommandArgument)); Response.Redirect(Globals.NavigateURL()); } }
public async Task <IActionResult> Delete(int id) { var survey = await _surveyStore.GetSurveyAsync(id); if (survey == null) { return(NotFound()); } // Validate that the current user has Delete permissions to this survey. if (!await _authorizationService.AuthorizeAsync(User, survey, Operations.Delete)) { return(new StatusCodeResult((int)HttpStatusCode.Forbidden)); } await _surveyStore.DeleteSurveyAsync(survey); return(new ObjectResult(DataMapping._surveyToDto(survey))); }
/* * offFavorites2 = 134 * offAudioPid2 = 182 */ public DtvChannel(int slot, DataMapping data) : base(data) { var signalSource = SignalSource.Digital; signalSource |= data.GetByte(_SignalSource) == 1 ? SignalSource.Antenna : SignalSource.Cable; this.InitCommonData(slot, signalSource, data); this.InitDvbData(data); int channel = data.GetByte(_ChannelOrTransponder); this.ChannelOrTransponder = channel.ToString("d2"); // ReSharper disable PossibleLossOfFraction this.FreqInMhz = (data.GetDword(_FrequencyLong) + 10) / 1000; // ReSharper restore PossibleLossOfFraction if (this.FreqInMhz == 0) { this.FreqInMhz = LookupData.Instance.GetDvbtFrequency(channel); } }
public async Task <IActionResult> Delete(int id) { var survey = await _surveyStore.GetSurveyAsync(id); if (survey == null) { return(NotFound()); } // Validate that the current user has Delete permissions to this survey. if (!(await _authorizationService.AuthorizeAsync(User, survey, Operations.Delete)).Succeeded) { return(StatusCode(403)); } await _surveyStore.DeleteSurveyAsync(survey); return(Ok(DataMapping._surveyToDto(survey))); }
/// <summary> /// Permet de valider les modifications des AAR /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void BT_Valider_Click(object sender, EventArgs e) { if (!(UserInfo.IsSuperUser || UserInfo.IsInRole(Const.ADMIN_ROLE) || UserInfo.IsInRole(Const.ROLE_ADMIN_CLUB) || UserInfo.IsInRole(Const.ROLE_ADMIN_DISTRICT) || DataMapping.isADG(Functions.GetCurrentMember().id))) { return; } int cric = Functions.CurrentCric; List <Affectation> affectations = new List <Affectation>(); foreach (Control row in Panel1.Controls) { if (row is DropDownList) { DropDownList dl = row as DropDownList; string[] ids = dl.ID.Split(new char[] { '_' }, StringSplitOptions.RemoveEmptyEntries); Affectation affectation = new Affectation(); affectation.cric = cric; affectation.function = ids[ids.Length - 1]; int nim = 0; int.TryParse("" + dl.SelectedValue, out nim); affectation.nim = nim; affectation.name = dl.SelectedIndex > 0 ? dl.Items[dl.SelectedIndex].Text : ""; if (affectation.name != "") { affectations.Add(affectation); } } } if (DataMapping.UpdateAffectationRY(cric, int.Parse(RB_AR.SelectedValue), affectations)) { Club c = AIS.DataMapping.GetClub(cric); string subject = "[Rotary 1730] Information"; string body = "Le bureau du club " + c.name + " vient d'être modifié pour l'année " + RB_AR.SelectedValue + "."; AIS.Functions.SendMail("*****@*****.**", subject, body); AIS.Functions.SendMail("*****@*****.**", subject, body); } }
private void assignButton_Click(object sender, EventArgs e) { //Check if there is a selected base window to work on if (designerForm.CurrentBaseWindow != null) { //check if it is Form Pattern if (designerForm.CurrentBaseWindow.TypeOfWindow.Equals(FormDesignerConstants.FormPattern)) { //check if there is selected control on the form if (designerForm.CurrentBaseWindow.CurrentControl != null && designerForm.currentBaseWindow.CurrentControl.Count == 1) { //Assign to this control the selected data node TreeNode treeNode = this.treeView1.SelectedNode; int nodeLevel = NodeLevel(treeNode); if (!(nodeLevel == 0)) { if (nodeLevel == 1) { MessageBox.Show("Incorrect Assignment", "Warning -Assignment"); //designerForm.CurrentBaseWindow.CurrentControl.DataPatternName = treeNode.Text; } else if (nodeLevel == 2) { /*designerForm.CurrentBaseWindow.CurrentControl[0].DataTableName = treeNode.Text; * designerForm.CurrentBaseWindow.CurrentControl[0].DataPatternName = treeNode.Parent.Text;*/ } else if (nodeLevel == 3) { /*designerForm.CurrentBaseWindow.CurrentControl[0].DataFieldName = treeNode.Text; * designerForm.CurrentBaseWindow.CurrentControl[0].DataTableName = treeNode.Parent.Text; * designerForm.CurrentBaseWindow.CurrentControl[0].DataPatternName = treeNode.Parent.Parent.Text;*/ if (designerForm.currentBaseWindow.CurrentControl[0].DataMappings == null) { designerForm.currentBaseWindow.CurrentControl[0].DataMappings = new System.Collections.Generic.List <DataMapping>(); } DataMapping dataMapping = new DataMapping(treeNode.Parent.Parent.Text, treeNode.Parent.Text, treeNode.Text); designerForm.currentBaseWindow.CurrentControl[0].DataMappings.Add(dataMapping); } } } } } }
protected void Page_Load(object sender, EventArgs e) { try { string id = "" + Request.QueryString["id"]; if (id == "") { throw new Exception("La commande est introuvable sans parametre id (querystring : " + Request.QueryString + ")"); } Order commande = DataMapping.GetOrderByGuid(id); if (commande == null) { throw new Exception("La commande " + id + " est introuvable"); } Payment reglement = DataMapping.GetPayment(commande.id_payment); if (reglement == null) { throw new Exception("Le reglement " + commande.id_payment + " de la commande " + id + " est introuvable"); } Club club = DataMapping.GetClub(commande.cric); if (club == null) { throw new Exception("Le club " + commande.club + " est introuvable"); } HF_id.Value = "" + commande.guid; TXT_id.Text = "" + commande.id; TXT_dt.Text = "" + commande.dt.ToString("dd/MM/yyyy"); TXT_montant.Text = commande.amount + " €"; TXT_club.Text = club.name; HL_Detail.NavigateUrl = Functions.UrlAddParam(Const.ORDER_VIEW_URL, "id", commande.guid); } catch (Exception ee) { Functions.Error(ee); } }
public async Task <IActionResult> UnPublish(int id) { var survey = await _surveyStore.GetSurveyAsync(id); if (survey == null) { return(HttpNotFound()); } // Validate that the current user has UnPublish permissions to this survey. if (!await _authorizationService.AuthorizeAsync(User, survey, Operations.UnPublish)) { return(new HttpStatusCodeResult((int)HttpStatusCode.Forbidden)); } var unpublished = await _surveyStore.UnPublishSurveyAsync(id); return(new ObjectResult(DataMapping._surveyToDto(unpublished))); }
public async Task <IActionResult> Publish(int id) { var survey = await _surveyStore.GetSurveyAsync(id); if (survey == null) { return(NotFound()); } // Validate that the current user has Publish permissions to this survey. if (!await _authorizationService.AuthorizeAsync(User, survey, Operations.Publish)) { return(StatusCode(403)); } var published = await _surveyStore.PublishSurveyAsync(id); return(Ok(DataMapping._surveyToDto(published))); }
private void AddMapping(DataMapping mapping) { var i = 0; while (i < _mappings.Count && (_mappings[i].Type.Level < mapping.Type.Level || ((_mappings[i].Property ?? _emptyProperty).ToString().CompareTo((mapping.Property ?? _emptyProperty).ToString()) < 0 && _mappings[i].Type == mapping.Type))) i++; if (i + 1 < _mappings.Count && (_mappings[i + 1].Property == mapping.Property || _mappings[i + 1].Property == null)) { _mappings[i + 1] = mapping; } else { _mappings.Insert(i, mapping); } }
/// <summary> /// データの出力先情報を指定 /// </summary> /// <param name="propName"></param> /// <param name="rowOffset"></param> /// <param name="colOffset"></param> public void SetMapping(string propName, int rowOffset, int colOffset) { // TODO UnitRowはここで自動設定しても良い(後で) // TODO DataMapping map = new DataMapping(); map.propertyName = propName; map.rowOffset = rowOffset; map.colOffset = colOffset; mappingMap.Add(propName, map); }
private void btnAdd_Click(object sender, EventArgs e) { try { var property = cboProperties.SelectedItem as Property; var mappedType = cboItemTypes.SelectedItem as MappedType; if (mappedType == null) { var itemType = cboItemTypes.SelectedItem as ItemType; if (itemType != null) { mappedType = new MappedType(itemType) { Level = 1 }; } } if (mappedType != null && property != null && (property == _emptyProperty || !string.IsNullOrEmpty(txtValue.Text))) { if (mappedType.Level == 0) { mappedType.Level = 1; foreach (var m in _mappings) { m.Type.Level++; } } var mapping = new DataMapping() { IsCalculated = chkCalculated.Checked, Type = mappedType, Property = (property == _emptyProperty ? null : property), Value = txtValue.Text }; if (!_mappings.Any(m => m.Type == mappedType)) { cboItemTypes.DataSource = GetItemTypeList(mappedType); cboItemTypes.SelectedItem = mapping.Type; } AddMapping(mapping); ResetMapping(); xsltEditor.Text = BuildXslt(); } } catch (Exception ex) { Utils.HandleError(ex); } }
public void Serialize(DataMapping mapping) { }
private static void SetDataMappingValue(IEIBControl control, XmlNode xmlNode) { XmlNode xmlChildNode = xmlNode.SelectSingleNode(XMLServicesConstants.xmlDataMappings); if (xmlChildNode != null) { foreach (XmlNode childXmlNode in xmlChildNode.ChildNodes) { if (childXmlNode.NodeType == XmlNodeType.Element) { if (childXmlNode.Name == XMLServicesConstants.xmlMappings) { int attributeCount = childXmlNode.Attributes.Count; if (attributeCount > 0) { string dataFieldName="", dataTableName="", dataPatternName=""; XmlAttribute dataFieldAtt = childXmlNode.Attributes[XMLServicesConstants.XmlNodeDataFieldAtt]; if (dataFieldAtt != null) { dataFieldName = dataFieldAtt.Value; } XmlAttribute dataPatternAtt = childXmlNode.Attributes[XMLServicesConstants.XmlNodeDataPatternAtt]; if (dataPatternAtt != null) { dataPatternName = dataPatternAtt.Value; } XmlAttribute dataTableAtt = childXmlNode.Attributes[XMLServicesConstants.XmlNodeDataTableAtt]; if (dataTableAtt != null) { dataTableName = dataTableAtt.Value; } DataMapping dataMapping = new DataMapping(dataPatternName, dataTableName, dataFieldName); if (control.DataMappings == null) { control.DataMappings = new List<DataMapping>(); } control.DataMappings.Add(dataMapping); } } } } } }
private void assignButton_Click(object sender, EventArgs e) { //Check if there is a selected base window to work on if (designerForm.CurrentBaseWindow != null) { //check if it is Form Pattern if (designerForm.CurrentBaseWindow.TypeOfWindow.Equals(FormDesignerConstants.FormPattern)) { //check if there is selected control on the form if (designerForm.CurrentBaseWindow.CurrentControl != null && designerForm.currentBaseWindow.CurrentControl.Count==1) { //Assign to this control the selected data node TreeNode treeNode = this.treeView1.SelectedNode; int nodeLevel = NodeLevel(treeNode); if (! (nodeLevel == 0)) { if (nodeLevel == 1) { MessageBox.Show("Incorrect Assignment","Warning -Assignment"); //designerForm.CurrentBaseWindow.CurrentControl.DataPatternName = treeNode.Text; } else if (nodeLevel == 2) { /*designerForm.CurrentBaseWindow.CurrentControl[0].DataTableName = treeNode.Text; designerForm.CurrentBaseWindow.CurrentControl[0].DataPatternName = treeNode.Parent.Text;*/ } else if (nodeLevel == 3) { /*designerForm.CurrentBaseWindow.CurrentControl[0].DataFieldName = treeNode.Text; designerForm.CurrentBaseWindow.CurrentControl[0].DataTableName = treeNode.Parent.Text; designerForm.CurrentBaseWindow.CurrentControl[0].DataPatternName = treeNode.Parent.Parent.Text;*/ if (designerForm.currentBaseWindow.CurrentControl[0].DataMappings == null) { designerForm.currentBaseWindow.CurrentControl[0].DataMappings = new System.Collections.Generic.List<DataMapping>(); } DataMapping dataMapping = new DataMapping(treeNode.Parent.Parent.Text, treeNode.Parent.Text, treeNode.Text); designerForm.currentBaseWindow.CurrentControl[0].DataMappings.Add(dataMapping); } } } } } }