Private void deletedEvdata () {INT DELETENUM = 0; // Delete a row or multi-line record, call DataGrid's ISSelected (i) function, if the function returns to true, indicating that the line is selected ArrayList Arrlist = New ArrayList (); For (int i = 0; i {if (DTG_BasicDataInFo.isisselected (i) == true) {f_wr_public.vo_devspec vo_wr_public.vo_devspec (); // Save the 11th column in the table is the device type The primary key, but not shown in the table. VO_DEVSPEC_DELETE.DEVSPECID = INT64.PARSE (DevSpec.Rows [i] [10] .tostring ()); arrlist.add (vo_devspec_delete); deletenum ;}}
IF (DELETENUM! = 0) {if ("Do you determine these data?" NEW f_wr_public.f_wr_public (); f_wr_public.vo_devspec [] arrvo_devspec_delete = new f_wr_public.vo_devspec [deletenum];
IEnumerator ienum = arrList.GetEnumerator (); int deleteIndex = 0; while (ienum.MoveNext ()) {arrVO_DevSpec_Delete [deleteIndex] = (F_WR_Public.VO_DevSpec) ienum.Current; arrVO_DevSpec_Delete [deleteIndex] .col = Int64.MaxValue; arrVO_DevSpec_Delete [ DeleteIndex] .devTypeId = int64.maxValue; arrvo_devspec_delete [deleteIndex] .num = int64.maxvalue; arrvo_devspec_delete [deleteIndex] .row = int64.maxvalue; deleteIndex ;}
f_WR_Public.removeDevSpec (arrVO_DevSpec_Delete); MessageBox.Show ( "deleted successfully!", "delete data", MessageBoxButtons.OK, MessageBoxIcon.Information);} else {return;}} else {MessageBox.Show ( "not selected to be deleted Data! "," Delete Data ", MessageBoxButtons.ok, MessageBoxicon.warning;
}
private void QueryDevSpec () {try {DevSpec.Clear (); F_WR_Public.F_WR_Public f_WR_Public = new F_WR_Public.F_WR_Public (); F_WR_Public.VO_DevSpec vo_DevSpec = new F_WR_Public.VO_DevSpec (); vo_DevSpec.col = Int64.MaxValue; vo_DevSpec.devSpecID = INT64.MAXVALUE; VO_DEVSPEC.DEVTYPEID = INT64.PARSE (CBO_DEVTYPE.SELECTEDVALUE.TOSTRING ()); VO_DEVSPEC.NUM = INT64.MAXVALUE; VO_DEVSPEC.ROW = Int64.MaxValue;
F_WR_PUBLIC.VO_DEVSPEC [] arrvo_devspec = f_wr_public.querydevspec (Vo_DEVSPEC);
if (arrVO_DevSpec = null!) {for (int i = 0; i {F_WR_Public.VO_DevSpec vo_DevSpec_Result = arrVO_DevSpec [i]; DataRow myRow; myRow = DevSpec.NewRow (); myRow [ "Device category"] = DIC_DevSpec [vo_DevSpec_Result .devTypeID] .displayMember.ToString (); myRow [ "Specifications type"] = vo_DevSpec_Result.specType; myRow [ "manufacturer"] = vo_DevSpec_Result.manufacturer; myRow [ "long"] = vo_DevSpec_Result @ long;. myRow [ "wide "] = vo_DevSpec_Result.width; myRow [" high "] = vo_DevSpec_Result.high; if (vo_DevSpec_Result.num = Int64.MaxValue!) {myRow [" number "] = vo_DevSpec_Result.num;} else myRow [" number "] = "" "; If (vo_devspec_result.row! = Int64.maxvalue) {Myrow [" line "] = VO_DEVSPEC_RESULT.ROW;} else myrow [" line "] =" "; if (vo_devspec_result.col! = Int64.maxvalue) { MYROW ["Columns"] = VO_DEVSPEC_RESULT.COL;} Else Myrow ["Column"] = "" ;; Myrow ["Arrangement"] = VO_DEVSPEC_RESULT.DISPOSTYPE; MyRow ["device model"] = VO_DEVSPEC_R Esult.devspecid;
DevSpec.Rows.Add (myRow);} DevSpec.AcceptChanges (); // Set the DataMember dtg_BasicDataInfo is DevSpec dtg_BasicDataInfo.DataMember = DevSpec.ToString (); dtg_BasicDataInfo.DataSource = dataSet1; DevTableStyle.MappingName = "DevSpec"; rowCounts = arrVO_DevSpec.Length;} else {rowCounts = 0;} dtg_BasicDataInfo.ReadOnly = true;} catch (Exception ee) {MessageBox.Show (ee.ToString (), "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);}} Private void savedevdata () {try {f_wr_public.f_wr_public f_wr_public = new f_wr_public.f_wr_public ();
// If the status of a row is Added, the data indicating that the line is new DataRow [] DataRowadd = DevSpec.select (Null, Null, DataViewstate.Added); int mcount = DATAROWADD.LENGTH; if (McOUNT! = 0) {F_WR_Public.VO_DevSpec [] arrVO_DevSpec_Add = new F_WR_Public.VO_DevSpec [mCount]; for (int i = 0; i {F_WR_Public.VO_DevSpec vo_DevSpec = new F_WR_Public.VO_DevSpec ();
Vo_devspec.col = int64.maxvalue; vo_devspec.num = int64.MaxValue; vo_devspec.row = int64.maxvalue;
vo_DevSpec.devTypeID = Int64.Parse (cbo_DevType.SelectedValue.ToString ()); vo_DevSpec.specType = dataRowAdd [i] [1] .ToString (); vo_DevSpec.manufacturer = dataRowAdd [i] [2] .ToString (); vo_DevSpec . @ long = DATAROWADD [I] [3] .tostring (); vo_devspec.width = DATAROWADD [i] [4] .tostring (); vo_devspec.high = DATAROWADD [i] [5] .tostring (); if ( DataRowadd [i] [6] .tostring (). Equals (")) {vo_devspec.num = int64.parse (DataRowadd [i] [6] .tostring ());} if (!! DataRowadd [i] [ 7] .tostring (). Equals (")) {vo_devspec.row = int64.parse (DataRowadd [i] [7] .tostring ());} if (! DataRowAdd [i] [8] .tostring () .Equals (")) {vo_devspec.col = int64.parse (DataRowadd [i] [8] .tostring ());} vo_devspec.disposeType = DATAROWADD [i] [9] .tostring (); vo_devspec.devspecid = Int64.MaxValue; arrVO_DevSpec_Add [i] = vo_DevSpec;} f_WR_Public.addDevSpec (arrVO_DevSpec_Add); MessageBox.Show ( "increase the success!", "to increase the data", MessageBoxButtons.OK, MessageBoxIcon. Information;
// If the status of a row is ModifiedCurrent, the data representing the line to be modified DataRow [] dataRowModify = DevSpec.Select (null, null, DataViewRowState.ModifiedCurrent); int intDataRowModify = dataRowModify.Length;! If (intDataRowModify = 0 ) {F_WR_Public.VO_DevSpec [] arrVO_DevSpec_Modify = new F_WR_Public.VO_DevSpec [intDataRowModify]; for (int i = 0; i {F_WR_Public.VO_DevSpec vo_DevSpec = new F_WR_Public.VO_DevSpec (); // table 11 stored in the first device type The primary key, but not shown in the table. Vo_devspec.devspecid = int64.parse (DataRowModify [i] [10] .tostring ()); // vo_devspec.col = int64.MaxValue; vo_devspec.num = int64.maxvalue; vo_devspec .row = Int64.MaxValue; vo_DevSpec.specType = dataRowModify [i] [1] .ToString (); vo_DevSpec.manufacturer = dataRowModify [i] [2] .ToString ();. vo_DevSpec @ long = dataRowModify [i] [3 ] .Tostring (); vo_devspec.width = DATAROWMODID1 [I] [4] .tostring (); vo_devspec.high = DATAROWMODIFY [i] [5] .tostring (); if (! DataRowModify [i] [6] .tostring (). Equals ("")) {vo_devspec.num = int64.parse (DATARO WMODIFY [I] [6] .tostring ());} if (! DATAROWMODIFY [I] [7] .tostring (). Equals (")) {vo_devspec.row = int64.parse (DataRowModify [i] [7 ] .Tostring ());} if (! DATAROWMODIFY [i] [8] .tostring (). Equals (")) {vo_devspec.col = int64.parse (DataRowModify [i] [8] .tostring ()) ;} Vo_devspec.disposeType = DATAROWMODIFY [I] [9] .tostring ();
arrVO_DevSpec_Modify [i] = vo_DevSpec;} f_WR_Public.modifyDevSpec (arrVO_DevSpec_Modify); MessageBox.Show ( "saved successfully!", "save data", MessageBoxButtons.OK, MessageBoxIcon.Information);} DevSpec.AcceptChanges ();} catch (Exception EE) {MessageBox.show (Ee.tostring (), "Error", MessageBoxButtons.ok, MessageBoxicon.information;}} private void queryifsavedevdata () {/ * This function querying whether there is unsaved data in the DEV table, if Yes, ask if it is saved, * If the user answers you need to save, call the SaveDevData process to save the data. If you reply, * then call the query process querydevspec refresh page * / DATAROW [] DataRowadd1 = devspec.select (Null, Null, DataViewstate. Added); int mAddCount1 = dataRowAdd1.Length; DataRow [] dataRowModify1 = DevSpec.Select (null, null, DataViewRowState.ModifiedCurrent); int mModifyCount1 = dataRowModify1.Length;!! if (mAddCount1 = 0 || mModifyCount1 = 0) {if (MessageBox.show ("Is there a edited data not saved, do you need to save?", "Prompt", messageboxbuttons.yesno, messageboxicon.question == DialogResult.yes Savedevdata (); else querydevspec ();}}