Ejemplo n.º 1
0
 /// <summary>
 /// 创建实例
 /// </summary>
 /// <param name="dbtype"></param>
 public void InitDAL(DBSettingCompare setting)
 {
     IninSourceDAL(setting.Source);
     IninTargetDAL(setting.Target);
     IninDefinitionDAL(setting.Definition);
 }
Ejemplo n.º 2
0
        private Boolean SetSettingModel()
        {
            #region 校验
            ListItem liSource = (ListItem)cbSource.SelectedItem;
            ListItem liTarget = (ListItem)cbTarget.SelectedItem;
            if (liSource.Value == "-1")
            {
                MessageBox.Show("请选择源数据库", "提示", MessageBoxButtons.OK);
                return(false);
            }
            if (liTarget.Value == "-1")
            {
                MessageBox.Show("请选择目标数据库", "提示", MessageBoxButtons.OK);
                return(false);
            }
            string SourceVal = liSource.Value.Split('&')[0];
            string TargetVal = liTarget.Value.Split('&')[0];
            if (SourceVal == TargetVal)
            {
                MessageBox.Show("请不要选择相同的源数据库和目标数据库进行比对", "提示", MessageBoxButtons.OK);
                return(false);
            }
            #endregion

            #region 业务类初始化
            DBSettingCompare setmodel = new DBSettingCompare();
            if (liSource.Value.IndexOf("Cache") > -1)
            {
                setmodel.Source.Flag = CommonConfig.DataType.XML;
                DataBaseModel db = setbll.GetDBSetDetail(SourceVal);
                setmodel.Source.XMLPath = db.RealPATH;
            }
            else
            {
                setmodel.Source.Flag = CommonConfig.DataType.DB;
                DataBaseModel db = setbll.GetDBSetDetail(SourceVal);
                setmodel.Source.DBAccount.DB   = db.DB;
                setmodel.Source.DBAccount.User = db.USER;
                setmodel.Source.DBAccount.Pwd  = db.PWD;
            }

            if (liTarget.Value.IndexOf("Cache") > -1)
            {
                setmodel.Target.Flag = CommonConfig.DataType.XML;
                DataBaseModel db = setbll.GetDBSetDetail(TargetVal);
                setmodel.Target.XMLPath = db.RealPATH;
            }
            else
            {
                setmodel.Target.Flag = CommonConfig.DataType.DB;
                DataBaseModel db = setbll.GetDBSetDetail(TargetVal);
                setmodel.Target.DBAccount.DB   = db.DB;
                setmodel.Target.DBAccount.User = db.USER;
                setmodel.Target.DBAccount.Pwd  = db.PWD;
            }
            setmodel.Definition = setmodel.Source;
            bll.InitDAL(setmodel);
            #endregion

            return(true);
        }