Exemplo n.º 1
0
        public void SaveBow(DataTable dt, int TaskID)
        {
            Hownet.BLL.SizeBow           bllSB  = new SizeBow();
            Hownet.BLL.Materiel          bllMat = new Materiel();
            Hownet.BLL.MaterielAttribute blMa   = new MaterielAttribute();
            Hownet.Model.SizeBow         modSB  = new Hownet.Model.SizeBow();
            int sizeID = 0;

            modSB.ProduceTaskID = TaskID;
            for (int c = 1; c < dt.Columns.Count; c++)
            {
                if (dt.DefaultView[0][c].ToString() != string.Empty)
                {
                    sizeID       = blMa.GetID(dt.DefaultView[0][c].ToString(), 2);
                    modSB.SizeID = sizeID;
                    if (dt.DefaultView[2][c] != null && dt.DefaultView[2][c].ToString() != string.Empty)
                    {
                        modSB.BowID = bllMat.GetID(dt.DefaultView[2][c].ToString());
                    }
                    if (dt.DefaultView[1][c] != null && dt.DefaultView[2][c].ToString() != string.Empty)
                    {
                        modSB.CottonID = bllMat.GetID(dt.DefaultView[1][c].ToString());
                    }
                    modSB.SizeBowID = bllSB.SelectSize(TaskID, sizeID);
                    if (modSB.SizeBowID != 0)
                    {
                        bllSB.Update(modSB);
                    }
                    else
                    {
                        bllSB.Add(modSB);
                    }
                }
            }
        }