示例#1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <Ajax.Model.InvoiceType> DataTableToList(DataTable dt)
        {
            List <Ajax.Model.InvoiceType> modelList = new List <Ajax.Model.InvoiceType>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                Ajax.Model.InvoiceType model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new Ajax.Model.InvoiceType();
                    if (dt.Rows[n]["ID"] != null && dt.Rows[n]["ID"].ToString() != "")
                    {
                        model.ID = dt.Rows[n]["ID"].ToString();
                    }
                    if (dt.Rows[n]["Name"] != null && dt.Rows[n]["Name"].ToString() != "")
                    {
                        model.Name = dt.Rows[n]["Name"].ToString();
                    }
                    if (dt.Rows[n]["Standard"] != null && dt.Rows[n]["Standard"].ToString() != "")
                    {
                        model.Standard = dt.Rows[n]["Standard"].ToString();
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
示例#2
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<Ajax.Model.InvoiceType> DataTableToList(DataTable dt)
 {
     List<Ajax.Model.InvoiceType> modelList = new List<Ajax.Model.InvoiceType>();
     int rowsCount = dt.Rows.Count;
     if (rowsCount > 0)
     {
         Ajax.Model.InvoiceType model;
         for (int n = 0; n < rowsCount; n++)
         {
             model = new Ajax.Model.InvoiceType();
             if(dt.Rows[n]["ID"]!=null && dt.Rows[n]["ID"].ToString()!="")
             {
             model.ID=dt.Rows[n]["ID"].ToString();
             }
             if(dt.Rows[n]["Name"]!=null && dt.Rows[n]["Name"].ToString()!="")
             {
             model.Name=dt.Rows[n]["Name"].ToString();
             }
             if(dt.Rows[n]["Standard"]!=null && dt.Rows[n]["Standard"].ToString()!="")
             {
             model.Standard=dt.Rows[n]["Standard"].ToString();
             }
             modelList.Add(model);
         }
     }
     return modelList;
 }
示例#3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(Ajax.Model.InvoiceType model)
 {
     using (DBHelper db = DBHelper.Create())
     {
         db.Insert <InvoiceType>(model);
     }
 }
示例#4
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Ajax.Model.InvoiceType model)
 {
     using (DBHelper db = DBHelper.Create())
     {
         db.Update <InvoiceType>(model);
         return(true);
     }
 }
示例#5
0
 /// <summary>
 /// 新增票据分类
 /// </summary>
 /// <param name="IType"></param>
 /// <returns></returns>
 public ActionResult AddInvoiceType(InvoiceType IType)
 {
     AjaxResult result = new AjaxResult();
     IType.ID = Guid.NewGuid().ToString("N");
     try
     {
         new InvoiceTypeRule().Add(IType);
         result.Success = true;
         result.Message = "添加成功。";
     }
     catch (Exception ex)
     {
         result.Success = false;
         result.Message = "error:" + ex.Message;
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
示例#6
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List<InvoiceType> GetList(InvoiceType IType)
 {
     List<InvoiceType> list = new List<InvoiceType>();
     StringBuilder strWhereSql = new StringBuilder();
     Dictionary<string, object> paramList = new Dictionary<string, object>();
     if (IType != null)
     {
         if (!string.IsNullOrEmpty(IType.ID))
         {
             strWhereSql.Append(" and ID=@ID ");
             paramList.Add("ID", IType.ID);
         }
         if (!string.IsNullOrEmpty(IType.Name))
         {
             strWhereSql.Append(" and Standard=@Standard ");
             paramList.Add("Standard", IType.Standard);
         }
     }
     using (DBHelper db = DBHelper.Create())
     {
         list = db.GetList<InvoiceType>(strWhereSql.ToString(), paramList, "ID", "");
     }
     return list;
 }
示例#7
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 public List <Ajax.Model.InvoiceType> GetList(Ajax.Model.InvoiceType IType)
 {
     return(dal.GetList(IType));
 }
示例#8
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Ajax.Model.InvoiceType model)
 {
     return(dal.Update(model));
 }
示例#9
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(Ajax.Model.InvoiceType model)
 {
     dal.Add(model);
 }
示例#10
0
 /// <summary>
 /// 新增票据分类
 /// </summary>
 /// <param name="IType"></param>
 /// <returns></returns>
 public ActionResult EditInvoiceType(InvoiceType IType)
 {
     AjaxResult result = new AjaxResult();
     if (!string.IsNullOrEmpty(IType.ID))
     {
         result.Success = new InvoiceTypeRule().Update(IType);
         result.Message = result.Success ? "修改成功。" : "修改失败";
     }
     return Json(result, JsonRequestBehavior.AllowGet);
 }
示例#11
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="param"></param>
 /// <param name="IType"></param>
 /// <param name="itemCount"></param>
 /// <returns></returns>
 public List<object> Search(EasyUIGridParamModel param, InvoiceType IType, out int itemCount)
 {
     return dal.Search(param,IType,out itemCount);
 }
示例#12
0
 /// <summary>
 /// search一览
 /// </summary>
 /// <param name="param"></param>
 /// <param name="IType"></param>
 /// <param name="itemCount"></param>
 /// <returns></returns>
 public List<object> Search(EasyUIGridParamModel param, InvoiceType IType, out int itemCount)
 {
     List<object> list = new List<object>();
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select * from T_InvoiceType where 1=1");
     Dictionary<string, object> paramList = new Dictionary<string, object>();
     if (IType != null)
     {
         if (!string.IsNullOrEmpty(IType.ID))
         {
             strSql.Append(" and ID=@ID ");
             paramList.Add("ID", IType.ID);
         }
         if (!string.IsNullOrEmpty(IType.Name))
         {
             strSql.Append(" and Standard=@Standard ");
             paramList.Add("Standard", IType.Standard);
         }
     }
     using (DBHelper db = DBHelper.Create())
     {
         int pageIndex = Convert.ToInt32(param.page) - 1;
         int pageSize = Convert.ToInt32(param.rows);
         itemCount = db.GetCount(string.Format(DBHelper.StrGetCountSql,strSql.ToString()), paramList);
         list = db.GetDynaminObjectList(strSql.ToString(), pageIndex, pageSize, "ID", paramList);
     }
     return list;
 }