Exemple #1
0
        internal void AddNewCable(CableVO p)
        {
            int ID = new DBProduct().AddNewProduct(p);

            DA.InsertCommand.Parameters.Clear();
            DA.InsertCommand.Parameters.AddWithValue("ID", ID);
            DA.InsertCommand.Parameters.AddWithValue("CABLENAME", p.WPName);
            DA.InsertCommand.Parameters.AddWithValue("IDCATEGORY", p.IDCat);
            DA.InsertCommand.Parameters.AddWithValue("IDSUBCAT", p.IDSubCat);
            DA.InsertCommand.Parameters.AddWithValue("DECNUM", p.DecNum);
            DA.InsertCommand.Parameters.AddWithValue("DIMENSIONALDRAWING", ((object)p.DIMENDRAWING) ?? DBNull.Value);
            DA.InsertCommand.Parameters.AddWithValue("MECHPARTS", ((object)p.MECHPARTS) ?? DBNull.Value);
            DA.InsertCommand.Parameters.AddWithValue("CLENGTH", p.CLENGTH);
            DA.InsertCommand.Parameters.AddWithValue("CONNECTORS", p.CONECTORS);
            DA.InsertCommand.Parameters.AddWithValue("NOTE", p.NOTE);
            DA.InsertCommand.Parameters.AddWithValue("CREATED", DateTime.Now);

            //wp.ZHGUTS = new DBZhgutList().GetPackageForVO(wp.ID);
            /////////////////////////////////////////////////////////////////////////////////    ЗАПРЕЩЕНО НАПОЛНЯТЬ ЖГУТЫ КОГДА СОЗДАЁШЬ ИЗДЕЛИЕ!!!!!!!!!!!!!!!!!
            //wp.CABLES = new DBCableList().GetPackageForVO(wp.ID);

            DA.InsertCommand.CommandText = "insert into " + Base.BaseName + "..CABLELIST " +
                                           " (ID,CABLENAME,IDCATEGORY,IDSUBCAT,DECNUM,DIMENSIONALDRAWING,MECHPARTS,CLENGTH,CONNECTORS, " +
                                           " NOTE,CREATED)      " +
                                           " values (@ID,@CABLENAME,@IDCATEGORY,@IDSUBCAT,@DECNUM,@DIMENSIONALDRAWING,@MECHPARTS,@CLENGTH,@CONNECTORS, " +
                                           " @NOTE,@CREATED)      ";
            DA.InsertCommand.Connection.Open();
            DA.InsertCommand.ExecuteNonQuery();
            DA.InsertCommand.Connection.Close();
        }
Exemple #2
0
        public List <CableVO> GetPackageForVO(int IDWP)
        {
            DA.SelectCommand.Parameters.AddWithValue("IDWP", IDWP);
            DA.SelectCommand.CommandText = " select A.IDCABLE id,A.ID nn,B.CABLENAME name,A.CNT " +
                                           " from " + Base.BaseName + "..CABLES A " +
                                           " left join " + Base.BaseName + "..CABLELIST B ON B.ID = A.IDCABLE " +
                                           "  where IDWP = @IDWP ";
            DA.Fill(DS, "t");
            List <CableVO> ret = new List <CableVO>();

            foreach (DataRow r in DS.Tables["t"].Rows)
            {
                ret.Add(CableVO.GetCableVOByID((int)r["id"]));
            }

            return(ret);
        }
Exemple #3
0
        public static IProduct Create(int ID, string WPTYPE)
        {
            switch (WPTYPE)
            {
            case "WPNAMELIST":
                return(WPNameVO.WPNameVOByID(ID));

            case "ZHGUTLIST":
                return(ZhgutVO.GetZhgutVOByID(ID));

            case "CABLELIST":
                return(CableVO.GetCableVOByID(ID));
            }
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("Неизвестный тип продукта : \"{0}\"!", WPTYPE);

            throw new Exception(sb.ToString());
        }
Exemple #4
0
        internal CableVO GetCableVOByID(int ID)
        {
            DA.SelectCommand.Parameters.AddWithValue("ID", ID);
            DA.SelectCommand.CommandText = " select * from " + Base.BaseName + "..CABLELIST where ID = @ID ";
            DA.Fill(DS, "t");
            DataRow r   = DS.Tables["t"].Rows[0];
            CableVO CVO = new CableVO();

            CVO.ID           = (int)r["ID"];
            CVO.WPName       = r["CABLENAME"].ToString();
            CVO.IDCat        = (int)r["IDCATEGORY"];
            CVO.IDSubCat     = (r["IDSUBCAT"] == DBNull.Value) ? 0 : (int)r["IDSUBCAT"];
            CVO.DecNum       = r["DECNUM"].ToString();
            CVO.DIMENDRAWING = r["DIMENSIONALDRAWING"].ToString();
            CVO.MECHPARTS    = r["MECHPARTS"].ToString();
            CVO.CONECTORS    = r["CONNECTORS"].ToString();
            CVO.CLENGTH      = r["CLENGTH"].ToString();
            CVO.NOTE         = r["NOTE"].ToString();
            CVO.WPType       = WPTYPE.CABLELIST;
            return(CVO);
        }
