public ReturnValueInfo Save(IModelObject itemEntity, Common.DefineConstantValue.EditStateEnum EditMode)
 {
     ReturnValueInfo rvInfo = new ReturnValueInfo();
     try
     {
         switch (EditMode)
         {
             case Common.DefineConstantValue.EditStateEnum.OE_Insert:
                 rvInfo = this._IPreRechargeRecordDA.InsertRecord(itemEntity as PreRechargeRecord_prr_Info);
                 break;
             case Common.DefineConstantValue.EditStateEnum.OE_Update:
                 rvInfo = this._IPreRechargeRecordDA.UpdateRecord(itemEntity as PreRechargeRecord_prr_Info);
                 break;
             case Common.DefineConstantValue.EditStateEnum.OE_Delete:
                 rvInfo = this._IPreRechargeRecordDA.DeleteRecord(itemEntity);
                 break;
             default:
                 break;
         }
     }
     catch (Exception ex)
     {
         rvInfo.isError = true;
         rvInfo.messageText = ex.Message;
     }
     return rvInfo;
 }
        public PaymentUDMealState_pms_Info DisplayRecord(IModelObject KeyObject)
        {
            PaymentUDMealState_pms_Info displayInfo = KeyObject as PaymentUDMealState_pms_Info;

            if (displayInfo != null)
            {
                try
                {
                    using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
                    {
                        PaymentUDMealState_pms displayData = db.PaymentUDMealState_pms.FirstOrDefault(t => t.pms_cRecordID == displayInfo.pms_cRecordID);

                        if (displayData != null)
                        {
                            displayInfo = Common.General.CopyObjectValue<PaymentUDMealState_pms, PaymentUDMealState_pms_Info>(displayData);
                        }
                    }
                }
                catch (Exception Ex)
                {

                    throw Ex;
                }
            }

            return displayInfo;
        }
Beispiel #3
0
        public bool DeleteRecord(IModelObject KeyObject)
        {
            bool isSuccess = false;

            if (KeyObject != null)
            {
                MailConfig_mcf_Info deleteInfo = KeyObject as MailConfig_mcf_Info;

                try
                {
                    using (MainDBDataContext db = new MainDBDataContext())
                    {
                        MailConfig_mcf deleteData = db.MailConfig_mcf.FirstOrDefault(t => t.mcf_iRecordID == deleteInfo.mcf_iRecordID);

                        db.MailConfig_mcf.DeleteOnSubmit(deleteData);

                        db.SubmitChanges();

                        isSuccess = true;
                    }
                }
                catch (Exception Ex)
                {

                    throw Ex;
                }
            }

            return isSuccess;
        }
 public ReturnValueInfo Save(IModelObject itemEntity, Common.DefineConstantValue.EditStateEnum EditMode)
 {
     ReturnValueInfo rvInfo = new ReturnValueInfo();
     try
     {
         switch (EditMode)
         {
             case Common.DefineConstantValue.EditStateEnum.OE_Insert:
                 rvInfo = this._iDMDL.InsertRecord(itemEntity as DepartmentMaster_dpm_Info);
                 break;
             case Common.DefineConstantValue.EditStateEnum.OE_Update:
                 rvInfo = this._iDMDL.UpdateRecord(itemEntity as DepartmentMaster_dpm_Info);
                 break;
             case Common.DefineConstantValue.EditStateEnum.OE_Delete:
                 rvInfo = this._iDMDL.DeleteRecord(itemEntity);
                 break;
             case Common.DefineConstantValue.EditStateEnum.OE_ReaOnly:
                 break;
             default:
                 break;
         }
     }
     catch (Exception ex)
     {
         rvInfo.messageText = ex.Message;
         rvInfo.isError = true;
     }
     return rvInfo;
 }
Beispiel #5
0
        public MailConfig_mcf_Info DisplayRecord(IModelObject KeyObject)
        {
            MailConfig_mcf_Info displayInfo = null;

            if (KeyObject != null)
            {
                displayInfo = KeyObject as MailConfig_mcf_Info;

                try
                {
                    using (MainDBDataContext db = new MainDBDataContext())
                    {
                        MailConfig_mcf displayData = db.MailConfig_mcf.FirstOrDefault(t => t.mcf_iRecordID == displayInfo.mcf_iRecordID);

                        if (displayData != null)
                        {
                            displayInfo = Common.General.CopyObjectValue<MailConfig_mcf, MailConfig_mcf_Info>(displayData);
                        }
                    }
                }
                catch (Exception Ex)
                {

                    throw Ex;
                }
            }

            return displayInfo;
        }
        public ReturnValueInfo DeleteRecord(IModelObject KeyObject)
        {
            ReturnValueInfo returnInfo = new ReturnValueInfo(false);

            PaymentUDMealState_pms_Info deleteInfo = KeyObject as PaymentUDMealState_pms_Info;

            if (deleteInfo != null)
            {
                try
                {
                    using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
                    {
                        PaymentUDMealState_pms deleteData = db.PaymentUDMealState_pms.FirstOrDefault(t => t.pms_cRecordID == deleteInfo.pms_cRecordID);

                        if (deleteData != null)
                        {
                            db.PaymentUDMealState_pms.DeleteOnSubmit(deleteData);

                            db.SubmitChanges();

                            returnInfo.boolValue = true;
                        }
                    }
                }
                catch (Exception Ex)
                {

                    returnInfo.messageText = Ex.Message;
                }
            }

            return returnInfo;
        }
Beispiel #7
0
        public IdleStateMaster_ism_Info DisplayRecord(IModelObject KeyObject)
        {
            IdleStateMaster_ism_Info displayInfo = null;

            if (KeyObject != null)
            {
                displayInfo = KeyObject as IdleStateMaster_ism_Info;

                try
                {

                    IdleStateMaster_ism displayData = DBCtx.IdleStateMaster_ism.FirstOrDefault(t => t.ism_RecordID == displayInfo.ism_RecordID);

                    if (displayData != null)
                    {
                        displayInfo = Common.General.CopyObjectValue<IdleStateMaster_ism, IdleStateMaster_ism_Info>(displayData);
                    }

                }
                catch (Exception Ex)
                {

                    throw Ex;
                }
            }
            if (!UseTran)
            {
                DBCtx = null;
            }
            return displayInfo;
        }
Beispiel #8
0
        public bool DeleteRecord(IModelObject KeyObject)
        {
            bool isSuccess = false;

            if (KeyObject != null)
            {
                IdleStateMaster_ism_Info deleteInfo = KeyObject as IdleStateMaster_ism_Info;

                try
                {

                    IdleStateMaster_ism deleteData = DBCtx.IdleStateMaster_ism.FirstOrDefault(t => t.ism_RecordID == deleteInfo.ism_RecordID);

                    if (deleteData != null)
                    {
                        DBCtx.IdleStateMaster_ism.DeleteOnSubmit(deleteData);
                        DBCtx.SubmitChanges();

                        isSuccess = true;
                    }

                }
                catch (Exception Ex)
                {

                    throw Ex;
                }
            }
            if (!UseTran)
            {
                DBCtx = null;
            }
            return isSuccess;
        }
        public override void load(IModelObject mo)
        {
            const int DATAREADER_FLD_CODE = 0;
            const int DATAREADER_FLD_DESCR_GR = 1;
            const int DATAREADER_FLD_DESCR_EN = 2;

            TrainingCourse obj = (TrainingCourse)mo;
            obj.IsObjectLoading = true;

            if (!this.reader.IsDBNull(DATAREADER_FLD_CODE) ) {
                obj.PrCODE = this.reader.GetString(DATAREADER_FLD_CODE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_DESCR_GR) ) {
                obj.PrDescrGr = this.reader.GetString(DATAREADER_FLD_DESCR_GR);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_DESCR_EN) ) {
                obj.PrDescrEn = this.reader.GetString(DATAREADER_FLD_DESCR_EN);
            }

            obj.isNew = false;
            // since we've just loaded from database, we mark as "old"
            obj.isDirty = false;
            obj.IsObjectLoading = false;
            obj.afterLoad();

            return;
        }
Beispiel #10
0
        public CardUserMaster_cus_Info DisplayRecord(IModelObject itemEntity)
        {
            try
            {
                CardUserMaster_cus_Info userInfo = this._cardUserMasterDA.DisplayRecord(itemEntity);

                AddCardInfoToUser(userInfo);
                AddUserAccountInfo(userInfo);
                if (userInfo.cus_cIdentityNum == Common.DefineConstantValue.CodeMasterDefine.KEY2_SIOT_CardUserIdentity_Student)
                {
                    AddClassInfoToUser(userInfo);
                }
                else if (userInfo.cus_cIdentityNum == Common.DefineConstantValue.CodeMasterDefine.KEY2_SIOT_CardUserIdentity_Staff)
                {
                    AddDeptInfoToUser(userInfo);
                }

                return userInfo;
            }
            catch (Exception Ex)
            {

                throw Ex;
            }
        }
Beispiel #11
0
        public bool DeleteRecord(IModelObject KeyObject)
        {
            bool isSuccess = false;
            MixMaterialDetail_mmdl_Info info = new MixMaterialDetail_mmdl_Info();
            info = KeyObject as MixMaterialDetail_mmdl_Info;

            using (MainDBDataContext db = new MainDBDataContext())
            {
                MixMaterialDetail_mmdl delTab = null;
                if (info.mmdl_Id != new Guid())
                {
                    delTab = db.MixMaterialDetail_mmdl.SingleOrDefault(t => t.mmdl_Id == info.mmdl_Id);
                    if (delTab != null)
                    {
                        db.MixMaterialDetail_mmdl.DeleteOnSubmit(delTab);
                    }
                }
                else
                {
                    var del = db.MixMaterialDetail_mmdl.Where(t =>
                        (info.mmdl_cMaterialCode != null ? t.mmdl_cMaterialCode == info.mmdl_cMaterialCode : true)
                        && (info.mmdl_cMaterialGroupNo != null ? t.mmdl_cMaterialGroupNo == info.mmdl_cMaterialGroupNo : true)
                        );
                    db.MixMaterialDetail_mmdl.DeleteAllOnSubmit(del);
                }
                //if (info.mmdl_cMaterialGroupNo != null)
                //{
                //    var del = db.MixMaterialDetail_mmdl.Where(c => c.mmdl_cMaterialGroupNo == info.mmdl_cMaterialGroupNo);
                //    db.MixMaterialDetail_mmdl.DeleteAllOnSubmit(del);
                //}
                db.SubmitChanges();
                isSuccess = true;
            }
            return isSuccess;
        }
        public DepartmentMaster_dpm_Info DisplayRecord(IModelObject KeyObject)
        {
            DepartmentMaster_dpm_Info resInfo = null;
            DepartmentMaster_dpm_Info searchInfo = KeyObject as DepartmentMaster_dpm_Info;
            if (searchInfo == null)
            {
                return resInfo;
            }
            else
            {
                try
                {
                    using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
                    {
                        DepartmentMaster_dpm queryInfo = db.DepartmentMaster_dpm.Where(x => x.dpm_RecordID == searchInfo.dpm_RecordID).FirstOrDefault();
                        resInfo = Common.General.CopyObjectValue<DepartmentMaster_dpm, DepartmentMaster_dpm_Info>(queryInfo);
                    }
                }
                catch (Exception ex)
                {

                    throw ex;
                }
                return resInfo;
            }
        }
