private bool NewReceipt(out string errorMsg) { errorMsg = ""; bool IsSuccess = false; List<StoreInDetail> param = new List<StoreInDetail>(); for (int i = 0; (this.dataGridView1.Rows.Count) > i; i++) { if ((bool)dataGridView1.Rows[i].Cells["selected"].Value) { StoreInDetail result = new StoreInDetail(); result.PONum = (int)dataGridView1.Rows[i].Cells["pono"].Value.GetInt(); result.POLine = (int)dataGridView1.Rows[i].Cells["poline"].Value.GetInt(); result.LineID = (int)dataGridView1.Rows[i].Cells["lineId1"].Value.GetInt(); result.VendorNum = (int)dataGridView1.Rows[i].Cells["vendornum"].Value.GetInt(); result.StoreInNum = HeadContent.StoreInNum; param.Add(result); } } //_repo.GetNewRcv(param, epiSession, out IsSuccess, out errorMsg); return IsSuccess; }
private void tlbSave_Click(object sender, EventArgs e) { //bool IsSuccess; string msg; int StoreInid; int SelectedCount = 0; if (dataGridView1.Rows.Count == 0) { return; } if (!HashListSeleted()) { MessageBox.Show("Please select rows in grid.", "Please try agian.", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } if (!HashArticleSelected(out SelectedCount)) { MessageBox.Show("Please select rows in grid.", "Please try agian.", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } if (SelectedCount > 0) { DialogResult dialogResult = MessageBox.Show("Are you sure to save store in. \rAfter your save, you can't modify it.", "Please Confirm.", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { int iRow = dataGridView1.CurrentRow.Index; List<StoreInDetail> selectedList = new List<StoreInDetail>(); for (int i = 0; (this.dataGridView2.Rows.Count) > i; i++) { if ((bool)dataGridView2[0, i].EditedFormattedValue && string.IsNullOrEmpty(dataGridView2.Rows[i].Cells["stock"].Value.GetString())) { dataGridView2.CurrentCell = dataGridView2[0, i]; var item = new StoreInDetail(); item = _repo.GetArticleListToSave(Convert.ToInt32(dataGridView2.Rows[i].Cells["lineid"].Value)); item.Location = dataGridView2.Rows[i].Cells["Place"].Value.GetString(); item.NGStatus = Convert.ToInt32(dataGridView2.Rows[i].Cells["ngflag"].Value.GetBoolean()); item.NGRemark = dataGridView2.Rows[i].Cells["ngRemark"].Value.GetString(); HeadContent.PONum = item.PONum; HeadContent.PONumber = item.PONumber; selectedList.Add(item); } } if (selectedList != null) { HeadContent.StoreInDate = DateTime.Now; HeadContent = _repo.InsertStoreIn(HeadContent, epiSession); _repo.InsertStoreInLine(selectedList, epiSession, HeadContent.StoreInID, HeadContent.TransactionID, out msg); } SetHeaderContent(HeadContent); MessageBox.Show("Save Store In completed. And then will be create Part in Epicor.", "Progression.", MessageBoxButtons.OK); Progression frm1 = new Progression("NEWPART", HeadContent.TransactionID, epiSession, HeadContent.Possession); frm1.ShowDialog(); tlbSave.Enabled = false; SetHeaderContent(HeadContent, true); var result = _repo.GetDetailArticle(HeadContent.StoreInPlanId, HeadContent.TransactionID); SetDetailArticle(result, true); } } }