private void btnFind_Click(object sender, EventArgs e) { Cursor.Current = Cursors.WaitCursor; dtPost.Clear(); GrdPost.DataSource = null; ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service itemSev = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service(); itemSev.Url = WebServiceInstants.GetURL(ServiceType.ItemJournalDailyLossQH); itemSev.Credentials = nc; List <ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter> FilterArray = new List <QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter>(); ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter filterStaff = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter(); filterStaff.Field = QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Fields.Staff_Dimension_Code; filterStaff.Criteria = cboDailyLPost.SelectedItem.ToString(); FilterArray.Add(filterStaff); itemArray = itemSev.ReadMultiple(BatchName, FilterArray.ToArray(), null, 0); //DateTime[] dateToCompare = new DateTime[itemArray.Length]; //for (int j = 0; j < itemArray.Length; j++) //{ // dateToCompare[j] = itemArray[j].Posting_Date; //} //Array.Sort(dateToCompare); //for (int k = 0; k < dateToCompare.Length; k++) //{ for (int i = 0; i < itemArray.Length; i++) { //DateTime compare1 = dateToCompare[k]; //DateTime compare2 = itemArray[i].Posting_Date; //if (dateToCompare[k].Equals(itemArray[i].Posting_Date)) //{ Object[] array = new Object[9]; array[0] = itemArray[i].Line_No; array[1] = itemArray[i].Item_No; array[2] = itemArray[i].Description; array[3] = itemArray[i].Entry_Type; array[4] = itemArray[i].Quantity; array[5] = itemArray[i].Location_Code; array[6] = itemArray[i].Bin_Code; array[7] = itemArray[i].Staff_Dimension_Code; array[8] = itemArray[i].Posting_Date; dtPost.Rows.Add(array); // } } // } GrdPost.DataSource = dtPost; lblcountforpost.Text = dtPost.Rows.Count.ToString(); Cursor.Current = Cursors.Default; }
private void btnSaveUpdate_Click(object sender, EventArgs e) { try { Cursor.Current = Cursors.WaitCursor; ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service Sev = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Service(); Sev.Url = WebServiceInstants.GetURL(ServiceType.ItemJournalDailyLossQH); Sev.Credentials = nc; ItemJournalDailyLossQH.ItemJournalDailyLossQH update = Sev.Read(BatchName, Convert.ToInt32(txtLine.Text.Trim())); update.Bin_Code = txtBin.Text.Trim(); update.Quantity = Convert.ToInt32(txtQty.Text.Trim()); update.Staff_Dimension_Code = txtStaffCode.Text.Trim(); Sev.Update(BatchName, ref update); GrdPost.DataSource = null; dtPost.Clear(); List <ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter> FilterArray = new List <QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter>(); ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter filterStaff = new QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Filter(); filterStaff.Field = QHMobile.ItemJournalDailyLossQH.ItemJournalDailyLossQH_Fields.Staff_Dimension_Code; filterStaff.Criteria = cboDailyLPost.SelectedItem.ToString(); FilterArray.Add(filterStaff); itemArray = Sev.ReadMultiple(BatchName, FilterArray.ToArray(), null, 0); for (int i = 0; i < itemArray.Length; i++) { Object[] array = new Object[9]; array[0] = itemArray[i].Line_No; array[1] = itemArray[i].Item_No; array[2] = itemArray[i].Description; array[3] = itemArray[i].Entry_Type; array[4] = itemArray[i].Quantity; array[5] = itemArray[i].Location_Code; array[6] = itemArray[i].Bin_Code; array[7] = itemArray[i].Staff_Dimension_Code; array[8] = itemArray[i].Posting_Date; dtPost.Rows.Add(array); //Object[] array = new Object[9]; } GrdPost.DataSource = dtPost; lblcountforpost.Text = dtPost.Rows.Count.ToString(); Cursor.Current = Cursors.Default; MessageBox.Show("Successfully Updated!"); } catch (Exception ex) { MessageBox.Show("Error:" + ex); } }