Exemple #1
0
        protected void grdResource_NodeUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            AppComponent re = session.GetObjectByKey <AppComponent>(Guid.Parse(grdResource.FocusedNode[grdResource.KeyFieldName].ToString()));

            //AppComponent re = session.GetObjectByKey<AppComponent>(Guid.Parse(e.OldValues["AppComponentId"].ToString()));

            re.Code        = e.NewValues["Code"].ToString();
            re.Name        = e.NewValues["Name"].ToString();
            re.Description = e.NewValues["Description"] as string;

            if (e.NewValues["RowStatus"].ToString().Equals("Sử dụng") || e.NewValues["RowStatus"].ToString().Equals("1"))
            {
                re.RowStatus = Constant.ROWSTATUS_ACTIVE;
            }
            else
            {
                re.RowStatus = Constant.ROWSTATUS_INACTIVE;
            }

            re.Save();

            e.Cancel = true;
            grdResource.CancelEdit();

            grdResource.JSProperties.Add("cpRefresh", "true");
        }
Exemple #2
0
        protected void grdResource_NodeInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            AppComponent re = new AppComponent(session);

            re.Code                 = e.NewValues["Code"].ToString();
            re.Name                 = e.NewValues["Name"].ToString();
            re.Description          = e.NewValues["Description"] as string;
            re.RowCreationTimeStamp = DateTime.Now;
            re.RowStatus            = Constant.ROWSTATUS_ACTIVE;

            App aa = session.GetObjectByKey <App>(Guid.Parse(hdId.Get("id").ToString()));

            if (aa == null)
            {
                throw new Exception("Ứng dụng đã bị xóa hoặc không tồn tại !");
            }
            re.AppId = aa;

            if (e.NewValues[grdResource.ParentFieldName] != null)
            {
                re.ParentAppComponentId = session.GetObjectByKey <AppComponent>(Guid.Parse(e.NewValues[grdResource.ParentFieldName].ToString()));
            }

            re.Save();

            e.Cancel = true;
            grdResource.CancelEdit();
        }
Exemple #3
0
        protected void grdResource_NodeDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            AppComponent re = session.GetObjectByKey <AppComponent>(Guid.Parse(grdResource.FocusedNode[grdResource.KeyFieldName].ToString()));

            re.RowStatus = Constant.ROWSTATUS_DELETED;
            re.Save();

            e.Cancel = true;
            grdResource.DataBind();
        }
Exemple #4
0
        protected void grdResource_NodeInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            AppComponent re = new AppComponent(session);

            re.Code                 = e.NewValues["Code"].ToString();
            re.Name                 = e.NewValues["Name"].ToString();
            re.Description          = e.NewValues["Description"].ToString();
            re.RowCreationTimeStamp = DateTime.Now;
            re.RowStatus            = Constant.ROWSTATUS_ACTIVE;

            if (e.NewValues[grdResource.ParentFieldName] != null)
            {
                re.ParentAppComponentId = session.GetObjectByKey <AppComponent>(Guid.Parse(e.NewValues[grdResource.ParentFieldName].ToString()));
            }

            re.Save();

            e.Cancel = true;
            grdResource.CancelEdit();
        }