private void Confirm_Data() { if (F8_dt1.Rows.Count > 0) { var dtConfirm = F8_dt1.AsEnumerable().OrderBy(r => r.Field <string>("ShouhinCD")).ThenBy(r => r.Field <string>("表示順")).ThenBy(r => r.Field <string>("受注番号-行番号")).ThenBy(r => r.Field <string>("小売店名")).CopyToDataTable(); gvMainDetail.DataSource = dtConfirm; gvMainDetail.Memory_Row_Count = F8_dt1.Rows.Count; gvAggregationDetails.Memory_Row_Count = F8_dt1.Rows.Count; //For Error Check gvFreeInventoryDetails.Memory_Row_Count = F8_dt1.Rows.Count; //For Error Check } }
private void D_Exclusive_OneNumber_Delete(DataRow dr) { string JuchuuNO = dr["受注番号"].ToString(); DataRow[] selectRow = F8_dt1.Select("受注番号 ='" + JuchuuNO + "'"); if (selectRow.Length > 0) { return; } ChakuniNyuuryoku_Entity chkLockEntity = new ChakuniNyuuryoku_Entity(); chkLockEntity.DataKBN = 1; chkLockEntity.Number = JuchuuNO; chkLockEntity.ProgramID = ProgramID; chkLockEntity.PC = PCID; chkLockEntity.OperatorCD = OperatorCD; hbl.D_Exclusive_JuchuuNO_Delete(chkLockEntity); }
private void D_Exclusive_OneNumber_Insert(DataRow dr) { if (!string.IsNullOrWhiteSpace(dr["受注番号"].ToString())) { string JuchuuNO = dr["受注番号"].ToString(); DataRow[] selectRow = F8_dt1.Select("受注番号 ='" + JuchuuNO + "'"); if (selectRow.Length == 0) { return; } HikiateHenkouShoukaiEntity chkLockEntity = new HikiateHenkouShoukaiEntity(); chkLockEntity.DataKBN = 1; chkLockEntity.Number = JuchuuNO; chkLockEntity.ProgramID = ProgramID; chkLockEntity.PC = PCID; chkLockEntity.OperatorCD = OperatorCD; hbl.D_Exclusive_Lock_Check(chkLockEntity); } }
private void F11_Gridview_Bind() { for (int t = 0; t < gvMainDetail.RowCount; t++) { DataRow F8_drNew = F8_dt1.NewRow(); // save updated data DataGridViewRow row = gvMainDetail.Rows[t]; // grid view data string HinbanCD = row.Cells[0].Value.ToString(); string ShouhinCD = row.Cells["ShouhinCD"].Value.ToString(); string JuchuuNo = row.Cells[12].Value.ToString(); string KanriNO = row.Cells[14].Value.ToString(); DataRow[] select_dr1 = dtMain.Select("([受注番号-行番号] ='" + JuchuuNo + "' OR [受注番号-行番号] IS NULL) AND 小売店名 = '" + KanriNO + "' AND ShouhinCD = '" + ShouhinCD + "'");// original data DataRow existDr1 = F8_dt1.Select("([受注番号-行番号] ='" + JuchuuNo + "' OR [受注番号-行番号] IS NULL) AND 小売店名 = '" + KanriNO + "' AND ShouhinCD = '" + ShouhinCD + "'").SingleOrDefault(); if (existDr1 != null) { if (row.Cells[11].Value.ToString() == "0") { F8_dt1.Rows.Remove(existDr1); existDr1 = null; } } F8_drNew[0] = HinbanCD; if (row.Cells[11].Value.ToString() != "0") { for (int c = 1; c < gvMainDetail.Columns.Count; c++) { if (c == 11) { if (existDr1 != null) { if (select_dr1.Length > 0 && select_dr1[0][c].ToString() != row.Cells[c].Value.ToString()) { //bl = true; F8_drNew[c] = row.Cells[c].Value; } else { F8_drNew[c] = existDr1[c]; } } else { F8_drNew[c] = row.Cells[c].Value; } } else { F8_drNew[c] = row.Cells[c].Value; } } // grid 1 insert(if exist, remove exist and insert) if (existDr1 != null) { F8_dt1.Rows.Remove(existDr1); } F8_dt1.Rows.Add(F8_drNew); D_Exclusive_OneNumber_Insert(F8_drNew); } else { if (select_dr1.Length > 0) { //排他Delete D_Exclusive_OneNumber_Delete(select_dr1[0]); } } } gvMainDetail.Memory_Row_Count = F8_dt1.Rows.Count; gvAggregationDetails.Memory_Row_Count = F8_dt1.Rows.Count; //For Error Check gvFreeInventoryDetails.Memory_Row_Count = F8_dt1.Rows.Count; //For Error Check }
private void Display_Data() { D_Exclusive_JuchuuNO_Delete(); HikiateHenkouShoukaiEntity entity = new HikiateHenkouShoukaiEntity(); if (rdoAggregation.Checked) { entity.Representation = 0; } else if (rdoDetails.Checked) { entity.Representation = 1; } else { entity.Representation = 2; } entity.BrandCD = txtBrand.Text; entity.ChakuniYoteiNO = txtChakuniYoteiNO.Text; entity.KanriNO = txtKanriNO.Text; entity.YearTerm = txtYearTerm.Text; entity.SeasonSS = chkSeasonSS.Checked ? 1 : 0; entity.SeasonFW = chkSeasonFW.Checked ? 1 : 0; entity.TokuisakiCD = txtTokuisakiCD.Text; entity.SoukoCD = txtSoukoCD.Text; entity.KouritenCD = txtKouritenCD.Text; entity.PostalCode1 = txtPostalCode1.Text; entity.PostalCode2 = txtPostalCode2.Text; entity.Phoneno1 = txtPhoneNo1.Text; entity.Phoneno2 = txtPhoneNo2.Text; entity.Phoneno3 = txtPhoneNo3.Text; entity.Name = txtName.Text; entity.Address = txtAddress.Text; entity.ShouhinCD = txtShouhinCD.Text; entity.JANCD = txtJANCD.Text; entity.ColorNO = txtColorNO.Text; entity.SizeNO = txtSizeNO.Text; entity.ShouhinName = txtShouhinName.Text; entity.Type1 = chkType1.Checked ? 1 : 0; entity.Type2 = chkType2.Checked ? 1 : 0; entity.OperatorCD = base_entity.OperatorCD; entity.PC = base_entity.PC; entity.ProgramID = base_entity.ProgramID; dtMain = hbl.Select_DisplayData(entity); if (rdoAggregation.Checked) { gvAggregationDetails.DataSource = dtMain; gvAggregationDetails.Focus(); if (dtMain.Rows.Count > 0) { gvAggregationDetails.CurrentCell = gvAggregationDetails.Rows[0].Cells[3]; gvAggregationDetails.Select(); gvAggregationDetails.Memory_Row_Count = dtMain.Rows.Count; gvFreeInventoryDetails.Memory_Row_Count = dtMain.Rows.Count; gvMainDetail.Memory_Row_Count = dtMain.Rows.Count; } } else if (rdoDetails.Checked) { foreach (DataRow dr in dtMain.Rows) { bool exists = false; if (F8_dt1.Rows.Count > 0) { //重複行はDelete string ShouhinCD = dr["ShouhinCD"].ToString(); string JuchuuNo = dr["受注番号-行番号"].ToString(); string KanriNO = dr["小売店名"].ToString(); DataRow existDr1 = F8_dt1.Select("([受注番号-行番号] ='" + JuchuuNo + "' OR [受注番号-行番号] IS NULL) AND 小売店名 = '" + KanriNO + "' AND ShouhinCD = '" + ShouhinCD + "'").SingleOrDefault(); if (existDr1 != null) { dr["表示順"] = "9"; exists = true; } } if (!string.IsNullOrWhiteSpace(dr["受注番号"].ToString()) && !exists) { string JuchuuNO = dr["受注番号"].ToString(); entity.DataKBN = 1; entity.Number = JuchuuNO; entity.ProgramID = ProgramID; entity.PC = PCID; entity.OperatorCD = OperatorCD; DataTable dt = new DataTable(); dt = hbl.D_Exclusive_Lock_Check(entity); if (dt.Rows[0]["MessageID"].ToString().Equals("S004")) { string Data1 = string.Empty, Data2 = string.Empty, Data3 = string.Empty; Data1 = dt.Rows[0]["Program"].ToString(); Data2 = dt.Rows[0]["Operator"].ToString(); Data3 = dt.Rows[0]["PC"].ToString(); D_Exclusive_JuchuuNO_Delete(); bbl.ShowMessage("S004", Data1, Data2, Data3); return; } } } DataRow[] select_dr1 = dtMain.Select("表示順 = '9'"); foreach (DataRow dr in select_dr1) { dtMain.Rows.Remove(dr); } //dtMain.Columns.RemoveAt(20); //dtMain.Columns.RemoveAt(19); gvMainDetail.DataSource = dtMain; gvMainDetail.Columns[19].Visible = false; gvMainDetail.Columns[20].Visible = false; gvMainDetail.Columns[21].Visible = false; gvMainDetail.Focus(); if (dtMain.Rows.Count > 0) { gvMainDetail.CurrentCell = gvMainDetail.Rows[0].Cells[11]; gvMainDetail.Select(); } //gvMainDetail.Columns[gvMainDetail.Columns.Count - 1].Visible = false; } else { gvFreeInventoryDetails.DataSource = dtMain; gvFreeInventoryDetails.Focus(); if (dtMain.Rows.Count > 0) { gvFreeInventoryDetails.CurrentCell = gvFreeInventoryDetails.Rows[0].Cells[0]; gvFreeInventoryDetails.Select(); gvFreeInventoryDetails.Memory_Row_Count = dtMain.Rows.Count; gvMainDetail.Memory_Row_Count = dtMain.Rows.Count; gvAggregationDetails.Memory_Row_Count = dtMain.Rows.Count; } } if (dtTemp != null) { dtTemp.Clear(); } }