Beispiel #1
0
        /// <summary>
        /// 保存数据
        /// </summary>
        /// <param name="model"></param>
        /// <param name="list"></param>
        /// <returns></returns>
        public static bool SaveData(UnitGroupModel model, IList <UnitGroupDetailModel> list)
        {
            ArrayList sqlList = new ArrayList();

            if (!model.ID.HasValue)
            {// 新增
                sqlList.Add(UnitGroupDBHelper.InsertCommand(model));
            }
            else
            {// 修改
                sqlList.Add(UnitGroupDBHelper.UpdateCommand(model));
                sqlList.Add(UnitGroupDetailDBHelper.DeleteCommand(model.CompanyCD, model.GroupUnitNo));
            }
            foreach (UnitGroupDetailModel info in list)
            {
                sqlList.Add(UnitGroupDetailDBHelper.InsertCommand(info));
            }

            if (SqlHelper.ExecuteTransWithArrayList(sqlList))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #2
0
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="iD"></param>
        /// <param name="CompanyCD"></param>
        /// <param name="GroupUnitNo"></param>
        /// <returns></returns>
        public static bool DeleteData(int[] iD, string CompanyCD, string[] GroupUnitNo)
        {
            ArrayList sqlList = new ArrayList();

            for (int i = 0; i < iD.Length; i++)
            {
                sqlList.Add(UnitGroupDBHelper.DeleteCommand(iD[i]));
                if (i < GroupUnitNo.Length)
                {
                    sqlList.Add(UnitGroupDetailDBHelper.DeleteCommand(CompanyCD, GroupUnitNo[i]));
                }
            }
            if (SqlHelper.ExecuteTransWithArrayList(sqlList))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }