public static bool AjouterContactAPI(ContactEntity.User user, System.Collections.Specialized.IOrderedDictionary newValues) { ContactEntity.Contact c = new ContactEntity.Contact(); Template template = GestionContacts.GetTemplate(ApiContact.GetStringJSonTemplate(user)); c.setIdcontact(0); c.setIduser(template.getIduser()); c.setDtcreation(DateTime.Now); c.setFavoris(false); c.setActif(true); if (c != null) { List <ContactEntity.Donnee> donnees = SetListeDonnees(newValues); c.setIduser(user.getIduser()); c.setDtcreation(DateTime.Now); c.setFavoris(false); c.setActif(true); c.setDonnees(donnees); c.setIduser(user.getIduser()); ContactWrapper cw = new ContactWrapper(); cw.setContact(c); cw.setIdtemplate(template.getIdtemplate()); ApiContact.SetContact(cw); return(true); } return(false); }
public void ExtractValues(System.Collections.Specialized.IOrderedDictionary dictionary) { var conditionsJsonStr = conditions.Value; var expressionJsonStr = expression.Value; dictionary[ConditionsFieldName] = conditionsJsonStr; dictionary[ExpressionFieldName] = expressionJsonStr; if (RelexFieldName != null && !String.IsNullOrEmpty(conditionsJsonStr) && !String.IsNullOrEmpty(expressionJsonStr)) { var expressionData = JsHelper.FromJsonString <IDictionary <string, object> >(expressionJsonStr); var exprStr = Convert.ToString(expressionData["expression"]); if (String.IsNullOrEmpty(exprStr.Trim())) { dictionary[RelexFieldName] = "1=1"; } else { var fieldData = JsHelper.FromJsonString <IList <Dictionary <string, object> > >(fieldDescriptors.Value); var fieldTypeMapping = new Dictionary <string, string>(); var relexConditionMapping = new Dictionary <string, string>(); foreach (var fldData in fieldData) { fieldTypeMapping[Convert.ToString(fldData["name"])] = Convert.ToString(fldData["dataType"]); if (fldData.ContainsKey("relexcondition")) { relexConditionMapping[Convert.ToString(fldData["name"])] = Convert.ToString(fldData["relexcondition"]); } } dictionary[RelexFieldName] = QueryBuilderHelper.GenerateRelexFromQueryBuilder(JsHelper.FromJsonString <IList <IDictionary <string, object> > >(conditionsJsonStr), exprStr, fieldTypeMapping, relexConditionMapping); } } }
public void ExtractValues(System.Collections.Specialized.IOrderedDictionary dictionary) { if (RelationEditor == null) { dictionary[ID] = GetControlSelectedIds(); } }
// Correct null string values for updating and inserting private void CorrectNullValue(System.Collections.Specialized.IOrderedDictionary NewValues, string Name) { if (String.IsNullOrEmpty(NewValues[Name].ToString())) { NewValues[Name] = null; } }
public override void ExtractValuesFromCell(System.Collections.Specialized.IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly) { Object value = null; if (cell == null || dictionary == null) { return; } if (cell.Controls.Count > 0) { Int32 indexOfEditorList = (cell.Controls.Count == 2) ? 0 : 1; ListControl valueList = cell.Controls[indexOfEditorList] as ListControl; if (valueList != null) { value = valueList.SelectedValue; } } if (value != null || this.AllowNulls) { if (dictionary.Contains(this.DataField)) { dictionary[this.DataField] = value; } else { dictionary.Add(this.DataField, value); } } }
public override void ExtractValuesFromCell(System.Collections.Specialized.IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly) { if (String.IsNullOrEmpty(this.DataField)) { return; } if (cell == null || dictionary == null) { return; } Object value = null; if (cell.Controls.Count > 0) { ISelectorFieldControl selector = cell.Controls[0] as ISelectorFieldControl; if (selector != null) { value = selector.Selected; } } if (value != null) { if (dictionary.Contains(this.DataField)) { dictionary[this.DataField] = value; } else { dictionary.Add(this.DataField, value); } } }
public override void ExtractValuesFromCell(System.Collections.Specialized.IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly) { if (rowState == DataControlRowState.Normal) { } base.ExtractValuesFromCell(dictionary, cell, rowState, includeReadOnly); }
protected override void ExtractRowValues(System.Collections.Specialized.IOrderedDictionary fieldValues, bool includeReadOnlyFields, bool includeKeys) { base.ExtractRowValues(fieldValues, includeReadOnlyFields, includeKeys); if (ExtractRowValuesEvent != null) { ExtractRowValuesEvent(fieldValues, includeReadOnlyFields, includeKeys); } }
// Correct null string values for updating and inserting private void CorrectNullValues(System.Collections.Specialized.IOrderedDictionary NewValues) { CorrectNullValue(NewValues, "NODecPlaces"); CorrectNullValue(NewValues, "NOMinValue"); CorrectNullValue(NewValues, "NOMaxValue"); CorrectNullValue(NewValues, "Alias"); CorrectNullValue(NewValues, "Code"); }
protected override IEnumerable ExecuteSelect(DataSourceSelectArguments arguments) { int pageSize = Int32.MaxValue; if (arguments.MaximumRows > 0) { pageSize = arguments.MaximumRows; } int pageIndex = (arguments.StartRowIndex / pageSize); PageRequest request = null; if (!(String.IsNullOrEmpty(_owner.PageRequestParameterName))) { string r = HttpContext.Current.Request.Params[_owner.PageRequestParameterName]; if (!(String.IsNullOrEmpty(r))) { #pragma warning disable 0618 System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); #pragma warning restore 0618 request = serializer.Deserialize <PageRequest>(r); request.PageIndex = pageIndex; request.PageSize = pageSize; request.View = _owner.DataView; } } if (request == null) { request = new PageRequest(pageIndex, pageSize, arguments.SortExpression, null); List <string> filter = new List <string>(); System.Collections.Specialized.IOrderedDictionary filterValues = FilterParameters.GetValues(HttpContext.Current, _owner); foreach (Parameter p in FilterParameters) { if (filterValues[p.Name] != null) { string query = (p.Name + ":"); foreach (string s in Convert.ToString(filterValues[p.Name]).Split(',', ';')) { string q = Controller.ConvertSampleToQuery(s); if (!(String.IsNullOrEmpty(q))) { query = (query + q); } } filter.Add(query); } } request.Filter = filter.ToArray(); } request.RequiresMetaData = true; request.RequiresRowCount = arguments.RetrieveTotalRowCount; ViewPage page = ControllerFactory.CreateDataController().GetPage(_dataController, _dataView, request); if (arguments.RetrieveTotalRowCount) { arguments.TotalRowCount = page.TotalRowCount; } return(page.ToDataTable().DefaultView); }
/// <summary> /// Fills the specified <see cref="T:System.Collections.IDictionary"></see> object with the values from the specified <see cref="T:System.Web.UI.WebControls.TableCell"></see> object. /// </summary> /// <param name="dictionary">A <see cref="T:System.Collections.IDictionary"></see> used to store the values of the specified cell.</param> /// <param name="cell">The <see cref="T:System.Web.UI.WebControls.TableCell"></see> that contains the values to retrieve.</param> /// <param name="rowState">One of the <see cref="T:System.Web.UI.WebControls.DataControlRowState"></see> values.</param> /// <param name="includeReadOnly">true to include the values of read-only fields; otherwise, false.</param> public override void ExtractValuesFromCell(System.Collections.Specialized.IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly) { if (cell.HasControls() && cell.Controls[0] is EntityDropDownList) { EntityDropDownList eddl = (EntityDropDownList)cell.Controls[0]; dictionary[this.DataField] = String.IsNullOrEmpty(eddl.SelectedValue) ? null : eddl.SelectedValue; } }
protected void mfScoreCardDashboard_ExtractRowValues(System.Collections.Specialized.IOrderedDictionary fieldValues, bool includeReadOnlyFields, bool includeKeys) { string v = rcbMetricOrg.SelectedValue; if (!string.IsNullOrEmpty(v)) { Guid ScoreCardMetricID = new Guid(v); fieldValues.Add("ScoreCardMetricID", ScoreCardMetricID); } }
public void ExtractValues(System.Collections.Specialized.IOrderedDictionary dictionary) { if (Template is IBindableTemplate) { foreach (DictionaryEntry entry in ((IBindableTemplate)Template).ExtractValues(this)) { dictionary[entry.Key] = entry.Value; } } }
private void CorrectNullValues(System.Collections.Specialized.IOrderedDictionary NewValues) { CorrectNullValue(NewValues, "MinValue"); CorrectNullValue(NewValues, "MaxValue"); CorrectNullValue(NewValues, "BaselineValue"); CorrectNullValue(NewValues, "Breakpoint1Value"); CorrectNullValue(NewValues, "Breakpoint2Value"); CorrectNullValue(NewValues, "BaselineValueLabel"); CorrectNullValue(NewValues, "Breakpoint1ValueLabel"); CorrectNullValue(NewValues, "Breakpoint2ValueLabel"); }
private void UpdateUserGroup(System.Collections.Specialized.IOrderedDictionary v) { RadioButton rbUser = mfDataCollector.FindControl("rbUser") as RadioButton; if (rbUser.Checked) { v["GroupId"] = (Guid?)null; v["UserId"] = new Guid(ddlUser.SelectedValue); } else { v["UserId"] = (Guid?)null; v["GroupId"] = new Guid(ddlGroup.SelectedValue); } }
private static List <ContactEntity.Donnee> SetListeDonnees(System.Collections.Specialized.IOrderedDictionary newValues) { List <EvalEntity.Champ> listeChamp = dao.DaoChamp.GetChamps(); List <ContactEntity.Donnee> donnees = new List <ContactEntity.Donnee>(); int idChamp = 0; foreach (string key in newValues.Keys) { string valeur = newValues[key] as string; //recherche l'idChamp EvalEntity.Champ ch = null; if (key == "Prenom") { ch = listeChamp.Where(x => x.libelle == "Prénom").FirstOrDefault(); } else if (key == "DateNaissance") { try { ch = listeChamp.Where(x => x.libelle == "Date de naissance").FirstOrDefault(); DateTime d = DateTime.Parse(valeur); valeur = d.ToString("yyyy-MM-dd"); } catch { valeur = null; } } else { ch = listeChamp.Where(x => x.libelle == key).FirstOrDefault(); } if (ch != null) { idChamp = ch.idchamp; ContactEntity.Donnee d = new ContactEntity.Donnee(); d.setIdchamp(idChamp); d.setValeur(valeur); donnees.Add(d); } } return(donnees); }
protected void mfScoreCardMetric_ExtractRowValues(System.Collections.Specialized.IOrderedDictionary fieldValues, bool includeReadOnlyFields, bool includeKeys) { if (!string.IsNullOrEmpty(ddlMetric.SelectedValue)) { Guid MetricID = new Guid(ddlMetric.SelectedValue); fieldValues.Add("MetricID", MetricID); } string v = (orgLocationSelect.OrgLocationID == null)?null:orgLocationSelect.OrgLocationID.ToString(); Guid? OrgLocationID = null; try { OrgLocationID = new Guid(v); } catch { } if (OrgLocationID == Guid.Empty) { OrgLocationID = null; } fieldValues.Add("OrgLocationID", OrgLocationID); }
/// <summary> /// Validates that the keys in the update parameters all match property names on the entityWrapper. /// </summary> /// <param name="entityWrapper"></param> /// <param name="parameters"></param> internal static void ValidateWebControlParameterNames(EntityDataSourceWrapper entityWrapper, ParameterCollection parameters, EntityDataSource owner) { Debug.Assert(null != entityWrapper, "entityWrapper should not be null"); if (null != parameters) { PropertyDescriptorCollection entityProperties = entityWrapper.GetProperties(); System.Collections.Specialized.IOrderedDictionary parmVals = parameters.GetValues(owner.HttpContext, owner); foreach (DictionaryEntry de in parmVals) { string key = de.Key as string; if (null == key || null == entityProperties.Find(key, false)) { throw new InvalidOperationException(Strings.EntityDataSourceUtil_InsertUpdateParametersDontMatchPropertyNameOnEntity(key, entityWrapper.WrappedEntity.GetType().ToString())); } } } }
public static void SaveContactAPI(ContactEntity.User user, System.Collections.Specialized.IOrderedDictionary oldValues, System.Collections.Specialized.IOrderedDictionary newValues) { if (user == null) { return; } //charge la liste des contacts par l'API string strJson = ContactClasse.ApiContact.GetStringJSonContacts(user); List <ContactEntity.Contact> ListeContacts = ContactClasse.GestionContacts.GetContacts(strJson); List <EvalEntity.Champ> listeChamp = dao.DaoChamp.GetChamps(); int idcontact = 0; if (oldValues != null) { idcontact = Int32.Parse(oldValues["idcontact"] as string); } Template template = GestionContacts.GetTemplate(ApiContact.GetStringJSonTemplate(user)); if (template != null && ListeContacts != null) { ContactEntity.Contact c = ListeContacts.Where(x => x.getIdcontact() == idcontact).FirstOrDefault(); if (c != null) { List <ContactEntity.Donnee> donnees = SetListeDonnees(newValues); c.setIduser(user.getIduser()); c.setDtcreation(DateTime.Now); c.setFavoris(false); c.setActif(true); c.setDonnees(donnees); c.setIduser(user.getIduser()); ContactWrapper cw = new ContactWrapper(); cw.setContact(c); cw.setIdtemplate(template.getIdtemplate()); ApiContact.SetContact(cw); } } }
/// <summary> /// Returns the value set onto the Parameter named by propertyName. /// If the Paramter does not have a value, it returns null. /// </summary> /// <param name="propertyName"></param> /// <param name="parameterCollection"></param> /// <param name="entityDataSource"></param> /// <returns></returns> internal static object GetParameterValue(string propertyName, ParameterCollection parameterCollection, EntityDataSource entityDataSource) { if (null == parameterCollection) // ParameterCollection undefined { return(null); } System.Collections.Specialized.IOrderedDictionary values = parameterCollection.GetValues(entityDataSource.HttpContext, entityDataSource); foreach (object key in values.Keys) { string parameterName = key as string; if (null != parameterName && String.Equals(propertyName, parameterName, StringComparison.Ordinal)) { return(values[parameterName]); } } return(null); }
// ============================== #region MagicForm Actions private Bll.DataRule.Extend CreateRule(System.Collections.Specialized.IOrderedDictionary FormData) { Bll.DataRule.Extend rule = new MetricTrac.Bll.DataRule.Extend(); rule.DataRuleID = DataRuleID; rule.DataRuleOrgLocation = (Guid?[])FormData["DataRuleOrgLocation"]; rule.GroupCategoryAspectID = (Guid?)FormData["GroupCategoryAspectID"]; rule.DataRulePI = (Guid?[])FormData["DataRulePI"]; rule.DataRuleMetric = (Guid?[])FormData["DataRuleMetric"]; rule.Description = (string)FormData["Description"]; rule.DataRuleTypeID = DataRuleTypeID; RadioButton rbUser = mfDataCollector.FindControl("rbUser") as RadioButton; if (rbUser.Checked) { rule.GroupId = (Guid?)null; rule.UserId = new Guid(ddlUser.SelectedValue); } else { rule.UserId = (Guid?)null; rule.GroupId = new Guid(ddlGroup.SelectedValue); } return(rule); }
protected void mfScoreCardMetric_ExtractRowValues(System.Collections.Specialized.IOrderedDictionary fieldValues, bool includeReadOnlyFields, bool includeKeys) { if (rbMetric.Checked && !string.IsNullOrEmpty(ddlMetric.SelectedValue)) { Guid MetricID = new Guid(ddlMetric.SelectedValue); fieldValues.Add("MetricID", MetricID); } if (rbPI.Checked && cSelectPI.SelectedPIId != null) { fieldValues.Add("PerformanceIndicatorId", (Guid)cSelectPI.SelectedPIId); } string v = (orgLocationSelect.OrgLocationID == null)?null:orgLocationSelect.OrgLocationID.ToString(); Guid? OrgLocationID = null; try { OrgLocationID = new Guid(v); } catch { } if (OrgLocationID == Guid.Empty) { OrgLocationID = null; } fieldValues.Add("OrgLocationID", OrgLocationID); fieldValues["ScoreCardPeriodID"] = 1; fieldValues["InstanceId"] = MetricTrac.Bll.LinqMicajahDataContext.InstanceId; }
protected virtual new void ExtractRowValues(System.Collections.Specialized.IOrderedDictionary fieldValues, GridViewRow row, bool includeReadOnlyFields, bool includePrimaryKey) { }
public DataKey(System.Collections.Specialized.IOrderedDictionary keyTable) { }
protected override void ExtractValues(System.Collections.Specialized.IOrderedDictionary dictionary) { dictionary[Column.Name] = ConvertEditedValue(StrDate); }
protected void UpdateSearchResultSet(System.Collections.Specialized.IOrderedDictionary newValues) { Logging.Logger.Instance.Info(String.Format("Updating Result Set")); string connectionString = SPContext.Current.Site.RootWeb.Properties[SusDeb.DOI.Common.Utilities.eCaseConstants.PropertyBagKeys.ECASE_DB_CONNECTION_STRING]; long searchRowIdentity; using (SqlConnection conn = new SqlConnection(connectionString)) { Logging.Logger.Instance.Info(String.Format("Updating Saved Search Result Set. Opening database connection to: {0}", connectionString)); conn.Open(); using (System.Data.SqlClient.SqlTransaction trans = conn.BeginTransaction()) { //Insert the Saved Search Results Parent Entry using (SqlCommand updateCommand = new System.Data.SqlClient.SqlCommand()) { updateCommand.Connection = conn; updateCommand.Transaction = trans; updateCommand.CommandType = CommandType.StoredProcedure; updateCommand.CommandText = "CreateSavedSearchResult"; updateCommand.Parameters.AddWithValue("@Id", newValues["Id"]); updateCommand.Parameters.AddWithValue("@Name", newValues["Name"]); updateCommand.Parameters.AddWithValue("@Description", newValues["Description"]); updateCommand.Parameters.AddWithValue("@Query", newValues["OriginalQuery"]); updateCommand.Parameters.AddWithValue("@Owner", newValues["Owner"]); searchRowIdentity = (Int64)updateCommand.ExecuteScalar(); } using (System.Data.SqlClient.SqlDataAdapter permsAdapter = new System.Data.SqlClient.SqlDataAdapter()) { //for permissions, always remove all items and then add them back using (System.Data.SqlClient.SqlCommand permsDeleteCommand = new System.Data.SqlClient.SqlCommand()) { permsDeleteCommand.Connection = conn; permsDeleteCommand.Transaction = trans; permsDeleteCommand.CommandText = @"DELETE FROM SavedSearchResultPermissions WHERE SavedSearchResultsId = @SavedSearchResultsId "; permsDeleteCommand.Parameters.Add("@SavedSearchResultsId", System.Data.SqlDbType.BigInt); permsDeleteCommand.Parameters["@SavedSearchResultsId"].Value = searchRowIdentity; permsDeleteCommand.ExecuteNonQuery(); } using (System.Data.SqlClient.SqlCommand permsInsertCommand = new System.Data.SqlClient.SqlCommand()) { permsInsertCommand.Connection = conn; permsInsertCommand.Transaction = trans; permsInsertCommand.CommandText = @"INSERT INTO SavedSearchResultPermissions ( SavedSearchResultsId, PermissionName ) VALUES ( @SavedSearchResultsId, @PermissionName )"; permsInsertCommand.Parameters.Add("@SavedSearchResultsId", System.Data.SqlDbType.BigInt); permsInsertCommand.Parameters["@SavedSearchResultsId"].Value = searchRowIdentity; permsInsertCommand.Parameters.Add("@PermissionName", System.Data.SqlDbType.NVarChar, 100, "PermissionName"); string[] shareWithAccounts = newValues["ShareWith"].ToString().Split(','); foreach (string account in shareWithAccounts) { permsInsertCommand.Parameters["@PermissionName"].Value = account.ToString(); permsInsertCommand.ExecuteNonQuery(); } } } trans.Commit(); } } }
// Constructors public SqlDataSourceFilteringEventArgs(System.Collections.Specialized.IOrderedDictionary parameterValues) { }
public ObjectDataSourceMethodEventArgs(System.Collections.Specialized.IOrderedDictionary inputParameters) { }
protected virtual new void ExtractRowValues(System.Collections.Specialized.IOrderedDictionary fieldValues, bool includeReadOnlyFields, bool includeKeys) { }
// Methods public virtual void ExtractValuesFromCell(System.Collections.Specialized.IOrderedDictionary dictionary, DataControlFieldCell cell, DataControlRowState rowState, bool includeReadOnly) { }