/// <summary> /// /// </summary> /// <param name="dg"></param> /// <param name="dt"></param> /// <param name="dic">fields,tableName,datatable's column name</param> /// <returns></returns> protected bool DataExistsCheckForGrid(DataGridView dg, DataTable dt, Dictionary <string, string> dic) { int row = -1; foreach (DataRow dr in dt.Rows) { row++; foreach (KeyValuePair <string, string> kvp in dic) { string fields = kvp.Value.Split(',')[0]; string tableName = kvp.Value.Split(',')[1]; string colName = kvp.Key; string condition = "Where " + fields + " = '" + dr[colName] + "'"; if (!string.IsNullOrWhiteSpace(dr[colName].ToString())) { DataTable dtResult = basebl.DynamicSelectData(fields, tableName, condition); if (dtResult.Rows.Count <= 0) { DSP_MSG("E101", kvp.Key, string.Empty, string.Empty, string.Empty, string.Empty); return(false); } } } } return(true); }
/// <summary>select data from relative table /// /// </summary> /// <returns></returns> public bool SelectData() { string fields = string.Empty; string tableName = string.Empty; string condition = string.Empty; DataTable dtResult = new DataTable(); if (this.UC_Type == Type.Pattern) { fields = "PatternName"; tableName = "M_MakerZaiko_H"; condition = "Where PatternCD = '" + txtCode.Text + "'"; dtResult = basebl.DynamicSelectData(fields, tableName, condition); } else if (this.UC_Type == Type.Maker) { fields = "VM_SHIIRESAKI"; tableName = "M_SHIIRESAKI"; condition = "Where VC_SHIIRESAKI = '" + txtCode.Text + "'"; dtResult = basebl.DynamicSelectData(fields, tableName, condition); } else if (this.UC_Type == Type.Brand) { fields = "vm_brand"; tableName = "m_brand"; condition = "Where nc_brand = '" + txtCode.Text + "'"; dtResult = basebl.DynamicSelectData(fields, tableName, condition); } else if (this.UC_Type == Type.Category) { fields = "vm_bunrui"; tableName = "m_bunrui"; condition = "Where nc_bunrui = '" + txtCode.Text + "'"; dtResult = basebl.DynamicSelectData(fields, tableName, condition); } else if (this.UC_Type == Type.Sports) { fields = "vm_sports"; tableName = "m_sports"; condition = "Where nc_sports = '" + txtCode.Text + "'"; dtResult = basebl.DynamicSelectData(fields, tableName, condition); } else if (this.UC_Type == Type.ITEM) { fields = "vc_user_shohin"; tableName = " t_hanbai_shohin "; condition = "where vc_user_shohin= '" + txtCode.Text + "'"; dtResult = basebl.DynamicSelectData(fields, tableName, condition); } else if (this.UC_Type == Type.MultiJANCD) { fields = "VC_JAN1"; tableName = "M_KIHON_SHOHIN"; string jan = "'" + txtCode.Text.Replace(",", "','") + "'"; condition = "where VC_JAN1 IN(" + jan + ")"; dtResult = basebl.DynamicSelectData(fields, tableName, condition); } else if (this.UC_Type == Type.MakerShohinCD) { fields = "vc_maker_shohin"; tableName = "t_kihon_shohin"; condition = "where vc_maker_shohin= '" + txtCode.Text + "'"; dtResult = basebl.DynamicSelectData(fields, tableName, condition); } else if (this.UC_Type == Type.SKUCD) { fields = "HanbaiShohinCD"; tableName = "T_MakerZaiko"; condition = " where HanbaiShohinCD = '" + txtCode.Text + "'"; dtResult = basebl.DynamicSelectData(fields, tableName, condition); } if (dtResult.Rows.Count > 0) { lblName.Text = dtResult.Rows[0][fields].ToString(); UC_Exists = true; return(true); } else { lblName.Text = string.Empty; } UC_Exists = false; return(false); }
public void Bind() { if (Cbo_Type == cbo_Type.m_nendo) { DataTable dt = bbl.DynamicSelectData("nk_nendo,vm_nendo", "m_nendo", "order by nn_row"); BindCombo("nk_nendo", "vm_nendo", dt); } else if (Cbo_Type == cbo_Type.m_season) { DataTable dt = bbl.DynamicSelectData("nk_season,vm_season", "m_season", "order by nn_row"); BindCombo("nk_season", "vm_season", dt); } else if (Cbo_Type == cbo_Type.m_brand) { DataTable dt = bbl.DynamicSelectData("nc_brand,vm_brand", "m_brand", "order by vm_brand"); BindCombo("nc_brand", "vm_brand", dt); } else if (Cbo_Type == cbo_Type.m_sports) { DataTable dt = bbl.DynamicSelectData("nc_sports,vm_sports", "m_sports", "order by nn_row"); BindCombo("nc_sports", "vm_sports", dt); } else if (Cbo_Type == cbo_Type.m_bunrui) { DataTable dt = bbl.DynamicSelectData("nc_bunrui,vm_bunrui", "m_bunrui", "order by nn_row"); BindCombo("nc_bunrui", "vm_bunrui", dt); } else if (Cbo_Type == cbo_Type.M_SHIIRESAKI) { DataTable dt = bbl.DynamicSelectData("VC_SHIIRESAKI,VM_SHIIRESAKI", "M_SHIIRESAKI", "order by VM_SHIIRESAKI"); BindCombo("VC_SHIIRESAKI", "VM_SHIIRESAKI", dt); } else if (Cbo_Type == cbo_Type.SpecialFlag) { DataTable dt = new DataTable(); dt.Columns.Add("nf_maker_hachu_huka"); dt.Columns.Add("name"); dt.Rows.Add("1", "【★】"); dt.Rows.Add("3", "【■】"); dt.Rows.Add("5", "【F】"); dt.Rows.Add("6", "【□】"); dt.Rows.Add("8", "[送料別途]"); BindCombo("nf_maker_hachu_huka", "name", dt); } else if (Cbo_Type == cbo_Type.YoyakuFlag) { DataTable dt = new DataTable(); dt.Columns.Add("nk_yoyaku_shohin"); dt.Columns.Add("name"); dt.Rows.Add("1", "-"); dt.Rows.Add("2", "予約"); dt.Rows.Add("3", "☆即☆"); dt.Rows.Add("4", "【B】"); BindCombo("nk_yoyaku_shohin", "name", dt); } else if (Cbo_Type == cbo_Type.Taisho) { DataTable dt = new DataTable(); dt.Columns.Add("taishoID"); dt.Columns.Add("name"); dt.Rows.Add("0", "無効"); dt.Rows.Add("1", "有効"); BindCombo("taishoID", "name", dt); } else if (Cbo_Type == cbo_Type.ZaikoKeisan) { DataTable dt = new DataTable(); dt.Columns.Add("zaikoKeisan"); dt.Columns.Add("name"); dt.Rows.Add("0", "WEB在庫のみ"); dt.Rows.Add("1", "豊中在庫数+Web通販在庫数"); BindCombo("zaikoKeisan", "name", dt); } }