Exemple #1
0
 private void grdControl_RowCheckStateChanged(object sender, RowCheckStateChangeEventArgs e)
 {
     try
     {
         if (grdControl.CurrentRow.IsChecked)
         {
             LUserFormControl obj = new LUserFormControl();
             obj.UserName  = Utility.sDbnull(grdUser.GetValue("PK_sUID"));
             obj.ControlId = Utility.Int32Dbnull(grdControl.GetValue("Control_ID"));
             obj.IsNew     = true;
             obj.Save();
         }
         else
         {
             new Delete().From(LUserFormControl.Schema.Name).Where(LUserFormControl.Columns.UserName).
             IsEqualTo(grdUser.GetValue("PK_sUID")).And(LUserFormControl.Columns.ControlId).
             IsEqualTo(grdControl.GetValue("Control_ID")).Execute();
         }
     }
     catch (Exception ex)
     {
         Utility.ShowMsg(ex.Message);
     }
 }
 private void grdControl_RowCheckStateChanged(object sender, RowCheckStateChangeEventArgs e)
 {
     try
     {
         if (grdControl.CurrentRow.IsChecked)
         {
             LUserFormControl obj = new LUserFormControl();
             obj.UserName = Utility.sDbnull(grdUser.GetValue("PK_sUID"));
             obj.ControlId = Utility.Int32Dbnull(grdControl.GetValue("Control_ID"));
             obj.IsNew = true;
             obj.Save();
         }
         else
         {
             new Delete().From(LUserFormControl.Schema.Name).Where(LUserFormControl.Columns.UserName).
                 IsEqualTo(grdUser.GetValue("PK_sUID")).And(LUserFormControl.Columns.ControlId).
                 IsEqualTo(grdControl.GetValue("Control_ID")).Execute();
         }
     }
     catch (Exception ex)
     {
         Utility.ShowMsg(ex.Message);
     }
 }
        public void Update(string UserName,int ControlId)
        {
            LUserFormControl item = new LUserFormControl();
            item.MarkOld();
            item.IsLoaded = true;

            item.UserName = UserName;

            item.ControlId = ControlId;

            item.Save(UserName);
        }
        public void Insert(string UserName,int ControlId)
        {
            LUserFormControl item = new LUserFormControl();

            item.UserName = UserName;

            item.ControlId = ControlId;

            item.Save(UserName);
        }