private void frm_packsBackUp01_eventSaveToEdit() { frmPackM = new gatepass.ui.package.frm_GatePassesGatePlace(); //var frmPackM = new gatepass.ui.package.frm_packManage(); frmPackM.isNew = false; frmPackM.pmStatus = ItemsPublic.IndexStatus.toEdit; frmPackM.IndexPack = ( decimal? )MainRadGridView.CurrentRow.Cells ["package_Id"].Value; frmPackM.setItemsPack(ref radGridViewPacks); frmPackM.ShowDialog(); result = frmPackM.DialogResult == DialogResult.OK ? frmPackM.gotResult() : null; //if ( result.success ) //{ // MessageBox.Show ( "ok" ); //} }
private void frm_packsBackUp01_eventSaveToNew() { frmPackM = new gatepass.ui.package.frm_GatePassesGatePlace(); frmPackM.pmStatus = ItemsPublic.IndexStatus.toNew; frmPackM.IndexPack = null; frmPackM.isNew = true; // frmPackM. var frmAddPersons = new gatepass.ui.package.frm_SelectOrAddPersons4(); frmAddPersons.ShowDialog(); if (true || frmAddPersons.DialogResult == DialogResult.OK) { // frmAddPersons.ShowDialog(); if (frmAddPersons.State) { //MainRadGridView.DataSource=null; //MainRadGridView.SelectAll(); //frmPackM.MainRadGridView.AllowAddNewRow = true; frmPackM.IsnewRowAdded = true; //frmPackM.MainRadGridView.CurrentRow = null; //MainRadGridView.Rows.RemoveAt(0); //frmPackM.MainRadGridView.DataSource = null; //MainRadGridView.EndInit(); //MainRadGridView.EndUpdate(); // MainRadGridView.EndEdit(); //while (MainRadGridView.Rows.Count > 0) //{ // MainRadGridView.Rows.RemoveAt(0); //} for (int count = 0; count < frmAddPersons.radGridViewSelected.Rows.Count; count++) { #region set rows frmPackM.MainRadGridView.Rows.AddNew(); frmPackM.MainRadGridView.CurrentRow.Cells["Person_ID"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_ID"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_NationalCode"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_NationalCode"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_isWoman"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_isWoman"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_IdentifyCode"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_IdentifyCode"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_LicenseDriverCode"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_LicenseDriverCode"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_Name"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_Name"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_Surname"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_Surname"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_FatherName"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_FatherName"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_BirthCity"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_BirthCity"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_RegisterCity"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_RegisterCity"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_Nationality"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_Nationality"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_BirthDate"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_BirthDate"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_Phone1"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_Phone1"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_Phone2"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_Phone2"].Value; // frmPackM.MainRadGridView.CurrentRow.Cells["Person_Picture"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_Picture"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_HaveForm"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_HaveForm"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_RegisterCode"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_RegisterCode"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Person_LabelIsWoman"].Value = frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_LabelIsWoman"].Value; frmPackM.MainRadGridView.CurrentRow.Cells["Gatepass_ID"].Value = -1; frmPackM.MainRadGridView.CurrentRow.Cells["GatePass_IntPrint"].Value = -1; frmPackM.MainRadGridView.CurrentRow.Cells["GatePass_IsDriver"].Value = false; frmPackM.MainRadGridView.CurrentRow.Cells["GatePass_TimeLock"].Value = null; frmPackM.MainRadGridView.CurrentRow.Cells["GatePass_LockerId"].Value = -1; frmPackM.MainRadGridView.CurrentRow.Cells["package_Id"].Value = -1; if (frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_Picture"].Value != null) { using (var ms = new System.IO.MemoryStream()) { ((Bitmap)frmAddPersons.radGridViewSelected.Rows[count].Cells["Person_Picture"].Value). Save(ms, System. Drawing . Imaging . ImageFormat .Jpeg); var picture = ms.ToArray(); frmPackM.MainRadGridView.CurrentRow.Cells["Person_Picture"].Value = picture.Length > 0 ? picture : null; } } else { frmPackM.MainRadGridView.CurrentRow.Cells["Person_Picture"].Value = null; } #endregion } frmPackM.MainRadGridView.AllowAddNewRow = false; frmPackM.IsnewRowAdded = false; //frmPackM.MainRadGridView.Refresh(); } var frmSet = new gatepass.ui.package.frm_SettingPackGatePlace(); frmSet.ShowDialog(); frmPackM.SetSetting(frmSet.v01_UC_packDetailsNewGatePlace1); frmPackM.ShowDialog(); //result = frmPackM.gotResult (); result = frmPackM.DialogResult == DialogResult.OK ? frmPackM.gotResult() : null; frmPackM.Close(); frmPackM.Dispose(); frmSet.Close(); frmSet.Dispose(); frmAddPersons.Close(); frmAddPersons.Dispose(); } }