Exemplo n.º 1
0
        protected void gridEnterpriseLevel_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            var comp = new Componets();

            comp.ComponentId       = e.Keys["ComponentId"].ToString();
            comp.ComponentName     = e.NewValues["ComponentName"].ToString();
            comp.ComponentType     = e.NewValues["ComponentType"].ToString();
            comp.ComponentMode     = e.NewValues["ComponentMode"].ToString();
            comp.ComponentTest     = e.NewValues["ComponentTest"].ToString();
            comp.ComponentLocation = e.NewValues["ComponentLocation"].ToString();
            comp.StartDate         = e.NewValues["StartDate"].ToString();
            comp.EndDate           = (String)e.NewValues["EndDate"];
            comp.Notes             = e.NewValues["Notes"].ToString();
            comp.SerialNumber      = e.NewValues["SerialNumber"].ToString();

            rc_services.UpdateComponentDetails(comp);
            e.Cancel = true;
            gridEnterpriseLevel.CancelEdit();

            gridEnterpriseLevel.DataSource = rc_services.GetComponents();
            gridEnterpriseLevel.DataBind();

            gridProjectLevel.DataSource = rc_services.GetComponents();
            gridProjectLevel.DataBind();
        }
Exemplo n.º 2
0
    public string GetNextAvailableName()
    {
        int i = 0;

        while (Componets.Any(x => x.FieldName.Equals(string.Format("{0} {1}", DefaultComponentName, i))))
        {
            i++;
        }
        return(string.Format("{0} {1}", DefaultComponentName, i));
    }
Exemplo n.º 3
0
    //methods--------------------------------------------------------------------------------------------
    public void ValidateFieldName(EntryComponent component)
    {
        if (!Componets.Contains(component))
        {
            throw new ArgumentException("component does not belong to entry");
        }

        if (string.IsNullOrEmpty(component.FieldName))
        {
            throw new ArgumentNullException("field new name must not be null");
        }

        if (Componets.Any(x => x != component && x.FieldName.Equals(component.FieldName)))
        {
            component.FieldName = GetNextAvailableName();
        }
    }