Beispiel #13
0
        public override void load(IModelObject mo)
        {
            const int DATAREADER_FLD_BANKID = 0;
            const int DATAREADER_FLD_BANKNAME = 1;
            const int DATAREADER_FLD_BANKCODE = 2;
            const int DATAREADER_FLD_BANKSWIFTCODE = 3;

            Bank obj = (Bank)mo;
            obj.IsObjectLoading = true;

            if (!this.reader.IsDBNull(DATAREADER_FLD_BANKID) ) {
                obj.PrBANKID = Convert.ToInt64(this.reader.GetInt32(DATAREADER_FLD_BANKID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_BANKNAME) ) {
                obj.PrBankName = this.reader.GetString(DATAREADER_FLD_BANKNAME);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_BANKCODE) ) {
                obj.PrBankCode = this.reader.GetString(DATAREADER_FLD_BANKCODE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_BANKSWIFTCODE) ) {
                obj.PrBankSWIFTCode = this.reader.GetString(DATAREADER_FLD_BANKSWIFTCODE);
            }

            obj.isNew = false;
            // since we've just loaded from database, we mark as "old"
            obj.isDirty = false;
            obj.IsObjectLoading = false;
            obj.afterLoad();

            return;
        }
        public override void load(IModelObject mo)
        {
            const int DATAREADER_FLD_EMPLOYEEINFOID = 0;
            const int DATAREADER_FLD_EIEMPLOYEEID = 1;
            const int DATAREADER_FLD_SALARY = 2;
            const int DATAREADER_FLD_ADDRESS = 3;

            EmployeeInfo obj = (EmployeeInfo)mo;
            obj.IsObjectLoading = true;

            if (!this.reader.IsDBNull(DATAREADER_FLD_EMPLOYEEINFOID) ) {
                obj.PrEmployeeInfoId = Convert.ToInt64(this.reader.GetInt32(DATAREADER_FLD_EMPLOYEEINFOID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_EIEMPLOYEEID) ) {
                obj.PrEIEmployeeId = Convert.ToInt64(this.reader.GetInt32(DATAREADER_FLD_EIEMPLOYEEID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_SALARY) ) {
                obj.PrSalary = this.reader.GetDecimal(DATAREADER_FLD_SALARY);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_ADDRESS) ) {
                obj.PrAddress = this.reader.GetString(DATAREADER_FLD_ADDRESS);
            }

            obj.isNew = false;
            // since we've just loaded from database, we mark as "old"
            obj.isDirty = false;
            obj.IsObjectLoading = false;
            obj.afterLoad();

            return;
        }
        public bool DeleteRecord(IModelObject KeyObject)
        {
            bool isSuccess = false;

            if (KeyObject != null)
            {
                ShiftTargetYieldSchedule_sty_Info deleteInfo = KeyObject as ShiftTargetYieldSchedule_sty_Info;

                try
                {
                    using (MainDBDataContext db = new MainDBDataContext())
                    {
                        ShiftTargetYieldSchedule_sty deleteData = db.ShiftTargetYieldSchedule_sty.FirstOrDefault(t => t.sty_iRecordID == deleteInfo.sty_iRecordID);

                        if (deleteData != null)
                        {
                            //deleteData.sty_lIsDeleted = true;
                            deleteData.sty_lIsAtive = false;

                            db.SubmitChanges();

                            isSuccess = true;
                        }
                    }
                }
                catch (Exception Ex)
                {

                    throw Ex;
                }
            }

            return isSuccess;
        }
        public ShiftTargetYieldSchedule_sty_Info DisplayRecord(IModelObject KeyObject)
        {
            ShiftTargetYieldSchedule_sty_Info displayInfo = null;

            if (KeyObject != null)
            {
                displayInfo = KeyObject as ShiftTargetYieldSchedule_sty_Info;

                try
                {
                    using (MainDBDataContext db = new MainDBDataContext())
                    {
                        ShiftTargetYieldSchedule_sty displayData = db.ShiftTargetYieldSchedule_sty.FirstOrDefault(t => t.sty_iRecordID == displayInfo.sty_iRecordID);

                        if (displayData != null)
                        {
                            displayInfo = Common.General.CopyObjectValue<ShiftTargetYieldSchedule_sty, ShiftTargetYieldSchedule_sty_Info>(displayData);
                        }
                    }
                }
                catch (Exception Ex)
                {

                    throw Ex;
                }
            }

            return displayInfo;
        }
        public override void load(IModelObject mo)
        {
            const int DATAREADER_FLD_EMPLOYEE_TRAINING_HISTORY_ID = 0;
            const int DATAREADER_FLD_EMPLOYEE_ID = 1;
            const int DATAREADER_FLD_DATE_FROM = 2;
            const int DATAREADER_FLD_DATE_TO = 3;
            const int DATAREADER_FLD_TRAINING_COURSE_CODE = 4;

            EmployeeTrainingHistory obj = (EmployeeTrainingHistory)mo;
            obj.IsObjectLoading = true;

            if (!this.reader.IsDBNull(DATAREADER_FLD_EMPLOYEE_TRAINING_HISTORY_ID) ) {
                obj.PrEmployeeTrainingHistoryId = Convert.ToInt64(this.reader.GetDecimal(DATAREADER_FLD_EMPLOYEE_TRAINING_HISTORY_ID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_EMPLOYEE_ID) ) {
                obj.PrEmployeeId = Convert.ToInt64(this.reader.GetDecimal(DATAREADER_FLD_EMPLOYEE_ID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_DATE_FROM) ) {
                obj.PrDateFrom = this.reader.GetDateTime(DATAREADER_FLD_DATE_FROM);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_DATE_TO) ) {
                obj.PrDateTo = this.reader.GetDateTime(DATAREADER_FLD_DATE_TO);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_TRAINING_COURSE_CODE) ) {
                obj.PrTrainingCourseCode = this.reader.GetString(DATAREADER_FLD_TRAINING_COURSE_CODE);
            }

            obj.isNew = false;
            // since we've just loaded from database, we mark as "old"
            obj.isDirty = false;
            obj.IsObjectLoading = false;
            obj.afterLoad();

            return;
        }
        public override void load(IModelObject mo)
        {
            const int DATAREADER_FLD_EMPLOYEE_EVALUATION_ID = 0;
            const int DATAREADER_FLD_EVALUATOR_ID = 1;
            const int DATAREADER_FLD_EVALUATION_DATE = 2;
            const int DATAREADER_FLD_EMPLOYEE_ID = 3;

            EmployeeEvaluation obj = (EmployeeEvaluation)mo;
            obj.IsObjectLoading = true;

            if (!this.reader.IsDBNull(DATAREADER_FLD_EMPLOYEE_EVALUATION_ID) ) {
                obj.PrEmployeeEvaluationId = Convert.ToInt64(this.reader.GetInt32(DATAREADER_FLD_EMPLOYEE_EVALUATION_ID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_EVALUATOR_ID) ) {
                obj.PrEvaluatorId = Convert.ToInt64(this.reader.GetInt32(DATAREADER_FLD_EVALUATOR_ID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_EVALUATION_DATE) ) {
                obj.PrEvaluationDate = this.reader.GetDateTime(DATAREADER_FLD_EVALUATION_DATE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_EMPLOYEE_ID) ) {
                obj.PrEmployeeId = Convert.ToInt64(this.reader.GetInt32(DATAREADER_FLD_EMPLOYEE_ID));
            }

            obj.isNew = false;
            // since we've just loaded from database, we mark as "old"
            obj.isDirty = false;
            obj.IsObjectLoading = false;
            obj.afterLoad();

            return;
        }
        public override void load(IModelObject mo)
        {
            const int DATAREADER_FLD_PROJECTID = 0;
            const int DATAREADER_FLD_PROJECTNAME = 1;
            const int DATAREADER_FLD_ISACTIVE = 2;
            const int DATAREADER_FLD_PROJECTTYPEID = 3;

            Project obj = (Project)mo;
            obj.IsObjectLoading = true;

            if (!this.reader.IsDBNull(DATAREADER_FLD_PROJECTID) ) {
                obj.PrProjectId = Convert.ToInt64(this.reader.GetInt32(DATAREADER_FLD_PROJECTID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_PROJECTNAME) ) {
                obj.PrProjectName = this.reader.GetString(DATAREADER_FLD_PROJECTNAME);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_ISACTIVE) ) {
                obj.PrIsActive = this.reader.GetInt32(DATAREADER_FLD_ISACTIVE)!=0;
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_PROJECTTYPEID) ) {
                obj.PrProjectTypeId = (EnumProjectType?)this.reader.GetInt32(DATAREADER_FLD_PROJECTTYPEID);
            }

            obj.isNew = false;
            // since we've just loaded from database, we mark as "old"
            obj.isDirty = false;
            obj.IsObjectLoading = false;
            obj.afterLoad();

            return;
        }
        public ReturnValueInfo DeleteRecord(IModelObject KeyObject)
        {
            ReturnValueInfo rvInfo = new ReturnValueInfo();
            DepartmentMaster_dpm_Info searchInfo = KeyObject as DepartmentMaster_dpm_Info;
            if (searchInfo == null)
            {
                rvInfo.messageText = Common.DefineConstantValue.SystemMessageText.strMessageText_E_ObjectNull;
                rvInfo.isError = true;
                return rvInfo;
            }
            try
            {
                using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
                {
                    List<DepartmentMaster_dpm> listDept = db.DepartmentMaster_dpm.Where(x => x.dpm_RecordID == searchInfo.dpm_RecordID).ToList();

                    if (listDept != null)
                    {
                        db.DepartmentMaster_dpm.DeleteAllOnSubmit(listDept);
                        db.SubmitChanges();
                        rvInfo.boolValue = true;
                    }
                }
            }
            catch (Exception ex)
            {
                rvInfo.messageText = ex.Message;
                rvInfo.isError = true;
            }
            return rvInfo;
        }
        public override void load(IModelObject mo)
        {
            const int DATAREADER_FLD_JOB_HISTORY_ID = 0;
            const int DATAREADER_FLD_EMPLOYEE_ID = 1;
            const int DATAREADER_FLD_START_DATE = 2;
            const int DATAREADER_FLD_END_DATE = 3;
            const int DATAREADER_FLD_JOB_ID = 4;
            const int DATAREADER_FLD_DEPARTMENT_ID = 5;
            const int DATAREADER_FLD_CREATE_DATE = 6;
            const int DATAREADER_FLD_UPDATE_DATE = 7;
            const int DATAREADER_FLD_CREATE_USER = 8;
            const int DATAREADER_FLD_UPDATE_USER = 9;

            JobHistory obj = (JobHistory)mo;
            obj.IsObjectLoading = true;

            if (!this.reader.IsDBNull(DATAREADER_FLD_JOB_HISTORY_ID) ) {
                obj.PrJobHistoryId = Convert.ToInt64(this.reader.GetDecimal(DATAREADER_FLD_JOB_HISTORY_ID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_EMPLOYEE_ID) ) {
                obj.PrEmployeeId = Convert.ToInt64(this.reader.GetDecimal(DATAREADER_FLD_EMPLOYEE_ID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_START_DATE) ) {
                obj.PrStartDate = this.reader.GetDateTime(DATAREADER_FLD_START_DATE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_END_DATE) ) {
                obj.PrEndDate = this.reader.GetDateTime(DATAREADER_FLD_END_DATE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_JOB_ID) ) {
                obj.PrJobId = this.reader.GetString(DATAREADER_FLD_JOB_ID);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_DEPARTMENT_ID) ) {
                obj.PrDepartmentId = Convert.ToInt64(this.reader.GetDecimal(DATAREADER_FLD_DEPARTMENT_ID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_CREATE_DATE) ) {
                obj.CreateDate = this.reader.GetDateTime(DATAREADER_FLD_CREATE_DATE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_UPDATE_DATE) ) {
                obj.UpdateDate = this.reader.GetDateTime(DATAREADER_FLD_UPDATE_DATE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_CREATE_USER) ) {
                obj.CreateUser = this.reader.GetString(DATAREADER_FLD_CREATE_USER);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_UPDATE_USER) ) {
                obj.UpdateUser = this.reader.GetString(DATAREADER_FLD_UPDATE_USER);
            }

            obj.isNew = false;
            // since we've just loaded from database, we mark as "old"
            obj.isDirty = false;
            obj.IsObjectLoading = false;
            obj.afterLoad();

            return;
        }
        public override void load(IModelObject mo)
        {
            const int DATAREADER_FLD_LOCATION_ID = 0;
            const int DATAREADER_FLD_STREET_ADDRESS = 1;
            const int DATAREADER_FLD_POSTAL_CODE = 2;
            const int DATAREADER_FLD_CITY = 3;
            const int DATAREADER_FLD_STATE_PROVINCE = 4;
            const int DATAREADER_FLD_COUNTRY_ID = 5;
            const int DATAREADER_FLD_CREATE_DATE = 6;
            const int DATAREADER_FLD_UPDATE_DATE = 7;
            const int DATAREADER_FLD_CREATE_USER = 8;
            const int DATAREADER_FLD_UPDATE_USER = 9;

            Location obj = (Location)mo;
            obj.IsObjectLoading = true;

            if (!this.reader.IsDBNull(DATAREADER_FLD_LOCATION_ID) ) {
                obj.PrLocationId = Convert.ToInt64(this.reader.GetDecimal(DATAREADER_FLD_LOCATION_ID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_STREET_ADDRESS) ) {
                obj.PrStreetAddress = this.reader.GetString(DATAREADER_FLD_STREET_ADDRESS);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_POSTAL_CODE) ) {
                obj.PrPostalCode = this.reader.GetString(DATAREADER_FLD_POSTAL_CODE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_CITY) ) {
                obj.PrCITY = this.reader.GetString(DATAREADER_FLD_CITY);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_STATE_PROVINCE) ) {
                obj.PrStateProvince = this.reader.GetString(DATAREADER_FLD_STATE_PROVINCE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_COUNTRY_ID) ) {
                obj.PrCountryId = this.reader.GetString(DATAREADER_FLD_COUNTRY_ID);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_CREATE_DATE) ) {
                obj.CreateDate = this.reader.GetDateTime(DATAREADER_FLD_CREATE_DATE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_UPDATE_DATE) ) {
                obj.UpdateDate = this.reader.GetDateTime(DATAREADER_FLD_UPDATE_DATE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_CREATE_USER) ) {
                obj.CreateUser = this.reader.GetString(DATAREADER_FLD_CREATE_USER);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_UPDATE_USER) ) {
                obj.UpdateUser = this.reader.GetString(DATAREADER_FLD_UPDATE_USER);
            }

            obj.isNew = false;
            // since we've just loaded from database, we mark as "old"
            obj.isDirty = false;
            obj.IsObjectLoading = false;
            obj.afterLoad();

            return;
        }
        public override void load(IModelObject mo)
        {
            const int DATAREADER_FLD_ACCOUNTID = 0;
            const int DATAREADER_FLD_ACCOUNT = 1;
            const int DATAREADER_FLD_ACCOUNTTYPEID = 2;
            const int DATAREADER_FLD_BANKACCNUMBER = 3;
            const int DATAREADER_FLD_NEXTCHECKNUMBER = 4;
            const int DATAREADER_FLD_DESCRIPTION = 5;
            const int DATAREADER_FLD_CREATEDATE = 6;
            const int DATAREADER_FLD_UPDATEDATE = 7;
            const int DATAREADER_FLD_UPDATEUSER = 8;
            const int DATAREADER_FLD_CREATEUSER = 9;

            Account obj = (Account)mo;
            obj.IsObjectLoading = true;

            if (!this.reader.IsDBNull(DATAREADER_FLD_ACCOUNTID) ) {
                obj.PrAccountid = Convert.ToInt64(this.reader.GetInt32(DATAREADER_FLD_ACCOUNTID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_ACCOUNT) ) {
                obj.PrAccount = this.reader.GetString(DATAREADER_FLD_ACCOUNT);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_ACCOUNTTYPEID) ) {
                obj.PrAccountTypeid = Convert.ToInt64(this.reader.GetInt32(DATAREADER_FLD_ACCOUNTTYPEID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_BANKACCNUMBER) ) {
                obj.PrBankaccnumber = this.reader.GetString(DATAREADER_FLD_BANKACCNUMBER);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_NEXTCHECKNUMBER) ) {
                obj.PrNextCheckNumber = this.reader.GetString(DATAREADER_FLD_NEXTCHECKNUMBER);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_DESCRIPTION) ) {
                obj.PrDescription = this.reader.GetString(DATAREADER_FLD_DESCRIPTION);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_CREATEDATE) ) {
                obj.CreateDate = this.reader.GetDateTime(DATAREADER_FLD_CREATEDATE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_UPDATEDATE) ) {
                obj.UpdateDate = this.reader.GetDateTime(DATAREADER_FLD_UPDATEDATE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_UPDATEUSER) ) {
                obj.UpdateUser = this.reader.GetString(DATAREADER_FLD_UPDATEUSER);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_CREATEUSER) ) {
                obj.CreateUser = this.reader.GetString(DATAREADER_FLD_CREATEUSER);
            }

            obj.isNew = false;
            // since we've just loaded from database, we mark as "old"
            obj.isDirty = false;
            obj.IsObjectLoading = false;
            obj.afterLoad();

            return;
        }
