Пример #1
0
        public static bool DeleteSubSellOrder(string IDs, string OrderNos)
        {
            ArrayList lstDelete = new ArrayList();

            SqlCommand deletePri = SubSellOrderDBHelper.DeleteSubSellOrder(IDs);

            lstDelete.Add(deletePri);

            SqlCommand deleteDeteil = SubSellOrderDBHelper.DeleteSubSellOrderDetail(OrderNos);

            lstDelete.Add(deleteDeteil);

            //获取登陆用户信息
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            //定义返回变量
            bool isSucc = false;

            /*
             * 定义日志内容变量
             * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
             * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
             */

            //执行插入操作
            try
            {
                isSucc = SqlHelper.ExecuteTransWithArrayList(lstDelete);
            }
            catch (Exception ex)
            {
                //输出日志
                WriteSystemLog(userInfo, ex);
            }
            //定义变量
            string remark;

            //成功时
            if (isSucc)
            {
                //设置操作成功标识
                remark = ConstUtil.LOG_PROCESS_SUCCESS;
            }
            else
            {
                //设置操作成功标识
                remark = ConstUtil.LOG_PROCESS_FAILED;
            }

            //获取删除的编号列表
            string[] noList = OrderNos.Split(',');
            //遍历所有编号,登陆操作日志
            for (int i = 0; i < noList.Length; i++)
            {
                //获取编号
                string no = noList[i];
                //替换两边的 '
                no = no.Replace("'", string.Empty);

                //操作日志
                LogInfoModel logModel = InitLogInfo(no);
                //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
                logModel.Element = ConstUtil.LOG_PROCESS_DELETE;
                //设置操作成功标识
                logModel.Remark = remark;

                //登陆日志
                LogDBHelper.InsertLog(logModel);
            }
            return(isSucc);
        }
Пример #2
0
        public static bool UpdateSubSellOrder(SubSellOrderModel SubSellOrderM, List <SubSellOrderDetailModel> SubSellOrderDetailMList, Hashtable htExtAttr)
        {
            ArrayList lstUpdate = new ArrayList();
            //更新主表
            SqlCommand UpdatePri = SubSellOrderDBHelper.UpdateSubSellOrder(SubSellOrderM);

            lstUpdate.Add(UpdatePri);

            // 更新扩展属性
            SqlCommand commExtAttr = SubSellOrderDBHelper.UpdateExtAttr(SubSellOrderM, htExtAttr);

            if (commExtAttr != null)
            {
                lstUpdate.Add(commExtAttr);
            }

            //删除明细
            SqlCommand DeleteDetail = SubSellOrderDBHelper.DeleteSubSellOrderDetail(SubSellOrderM.OrderNo);

            lstUpdate.Add(DeleteDetail);
            //新增明细
            foreach (SubSellOrderDetailModel SubSellOrderDetailM in SubSellOrderDetailMList)
            {
                SqlCommand AddDetail = SubSellOrderDBHelper.InsertSubSellOrderDetail(SubSellOrderDetailM);
                lstUpdate.Add(AddDetail);
            }

            //获取登陆用户信息
            UserInfoUtil userInfo = (UserInfoUtil)SessionUtil.Session["UserInfo"];
            //定义返回变量
            bool isSucc = false;

            /*
             * 定义日志内容变量
             * 增删改相关的日志,需要输出操作日志,该类型日志插入到数据库
             * 其他的 如出现异常时,需要输出系统日志,该类型日志保存到日志文件
             */

            //执行插入操作
            try
            {
                isSucc = SqlHelper.ExecuteTransWithArrayList(lstUpdate);
            }
            catch (Exception ex)
            {
                //输出日志
                WriteSystemLog(userInfo, ex);
            }
            //定义变量
            string remark;

            //成功时
            if (isSucc)
            {
                //设置操作成功标识
                remark = ConstUtil.LOG_PROCESS_SUCCESS;
            }
            else
            {
                //设置操作成功标识
                remark = ConstUtil.LOG_PROCESS_FAILED;
            }

            LogInfoModel logModel = InitLogInfo(SubSellOrderM.OrderNo);

            //涉及关键元素 这个需要根据每个页面具体设置,本页面暂时设置为空
            logModel.Element = ConstUtil.LOG_PROCESS_UPDATE;
            //设置操作成功标识
            logModel.Remark = remark;

            //登陆日志
            LogDBHelper.InsertLog(logModel);
            return(isSucc);
        }