Esempio n. 1
0
        public static int CheckUpdate(PlatformEntity platformEntity)
        {
            OracleParameter[] parm ={
                                    new OracleParameter("PLATFORMCODE",OracleType.VarChar),
                                    new OracleParameter("PLATFORMNM",OracleType.VarChar)
                                };
            PlatformDBEntity dbParm = (platformEntity.PlatformDBEntity.Count > 0) ? platformEntity.PlatformDBEntity[0] : new PlatformDBEntity();
            parm[0].Value = dbParm.PlatformID;
            parm[1].Value = dbParm.Name_CN;
            platformEntity.QueryResult = HotelVp.Common.DBUtility.DbManager.Query("Platform", "t_lm_b_platform_updatesigle", false, parm);

            if (platformEntity.QueryResult.Tables.Count > 0 && platformEntity.QueryResult.Tables[0].Rows.Count > 0)
            {
                return 1;
            }
            return 0;
        }
Esempio n. 2
0
        public static int Update(PlatformEntity platformEntity)
        {
            platformEntity.LogMessages.MsgType = MessageType.INFO;
            platformEntity.LogMessages.Content = _nameSpaceClass + "Update";
            LoggerHelper.LogWriter(platformEntity.LogMessages);

            try
            {
                return PlatformDA.Update(platformEntity);
            }
            catch (Exception ex)
            {
                platformEntity.LogMessages.MsgType = MessageType.ERROR;
                platformEntity.LogMessages.Content = _nameSpaceClass + "Update  Error: " + ex.Message;
                LoggerHelper.LogWriter(platformEntity.LogMessages);
                throw ex;
            }
        }
Esempio n. 3
0
        public static int Insert(PlatformEntity platformEntity)
        {
            if (platformEntity.PlatformDBEntity.Count == 0)
            {
                return 0;
            }

            if (platformEntity.LogMessages == null)
            {
                return 0;
            }

            if (CheckInsert(platformEntity) > 0)
            {
                return 2;
            }

            PlatformDBEntity dbParm = (platformEntity.PlatformDBEntity.Count > 0) ? platformEntity.PlatformDBEntity[0] : new PlatformDBEntity();

            //List<CommandInfo> sqlList = new List<CommandInfo>();
            //CommandInfo InsertLmPlatformInfo = new CommandInfo();
            OracleParameter[] lmParm ={
                                    new OracleParameter("ID",OracleType.Number),
                                    new OracleParameter("PLATFORMCODE",OracleType.VarChar),
                                    new OracleParameter("PLATFORMNM",OracleType.VarChar)
                                };

            lmParm[0].Value = getMaxIDfromSeq("T_LM_B_PLATFORM_SEQ");
            lmParm[1].Value = dbParm.PlatformID;
            lmParm[2].Value = dbParm.Name_CN;
            DbManager.ExecuteSql("Platform", "t_lm_b_platform_insert", lmParm);

            //InsertLmPlatformInfo.SqlName = "Platform";
            //InsertLmPlatformInfo.SqlId = "t_lm_platform_insert";
            //InsertLmPlatformInfo.Parameters = lmParm;

            //CommandInfo InsertCSPlatformInfo = new CommandInfo();

            //OracleParameter[] csParm ={
            //                        new OracleParameter("ID",OracleType.Number),
            //                        new OracleParameter("PLATFORMID",OracleType.VarChar),
            //                        new OracleParameter("ONLINESTATUS",OracleType.VarChar)
            //                    };

            //csParm[0].Value = getMaxIDfromSeq("T_CS_PLATFORM_SEQ");
            //csParm[1].Value = lmParm[0].Value;
            //csParm[2].Value = "0";
            //InsertCSPlatformInfo.SqlName = "Platform";
            //InsertCSPlatformInfo.SqlId = "t_cs_platform_insert";
            //InsertCSPlatformInfo.Parameters = csParm;

            //sqlList.Add(InsertLmPlatformInfo);
            //sqlList.Add(InsertCSPlatformInfo);
            //DbManager.ExecuteSqlTran(sqlList);

            //DataCommand cmd = DataCommandManager.GetDataCommand("InsertCityList");
            //foreach (ChannelDBEntity dbParm in channelEntity.ChannelDBEntity)
            //{
            //    cmd.SetParameterValue("@ChannelID", dbParm.ChannelID);
            //    cmd.SetParameterValue("@NameCN", dbParm.Name_CN);
            //    cmd.SetParameterValue("@NameEN", PinyinHelper.GetPinyin(dbParm.Name_CN));
            //    cmd.SetParameterValue("@OnlineStatus", dbParm.OnlineStatus);
            //    cmd.SetParameterValue("@Remark", dbParm.Remark);
            //    cmd.SetParameterValue("@CreateUser", (channelEntity.LogMessages != null) ? channelEntity.LogMessages.Userid : "");
            //    cmd.SetParameterValue("@UpdateUser", (channelEntity.LogMessages != null) ? channelEntity.LogMessages.Userid : "");
            //    cmd.ExecuteNonQuery();
            //}

            return 1;
        }
Esempio n. 4
0
        public static PlatformEntity Select(PlatformEntity platformEntity)
        {
            OracleParameter[] parm ={
                                    new OracleParameter("PLATFORMNAME",OracleType.VarChar),
                                    new OracleParameter("ONLINESTATUS",OracleType.VarChar),
                                    new OracleParameter("StartDTime",OracleType.VarChar),
                                    new OracleParameter("EndDTime",OracleType.VarChar)
                                };
            PlatformDBEntity dbParm = (platformEntity.PlatformDBEntity.Count > 0) ? platformEntity.PlatformDBEntity[0] : new PlatformDBEntity();

            if (String.IsNullOrEmpty(dbParm.Name_CN))
            {
                parm[0].Value = DBNull.Value;
            }
            else
            {
                parm[0].Value = dbParm.Name_CN;
            }

            if (String.IsNullOrEmpty(dbParm.OnlineStatus))
            {
                parm[1].Value = DBNull.Value;
            }
            else
            {
                parm[1].Value = dbParm.OnlineStatus;
            }

            if (String.IsNullOrEmpty(dbParm.StartDTime))
            {
                parm[2].Value = DBNull.Value;
            }
            else
            {
                parm[2].Value = dbParm.StartDTime;
            }

            if (String.IsNullOrEmpty(dbParm.EndDTime))
            {
                parm[3].Value = DBNull.Value;
            }
            else
            {
                parm[3].Value = dbParm.EndDTime;
            }

            platformEntity.QueryResult = HotelVp.Common.DBUtility.DbManager.Query("Platform", "t_lm_b_platform",false, parm);
            return platformEntity;
        }