public void DeleteSelected(DataGridView dgv, DataGridViewSelectedRowCollection p_objects) { MessageBox.Show("Esto va a tardar porque pretende cancelar los turnos", "Warning"); //--Eliminar de la DB if (p_objects.Count > 0) { string queryAge = "UPDATE " + DB.schema + tabla + " SET age_habilitado=0 WHERE"; string querySem = "DELETE " + DB.schema + "semanal WHERE"; foreach (DataGridViewRow agenda in p_objects) { queryAge += " age_id=" + agenda.Cells["id"].Value + " OR"; querySem += " sem_agenda=" + agenda.Cells["id"].Value + " OR"; } //Para sacar el ultimo or queryAge = queryAge.Substring(0, queryAge.Length - 3); querySem = querySem.Substring(0, querySem.Length - 3); if (DB.ExecuteNonQuery(querySem + "; " + queryAge) == -1) MessageBox.Show("Error en la delecion"); //--Eliminar del ArrayList foreach (DataGridViewRow agenda in p_objects) { items.Remove(this[agenda.Cells["id"].Value.ToString()]); } //--Eliminar del dgv foreach (DataGridViewRow agenda in p_objects) { dgv.Rows.Remove(agenda); } } }
private void btnAllot_Click(object sender, EventArgs e) { rows = null; if (dataMemberInfo.SelectedRows != null && dataMemberInfo.SelectedRows.Count > 0) rows = dataMemberInfo.SelectedRows; else { MessageBox.Show("请在列表中选择会员!"); return; } if (dataCoachInfo.SelectedRows != null && dataCoachInfo.SelectedRows.Count > 0) { int[] ids = new int[rows.Count]; int i = 0; foreach (DataGridViewRow row in rows) { ids[i++] = Convert.ToInt32(row.Cells[0].Value); } MessageBox.Show( wsm.CoachAllots(ids, Convert.ToInt32(dataCoachInfo.SelectedRows[0].Cells[0].Value))); loadingData(); } else MessageBox.Show("请在列表中选择教练"); }
public void DeleteGasto(DataGridViewSelectedRowCollection drDelete) { foreach (DataGridViewRow Row in drDelete) { giClass.DeleteGastosIndirectos((DateTime)Row.Cells["Fecha"].Value, (decimal)Row.Cells["NoFactura"].Value, (string)Row.Cells["Serie"].Value); } }
/// <summary> /// Gets the row indexes. /// </summary> /// <param name="rows">The rows.</param> /// <returns></returns> public static int[] GetRowIndexes(DataGridViewSelectedRowCollection rows){ int[] result = new int[rows.Count]; for (int ct = 0; ct < rows.Count; ct++) { result[ct] = rows[ct].Index; } result = SortInt(result); return result; }
private void addContacts() { selectedRows = dataGridViewContactos.SelectedRows; foreach (System.Windows.Forms.DataGridViewRow d in selectedRows) { String contacto = d.Cells["correoElectrónicoDataGridViewTextBoxColumn"].Value.ToString(); if (contacto.Trim().Length != 0) { if(btnPara.Checked) addContact(txtPara,contacto); if (btnCc.Checked) addContact(txtCc, contacto); if (btnCco.Checked) addContact(txtCco, contacto); } } }
public void Button_Launch(DataGridViewSelectedRowCollection dataRows) { var selectedRows = new List<Streamer>(); for (int i = 0; i < dataRows.Count; i++) { var streamer = _datasourceStreamer.Single(o => o.name == dataRows[i].Cells[0].Value.ToString()); if (streamer.online == false) { MessageBox.Show("Streamer is not online: " + streamer.name, "Offline", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { selectedRows.Add(streamer); } } Task.Run(() => _serviceHandler.DisplayStream(selectedRows)); }
internal void InternalAddRange(DataGridViewSelectedRowCollection rows) { if (rows == null) { return; } // Believe it or not, MS adds the rows in reverse order... DataGridViewRow editing_row = dataGridView != null ? dataGridView.EditingRow : null; for (int i = rows.Count - 1; i >= 0; i--) { if (rows [i] == editing_row) { continue; } base.List.Add(rows [i]); } }
public void TryToApplySignature(DataGridViewSelectedRowCollection selectedRows, oFunctionList functionList) { DialogResult showDialog = ShowDialog(); if (showDialog == DialogResult.OK) { foreach (ListViewItem item in listSignatures.Items) { if (item.Checked) { EntpackSignature(item.SubItems[1].Text); if (!BuildIndex()) return; foreach (DataGridViewRow selectedRow in selectedRows) { oFunction function = functionList.getFunction(selectedRow.Index); string functionName = GetFunctionName(function.getSignature()); if (functionName != string.Empty) function.name = functionName; } } } } }
private void AddToShuffleQueueBottom(DataGridViewSelectedRowCollection rows) { List<DataGridViewRow> sortedRows = GetSortedRowList(rows); sortedRows.Reverse(); foreach (DataGridViewRow row in sortedRows) shuffleQueue.Add((Song)row.DataBoundItem); if (showingPlaylist == shuffleQueue) UpdateShowingPlaylist(); }
private void RateSongs(DataGridViewSelectedRowCollection rows, int rating) { List<Song> songs = new List<Song>(); foreach (DataGridViewRow row in rows) { Song s = row.DataBoundItem as Song; s.Rating = rating; songs.Add(s); } library.ResetSearchDictionaries(); foreach (Song s in songs) UpdateSong(s); RefreshSongGridView(); if (showingPlaylist.GetType() == typeof(FilterPlaylist)) UpdateShowingPlaylist(); }
private void GrdDatos_GridDatos_DoubleClick(object sender, VolcadorIkor.uctrlTablaConFiltro.GridDatos_DoubleClickEnventArgs e) { try { if (iMultiSelect == 3) return; if (iMultiSelect == 1) { if (GrdDatos.gridDatos.SelectedRows.Count > 0) { sResultadoMS = ""; for (int i = 0; i < GrdDatos.gridDatos.SelectedRows.Count; i++) { if (sResultadoMS.Length > 0) sResultadoMS = sResultadoMS + ","; if (string.IsNullOrEmpty(strColID)) sResultadoMS = sResultadoMS + GrdDatos.gridDatos.SelectedRows[i].Cells[intColID].Value.ToString(); else sResultadoMS = sResultadoMS + GrdDatos.gridDatos.SelectedRows[i].Cells[strColID].Value.ToString(); } } } if (string.IsNullOrEmpty(strColID)) { resultado = GrdDatos.gridDatos.CurrentRow.Cells[intColID].Value.ToString(); if (bLeeItem) { sitem = GrdDatos.gridDatos.CurrentRow.Cells[1].Value.ToString(); if (GrdDatos.gridDatos.Columns.Count >= 4) IDCuenta = GrdDatos.gridDatos.CurrentRow.Cells[3].Value.ToString(); } } else { resultado = GrdDatos.gridDatos.CurrentRow.Cells[strColID].Value.ToString(); if (bLeeItem) { sitem = GrdDatos.gridDatos.CurrentRow.Cells[1].Value.ToString(); if (GrdDatos.gridDatos.Columns.Count >= 4) IDCuenta = GrdDatos.gridDatos.CurrentRow.Cells[3].Value.ToString(); } } //if (!string.IsNullOrEmpty(strColID)) //{ drResultado = GrdDatos.gridDatos.SelectedRows; this.Close(); //} } catch { drResultado = null; resultado = ""; sResultadoMS = ""; this.Close(); } }
private void Seleccionar_Click(object sender, EventArgs e) { try { if (iMultiSelect == 1) { if (GrdDatos.gridDatos.SelectedRows.Count > 0) { sResultadoMS = ""; for (int i = 0; i < GrdDatos.gridDatos.SelectedRows.Count; i++) { if (sResultadoMS.Length > 0) sResultadoMS = sResultadoMS + ","; if (string.IsNullOrEmpty(strColID)) sResultadoMS = sResultadoMS + GrdDatos.gridDatos.SelectedRows[i].Cells[intColID].Value.ToString(); else sResultadoMS = sResultadoMS + GrdDatos.gridDatos.SelectedRows[i].Cells[strColID].Value.ToString(); } } } if (string.IsNullOrEmpty(strColID)) { resultado = GrdDatos.gridDatos.CurrentRow.Cells[intColID].Value.ToString(); if (bLeeItem) { sitem = GrdDatos.gridDatos.CurrentRow.Cells[1].Value.ToString(); if(GrdDatos.gridDatos.Columns.Count >= 4) IDCuenta = GrdDatos.gridDatos.CurrentRow.Cells[3].Value.ToString(); } } else { resultado = GrdDatos.gridDatos.CurrentRow.Cells[strColID].Value.ToString(); if (bLeeItem) { sitem = GrdDatos.gridDatos.CurrentRow.Cells[1].Value.ToString(); if (GrdDatos.gridDatos.Columns.Count >= 4) IDCuenta = GrdDatos.gridDatos.CurrentRow.Cells[3].Value.ToString(); } } drResultado = GrdDatos.gridDatos.SelectedRows; this.Close(); } catch { resultado = ""; sResultadoMS = ""; drResultado = null; this.Close(); } }
protected virtual void SetSelectedRowCore (int rowIndex, bool selected) { DataGridViewRow row = rows [rowIndex]; row.SelectedInternal = selected; if (selected_rows == null) selected_rows = new DataGridViewSelectedRowCollection (this); if (!selected && selected_rows.Contains (row)) { selected_rows.InternalRemove (row); } else if (selected && !selected_rows.Contains (row)) { selected_rows.InternalAdd (row); } Invalidate(); }
public DataGridViewMovedRows(DataGridViewSelectedRowCollection rows, DataGridView source) { if (rows == null) throw new ArgumentNullException(nameof(rows)); modifiedRows = rows.Cast<DataGridViewRow>().OrderBy(x => x.Index).ToArray(); SourceRows = new ReadOnlyCollection<DataGridViewRow>((DataGridViewRow[])modifiedRows.Clone()); Source = source; }
protected virtual void SetSelectedRowCore (int rowIndex, bool selected) { DataGridViewRow row = rows [rowIndex]; row.SelectedInternal = selected; if (selected_rows == null) selected_rows = new DataGridViewSelectedRowCollection (this); bool selectionChanged = false; if (!selected && selected_rows.Contains (row)) { selected_rows.InternalRemove (row); selectionChanged = true; } else if (selected && !selected_rows.Contains (row)) { selected_rows.InternalAdd (row); selectionChanged = true; } if (selectionChanged) OnSelectionChanged (EventArgs.Empty); Invalidate(); }
private List<DataGridViewRow> GetSortedRowList(DataGridViewSelectedRowCollection rows) { List<DataGridViewRow> ret = new List<DataGridViewRow>(); foreach (DataGridViewRow row in rows) ret.Add(row); ret.Sort((r1, r2) => r2.Index.CompareTo(r1.Index)); return ret; }
public SetearMotivoCancelacion(BaseCancelarAtencion padre, DataGridViewSelectedRowCollection seleccion) : base(padre) { this.seleccion = seleccion; }
private void DeleteSongs(DataGridViewSelectedRowCollection rows) { if (showingPlaylist.GetType() == typeof(FilterPlaylist)) return; if (rows.Count > 25) { string queryMessage = "You are about to delete " + rows.Count + " songs from the "; if (showingPlaylist != library) queryMessage += "playlist"; else queryMessage += "library"; queryMessage += ".\nAre you sure?"; DialogResult dialogResult = MessageBox.Show(queryMessage, "", MessageBoxButtons.OKCancel); if (dialogResult == DialogResult.Cancel) return; } if (songGridView.SelectedRows.Count == showingPlaylist.NumSongs) { showingPlaylist.RemoveAll(); if (musicPlayer.PlaybackState != PlaybackState.Stopped) StopPlaying(); } else { List<int> indexList = GetSortedRowIndexes(rows); foreach (int i in indexList) { if (currentlyPlaying != null) { if (showingPlaylist == library) { if (currentlyPlaying == (Song)songGridView.Rows[i].DataBoundItem) StopPlaying(); } else if (playingPlaylist.CurrentIndex == i) StopPlaying(); } } showingPlaylist.Remove(indexList); } if (showingPlaylist == shuffleQueue) shuffleQueue.Populate(); showingPlaylist.Save(); UpdateShowingPlaylist(); }
private DialogResult ShowPayment() { DialogResult paymentResult = DialogResult.Cancel; if (Convert.ToDecimal(lblBalanceSelected.Text) > 0) { Data.SalesTransactionDetails clsSalesTransactionDetails = new Data.SalesTransactionDetails(); switch (mclsSysConfigDetails.CreditPaymentType) { case CreditPaymentType.Houseware: clsSalesTransactionDetails.SubTotal = Convert.ToDecimal(lblAmountDue.Text); break; case CreditPaymentType.Normal: case CreditPaymentType.MPC: default: clsSalesTransactionDetails.SubTotal = Convert.ToDecimal(lblBalanceSelected.Text); break; } clsSalesTransactionDetails.TransactionStatus = TransactionStatus.CreditPayment; PaymentsWnd payment = new PaymentsWnd(); payment.TerminalDetails = TerminalDetails; payment.SysConfigDetails = mclsSysConfigDetails; payment.CustomerDetails = mclsCustomerDetails; payment.SalesTransactionDetails = clsSalesTransactionDetails; payment.CreditCardSwiped = false; payment.IsRefund = false; payment.isFromCreditPayment = true; payment.ShowDialog(this); paymentResult = payment.Result; mdecAmountPaid = payment.AmountPaid; mdecCashPayment = payment.CashPayment; mdecChequePayment = payment.ChequePayment; mdecCreditCardPayment = payment.CreditCardPayment; mdecDebitPayment = payment.DebitPayment; mdecBalanceAmount = payment.BalanceAmount; mdecChangeAmount = payment.ChangeAmount; mPaymentType = payment.PaymentType; marrCashPaymentDetails = payment.CashPaymentDetails; marrChequePaymentDetails = payment.ChequePaymentDetails; marrCreditCardPaymentDetails = payment.CreditCardPaymentDetails; marrDebitPaymentDetails = payment.DebitPaymentDetails; payment.Close(); payment.Dispose(); if (paymentResult == DialogResult.OK) { // Nov 2, 2014 do not save do the saving in MainWnd // get the selected Transactions to be paid instead //SavePayments(mdecAmountPaid, mdecCashPayment, mdecChequePayment, mdecCreditCardPayment, mdecDebitPayment, // marrCashPaymentDetails, marrChequePaymentDetails, marrCreditCardPaymentDetails, marrDebitPaymentDetails); mdgvItemsSelectedRows = dgvItems.SelectedRows; } } return paymentResult; }
// moving code from "Y:\jsc.svn\core\ScriptCoreLib.Ultra.Library\ScriptCoreLib.Ultra.Library\Extensions\LinqExtensions.cs" public static IEnumerable <DataGridViewRow> AsEnumerable(this DataGridViewSelectedRowCollection c) { // X:\jsc.svn\core\ScriptCoreLib.Windows.Forms\ScriptCoreLib.Windows.Forms\JavaScript\BCLImplementation\System\Windows\Forms\DataGridView\DataGridViewSelectedRowCollection.cs return(Enumerable.Range(0, c.Count).Select(k => c[k])); }
public MultiSplitForm(DataGridViewSelectedRowCollection parentViewSelectedRows, DataSet allocations) { this.parentViewSelectedRows = parentViewSelectedRows; // grab data sent from parent form this.allocations = allocations; InitializeComponent(); }
private List<int> obtenerFacturas(DataGridViewSelectedRowCollection dgv) { List<int> codigosPublicaciones = new List<int>(); foreach(DataGridViewRow fila in dgv) { int codPublicacion = Convert.ToInt32(fila.Cells[2].Value); codigosPublicaciones.Add(codPublicacion); } return codigosPublicaciones; }
private List<int> GetSortedRowIndexes(DataGridViewSelectedRowCollection rows) { List<int> indexList = new List<int>(); foreach (DataGridViewRow row in rows) indexList.Add(row.Index); indexList.Sort(); indexList.Reverse(); return indexList; }
public void SetSelectedStocks(DataGridViewSelectedRowCollection SelectedRows) { for (int i = 0; i < SelectedRows.Count; i++){ //lay stock code trong watchlist string code=SelectedRows[i].Cells[1].Value.ToString(); //lam viec voi codeSlectLB la kieu stockCodeSelect //codeSelectLb.myValues.Add(code); codeSelectLb.CheckStockCode(code); } //Refresh(); codeSelectLb.Refresh(); ; }
private void dgvSheets_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e) { selected = dgvSheets.SelectedRows; }
/// <summary> /// deletes the rows in the database /// </summary> /// <param name="markedRows"></param> internal void DeleteRows(DataGridViewSelectedRowCollection markedRows) { System.Text.StringBuilder sqlString = new System.Text.StringBuilder(); try { sqlString.Append("delete from tbLog where "); for (int i = 0; i < markedRows.Count; i++) { if(i == 0) sqlString.Append(String.Format(" time = {0}", DBConnector.SQLDateTime((DateTime)markedRows[i].Cells["time"].Value))); else sqlString.Append(String.Format(" or time = {0} ", DBConnector.SQLDateTime((DateTime)markedRows[i].Cells["time"].Value))); } Program.DBCon.Execute(sqlString.ToString()); } catch (Exception ex) { throw new Exception("Error while deleting rows", ex); } }
public void iniDialogoAtri(DataGridViewSelectedRowCollection fila, ref DCapturaAtributo dlgAtri) { if (fila[0].Cells[1].Value != null) { dlgAtri.clave.Checked = true; dlgAtri.cbListEnt.Enabled = false; } else dlgAtri.cbListEnt.Enabled = true; nameAtributo = dlgAtri.tbName.Text = (string)fila[0].Cells[2].Value; dlgAtri.cbTipo.Text = (string)fila[0].Cells[3].Value; dlgAtri.tbTamaño.Text = (string)fila[0].Cells[4].Value; dlgAtri.cbListEnt.Text = (string)fila[0].Cells[6].Value; dlgAtri.cbListEnt.Items.AddRange(getListaDeEntidades()); if (dlgAtri.cbListEnt.Text.CompareTo("None")==0) dlgAtri.clave.Enabled = true; else dlgAtri.clave.Enabled = false; }
public void deletePlayRecord(DataGridViewSelectedRowCollection p_Rows) { /* int length = p_Rows.Count; for (int index = length - 1; index >= 0; index--) WiimoteDataStore.getWiimoteDataStore().deleteWiimotePlayRecord(p_Rows[index].Index); this.m_parent.wiimotePlayDataStoreBindingSource.DataSource = WiimoteDataStore.getWiimoteDataStore().WiimotePlayRecords; */ }
/// <summary> /// </summary> /// <param name="arSelected"></param> /// <param name="arOpts"></param> private static void ShellStopHelper(DataGridViewSelectedRowCollection arSelected, out List<string> arOpts) { arOpts = null; int iWorkCount = arSelected.Count; if (iWorkCount < 5) { foreach (DataGridViewRow dsvc in arSelected) { object obj = dsvc.DataBoundItem; var objz = (WmiServiceObj) obj; bool aRet = ShellHelper.SwitchServiceStatusTo(objz, ServiceControllerStatus.Stopped); if (arOpts == null) arOpts = new List<string>(); arOpts.Add(string.Format("{0}->{1}\n", objz.Name, aRet ? "succ" : "fail")); } } else { // const int thrCou = 4; //并发数 double xt = Math.Ceiling(iWorkCount/(float) thrCou); //周期数 var device = new WorkThread[thrCou]; bool bSetMaxThread = ThreadPool.SetMaxThreads(thrCou, thrCou*2); if (!bSetMaxThread) { Console.WriteLine("Setting max threads of the threadpool failed!"); } for (int i = 0; i < xt; i++) { for (int j = 0; j < thrCou; j++) { int iPoint = i*thrCou + j; if (iPoint >= iWorkCount) break; if (arSelected[iPoint].Cells.Count > 1) { var obj = arSelected[iPoint]; var objTmp = (WmiServiceObj) obj.DataBoundItem; device[j] = new WorkThread(objTmp); ThreadPool.QueueUserWorkItem(device[j].ThreadPoolCallBack); } } } Console.WriteLine("Pls Wait for a moment......Current Time:{0}", DateTime.Now.ToLongTimeString()); // } }
public void SaveCreditPayments(DataGridViewSelectedRowCollection dgvItemsSelectedRows, ArrayList arrCashPaymentDetails, ArrayList arrChequePaymentDetails, ArrayList arrCreditCardPaymentDetails, ArrayList arrCreditPaymentDetails, ArrayList arrDebitPaymentDetails, bool ActivateSuspendedAccount) { // save the cashpayments foreach (Data.CashPaymentDetails det in mclsSalesTransactionDetails.PaymentDetails.arrCashPaymentDetails) { //string strRemarks = "PAID BY:" + mclsSalesTransactionDetails.CustomerDetails.ContactName + " PAYMENTTYPE:Cash DATE:" + mclsSalesTransactionDetails.TransactionDate.ToString("MM-dd-yyyy hh:mm:ss tt"); //if (!string.IsNullOrEmpty(det.Remarks)) strRemarks += Environment.NewLine + det.Remarks; string strRemarks = string.Empty; decimal decRemainingAmountPaid = det.Amount; foreach (DataGridViewRow dr in dgvItemsSelectedRows) { Int64 intCreditPaymentID = Convert.ToInt64(dr.Cells["CreditPaymentID"].Value.ToString()); Int32 intCPRefBranchID = Convert.ToInt32(dr.Cells["BranchID"].Value.ToString()); string strCPRefTerminalNo = dr.Cells["TerminalNo"].Value.ToString(); decimal decBalance = Convert.ToDecimal(dr.Cells["Balance"].Value.ToString()); if (decRemainingAmountPaid >= decBalance) { InsertCreditPaymentCash(intCreditPaymentID, intCPRefBranchID, strCPRefTerminalNo, decBalance, strRemarks, ActivateSuspendedAccount); dr.Cells["CreditPaid"].Value = decBalance; dr.Cells["Balance"].Value = 0; decRemainingAmountPaid -= decBalance; } else if (decRemainingAmountPaid > 0 && decRemainingAmountPaid < decBalance) { InsertCreditPaymentCash(intCreditPaymentID, intCPRefBranchID, strCPRefTerminalNo, decRemainingAmountPaid, strRemarks, ActivateSuspendedAccount); //dgItems.Select(itemIndex); dr.Cells["CreditPaid"].Value = decRemainingAmountPaid; dr.Cells["Balance"].Value = decBalance - decRemainingAmountPaid; decRemainingAmountPaid = 0; break; } } if (decRemainingAmountPaid > 0) { //insert a dummy purchase dated Jan 1, 2014 as a reference for paying Data.CreditPaymentDetails clsCreditPaymentDetails = new Data.CreditPaymentDetails(); clsCreditPaymentDetails.BranchDetails = mclsTerminalDetails.BranchDetails; clsCreditPaymentDetails.TerminalNo = mclsSalesTransactionDetails.TerminalNo; clsCreditPaymentDetails.TransactionID = mclsSalesTransactionDetails.TransactionID; clsCreditPaymentDetails.TransactionNo = mclsSalesTransactionDetails.TransactionNo; clsCreditPaymentDetails.IsRefund = false; clsCreditPaymentDetails.TransactionDate = new DateTime(2014, 12, 1); //this should be Dec1,2014 so that it wont include in Billing clsCreditPaymentDetails.CashierName = "SysUser"; clsCreditPaymentDetails.Amount = decRemainingAmountPaid; clsCreditPaymentDetails.CustomerDetails = mclsSalesTransactionDetails.CustomerDetails; clsCreditPaymentDetails.Remarks = "pay-no purchase: deposit " + mclsSalesTransactionDetails.TransactionDate.ToString("yyyy-MM-dd HH:mm:ss"); clsCreditPaymentDetails.CreditReason = "Deposit @ Ter#:" + mclsSalesTransactionDetails.TerminalNo + " Br#:1 trx: " + mclsSalesTransactionDetails.TransactionNo + " date:" + mclsSalesTransactionDetails.TransactionDate.ToString("yyyy-MM-dd HH:mm"); clsCreditPaymentDetails.CreditCardTypeID = mclsContactDetails.CreditDetails.CardTypeDetails.CardTypeID; Data.CreditPayments clsCreditPayments = new Data.CreditPayments(mConnection, mTransaction); mConnection = clsCreditPayments.Connection; mTransaction = clsCreditPayments.Transaction; clsCreditPaymentDetails.CreditPaymentID = clsCreditPayments.Insert(clsCreditPaymentDetails); clsCreditPayments.CommitAndDispose(); //insert the payment InsertCreditPaymentCash(clsCreditPaymentDetails.CreditPaymentID, mclsTerminalDetails.BranchDetails.BranchID, mclsSalesTransactionDetails.TerminalNo, decRemainingAmountPaid, "pay-no purchase: deposit", ActivateSuspendedAccount); } } foreach (Data.ChequePaymentDetails det in mclsSalesTransactionDetails.PaymentDetails.arrChequePaymentDetails) { //string strRemarks = "PAID BY:" + mclsSalesTransactionDetails.CustomerDetails.ContactName + " PAYMENTTYPE:Cheque DATE:" + mclsSalesTransactionDetails.TransactionDate.ToString("MM-dd-yyyy hh:mm:ss tt"); //if (det.Remarks != null) strRemarks += Environment.NewLine + det.Remarks; string strRemarks = string.Empty; decimal decRemainingAmountPaid = det.Amount; foreach (DataGridViewRow dr in dgvItemsSelectedRows) { Int64 intCreditPaymentID = Convert.ToInt64(dr.Cells["CreditPaymentID"].Value.ToString()); Int32 intCPRefBranchID = Convert.ToInt32(dr.Cells["BranchID"].Value.ToString()); string strCPRefTerminalNo = dr.Cells["TerminalNo"].Value.ToString(); decimal decBalance = Convert.ToDecimal(dr.Cells["Balance"].Value.ToString()); if (decRemainingAmountPaid >= decBalance) { InsertCreditPaymentCheque(intCreditPaymentID, intCPRefBranchID, strCPRefTerminalNo, det.ChequeNo, decBalance, det.ValidityDate, strRemarks); dr.Cells["CreditPaid"].Value = decBalance; dr.Cells["Balance"].Value = 0; decRemainingAmountPaid -= decBalance; } else if (decRemainingAmountPaid > 0 && decRemainingAmountPaid < decBalance) { InsertCreditPaymentCheque(intCreditPaymentID, intCPRefBranchID, strCPRefTerminalNo, det.ChequeNo, decRemainingAmountPaid, det.ValidityDate, strRemarks); //dgItems.Select(itemIndex); dr.Cells["CreditPaid"].Value = decRemainingAmountPaid; dr.Cells["Balance"].Value = decBalance - decRemainingAmountPaid; decRemainingAmountPaid = 0; break; } } if (decRemainingAmountPaid > 0) { //insert a dummy purchase dated Jan 1, 2014 as a reference for paying Data.CreditPaymentDetails clsCreditPaymentDetails = new Data.CreditPaymentDetails(); clsCreditPaymentDetails.BranchDetails = mclsTerminalDetails.BranchDetails; clsCreditPaymentDetails.TerminalNo = mclsSalesTransactionDetails.TerminalNo; clsCreditPaymentDetails.TransactionID = mclsSalesTransactionDetails.TransactionID; clsCreditPaymentDetails.TransactionNo = mclsSalesTransactionDetails.TransactionNo; clsCreditPaymentDetails.IsRefund = false; clsCreditPaymentDetails.TransactionDate = new DateTime(2014, 12, 1); //this should be Dec1,2014 so that it wont include in Billing clsCreditPaymentDetails.CashierName = "SysUser"; clsCreditPaymentDetails.Amount = decRemainingAmountPaid; clsCreditPaymentDetails.CustomerDetails = mclsSalesTransactionDetails.CustomerDetails; clsCreditPaymentDetails.Remarks = "pay-no purchase: deposit " + mclsSalesTransactionDetails.TransactionDate.ToString("yyyy-MM-dd HH:mm:ss"); clsCreditPaymentDetails.CreditReason = "Deposit @ Ter#:" + mclsSalesTransactionDetails.TerminalNo + " Br#:1 trx: " + mclsSalesTransactionDetails.TransactionNo + " date:" + mclsSalesTransactionDetails.TransactionDate.ToString("yyyy-MM-dd HH:mm"); clsCreditPaymentDetails.CreditCardTypeID = mclsContactDetails.CreditDetails.CardTypeDetails.CardTypeID; Data.CreditPayments clsCreditPayments = new Data.CreditPayments(mConnection, mTransaction); mConnection = clsCreditPayments.Connection; mTransaction = clsCreditPayments.Transaction; clsCreditPaymentDetails.CreditPaymentID = clsCreditPayments.Insert(clsCreditPaymentDetails); clsCreditPayments.CommitAndDispose(); //insert the payment InsertCreditPaymentCheque(clsCreditPaymentDetails.CreditPaymentID, mclsTerminalDetails.BranchDetails.BranchID, mclsSalesTransactionDetails.TerminalNo, det.ChequeNo, decRemainingAmountPaid, det.ValidityDate, "pay-no purchase: deposit"); } } }
internal void InternalAddRange (DataGridViewSelectedRowCollection rows) { if (rows == null) return; // Believe it or not, MS adds the rows in reverse order... DataGridViewRow editing_row = dataGridView != null ? dataGridView.EditingRow : null; for (int i = rows.Count - 1; i >= 0; i--) { if (rows [i] == editing_row) continue; base.List.Add (rows [i]); } }
public static void cancelarAtencion(DataGridViewSelectedRowCollection seleccion, string motivo) { DataGridViewRow row = seleccion[0]; ConectorSQL.ejecutarProcedure("cancelarTurno", row.Cells["Numero"].Value, "No asistencia", motivo); }