示例#1
0
        private void Query()
        {
            StringBuilder strBuilder = new StringBuilder(" where 1=1 ");

            if (!string.IsNullOrEmpty(txtLocalMaterial.Text.Trim()))
            {
                strBuilder.AppendFormat(" AND LocalMaterialCode='{0}'", txtLocalMaterial.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txtSupplyMaterial.Text.Trim()))
            {
                strBuilder.AppendFormat(" AND SupplyMaterialCode='{0}'", txtSupplyMaterial.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txtSupply.Text.Trim()))
            {
                strBuilder.AppendFormat(" AND Supply='{0}'", txtSupply.Text.Trim());
            }
            DataTable dt = BLL_Bllb_MaterialRelation_Tbmr.Query(strBuilder.ToString());

            dgvData.DataSource = dt;
        }
示例#2
0
 private bool ValidateInput(out string msg)
 {
     if (string.IsNullOrEmpty(txtLocalMaterial.Text.Trim()))
     {
         msg = "本厂料号必填";
         return(false);
     }
     if (string.IsNullOrEmpty(txtSupplyMaterial.Text.Trim()))
     {
         msg = "供应商料号必填";
         return(false);
     }
     //if (string.IsNullOrEmpty(txtSupply.Text.Trim()))
     //{
     //    msg = "供应商编码错误";
     //    return false;
     //}
     if (BLL_Material.Select(string.Format("MaterialCode='{0}'", txtLocalMaterial.Text.Trim())).Rows.Count == 0)
     {
         msg = "本厂料号错误";
         return(false);
     }
     //if (Bll_MdcDatSuppliesManage.Query(string.Format(" where SupplierCode='{0}'", txtSupply.Text.Trim())).Rows.Count == 0)
     //{
     //    msg = "供应商代码错误";
     //    return false;
     //}
     if (BLL_Bllb_MaterialRelation_Tbmr.Query(string.Format("WHERE  SupplyMaterialCode='{0}' {1}", txtSupplyMaterial.Text.Trim(),
                                                            TBMR_ID == string.Empty ? string.Empty : string.Format("AND TBMR_ID<>'{0}'", TBMR_ID))).Rows.Count > 0)
     {
         msg = "供应商料号已存在";
         return(false);
     }
     msg = "OK";
     return(true);
 }