Exemplo n.º 1
0
        public void SaveExecConfirmData(SaveExecConfirmDataModel cecdm)
        {
            uRolePowerConfirmHistoryConfirmData urpchcd = new uRolePowerConfirmHistoryConfirmData
            {
                state = 0,
                uRolePowerConfirmHistorySn = cecdm.urpchSn,
                cTableName         = cecdm.tableName,
                execAction         = cecdm.execAction.ToString(),
                primaryColumnName  = cecdm.primaryColumnName,
                primaryColumnValue = cecdm.primaryColumnValue,
                primaryColumnType  = cecdm.primaryColumnType
            };

            db.uRolePowerConfirmHistoryConfirmData.Add(urpchcd);
            db.SaveChanges();
            if (cecdm.execAction != SaveExecConfirmDataModelActionEnum.Remove)
            {
                if (cecdm.cColumnName.Count() == cecdm.cColumnValue.Count() && cecdm.cColumnName.Count() == cecdm.cColumnType.Count())
                {
                    for (int i = 0; i < cecdm.cColumnName.Count(); i++)
                    {
                        uRolePowerConfirmHistoryConfirmDataDetail urpchcdd = new uRolePowerConfirmHistoryConfirmDataDetail
                        {
                            uRolePowerConfirmHistoryConfirmDataSn = urpchcd.urpchcdSn,
                            cColumnName  = cecdm.cColumnName[i],
                            cColumnValue = cecdm.cColumnValue[i],
                            cColumnType  = cecdm.cColumnType[i],
                            state        = 0
                        };
                        db.uRolePowerConfirmHistoryConfirmDataDetail.Add(urpchcdd);
                    }
                    db.SaveChanges();
                }
            }
        }
Exemplo n.º 2
0
        //MSIT116APEXEntities db = new MSIT116APEXEntities();

        public void ExecConfirmAction(MSIT116APEXEntities db, uRolePowerConfirmHistoryConfirmData urpchcd, T _entity)
        {
            IEnumerable <uRolePowerConfirmHistoryConfirmDataDetail> urpchcdds = db.uRolePowerConfirmHistoryConfirmDataDetail.Where(n => n.uRolePowerConfirmHistoryConfirmDataSn == urpchcd.urpchcdSn).ToList();

            if (urpchcd.execAction == SaveExecConfirmDataModelActionEnum.Create.ToString())
            {
                UseConfirmDataToAdd(db, urpchcdds, _entity);
            }
            if (urpchcd.execAction == SaveExecConfirmDataModelActionEnum.Remove.ToString())
            {
                db.Entry(_entity).State = EntityState.Deleted;
                urpchcd.state           = 1;
                foreach (var urpchcdd in urpchcdds)
                {
                    urpchcdd.state = 1;
                }
                db.SaveChanges();
            }
            if (urpchcd.execAction == SaveExecConfirmDataModelActionEnum.Update.ToString())
            {
                UseConfirmDataToUpdate(db, urpchcdds, _entity);
            }
        }