using System; using System.Collections.Generic; using System.Text; using System.Data; namespace DAL { public class ClsCLD_Material_View:DBUtility.ClsGy_Base_View { // public Model.ClsCLD_Material_Model omodel = new Model.ClsCLD_Material_Model(); public List omodelList = new List(); SQLHelper.ClsCN oCn = new SQLHelper.ClsCN(); public ClsCLD_Material_View() { base.MvarReportTitle = "物料设置"; base.MvarItemKey = "h_v_CLD_Material"; base.SQLName = "Select HItemID,Hnumber 物料代码,Hname 物料名称,HModel 规格型号,HPicNo 图号,HUnitNumber 单位代码,Hunitname 计量单位,HUnitID from h_v_CLD_Material"; base.SQLList = "Select * from " + MvarItemKey + " "; base.SQLWhere = " where hstopflag=0 "; base.SQLOrder = " Order by 物料代码 "; base.SQLNameForDown = " Select top 30 HItemID,HNumber 物料代码,HName 物料名称,HModel 规格型号 from h_v_CLD_Material "; base.SQLOrderForDown = " Order by HNumber "; base.SQLWhereForDown = " where HStopflag=0 "; } // public void Dispose() { GC.SuppressFinalize(this); } // //返回项目信息 public override bool GetInfoByID(Int64 sItemID) { DataSet DS ; try { DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HItemID='" + sItemID + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo); if (DS.Tables[0].Rows.Count == 0) return false; else { return GetInfo(DS); } } catch (Exception e) { throw (e); } } //根据代码返回项目信息 public override bool GetInfoByNumber(string sNumber) { DataSet DS; try { DS = oCn.RunProcReturn("Select * from " + MvarItemKey + " Where HNumber='" + sNumber + "'", MvarItemKey, ref DBUtility.ClsPub.sExeReturnInfo); if (DS.Tables[0].Rows.Count == 0) return false; else { return GetInfo(DS); } } catch (Exception e) { throw (e); } } //返回项目信息 public override bool GetInfo(DataSet DS) { try { omodel = new Model.ClsCLD_Material_Model(); omodel.HItemID = Convert.ToInt64(DS.Tables[0].Rows[0]["HItemID"]); omodel.HNumber = DS.Tables[0].Rows[0]["HNumber"].ToString().Trim(); omodel.HName = DS.Tables[0].Rows[0]["HName"].ToString().Trim(); omodel.HModel = DS.Tables[0].Rows[0]["HModel"].ToString().Trim(); omodel.HStopflag = DBUtility.ClsPub.isBool(DS.Tables[0].Rows[0]["HStopflag"]); omodel.HRemark = DS.Tables[0].Rows[0]["HRemark"].ToString().Trim(); omodel.HhgNumber = DS.Tables[0].Rows[0]["HhgNumber"].ToString().Trim(); omodel.HBarCode = DS.Tables[0].Rows[0]["HBarCode"].ToString().Trim(); omodel.HPhaseFlag = DBUtility.ClsPub.isBool(DS.Tables[0].Rows[0]["HPhaseFlag"]); omodel.HUnitID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HUnitID"]); omodel.HQtyDecimal = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HQtyDecimal"]); omodel.HPriceDecimal = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HPriceDecimal"]); //omodel.HProcID = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HProcID"]); //omodel.HWHID_def = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HWHID_def"]); //omodel.HSPID_def = DBUtility.ClsPub.isLong(DS.Tables[0].Rows[0]["HSPID_def"]); //omodel.HBigPackPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HBigPackPrice"]); //omodel.HColorMidPackPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HColorMidPackPrice"]); //omodel.HWhiteMidPackPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HWhiteMidPackPrice"]); //omodel.HColorSmlPackPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HColorSmlPackPrice"]); //omodel.HWhiteSmlPackPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HWhiteSmlPackPrice"]); //omodel.HPaperCardPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HPaperCardPrice"]); //omodel.HPlasticBagPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HPlasticBagPrice"]); //omodel.HPlasticCardPrice = DBUtility.ClsPub.isSingle(DS.Tables[0].Rows[0]["HPlasticCardPrice"]); return true; } catch (Exception e) { throw (e); } } //帮助 public override bool RefreshView() { try {// Pub_Control.frmHlpInfo ofrm = new Pub_Control.frmHlpInfo(); // string sSQL = SQLName; //编辑ofrm ofrm.sTitle = MvarReportTitle; ofrm.sBill = "h_v_CLD_Material"; ofrm.txtFindInfo.Text = WherePart; ofrm.sOtherItem = ""; //编辑 ofrm.grdShow.RowTemplate.Height = 20; ofrm.ShowDialog(); //得到对应列 // if (ofrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) { if (ofrm.grdShow.CurrentRow == null) { return false; } this.omodel.HItemID = Pub_Class.ClsPub.isLong(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[0].Value); this.omodel.HNumber =DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[1].Value); this.omodel.HName =DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[2].Value); this.omodel.HModel =DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[3].Value); this.omodel.HUnitID = DBUtility.ClsPub.isLong(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[6].Value.ToString()); this.omodel.HUnitNumber = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[4].Value); this.omodel.HUnitName = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[5].Value); } else { return false; } // ofrm.Dispose(); ofrm = null; // return true; } catch (Exception e) { throw (e); } } public override bool RefreshView(string sWhere) { try {// Pub_Control.frmHlpInfo ofrm = new Pub_Control.frmHlpInfo(); // string sSQL = SQLName+SQLWhere+SQLOrder; //编辑ofrm ofrm.sTitle = MvarReportTitle; ofrm.sBill = "h_v_CLD_Material"; ofrm.txtFindInfo.Text = WherePart; ofrm.sSQLWhere = sWhere; ofrm.sOtherItem = ""; //编辑 ofrm.grdShow.RowTemplate.Height = 20; ofrm.ShowDialog(); //得到对应列 // if (ofrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) { if (ofrm.grdShow.CurrentRow == null) { return false; } this.omodel.HItemID = Pub_Class.ClsPub.isLong(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[0].Value); this.omodel.HNumber = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[1].Value); this.omodel.HName = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[2].Value); this.omodel.HModel = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[3].Value); this.omodel.HUnitID = DBUtility.ClsPub.isLong(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[6].Value.ToString()); this.omodel.HUnitNumber = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[4].Value); this.omodel.HUnitName = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.CurrentRow.Index].Cells[5].Value); } else { return false; } // ofrm.Dispose(); ofrm = null; // return true; } catch (Exception e) { throw (e); } } //帮助多项返回 public bool RefreshViewMul() { try {// Pub_Control.frmHlpInfo ofrm = new Pub_Control.frmHlpInfo(); // string sSQL = SQLName; //编辑ofrm ofrm.sTitle = MvarReportTitle; ofrm.sBill = "h_v_CLD_Material"; ofrm.txtFindInfo.Text = WherePart; ofrm.sOtherItem = ""; //编辑 ofrm.grdShow.RowTemplate.Height = 20; ofrm.ShowDialog(); //得到对应列 // if (ofrm.OKTag == Pub_Class.ClsPub.Enum_OKTag.OKTag_OK) { if (ofrm.grdShow.SelectedRows == null) { return false; } else { omodelList.Clear(); for (int r = 0; r < ofrm.grdShow.SelectedRows.Count; r++) { omodel = new Model.ClsCLD_Material_Model(); this.omodel.HItemID = Pub_Class.ClsPub.isLong(ofrm.grdShow.Rows[ofrm.grdShow.SelectedRows[r].Index].Cells[0].Value); this.omodel.HNumber = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.SelectedRows[r].Index].Cells[1].Value); this.omodel.HName = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.SelectedRows[r].Index].Cells[2].Value); this.omodel.HModel = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.SelectedRows[r].Index].Cells[3].Value); this.omodel.HUnitID = DBUtility.ClsPub.isLong(ofrm.grdShow.Rows[ofrm.grdShow.SelectedRows[r].Index].Cells[6].Value.ToString()); this.omodel.HUnitNumber = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.SelectedRows[r].Index].Cells[4].Value); this.omodel.HUnitName = DBUtility.ClsPub.isStrNull(ofrm.grdShow.Rows[ofrm.grdShow.SelectedRows[r].Index].Cells[5].Value); omodelList.Add(omodel); } } } else { return false; } // ofrm.Dispose(); ofrm = null; // return true; } catch (Exception e) { throw (e); } } } }