예제 #1
0
        public static int CheckUpdate(RegChannelEntity regChannelEntity)
        {
            OracleParameter[] parm ={
                                    new OracleParameter("REGCHANELCODE",OracleType.VarChar),
                                    new OracleParameter("REGCHANELNM",OracleType.VarChar)
                                };
            RegChannelDBEntity dbParm = (regChannelEntity.RegChannelDBEntity.Count > 0) ? regChannelEntity.RegChannelDBEntity[0] : new RegChannelDBEntity();
            parm[0].Value = dbParm.RegChannelID;
            parm[1].Value = dbParm.Name_CN;
            regChannelEntity.QueryResult = HotelVp.Common.DBUtility.DbManager.Query("RegChannel", "t_lm_b_regchanel_updatesigle", false, parm);

            if (regChannelEntity.QueryResult.Tables.Count > 0 && regChannelEntity.QueryResult.Tables[0].Rows.Count > 0)
            {
                return 1;
            }
            return 0;
        }
예제 #2
0
        public static int Update(RegChannelEntity regChannelEntity)
        {
            regChannelEntity.LogMessages.MsgType = MessageType.INFO;
            regChannelEntity.LogMessages.Content = _nameSpaceClass + "Update";
            LoggerHelper.LogWriter(regChannelEntity.LogMessages);

            try
            {
                return RegChannelDA.Update(regChannelEntity);
            }
            catch (Exception ex)
            {
                regChannelEntity.LogMessages.MsgType = MessageType.ERROR;
                regChannelEntity.LogMessages.Content = _nameSpaceClass + "Update  Error: " + ex.Message;
                LoggerHelper.LogWriter(regChannelEntity.LogMessages);
                throw ex;
            }
        }
예제 #3
0
        public static int Insert(RegChannelEntity regChannelEntity)
        {
            if (regChannelEntity.RegChannelDBEntity.Count == 0)
            {
                return 0;
            }

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

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

            RegChannelDBEntity dbParm = (regChannelEntity.RegChannelDBEntity.Count > 0) ? regChannelEntity.RegChannelDBEntity[0] : new RegChannelDBEntity();

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

            lmParm[0].Value = getMaxIDfromSeq("T_LM_B_REGCHANEL_SEQ");
            lmParm[1].Value = dbParm.RegChannelID;
            lmParm[2].Value = dbParm.Name_CN;
            DbManager.ExecuteSql("RegChannel", "t_lm_b_regchanel_insert", lmParm);
            //InsertLmRegChannelInfo.SqlName = "RegChannel";
            //InsertLmRegChannelInfo.SqlId = "t_lm_regchanel_insert";
            //InsertLmRegChannelInfo.Parameters = lmParm;

            //CommandInfo InsertCsRegChannelInfo = new CommandInfo();

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

            //csParm[0].Value = getMaxIDfromSeq("T_CS_REGCHANEL_SEQ");
            //csParm[1].Value = lmParm[0].Value;
            //csParm[2].Value = "0";
            //InsertCsRegChannelInfo.SqlName = "RegChannel";
            //InsertCsRegChannelInfo.SqlId = "t_cs_regchanel_insert";
            //InsertCsRegChannelInfo.Parameters = csParm;

            //sqlList.Add(InsertLmRegChannelInfo);
            //sqlList.Add(InsertCsRegChannelInfo);
            //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;
        }
예제 #4
0
        public static RegChannelEntity Select(RegChannelEntity regChannelEntity)
        {
            OracleParameter[] parm ={
                                    new OracleParameter("REGCHANELNAME",OracleType.VarChar),
                                    new OracleParameter("ONLINESTATUS",OracleType.VarChar),
                                    new OracleParameter("StartDTime",OracleType.VarChar),
                                    new OracleParameter("EndDTime",OracleType.VarChar)
                                };
            RegChannelDBEntity dbParm = (regChannelEntity.RegChannelDBEntity.Count > 0) ? regChannelEntity.RegChannelDBEntity[0] : new RegChannelDBEntity();

            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;
            }

            regChannelEntity.QueryResult = HotelVp.Common.DBUtility.DbManager.Query("RegChannel", "t_lm_b_regchanel", false, parm);
            return regChannelEntity;
        }