Beispiel #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);
                    }
                }
            }
        }
Beispiel #2
0
        public void SaveSizePart(DataTable dt, int TaskID)
        {
            Hownet.BLL.SizePart          bllSP = new SizePart();
            Hownet.BLL.SizeTable         bllSt = new SizeTable();
            Hownet.BLL.MaterielAttribute blMa  = new MaterielAttribute();
            Hownet.Model.SizeTable       modST = new Hownet.Model.SizeTable();
            ArrayList PartList = new ArrayList();
            ArrayList SizeList = new ArrayList();

            bllSt.DelTask(TaskID);
            PartList.Clear();
            SizeList.Clear();
            PartList.Add(0);
            SizeList.Add(0);
            for (int r = 1; r < dt.Rows.Count - 1; r++)
            {
                int partID = 0;
                if (dt.DefaultView[r]["Part"].ToString() != string.Empty)
                {
                    partID = bllSP.GetID(dt.DefaultView[r]["Part"].ToString());
                }
                PartList.Add(partID);
            }
            for (int c = 1; c < dt.Columns.Count; c++)
            {
                int sizeID = 0;
                if (dt.DefaultView[0][c].ToString() != string.Empty)
                {
                    sizeID = blMa.GetID(dt.DefaultView[0][c].ToString(), 2);
                }
                SizeList.Add(sizeID);
            }
            for (int r = 0; r < PartList.Count; r++)
            {
                if (PartList[r].ToString() != "0")
                {
                    for (int c = 0; c < SizeList.Count; c++)
                    {
                        if (SizeList[c].ToString() != "0")
                        {
                            if (dt.DefaultView[r][c].ToString() != string.Empty && dt.DefaultView[r][c].ToString() != "0")
                            {
                                modST.ProduceTaskID = TaskID;
                                modST.SizeID        = int.Parse(SizeList[c].ToString());
                                modST.SizePartID    = int.Parse(PartList[r].ToString());
                                modST.Length        = decimal.Parse(dt.DefaultView[r][c].ToString());
                                bllSt.Add(modST);
                            }
                        }
                    }
                }
            }
        }