Beispiel #24
0
 public IModelObject DisplayRecord_SQL(IModelObject itemEntity)
 {
     try
     {
         return _MaterialMasterSQL.DisplayRecord(itemEntity);
     }
     catch (Exception Ex)
     {
         throw Ex;
     }
 }
Beispiel #25
0
        public List<DepositSummary_dps_Info> SearchRecords(IModelObject searchCondition)
        {
            try
            {
                return this._IDepositSummaryDA.SearchRecords(searchCondition);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Beispiel #26
0
        public IModelObject DisplayRecord(IModelObject itemEntity)
        {
            try
            {
                return this._signalLightsStatusDA.DisplayRecord(itemEntity);
            }
            catch (Exception Ex)
            {

                throw Ex;
            }
        }
        public PaymentUDGeneralSetting_pus_Info DisplayRecord(IModelObject itemEntity)
        {
            try
            {
                return this._paymentUDGeneralSettingDA.DisplayRecord(itemEntity);
            }
            catch (Exception Ex)
            {

                throw Ex;
            }
        }
        public SourceConsumeRecord_scr_Info DisplayRecord(IModelObject KeyObject)
        {
            try
            {
                return this._ISourceConsumeRecordDA.DisplayRecord(KeyObject);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Beispiel #29
0
        public IModelObject DisplayRecord(IModelObject itemEntity)
        {
            try
            {
                return _supplierMasterDA.DisplayRecord(itemEntity);
            }
            catch (Exception Ex)
            {

                throw Ex;
            }
        }
        public List<CardUserAccountDetail_cuad_Info> SearchRecords(IModelObject itemEntity, DateTime dtBegin, DateTime dtEnd)
        {
            try
            {
                return this._icuadDA.SearchRecords(itemEntity, dtBegin, dtEnd);
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }
Beispiel #31
0
 internal ChildDeleteTransformation(IModelObject child)
     : this(child.GetDataPath(), child.Id)
 {
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="ObjectRepositoryEntryChanges"/> class.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="status">The change type.</param>
        /// <param name="old">The old value.</param>
        /// <param name="new">The new value.</param>
        public ObjectRepositoryEntryChanges(string path, ChangeKind status, IModelObject old = null, IModelObject @new = null)
        {
            Path   = path ?? throw new ArgumentNullException(nameof(path));
            Status = status;

            if (old == null && @new == null)
            {
                throw new ArgumentNullException($"{nameof(old)} and {nameof(@new)}");
            }

            Old = old;
            New = @new;
        }
Beispiel #33
0
 public int CompareTo(IModelObject other)
 {
     return(ToString().CompareTo(other.ToString()));
 }
Beispiel #34
0
 public bool HasChanged(IModelObject obj)
 {
     //TODO: dummy implementation
     return(true);
 }
Beispiel #35
0
 public UserInformationInfo DisplayRecord(IModelObject KeyObject)
 {
     throw new NotImplementedException();
 }
 /// <inheritdoc />
 public ITransformationComposer Remove <TModel, TChildProperty>(TModel node, Expression <Func <TModel, TChildProperty> > propertyPicker, IModelObject child)
     where TModel : IModelObject
     where TChildProperty : ILazyChildren
 {
     EnsureInRepository(node);
     EnsureInRepository(child);
     return(new TransformationComposer(_repository, _transformations.Add(new ChildDeleteTransformation(child))));
 }
Beispiel #37
0
        public override void load(IModelObject mo)
        {
            const int DATAREADER_FLD_JOB_HISTORY_ID = 0;
            const int DATAREADER_FLD_EMPLOYEE_ID    = 1;
            const int DATAREADER_FLD_START_DATE     = 2;
            const int DATAREADER_FLD_END_DATE       = 3;
            const int DATAREADER_FLD_JOB_ID         = 4;
            const int DATAREADER_FLD_DEPARTMENT_ID  = 5;
            const int DATAREADER_FLD_CREATE_DATE    = 6;
            const int DATAREADER_FLD_UPDATE_DATE    = 7;
            const int DATAREADER_FLD_CREATE_USER    = 8;
            const int DATAREADER_FLD_UPDATE_USER    = 9;

            JobHistory obj = (JobHistory)mo;

            obj.IsObjectLoading = true;

            if (!this.reader.IsDBNull(DATAREADER_FLD_JOB_HISTORY_ID))
            {
                obj.PrJobHistoryId = Convert.ToInt64(this.reader.GetDecimal(DATAREADER_FLD_JOB_HISTORY_ID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_EMPLOYEE_ID))
            {
                obj.PrEmployeeId = Convert.ToInt64(this.reader.GetDecimal(DATAREADER_FLD_EMPLOYEE_ID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_START_DATE))
            {
                obj.PrStartDate = this.reader.GetDateTime(DATAREADER_FLD_START_DATE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_END_DATE))
            {
                obj.PrEndDate = this.reader.GetDateTime(DATAREADER_FLD_END_DATE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_JOB_ID))
            {
                obj.PrJobId = this.reader.GetString(DATAREADER_FLD_JOB_ID);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_DEPARTMENT_ID))
            {
                obj.PrDepartmentId = Convert.ToInt64(this.reader.GetDecimal(DATAREADER_FLD_DEPARTMENT_ID));
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_CREATE_DATE))
            {
                obj.CreateDate = this.reader.GetDateTime(DATAREADER_FLD_CREATE_DATE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_UPDATE_DATE))
            {
                obj.UpdateDate = this.reader.GetDateTime(DATAREADER_FLD_UPDATE_DATE);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_CREATE_USER))
            {
                obj.CreateUser = this.reader.GetString(DATAREADER_FLD_CREATE_USER);
            }
            if (!this.reader.IsDBNull(DATAREADER_FLD_UPDATE_USER))
            {
                obj.UpdateUser = this.reader.GetString(DATAREADER_FLD_UPDATE_USER);
            }


            obj.isNew = false;
            // since we've just loaded from database, we mark as "old"
            obj.isDirty         = false;
            obj.IsObjectLoading = false;
            obj.afterLoad();

            return;
        }
        internal static IEnumerable <ObjectRepositoryPropertyChange> ComputeModifiedProperties(PatchEntryChanges changes, IModelObject ancestor, IModelObject theirs, IModelObject ours)
        {
            return(from property in ours.DataAccessor.ModifiableProperties
                   let ancestorChunk = GetChunk(ancestor, property)
                                       let theirChunk = GetChunk(theirs, property)
                                                        where !ancestorChunk.HasSameValue(theirChunk)
                                                        let ourChunk = GetChunk(ours, property)
                                                                       select new ObjectRepositoryPropertyChange(changes.Path, property, ancestorChunk, theirChunk, ourChunk));

            ObjectRepositoryPropertyValue GetChunk(IModelObject @object, ModifiablePropertyInfo property)
            {
                return(new ObjectRepositoryPropertyValue(@object, property, property.Accessor(@object)));
            }
        }
        private void AddModifiedProperties(PatchEntryChanges branchChange, IModelObject mergeBaseObject, IModelObject newObject, IModelObject headObject, PatchEntryChanges headChange)
        {
            if (headChange?.Status == ChangeKind.Deleted)
            {
                throw new NotImplementedException($"Conflict as a modified node {branchChange.Path} in merge branch source has been deleted in head.");
            }
            var changes = ComputeModifiedProperties(branchChange, mergeBaseObject, newObject, headObject);

            foreach (var modifiedProperty in changes)
            {
                if (typeof(IObjectRepositoryIndex).IsAssignableFrom(modifiedProperty.Property.Property.ReflectedType))
                {
                    // Indexes will be recomputed anyways from the changes when committed,
                    // so there is no need to track them in the modified chunks
                    continue;
                }

                ModifiedProperties.Add(modifiedProperty);
            }
        }
Beispiel #40
0
        public virtual void Initialize(IModelObject model)
        {
            try
            {
                _model = (ModelRoot)model;

                var hasMetaData = false;
                foreach (var table in (from x in _model.Database.Tables where x.Generated orderby x.Name select x))
                {
                    if (table.CreateMetaData)
                    {
                        hasMetaData = true;
                    }
                }

                Table projectItemDataType = null;
                if (hasMetaData)
                {
                    #region Create the PROPERTY_ITEM_DATA_TYPE table
                    projectItemDataType = _model.Database.Tables.Add("PROPERTY_ITEM_DATA_TYPE");
                    projectItemDataType.IsMetaDataMaster = true;

                    Column column = null;
                    column = _model.Database.Columns.Add("property_item_data_type_id");
                    column.ParentTableRef = projectItemDataType.CreateRef();
                    column.DataType       = System.Data.SqlDbType.Int;
                    column.PrimaryKey     = true;
                    column.Identity       = IdentityTypeConstants.None;
                    column.AllowNull      = false;
                    projectItemDataType.Columns.Add(column.CreateRef());

                    column = _model.Database.Columns.Add("name");
                    column.ParentTableRef = projectItemDataType.CreateRef();
                    column.DataType       = System.Data.SqlDbType.VarChar;
                    column.Length         = 50;
                    column.AllowNull      = false;
                    projectItemDataType.Columns.Add(column.CreateRef());
                    #endregion
                }

                foreach (var table in (from x in _model.Database.Tables where x.Generated orderby x.Name select x))
                {
                    if (table.CreateMetaData)
                    {
                        Column column = null;

                        #region Create the PROPERTY_ITEM_DEFINE table
                        var projectItemDefineTable = _model.Database.Tables.Add(table.DatabaseName + "_PROPERTY_ITEM_DEFINE");
                        projectItemDefineTable.IsMetaDataDefinition = true;

                        column = _model.Database.Columns.Add("property_item_define_id");
                        column.ParentTableRef = projectItemDefineTable.CreateRef();
                        column.DataType       = System.Data.SqlDbType.Int;
                        column.PrimaryKey     = true;
                        column.Identity       = IdentityTypeConstants.Database;
                        column.AllowNull      = false;
                        projectItemDefineTable.Columns.Add(column.CreateRef());

                        column = _model.Database.Columns.Add("name");
                        column.ParentTableRef = projectItemDefineTable.CreateRef();
                        column.DataType       = System.Data.SqlDbType.VarChar;
                        column.Length         = 50;
                        column.AllowNull      = false;
                        column.UIVisible      = true;
                        column.SortOrder      = 0;
                        column.FriendlyName   = "Name";
                        projectItemDefineTable.Columns.Add(column.CreateRef());

                        column                = _model.Database.Columns.Add("property_item_data_type");
                        column.EnumType       = "PropertyBagDataTypeConstants";
                        column.ParentTableRef = projectItemDefineTable.CreateRef();
                        column.DataType       = System.Data.SqlDbType.Int;
                        column.UIVisible      = true;
                        column.SortOrder      = 1;
                        column.FriendlyName   = "Data type";
                        column.AllowNull      = false;
                        projectItemDefineTable.Columns.Add(column.CreateRef());

                        //RELATIONRELATIONRELATIONRELATIONRELATIONRELATIONRELATIONRELATIONRELATIONRELATION
                        //Add a relation to from the datatype table to this one
                        var relation2 = _model.Database.Relations.Add();
                        relation2.ParentTableRef = projectItemDataType.CreateRef();
                        relation2.ChildTableRef  = projectItemDefineTable.CreateRef();
                        var relationship = new ColumnRelationship((INHydrateModelObject)relation2.Root);
                        relationship.ParentColumnRef = ((Column)projectItemDataType.Columns[0].Object).CreateRef();
                        relationship.ChildColumnRef  = column.CreateRef();
                        relation2.ColumnRelationships.Add(relationship);
                        projectItemDataType.Relationships.Add(relation2.CreateRef());
                        //RELATIONRELATIONRELATIONRELATIONRELATIONRELATIONRELATIONRELATIONRELATIONRELATION

                        column = _model.Database.Columns.Add("group");
                        column.ParentTableRef = projectItemDefineTable.CreateRef();
                        column.DataType       = System.Data.SqlDbType.VarChar;
                        column.Length         = 50;
                        column.AllowNull      = true;
                        column.UIVisible      = true;
                        column.SortOrder      = 2;
                        column.FriendlyName   = "Group";
                        projectItemDefineTable.Columns.Add(column.CreateRef());

                        column = _model.Database.Columns.Add("sort_index");
                        column.ParentTableRef = projectItemDefineTable.CreateRef();
                        column.DataType       = System.Data.SqlDbType.Int;
                        column.AllowNull      = false;
                        column.UIVisible      = true;
                        column.SortOrder      = 3;
                        column.FriendlyName   = "Sort order";
                        projectItemDefineTable.Columns.Add(column.CreateRef());

                        column = _model.Database.Columns.Add("minimum_value");
                        column.ParentTableRef = projectItemDefineTable.CreateRef();
                        column.DataType       = System.Data.SqlDbType.VarChar;
                        column.Length         = 50;
                        column.UIVisible      = true;
                        column.SortOrder      = 4;
                        column.FriendlyName   = "Minimum value";
                        projectItemDefineTable.Columns.Add(column.CreateRef());

                        column = _model.Database.Columns.Add("maximum_value");
                        column.ParentTableRef = projectItemDefineTable.CreateRef();
                        column.DataType       = System.Data.SqlDbType.VarChar;
                        column.Length         = 50;
                        column.UIVisible      = true;
                        column.SortOrder      = 5;
                        column.FriendlyName   = "Maximum value";
                        projectItemDefineTable.Columns.Add(column.CreateRef());

                        column = _model.Database.Columns.Add("max_length");
                        column.ParentTableRef = projectItemDefineTable.CreateRef();
                        column.DataType       = System.Data.SqlDbType.Int;
                        column.UIVisible      = true;
                        column.SortOrder      = 6;
                        column.FriendlyName   = "Maximum Length";
                        projectItemDefineTable.Columns.Add(column.CreateRef());


                        column = _model.Database.Columns.Add("is_required");
                        column.ParentTableRef = projectItemDefineTable.CreateRef();
                        column.DataType       = System.Data.SqlDbType.Bit;
                        column.AllowNull      = false;
                        column.UIVisible      = true;
                        column.SortOrder      = 7;
                        column.FriendlyName   = "Required";
                        projectItemDefineTable.Columns.Add(column.CreateRef());

                        #endregion

                        #region Create the PROPERTY_ITEM table
                        var projectItemValueTable = _model.Database.Tables.Add(table.DatabaseName + "_PROPERTY_ITEM");
                        projectItemValueTable.IsMetaData = true;

                        column = _model.Database.Columns.Add("property_item_id");
                        column.ParentTableRef = projectItemValueTable.CreateRef();
                        column.DataType       = System.Data.SqlDbType.Int;
                        column.PrimaryKey     = true;
                        column.AllowNull      = false;
                        column.Identity       = IdentityTypeConstants.Database;
                        projectItemValueTable.Columns.Add(column.CreateRef());

                        column = _model.Database.Columns.Add("property_item_define_id");
                        column.ParentTableRef = projectItemValueTable.CreateRef();
                        column.DataType       = System.Data.SqlDbType.Int;
                        column.AllowNull      = false;
                        projectItemValueTable.Columns.Add(column.CreateRef());

                        column = _model.Database.Columns.Add("item_value");
                        column.ParentTableRef = projectItemValueTable.CreateRef();
                        column.DataType       = System.Data.SqlDbType.VarChar;
                        column.Length         = 1024;
                        column.AllowNull      = false;
                        projectItemValueTable.Columns.Add(column.CreateRef());

                        //Create all primary keys
                        foreach (var pkColumn in table.PrimaryKeyColumns.OrderBy(x => x.Name))
                        {
                            column = _model.Database.Columns.Add(pkColumn.DatabaseName);
                            column.ParentTableRef = projectItemValueTable.CreateRef();
                            column.DataType       = pkColumn.DataType;
                            column.Length         = pkColumn.Length;
                            column.AllowNull      = false;
                            projectItemValueTable.Columns.Add(column.CreateRef());
                        }

                        //Add relationship between Definition and Value table
                        if (true)
                        {
                            var relation = new Relation(this._model);
                            relation.ParentTableRef = projectItemDefineTable.CreateRef();
                            relation.ChildTableRef  = projectItemValueTable.CreateRef();
                            var colRel = new ColumnRelationship(_model);
                            colRel.ParentColumnRef = projectItemDefineTable.Columns["property_item_define_id"];
                            colRel.ChildColumnRef  = projectItemValueTable.Columns["property_item_define_id"];
                            relation.ColumnRelationships.Add(colRel);
                            relation.RoleName = string.Empty;
                            _model.Database.Relations.Add(relation);
                            projectItemDefineTable.Relationships.Add(relation.CreateRef());
                        }

                        //Add relationship between Value table and primary table
                        if (true)
                        {
                            var relation = new Relation(this._model);
                            relation.ParentTableRef = table.CreateRef();
                            relation.ChildTableRef  = projectItemValueTable.CreateRef();
                            foreach (var pkColumn in table.PrimaryKeyColumns.OrderBy(x => x.Name))
                            {
                                var colRel = new ColumnRelationship(_model);
                                colRel.ParentColumnRef = table.Columns[pkColumn.DatabaseName];
                                colRel.ChildColumnRef  = projectItemValueTable.Columns[pkColumn.DatabaseName];
                                relation.RoleName      = string.Empty;
                                relation.ColumnRelationships.Add(colRel);
                                table.Relationships.Add(relation.CreateRef());
                            }
                            _model.Database.Relations.Add(relation);
                        }

                        #endregion
                    }
                }

                //_model = (ModelRoot)model;
            }
            catch (Exception ex)
            {
                throw;
            }
        }
        public static void CreateDiagram(Project project, string diagramName, int shapeSize, int shapesPerRow, int shapesPerColumn, bool connectShapes, bool withModels, bool withMappings, bool withLayers)
        {
            shapeSize = Math.Max(10, shapeSize);
            int lineLength = shapeSize / 2;
            //
            // Create ModelMappings
            NumericModelMapping numericModelMapping = null;
            FormatModelMapping  formatModelMapping  = null;
            StyleModelMapping   styleModelMapping   = null;

            if (withMappings)
            {
                // Create numeric- and format model mappings
                numericModelMapping = new NumericModelMapping(2, 4, NumericModelMapping.MappingType.FloatInteger, 10, 0);
                formatModelMapping  = new FormatModelMapping(4, 2, FormatModelMapping.MappingType.StringString, "{0}");
                // Create style model mapping
                float range = (shapesPerRow * shapesPerColumn) / 15f;
                styleModelMapping = new StyleModelMapping(1, 4, StyleModelMapping.MappingType.FloatStyle);
                for (int i = 0; i < 15; ++i)
                {
                    IStyle style = null;
                    switch (i)
                    {
                    case 0: style = project.Design.LineStyles.None; break;

                    case 1: style = project.Design.LineStyles.Dotted; break;

                    case 2: style = project.Design.LineStyles.Dashed; break;

                    case 3: style = project.Design.LineStyles.Special1; break;

                    case 4: style = project.Design.LineStyles.Special2; break;

                    case 5: style = project.Design.LineStyles.Normal; break;

                    case 6: style = project.Design.LineStyles.Blue; break;

                    case 7: style = project.Design.LineStyles.Green; break;

                    case 8: style = project.Design.LineStyles.Yellow; break;

                    case 9: style = project.Design.LineStyles.Red; break;

                    case 10: style = project.Design.LineStyles.HighlightDotted; break;

                    case 11: style = project.Design.LineStyles.HighlightDashed; break;

                    case 12: style = project.Design.LineStyles.Highlight; break;

                    case 13: style = project.Design.LineStyles.HighlightThick; break;

                    case 14: style = project.Design.LineStyles.Thick; break;

                    default: style = null; break;
                    }
                    if (style != null)
                    {
                        styleModelMapping.AddValueRange(i * range, style);
                    }
                }
            }
            //
            // Create model obejct for the planar shape's template
            IModelObject planarModel = null;

            if (withModels)
            {
                planarModel = project.ModelObjectTypes["Core.GenericModelObject"].CreateInstance();
            }
            //
            // Create a shape for the planar shape's template
            Shape planarShape = project.ShapeTypes["RoundedBox"].CreateInstance();

            planarShape.Fit(0, 0, shapeSize, shapeSize);
            //
            // Create a template for the planar shapes
            Template planarTemplate = new Template("PlanarShape Template", planarShape);

            if (withModels)
            {
                planarTemplate.Shape.ModelObject = planarModel;
                if (withMappings)
                {
                    foreach (ControlPointId id in planarTemplate.Shape.GetControlPointIds(ControlPointCapabilities.Connect))
                    {
                        planarTemplate.MapTerminal(TerminalId.Generic, id);
                    }
                    planarTemplate.MapProperties(numericModelMapping);
                    planarTemplate.MapProperties(formatModelMapping);
                    planarTemplate.MapProperties(styleModelMapping);
                }
            }
            //
            // Create a template for the linear shapes
            Template linearTemplate = null;

            if (connectShapes)
            {
                linearTemplate = new Template("LinearShape Template", project.ShapeTypes["Polyline"].CreateInstance());
            }
            //
            // Insert the created templates into the repository
            project.Repository.InsertAll(planarTemplate);
            if (connectShapes)
            {
                project.Repository.InsertAll(linearTemplate);
            }
            //
            // Prepare the connection points
            ControlPointId leftPoint   = withModels ? ControlPointId.Reference : 4;
            ControlPointId rightPoint  = withModels ? ControlPointId.Reference : 5;
            ControlPointId topPoint    = withModels ? ControlPointId.Reference : 2;
            ControlPointId bottomPoint = withModels ? ControlPointId.Reference : 7;
            //
            // Create the diagram
            Diagram diagram = new Diagram(diagramName);
            //
            // Create and add layers
            LayerIds planarLayer = LayerIds.None, linearLayer = LayerIds.None, oddRowLayer = LayerIds.None,
                     evenRowLayer = LayerIds.None, oddColLayer = LayerIds.None, evenColLayer = LayerIds.None;

            if (withLayers)
            {
                const string planarLayerName   = "PlanarShapesLayer";
                const string linearLayerName   = "LinearShapesLayer";
                const string oddRowsLayerName  = "OddRowsLayer";
                const string evenRowsLayerName = "EvenRowsLayer";
                const string oddColsLayerName  = "OddColsLayer";
                const string evenColsLayerName = "EvenColsLayer";
                // Create Layers
                Layer planarShapesLayer = new Layer(planarLayerName);
                planarShapesLayer.Title = "Planar Shapes";
                planarShapesLayer.LowerZoomThreshold = 5;
                planarShapesLayer.UpperZoomThreshold = 750;
                diagram.Layers.Add(planarShapesLayer);
                Layer linearShapesLayer = new Layer(linearLayerName);
                linearShapesLayer.Title = "Linear Shapes";
                linearShapesLayer.LowerZoomThreshold = 10;
                linearShapesLayer.UpperZoomThreshold = 500;
                diagram.Layers.Add(linearShapesLayer);
                Layer oddRowsLayer = new Layer(oddRowsLayerName);
                oddRowsLayer.Title = "Odd Rows";
                oddRowsLayer.LowerZoomThreshold = 2;
                oddRowsLayer.UpperZoomThreshold = 1000;
                diagram.Layers.Add(oddRowsLayer);
                Layer evenRowsLayer = new Layer(evenRowsLayerName);
                evenRowsLayer.Title = "Even Rows";
                evenRowsLayer.LowerZoomThreshold = 2;
                evenRowsLayer.UpperZoomThreshold = 1000;
                diagram.Layers.Add(evenRowsLayer);
                Layer oddColsLayer = new Layer(oddColsLayerName);
                oddColsLayer.Title = "Odd Columns";
                oddColsLayer.LowerZoomThreshold = 2;
                oddColsLayer.UpperZoomThreshold = 1000;
                diagram.Layers.Add(oddColsLayer);
                Layer evenColsLayer = new Layer(evenColsLayerName);
                evenColsLayer.Title = "Even Columns";
                evenColsLayer.LowerZoomThreshold = 2;
                evenColsLayer.UpperZoomThreshold = 1000;
                diagram.Layers.Add(evenColsLayer);
                // Assign LayerIds
                planarLayer  = diagram.Layers.FindLayer(planarLayerName).Id;
                linearLayer  = diagram.Layers.FindLayer(linearLayerName).Id;
                oddRowLayer  = diagram.Layers.FindLayer(oddRowsLayerName).Id;
                evenRowLayer = diagram.Layers.FindLayer(evenRowsLayerName).Id;
                oddColLayer  = diagram.Layers.FindLayer(oddColsLayerName).Id;
                evenColLayer = diagram.Layers.FindLayer(evenColsLayerName).Id;
            }

            for (int rowIdx = 0; rowIdx < shapesPerColumn; ++rowIdx)
            {
                LayerIds rowLayer = ((rowIdx + 1) % 2 == 0) ? evenRowLayer : oddRowLayer;
                for (int colIdx = 0; colIdx < shapesPerRow; ++colIdx)
                {
                    LayerIds colLayer  = ((colIdx + 1) % 2 == 0) ? evenColLayer : oddColLayer;
                    int      shapePosX = shapeSize + colIdx * (lineLength + shapeSize);
                    int      shapePosY = shapeSize + rowIdx * (lineLength + shapeSize);

                    planarShape = planarTemplate.CreateShape();
                    if (planarShape is ICaptionedShape)
                    {
                        ((ICaptionedShape)planarShape).SetCaptionText(0, string.Format("{0} / {1}", rowIdx + 1, colIdx + 1));
                    }

                    planarShape.MoveTo(shapePosX, shapePosY);
                    if (withModels)
                    {
                        project.Repository.Insert(planarShape.ModelObject);
                        ((GenericModelObject)planarShape.ModelObject).IntegerValue = rowIdx;
                    }

                    diagram.Shapes.Add(planarShape, project.Repository.ObtainNewTopZOrder(diagram));
                    if (withLayers)
                    {
                        diagram.AddShapeToLayers(planarShape, planarLayer | rowLayer | colLayer);
                    }
                    if (connectShapes)
                    {
                        if (rowIdx > 0)
                        {
                            Shape lineShape = linearTemplate.CreateShape();
                            lineShape.Connect(ControlPointId.FirstVertex, planarShape, topPoint);
                            Debug.Assert(ControlPointId.None != lineShape.IsConnected(ControlPointId.FirstVertex, planarShape));

                            Shape otherShape = diagram.Shapes.FindShape(shapePosX, shapePosY - (shapeSize + lineLength), ControlPointCapabilities.None, 0, null);
                            Debug.Assert(otherShape != null && otherShape != planarShape);
                            lineShape.Connect(ControlPointId.LastVertex, otherShape, bottomPoint);
                            diagram.Shapes.Add(lineShape, project.Repository.ObtainNewBottomZOrder(diagram));
                            if (withLayers)
                            {
                                diagram.AddShapeToLayers(lineShape, linearLayer);
                            }
                            Debug.Assert(ControlPointId.None != lineShape.IsConnected(ControlPointId.LastVertex, otherShape));
                        }
                        if (colIdx > 0)
                        {
                            Shape lineShape = linearTemplate.CreateShape();
                            lineShape.Connect(1, planarShape, leftPoint);
                            Debug.Assert(ControlPointId.None != lineShape.IsConnected(ControlPointId.FirstVertex, planarShape));

                            Shape otherShape = diagram.Shapes.FindShape(shapePosX - (shapeSize + lineLength), shapePosY, ControlPointCapabilities.None, 0, null);
                            Debug.Assert(otherShape != null && otherShape != planarShape);
                            lineShape.Connect(2, otherShape, rightPoint);

                            diagram.Shapes.Add(lineShape, project.Repository.ObtainNewBottomZOrder(diagram));
                            if (withLayers)
                            {
                                diagram.AddShapeToLayers(lineShape, linearLayer);
                            }
                            Debug.Assert(ControlPointId.None != lineShape.IsConnected(ControlPointId.LastVertex, otherShape));
                        }
                    }
                }
            }
            diagram.Width  = ((shapeSize + lineLength) * shapesPerRow) + lineLength;
            diagram.Height = ((shapeSize + lineLength) * shapesPerColumn) + lineLength;
            project.Repository.InsertAll(diagram);
        }
Beispiel #42
0
 private static int IMOCompareByGuid(IModelObject imo1, IModelObject imo2)
 {
     return(Utility.GuidOps.Compare(imo1.Guid, imo2.Guid));
 }
Beispiel #43
0
 /// <summary>
 /// Adds a model object to this model's ModelObjects collection.
 /// </summary>
 /// <param name="modelObject">The model object.</param>
 public void AddModelObject(IModelObject modelObject)
 {
     m_modelObjectDictionary.Add(modelObject.Guid, modelObject);
 }
Beispiel #44
0
 protected override void OnInitialize(IModelObject model)
 {
     //nHydrateGeneratorProject.AddICSharpDllToBinFolder();
 }
Beispiel #45
0
 internal PropertyTransformation(IModelObject instance, Expression propertyPicker, object value = null)
     : this(instance.Id, instance.GetDataPath(), PropertyVisitor.ExtractProperty(propertyPicker), value)
 {
 }
Beispiel #46
0
 public void Initialize(IModelObject model)
 {
     _model = model;
     OnInitialize(model);
 }
Beispiel #47
0
 public List <UserInformationInfo> SearchRecords(IModelObject MDobject)
 {
     throw new NotImplementedException();
 }
Beispiel #48
0
 protected override void OnInitialize(IModelObject model)
 {
     nHydrateGeneratorProject.AddEFCoreToBinFolder();
 }
Beispiel #49
0
 public bool DeleteRecord(IModelObject KeyObject)
 {
     throw new NotImplementedException();
 }
Beispiel #50
0
 public virtual void NotifyObjectModified(IModelObject obj)
 {
     // Note: Removed for performance reasons!     if (!Objects.Contains(obj)) return;
     flagChanged(obj, ModelChange.Modified);
 }
Beispiel #51
0
        private void UpdateModelObjectNode(IModelObject modelObject)
        {
            TreeNode node = FindTreeNode(treeView.Nodes, modelObject);

            Debug.Assert(node != null);

            bool     isSelected = (treeView.SelectedNode == node);
            TreeNode parentNode = null;
            int      position   = -1;

            if (node != null)
            {
                parentNode = node.Parent;
                // Remove old node
                if (parentNode == null)
                {
                    position = treeView.Nodes.IndexOf(node);
                    treeView.Nodes.RemoveAt(position);
                }
                else
                {
                    position = parentNode.Nodes.IndexOf(node);
                    parentNode.Nodes.RemoveAt(position);
                }
            }

            // Create and insert new node
            TreeNode newNode = CreateNode(modelObject);

            if (modelObject.Parent == null)
            {
                treeView.Nodes.Insert(position, newNode);
            }
            else
            {
                // If the parent has not changed, re-insert new node at the old position
                // otherwise insert new node under the new parent node
                if (parentNode == null)
                {
                    if (modelObject.Parent == null)
                    {
                        // Re-insert at the original root position
                        treeView.Nodes.Insert(position, newNode);
                    }
                    else
                    {
                        // Add to the new parent node
                        parentNode = FindTreeNode(treeView.Nodes, modelObject.Parent);
                        Debug.Assert(parentNode != null);
                        parentNode.Nodes.Add(newNode);
                    }
                }
                else
                {
                    if (modelObject.Parent == null)
                    {
                        // Add to root
                        treeView.Nodes.Add(newNode);
                    }
                    else if (parentNode.Tag == modelObject.Parent)
                    {
                        // Re-insert at the original hierarchical position
                        parentNode.Nodes.Insert(position, newNode);
                    }
                    else
                    {
                        // Add to the new parent node
                        parentNode = FindTreeNode(treeView.Nodes, modelObject.Parent);
                        Debug.Assert(parentNode != null);
                        parentNode.Nodes.Add(newNode);
                    }
                }
            }
            if (isSelected)
            {
                treeView.SelectedNode = newNode;
            }
        }
Beispiel #52
0
 /// <ToBeCompleted></ToBeCompleted>
 public TemplateControllerModelObjectReplacedEventArgs(Template template,
                                                       IModelObject oldModelObject, IModelObject newModelObject)
     : base(template)
 {
     this.oldModelObject = oldModelObject;
     this.newModelObject = newModelObject;
 }
Beispiel #53
0
 private static string _ModelData(string imgUrl, IModelObject obj)
 {
     return(string.Format("<img src=\"{0}\" title=\"Changed {1}, by {2}\" alt=\"metadata\" style=\"float:right\" />",
                          imgUrl, obj.LastChanged, obj.ChangedBy));
 }
Beispiel #54
0
 /// <override></override>
 public override void Disconnect(TerminalId ownTerminalId, IModelObject targetConnector, TerminalId targetTerminalId)
 {
     throw new NotImplementedException();
 }
Beispiel #55
0
 public static string ModelData(this ViewUserControl control, IModelObject obj)
 {
     return(_ModelData(control.ResolveUrl("~/Content/images/info.png"), obj));
 }
 protected virtual void OnInitialize(IModelObject model)
 {
     //Implement base functionality if needed
 }
 protected override void OnInitialize(IModelObject model)
 {
     WidgetsphereGeneratorProject.AddWidgetsphereCoreToBinFolder();
 }
 public JsonModelObjectWriter(IModelObject node, TextWriter textWriter)
     : base(textWriter)
 {
     AdditionalObjects = new List <ModelNestedObjectInfo>();
     Node = node ?? throw new ArgumentNullException(nameof(node));
 }
Beispiel #59
0
        public static void CompareModelObjects(IRepository repositoryA, IModelObject parentA, IRepository repositoryB, IModelObject parentB, int version)
        {
            IEnumerable <IModelObject> modelObjectsA = repositoryA.GetModelObjects(parentA);
            IEnumerable <IModelObject> modelObjectsB = repositoryB.GetModelObjects(parentB);

            CompareObjectCount(modelObjectsA, modelObjectsB);
            if (CompareIds)
            {
                foreach (IModelObject modelObjectA in modelObjectsA)
                {
                    IModelObject modelObjectB = repositoryB.GetModelObject(modelObjectA.Id);
                    Compare(modelObjectA, modelObjectB, version);
                    CompareModelObjects(repositoryA, modelObjectA, repositoryB, modelObjectB, version);
                }
            }
        }
 protected override void OnInitialize(IModelObject model)
 {
     WidgetsphereGeneratorProject.AddWidgetsphereCoreToBinFolder();
     WidgetsphereGeneratorProject.AddICSharpDllToBinFolder();
     WidgetsphereGeneratorProject.AddMicrosoftServiceModelWebToBinFolder();
 }