Пример #1
0
        public static void addQcCheckHead(TC_QCY_FILE model, string qcx06)
        {
            //开启事务管理1.添加记录。2.添加 tc_qcz_file 。
            using (TransactionScope sc = new TransactionScope())
            {
                try
                {
                    //1.添加
                    Tcqcys.AddModel(model);
                    //2.添加 tc_qcz_file

                    List <TC_QCX_FILE> qcxlist = Tcqcxs.GetList(qcx06, 0);

                    foreach (TC_QCX_FILE qcx in qcxlist)
                    {
                        TC_QCZ_FILE qcz = new TC_QCZ_FILE();

                        qcz.TC_QCZ01 = model.TC_QCY01;
                        qcz.TC_QCZ02 = qcx.TC_QCX02;
                        qcz.TC_QCZ05 = qcx.TC_QCX01;
                        qcz.TC_QCZ07 = qcx.TC_QCX07;
                        qcz.TC_QCZ06 = qcx.TC_QCX03;
                        qcz.TC_QCZ09 = qcx.TC_QCX04;

                        Tcqczs.AddModel(qcz);
                    }
                    //事务提交
                    sc.Complete();
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }
Пример #2
0
        public static void reloadqcz(string qcz01)
        {
            //开启事务管理1.添加记录。2.添加 tc_qcz_file 。
            using (TransactionScope sc = new TransactionScope())
            {
                try
                {
                    //1.删除记录
                    Tcqczs.DeleteModel(qcz01);

                    //2.添加记录
                    string             qcx06   = qcz01.Substring(0, qcz01.IndexOf('-'));
                    List <TC_QCX_FILE> qcxlist = Tcqcxs.GetList(qcx06, 0);

                    foreach (TC_QCX_FILE qcx in qcxlist)
                    {
                        TC_QCZ_FILE qcz = new TC_QCZ_FILE();

                        qcz.TC_QCZ01 = qcz01;
                        qcz.TC_QCZ02 = qcx.TC_QCX02;
                        qcz.TC_QCZ05 = qcx.TC_QCX01;
                        qcz.TC_QCZ06 = qcx.TC_QCX03;
                        qcz.TC_QCZ07 = qcx.TC_QCX07;
                        qcz.TC_QCZ09 = qcx.TC_QCX04;

                        Tcqczs.AddModel(qcz);
                    }
                    //事务提交
                    sc.Complete();
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }
Пример #3
0
        public static bool deleteQcy(string sid)
        {
            bool returnValue = false;

            //开启事务管理1.添加记录。2.添加 tc_qcz_file 。
            using (TransactionScope sc = new TransactionScope())
            {
                try
                {
                    //1.删除记录
                    Tcqcys.DeleteModel(sid);
                    //2.删除子记录
                    Tcqczs.DeleteModel(sid);
                    //事务提交
                    sc.Complete();
                    returnValue = true;
                }
                catch (Exception)
                {
                    returnValue = false;
                }
            }
            return(returnValue);
        }