private void PerformRowEdit() { try { NameValueCollection values = new NameValueCollection(); foreach (String str in HttpContext.Current.Request.Form.Keys) { if (str.NotEquals("oper")) { values[str] = HttpContext.Current.Request.Form[str]; } } GridRowEdit e = new GridRowEdit { RowData = values, RowKey = values["id"] }; String str3 = HttpContext.Current.Request.QueryString["parentRowID"]; if (str3.IsNotNullOrEmpty()) { e.ParentRowKey = str3; } HandleUpdate(e); } catch (Exception ex) { throw ex; } }
private void PerformEditByForce() { try { NameValueCollection values = new NameValueCollection(); foreach (String str in HttpContext.Current.Request.QueryString.Keys) { if (str.NotEquals("oper") && str.NotEquals("SessionVarName") && str.NotEquals("editbyforce") && str.NotEquals("jqGridID")) { values[str] = HttpContext.Current.Request.QueryString[str]; } } GridRowEdit e = new GridRowEdit { RowData = values, RowKey = values["id"] }; IEnumerable retrievedData = (IEnumerable)HttpContext.Current.Session[SessionVarName]; foreach (Object obj in retrievedData) { if (((BaseItem)obj).VID == e.RowKey.ToInt()) { foreach (String key in e.RowData.AllKeys) { if (key.Equals("id")) { continue; } PropertyInfo property = obj.GetType().GetProperty(key); if (property.IsNull()) { continue; } String format = String.Empty; Object[] attribs = property.GetCustomAttributes(typeof(CustomAttributes.FormatString), false); if ((attribs.Length > 0) && ((CustomAttributes.FormatString)attribs[0]).Format.IsNotNullOrEmpty()) { format = ((CustomAttributes.FormatString)attribs[0]).Format; } Object value = GetActualValueFromGridRow(property.PropertyType.ToString(), e.RowData[key], format); property.SetValue(obj, value, null); } return; } } } catch (Exception ex) { throw (ex); } }
private void HandleUpdate(GridRowEdit e) { try { IEnumerable retrievedData = (IEnumerable)HttpContext.Current.Session[SessionVarName]; foreach (Object obj in retrievedData) { if (((BaseItem)obj).VID == e.RowKey.ToInt()) { foreach (String key in e.RowData.AllKeys) { if (key.Equals("id")) { continue; } PropertyInfo property = obj.GetType().GetProperty(key); if (property.IsNull()) { continue; } String format = String.Empty; Object[] attribs = property.GetCustomAttributes(typeof(CustomAttributes.FormatString), false); if ((attribs.Length > 0) && ((CustomAttributes.FormatString)attribs[0]).Format.IsNotNullOrEmpty()) { format = ((CustomAttributes.FormatString)attribs[0]).Format; } Object value = GetActualValueFromGridRow(property.PropertyType.ToString(), e.RowData[key], format); property.SetValue(obj, value, null); } if (((BaseItem)obj).State == ItemState.Detached) { ((BaseItem)obj).SetAdded(); } return; } } } catch (Exception ex) { throw ex; } }
private void PerformEditByForce() { try { NameValueCollection values = new NameValueCollection(); foreach (String str in HttpContext.Current.Request.QueryString.Keys) { if (str.NotEquals("oper") && str.NotEquals("SessionVarName") && str.NotEquals("editbyforce") && str.NotEquals("jqGridID")) { values[str] = HttpContext.Current.Request.QueryString[str]; } } GridRowEdit e = new GridRowEdit { RowData = values, RowKey = values["id"] }; IEnumerable retrievedData = (IEnumerable)HttpContext.Current.Session[SessionVarName]; foreach (Object obj in retrievedData) { if (((BaseItem)obj).VID == e.RowKey.ToInt()) { foreach (String key in e.RowData.AllKeys) { if (key.Equals("id")) continue; PropertyInfo property = obj.GetType().GetProperty(key); if (property.IsNull()) continue; String format = String.Empty; Object[] attribs = property.GetCustomAttributes(typeof(CustomAttributes.FormatString), false); if ((attribs.Length > 0) && ((CustomAttributes.FormatString)attribs[0]).Format.IsNotNullOrEmpty()) { format = ((CustomAttributes.FormatString)attribs[0]).Format; } Object value = GetActualValueFromGridRow(property.PropertyType.ToString(), e.RowData[key], format); property.SetValue(obj, value, null); } return; } } } catch (Exception ex) { throw (ex); } }
private void HandleUpdate(GridRowEdit e) { try { IEnumerable retrievedData = (IEnumerable)HttpContext.Current.Session[SessionVarName]; foreach (Object obj in retrievedData) { if (((BaseItem)obj).VID == e.RowKey.ToInt()) { foreach (String key in e.RowData.AllKeys) { if (key.Equals("id")) continue; PropertyInfo property = obj.GetType().GetProperty(key); if (property.IsNull()) continue; String format = String.Empty; Object[] attribs = property.GetCustomAttributes(typeof(CustomAttributes.FormatString), false); if ((attribs.Length > 0) && ((CustomAttributes.FormatString)attribs[0]).Format.IsNotNullOrEmpty()) { format = ((CustomAttributes.FormatString)attribs[0]).Format; } Object value = GetActualValueFromGridRow(property.PropertyType.ToString(), e.RowData[key], format); property.SetValue(obj, value, null); } if (((BaseItem)obj).State == ItemState.Detached) ((BaseItem)obj).SetAdded(); return; } } } catch (Exception ex) { throw ex; } }