예제 #1
0
 private void OnGridBeforeRowUpdate(object sender, Infragistics.Win.UltraWinGrid.CancelableRowEventArgs e)
 {
     //Event handler for data entry row updated
     try {
         //There is no selected row when updating- at a cell level
         string clid    = e.Row.Cells["CLID"].Value.ToString();
         string format  = e.Row.Cells["ExportFormat"].Value.ToString();
         string path    = e.Row.Cells["ExportPath"].Value.ToString();
         string key     = e.Row.Cells["CounterKey"].Value.ToString();
         string client  = e.Row.Cells["Client"].Value.ToString();
         string scanner = e.Row.Cells["Scanner"].Value.ToString();
         string userid  = e.Row.Cells["UserID"].Value.ToString();
         if (clid != "" && format != "" && path != "" && key != "" && client != "")
         {
             if (e.Row.IsAddRow)
             {
                 //Add new entry
                 bool created = EnterpriseFactory.CreateClient(clid, format, path, key, client, scanner, userid);
                 OnRefresh(this.btnRefresh, EventArgs.Empty);
             }
             else
             {
                 //Update existing
                 bool updated = EnterpriseFactory.UpdateClient(clid, format, path, key, client, scanner, userid);
                 OnRefresh(this.btnRefresh, EventArgs.Empty);
             }
         }
         else
         {
             e.Cancel = true;
         }
     }
     catch (Exception ex) { App.ReportError(ex); }
 }