Exemple #5
0
        internal void EditCable(CableVO p)
        {
            DA.UpdateCommand.Parameters.Clear();
            DA.UpdateCommand.Parameters.AddWithValue("CABLENAME", p.WPName);
            DA.UpdateCommand.Parameters.AddWithValue("IDCATEGORY", p.IDCat);
            DA.UpdateCommand.Parameters.AddWithValue("IDSUBCAT", p.IDSubCat);
            DA.UpdateCommand.Parameters.AddWithValue("DECNUM", p.DecNum);
            DA.UpdateCommand.Parameters.AddWithValue("DIMENSIONALDRAWING", ((object)p.DIMENDRAWING) ?? DBNull.Value);
            DA.UpdateCommand.Parameters.AddWithValue("MECHPARTS", ((object)p.MECHPARTS) ?? DBNull.Value);
            DA.UpdateCommand.Parameters.AddWithValue("CLENGTH", p.CLENGTH);
            DA.UpdateCommand.Parameters.AddWithValue("CONNECTORS", p.CONECTORS);
            DA.UpdateCommand.Parameters.AddWithValue("NOTE", p.NOTE);
            DA.UpdateCommand.Parameters.AddWithValue("ID", p.ID);

            DA.UpdateCommand.CommandText = "update " + Base.BaseName + "..CABLELIST set CABLENAME  = @CABLENAME,IDCATEGORY = @IDCATEGORY,IDSUBCAT = @IDSUBCAT,DECNUM = @DECNUM, " +
                                           " DIMENSIONALDRAWING=@DIMENSIONALDRAWING, MECHPARTS=@MECHPARTS, " +
                                           " CLENGTH=@CLENGTH, CONNECTORS=@CONNECTORS," +
                                           " NOTE = @NOTE   " +
                                           " where ID = @ID";
            DA.UpdateCommand.Connection.Open();
            DA.UpdateCommand.ExecuteNonQuery();
            DA.UpdateCommand.Connection.Close();
        }
Exemple #6
0
        void IProduct.FillTableLayoutPanel(TableLayoutPanel TLP, IRole UVO)
        {
            CableVO wp = (CableVO)this;

            TextBox    tb  = new TextBox();
            DBCategory dbc = new DBCategory("CABLELIST");

            tb.Text     = dbc.GetName(wp.IDCat);
            tb.Anchor   = AnchorStyles.Left | AnchorStyles.Right;
            tb.ReadOnly = true;
            tb.Dock     = DockStyle.Fill;
            UIWorks.AddToTLP(TLP, "Категория", tb);

            tb = new TextBox();
            DBSubCategory dbsc = new DBSubCategory();

            tb.Text     = dbsc.GetName(wp.IDSubCat);
            tb.Anchor   = AnchorStyles.Left | AnchorStyles.Right;
            tb.ReadOnly = true;
            tb.Dock     = DockStyle.Fill;
            UIWorks.AddToTLP(TLP, "Подкатегория", tb);

            PathField pf = new PathField();

            pf.Tag = Roles.Inzhener;
            pf.Init(wp.DIMENDRAWING, true, false, false, true, Roles.Inzhener, "VIEWONLY", UVO, "DIMENSIONALDRAWING_CABLE", null, wp);
            pf.bDelVisible     = false;
            pf.bPathVisible    = false;
            pf.tbPath.Width   += 150;
            pf.tbPath.Dock     = DockStyle.Fill;
            pf.Dock            = DockStyle.Fill;
            pf.bRemark.Visible = false;

            UIWorks.AddToTLP(TLP, "Сборочный чертёж", pf);

            pf     = new PathField();
            pf.Tag = Roles.Inzhener;
            pf.Init(wp.MECHPARTS, true, false, false, true, Roles.Inzhener, "VIEWONLY", UVO, "MECHPARTS_CABLE", null, wp);
            pf.bDelVisible     = false;
            pf.bPathVisible    = false;
            pf.tbPath.Width   += 150;
            pf.tbPath.Dock     = DockStyle.Fill;
            pf.Dock            = DockStyle.Fill;
            pf.bRemark.Visible = false;

            UIWorks.AddToTLP(TLP, "Проект мех. деталей", pf);

            tb          = new TextBox();
            tb.Text     = wp.CONECTORS;
            tb.Anchor   = AnchorStyles.Left | AnchorStyles.Right;
            tb.ReadOnly = true;
            tb.Dock     = DockStyle.Fill;
            UIWorks.AddToTLP(TLP, "Соединители", tb);

            tb          = new TextBox();
            tb.Text     = wp.CLENGTH;
            tb.Anchor   = AnchorStyles.Left | AnchorStyles.Right;
            tb.ReadOnly = true;
            tb.Dock     = DockStyle.Fill;
            UIWorks.AddToTLP(TLP, "Длина", tb);
        }