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

            if (rowsCount > 0)
            {
                Hownet.Model.Bas_KJKM model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Hownet.Model.Bas_KJKM();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = int.Parse(dt.Rows[n]["ID"].ToString());
                    }
                    if (dt.Rows[n]["Orders"] != null && dt.Rows[n]["Orders"].ToString() != "")
                    {
                        model.Orders = int.Parse(dt.Rows[n]["Orders"].ToString());
                    }
                    model.Num  = dt.Rows[n]["Num"].ToString();
                    model.Name = dt.Rows[n]["Name"].ToString();
                    if (dt.Rows[n]["ParentID"] != null && dt.Rows[n]["ParentID"].ToString() != "")
                    {
                        model.ParentID = int.Parse(dt.Rows[n]["ParentID"].ToString());
                    }
                    model.Remark = dt.Rows[n]["Remark"].ToString();
                    if (dt.Rows[n]["Money"] != null && dt.Rows[n]["Money"].ToString() != "")
                    {
                        model.Money = decimal.Parse(dt.Rows[n]["Money"].ToString());
                    }
                    if (dt.Rows[n]["CompanyID"] != null && dt.Rows[n]["CompanyID"].ToString() != "")
                    {
                        model.CompanyID = int.Parse(dt.Rows[n]["CompanyID"].ToString());
                    }
                    if (dt.Rows[n]["DebitMoney"] != null && dt.Rows[n]["DebitMoney"].ToString() != "")
                    {
                        model.DebitMoney = decimal.Parse(dt.Rows[n]["DebitMoney"].ToString());
                    }
                    if (dt.Rows[n]["CreditMoney"] != null && dt.Rows[n]["CreditMoney"].ToString() != "")
                    {
                        model.CreditMoney = decimal.Parse(dt.Rows[n]["CreditMoney"].ToString());
                    }
                    if (dt.Rows[n]["MoneyType"] != null && dt.Rows[n]["MoneyType"].ToString() != "")
                    {
                        model.MoneyType = int.Parse(dt.Rows[n]["MoneyType"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Esempio n. 2
0
        public void InKJKM()
        {
            List <Hownet.Model.Company> li = DataTableToList(GetAllList().Tables[0]);

            Hownet.BLL.Bas_KJKM   bllKJ = new Bas_KJKM();
            Hownet.BLL.CompanyLog bllCL = new CompanyLog();
            Hownet.Model.Bas_KJKM modKJ;

            for (int i = 0; i < li.Count; i++)
            {
                if (bllKJ.GetList("(CompanyID=" + li[i].ID + ")").Tables[0].Rows.Count == 0)
                {
                    modKJ           = new Hownet.Model.Bas_KJKM();
                    modKJ.A         = 0;
                    modKJ.CompanyID = li[i].ID;
                    modKJ.ID        = 0;
                    modKJ.Money     = bllCL.GetLastMoney(li[i].ID);
                    modKJ.Name      = li[i].Name;
                    modKJ.Num       = string.Empty;
                    if (li[i].TypeID == 1)//客户
                    {
                        modKJ.Num      = bllKJ.GetMaxNum(1122).ToString();
                        modKJ.ParentID = 1122;
                    }
                    else if (li[i].TypeID == 2 || li[i].TypeID == 3)
                    {
                        modKJ.Num      = bllKJ.GetMaxNum(2202).ToString();
                        modKJ.ParentID = 2202;
                    }
                    if (modKJ.Num != string.Empty)
                    {
                        modKJ.Orders = bllKJ.GetMaxOrders() + 1;
                        modKJ.Remark = string.Empty;
                        bllKJ.Add(modKJ);
                    }
                }
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Hownet.Model.Bas_KJKM model)
 {
     return(dal.Update(model));
 }
Esempio n. 4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Hownet.Model.Bas_KJKM model)
 {
     return(dal.Add(model));
 }