예제 #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Hownet.Model.Deparment> DataTableToList(DataTable dt)
        {
            List <Hownet.Model.Deparment> modelList = new List <Hownet.Model.Deparment>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Hownet.Model.Deparment model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.Deparment();
                    if (dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    else
                    {
                        model.ID = 0;
                    }
                    model.Name   = dt.Rows[n]["Name"].ToString();
                    model.Remark = dt.Rows[n]["Remark"].ToString();
                    model.Sn     = dt.Rows[n]["Sn"].ToString();
                    if (dt.Rows[n]["IsEnd"].ToString() != "")
                    {
                        model.IsEnd = int.Parse(dt.Rows[n]["IsEnd"].ToString());
                    }
                    else
                    {
                        model.IsEnd = 0;
                    }
                    if (dt.Rows[n]["TypeID"].ToString() != "")
                    {
                        model.TypeID = int.Parse(dt.Rows[n]["TypeID"].ToString());
                    }
                    else
                    {
                        model.TypeID = 0;
                    }
                    if (dt.Rows[n]["ParentID"].ToString() != "")
                    {
                        model.ParentID = int.Parse(dt.Rows[n]["ParentID"].ToString());
                    }
                    else
                    {
                        model.ParentID = 0;
                    }
                    if (dt.Rows[n]["CountEmployee"].ToString() != "")
                    {
                        model.CountEmployee = int.Parse(dt.Rows[n]["CountEmployee"].ToString());
                    }
                    model.A = int.Parse(dt.Rows[n]["A"].ToString());
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
예제 #2
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(Hownet.Model.Deparment model)
 {
     dal.Update(model);
 }
예제 #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hownet.Model.Deparment model)
 {
     return(dal.Add(model));
 }
예제 #4
0
        /// <param name="t">真为审核入库,假为弃审出库</param>
        public bool VerifyStock(int MainID, int PackID, bool t, int VerifyMan)
        {
            try
            {
                Hownet.BLL.StockBack     bllSB  = new StockBack();
                Hownet.BLL.StockBackInfo bllSBI = new StockBackInfo();
                Hownet.BLL.Repertory     bllRep = new Repertory();
                Hownet.BLL.Deparment     bllDep = new Deparment();

                Hownet.BLL.PackAmount   bllPA  = new PackAmount();
                Hownet.BLL.MaterielList bllML  = new MaterielList();
                Hownet.BLL.Materiel     bllMat = new Materiel();

                Hownet.Model.PackAmount    modPA  = new Hownet.Model.PackAmount();
                Hownet.Model.MaterielList  modML  = new Hownet.Model.MaterielList();
                Hownet.Model.StockBack     modSB  = bllSB.GetModel(MainID);
                Hownet.Model.StockBackInfo modSBI = new Hownet.Model.StockBackInfo();
                Hownet.Model.Repertory     modRep = new Hownet.Model.Repertory();
                Hownet.Model.Deparment     modDep = bllDep.GetModel(PackID);


                List <Hownet.Model.StockBackInfo> li = bllSBI.DataTableToList(bllSBI.GetList("(MainID=" + MainID + ")").Tables[0]);

                modPA.DepartmentID = PackID;
                for (int i = 0; i < li.Count; i++)
                {
                    modRep.BrandID      = modPA.BrandID = modML.BrandID = li[i].BrandID;
                    modRep.ColorID      = modPA.ColorID = modML.ColorID = li[i].ColorID;
                    modRep.ColorOneID   = modPA.ColorOneID = modML.ColorOneID = li[i].ColorOneID;
                    modRep.ColorTwoID   = modPA.ColorTwoID = modML.ColorTwoID = li[i].ColorTwoID;
                    modRep.SizeID       = modPA.SizeID = modML.SizeID = li[i].SizeID;
                    modRep.MaterielID   = modPA.MaterielID = modML.MaterielID = li[i].MaterielID;
                    modRep.MeasureID    = modPA.MeasureID = modML.MeasureID = bllMat.GetModel(li[i].MaterielID).MeasureID;
                    modRep.PlanID       = modPA.PlanID = 0;
                    modRep.Remark       = modPA.Remark = string.Empty;
                    modRep.DepartmentID = modPA.DepartmentID = modSB.DepotID;
                    modRep.Amount       = modPA.Amount = li[i].Amount;
                    modSBI = bllSBI.GetModel(li[i].StockInfoID);
                    if (modSBI != null)
                    {
                        if (t)
                        {
                            modSBI.NotAmount -= li[i].Amount;
                        }
                        else
                        {
                            modSBI.NotAmount += li[i].Amount;
                        }
                        bllSBI.Update(modSBI);
                    }
                    if (li[i].MListID == 0)
                    {
                        modRep.MListID = modPA.MListID = li[i].MListID = bllML.GetID(modML);
                        bllSBI.Update(li[i]);
                    }
                    else
                    {
                        modRep.MListID = modPA.MListID = li[i].MListID;
                    }
                    if (modDep.TypeID == 39)
                    {
                        bllPA.InOrOut(modPA, t);
                    }
                    else if (modDep.TypeID == 42)
                    {
                        bllRep.InOrOut(modRep, t);
                    }
                }
                if (t)
                {
                    modSB.IsVerify   = 3;
                    modSB.VerifyDate = DateTime.Today;
                    modSB.VerifyMan  = VerifyMan;
                }
                else
                {
                    modSB.IsVerify   = 1;
                    modSB.VerifyDate = DateTime.Parse("1900-1-1");
                    modSB.VerifyMan  = 0;
                }
                bllSB.Update(modSB);
                return(true);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }