Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Hotel_app.Model.hhyyz_dx model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update hhyyz_dx set ");
            strSql.Append("yydh=@yydh,");
            strSql.Append("qymc=@qymc,");
            strSql.Append("hy_action_flage=@hy_action_flage,");
            strSql.Append("msm_content=@msm_content,");
            strSql.Append("enable=@enable,");
            strSql.Append("dxycsj=@dxycsj,");
            strSql.Append("msm_content_2=@msm_content_2,");
            strSql.Append("msm_content_3=@msm_content_3,");
            strSql.Append("msm_content_4=@msm_content_4,");
            strSql.Append("msm_content_5=@msm_content_5");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@yydh",            SqlDbType.VarChar,   50),
                new SqlParameter("@qymc",            SqlDbType.VarChar,   50),
                new SqlParameter("@hy_action_flage", SqlDbType.VarChar,   50),
                new SqlParameter("@msm_content",     SqlDbType.VarChar, 5000),
                new SqlParameter("@enable",          SqlDbType.Bit,        1),
                new SqlParameter("@dxycsj",          SqlDbType.Int,        4),
                new SqlParameter("@msm_content_2",   SqlDbType.VarChar, 1000),
                new SqlParameter("@msm_content_3",   SqlDbType.VarChar, 1000),
                new SqlParameter("@msm_content_4",   SqlDbType.VarChar, 1000),
                new SqlParameter("@msm_content_5",   SqlDbType.VarChar, 1000),
                new SqlParameter("@id",              SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.yydh;
            parameters[1].Value  = model.qymc;
            parameters[2].Value  = model.hy_action_flage;
            parameters[3].Value  = model.msm_content;
            parameters[4].Value  = model.enable;
            parameters[5].Value  = model.dxycsj;
            parameters[6].Value  = model.msm_content_2;
            parameters[7].Value  = model.msm_content_3;
            parameters[8].Value  = model.msm_content_4;
            parameters[9].Value  = model.msm_content_5;
            parameters[10].Value = model.id;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(Hotel_app.Model.hhyyz_dx model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into hhyyz_dx(");
            strSql.Append("yydh,qymc,hy_action_flage,msm_content,enable,dxycsj,msm_content_2,msm_content_3,msm_content_4,msm_content_5)");
            strSql.Append(" values (");
            strSql.Append("@yydh,@qymc,@hy_action_flage,@msm_content,@enable,@dxycsj,@msm_content_2,@msm_content_3,@msm_content_4,@msm_content_5)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@yydh",            SqlDbType.VarChar,   50),
                new SqlParameter("@qymc",            SqlDbType.VarChar,   50),
                new SqlParameter("@hy_action_flage", SqlDbType.VarChar,   50),
                new SqlParameter("@msm_content",     SqlDbType.VarChar, 5000),
                new SqlParameter("@enable",          SqlDbType.Bit,        1),
                new SqlParameter("@dxycsj",          SqlDbType.Int,        4),
                new SqlParameter("@msm_content_2",   SqlDbType.VarChar, 1000),
                new SqlParameter("@msm_content_3",   SqlDbType.VarChar, 1000),
                new SqlParameter("@msm_content_4",   SqlDbType.VarChar, 1000),
                new SqlParameter("@msm_content_5",   SqlDbType.VarChar, 1000)
            };
            parameters[0].Value = model.yydh;
            parameters[1].Value = model.qymc;
            parameters[2].Value = model.hy_action_flage;
            parameters[3].Value = model.msm_content;
            parameters[4].Value = model.enable;
            parameters[5].Value = model.dxycsj;
            parameters[6].Value = model.msm_content_2;
            parameters[7].Value = model.msm_content_3;
            parameters[8].Value = model.msm_content_4;
            parameters[9].Value = model.msm_content_5;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Hotel_app.Model.hhyyz_dx GetModel(int id)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 id,yydh,qymc,hy_action_flage,msm_content,enable,dxycsj,msm_content_2,msm_content_3,msm_content_4,msm_content_5 from hhyyz_dx ");
            strSql.Append(" where id=@id");
            SqlParameter[] parameters =
            {
                new SqlParameter("@id", SqlDbType.Int, 4)
            };
            parameters[0].Value = id;

            Hotel_app.Model.hhyyz_dx model = new Hotel_app.Model.hhyyz_dx();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["id"] != null && ds.Tables[0].Rows[0]["id"].ToString() != "")
                {
                    model.id = int.Parse(ds.Tables[0].Rows[0]["id"].ToString());
                }
                if (ds.Tables[0].Rows[0]["yydh"] != null && ds.Tables[0].Rows[0]["yydh"].ToString() != "")
                {
                    model.yydh = ds.Tables[0].Rows[0]["yydh"].ToString();
                }
                if (ds.Tables[0].Rows[0]["qymc"] != null && ds.Tables[0].Rows[0]["qymc"].ToString() != "")
                {
                    model.qymc = ds.Tables[0].Rows[0]["qymc"].ToString();
                }
                if (ds.Tables[0].Rows[0]["hy_action_flage"] != null && ds.Tables[0].Rows[0]["hy_action_flage"].ToString() != "")
                {
                    model.hy_action_flage = ds.Tables[0].Rows[0]["hy_action_flage"].ToString();
                }
                if (ds.Tables[0].Rows[0]["msm_content"] != null && ds.Tables[0].Rows[0]["msm_content"].ToString() != "")
                {
                    model.msm_content = ds.Tables[0].Rows[0]["msm_content"].ToString();
                }
                if (ds.Tables[0].Rows[0]["enable"] != null && ds.Tables[0].Rows[0]["enable"].ToString() != "")
                {
                    if ((ds.Tables[0].Rows[0]["enable"].ToString() == "1") || (ds.Tables[0].Rows[0]["enable"].ToString().ToLower() == "true"))
                    {
                        model.enable = true;
                    }
                    else
                    {
                        model.enable = false;
                    }
                }
                if (ds.Tables[0].Rows[0]["dxycsj"] != null && ds.Tables[0].Rows[0]["dxycsj"].ToString() != "")
                {
                    model.dxycsj = int.Parse(ds.Tables[0].Rows[0]["dxycsj"].ToString());
                }
                if (ds.Tables[0].Rows[0]["msm_content_2"] != null && ds.Tables[0].Rows[0]["msm_content_2"].ToString() != "")
                {
                    model.msm_content_2 = ds.Tables[0].Rows[0]["msm_content_2"].ToString();
                }
                if (ds.Tables[0].Rows[0]["msm_content_3"] != null && ds.Tables[0].Rows[0]["msm_content_3"].ToString() != "")
                {
                    model.msm_content_3 = ds.Tables[0].Rows[0]["msm_content_3"].ToString();
                }
                if (ds.Tables[0].Rows[0]["msm_content_4"] != null && ds.Tables[0].Rows[0]["msm_content_4"].ToString() != "")
                {
                    model.msm_content_4 = ds.Tables[0].Rows[0]["msm_content_4"].ToString();
                }
                if (ds.Tables[0].Rows[0]["msm_content_5"] != null && ds.Tables[0].Rows[0]["msm_content_5"].ToString() != "")
                {
                    model.msm_content_5 = ds.Tables[0].Rows[0]["msm_content_5"].ToString();
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        //发送短信
        //当预订和登记时,ddsj和lksj才有效,其它时留空就行
        //hykh,xf只有在退房时才有用到
        //fx房型只有在删除时才有用
        public string Hhygl_SendMsm(string phoneNo, string msm_title, string yydh, string qymc, string hyAction, string timeNow, string ddsj, string lksj, string fx, string hykh, string xf, string xxzs)
        {
            string result = common_file.common_app.get_failure;



            if (String.IsNullOrEmpty(phoneNo) || String.IsNullOrEmpty(hyAction) || String.IsNullOrEmpty(xxzs) || System.Text.RegularExpressions.Regex.IsMatch(phoneNo, @"^[1]+[3,4,5,6,8]+\d{9}"))
            {
                return(result);
            }
            else
            {
                try
                {
                    Hotel_app.cn.b2m.eucp.sdkhttp.SDKService msm = new Hotel_app.cn.b2m.eucp.sdkhttp.SDKService();

                    string   serialNo = ConfigurationManager.AppSettings["msm_serialNo"].ToString();
                    string   msm_key  = ConfigurationManager.AppSettings["msm_key"].ToString();
                    string[] phoneStr = phoneNo.Split(new char[] { '|' });

                    string sms_temp_0 = "";   //短消息的内容
                    string sms_temp_1 = "";   //短消息的内容
                    string sms_temp_2 = "";   //短消息的内容
                    string sms_temp_3 = "";   //短消息的内容
                    string sms_temp_4 = "";   //短消息的内容

                    int    tc_time      = 0;  //延迟发送时间,以分钟计算
                    string time_SendMsm = ""; //为空时保持空,表示马上发送
                    if (!timeNow.ToString().Equals(""))
                    {
                        time_SendMsm = timeNow;
                    }
                    Model.hhyyz_dx        M_Hhhyzz_dx = new Hotel_app.Model.hhyyz_dx();
                    List <Model.hhyyz_dx> list_0      = new List <Hotel_app.Model.hhyyz_dx>();
                    BLL.hhyyz_dx          B_hhyzz_dx  = new Hotel_app.BLL.hhyyz_dx();
                    list_0 = B_hhyzz_dx.GetModelList(" yydh='" + yydh + "'  and   hy_action_flage='" + hyAction + "'");
                    string content = "";//最后发送的消息
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    if (list_0 != null && list_0.Count > 0)
                    {
                        M_Hhhyzz_dx = list_0[0];
                        tc_time     = M_Hhhyzz_dx.dxycsj;
                        if (!time_SendMsm.Equals(""))
                        {
                            time_SendMsm = (DateTime.Parse(time_SendMsm)).AddMinutes(tc_time).ToString();//发送时间
                        }
                        sms_temp_0 = M_Hhhyzz_dx.msm_content;
                        sms_temp_1 = M_Hhhyzz_dx.msm_content_2;
                        sms_temp_2 = M_Hhhyzz_dx.msm_content_3;
                        sms_temp_3 = M_Hhhyzz_dx.msm_content_4;
                        sms_temp_4 = M_Hhhyzz_dx.msm_content_5;


                        // sb.Append(M_Hhhyzz_dx.msm_content);
                        if (hyAction == common_file.common_hyAction.hy_Action_djNew)
                        {
                            sb.Append(sms_temp_0);
                            sb.Append("[" + qymc + "]");
                            //sb.Append(sms_temp_1);
                            //sb.Append(":");
                            // sb.Append(ddsj + "到" + lksj);
                            sb.Append(sms_temp_2);
                            sb.Append(sms_temp_3);
                            sb.Append(sms_temp_4);
                        }//登记新增
                        if (hyAction == common_file.common_hyAction.hy_Action_djxg)
                        {
                            sb.Append(sms_temp_0);
                            sb.Append("[" + qymc + "]");
                            sb.Append(sms_temp_1);
                            //sb.Append("您当前的入住时间为:");
                            //sb.Append(ddsj + "到" + lksj);
                            sb.Append(sms_temp_2);
                            sb.Append(sms_temp_3);
                            sb.Append(sms_temp_4);
                        }//登记修改
                        if (hyAction == common_file.common_hyAction.hy_Action_HyNew)
                        {
                            sb.Append(sms_temp_0);
                            sb.Append("卡号" + phoneNo);
                            sb.Append(",密码123456,");
                            sb.Append(sms_temp_1);
                            sb.Append(sms_temp_2);
                            sb.Append(sms_temp_3);
                            sb.Append(sms_temp_4);
                        }//新增会员
                        if (hyAction == common_file.common_hyAction.hy_Action_hytf)
                        {
                            sb.Append(sms_temp_0);
                            sb.Append(sms_temp_1);
                            sb.Append(xf + ",");
                            sb.Append(sms_temp_2);
                            sb.Append(msm_title);//总积分存在这里,传值的时候
                            sb.Append(sms_temp_3);
                            sb.Append(sms_temp_4);
                        }//会员退房
                        if (hyAction == common_file.common_hyAction.hy_Action_ydNew)
                        {
                            sb.Append(sms_temp_0);
                            sb.Append(",");
                            sb.Append(sms_temp_1);
                            //sb.Append(":");
                            //sb.Append(ddsj + "到" + lksj);
                            sb.Append(sms_temp_2);
                            sb.Append(sms_temp_3);
                            sb.Append(sms_temp_4);
                        }//预订新增
                        if (hyAction == common_file.common_hyAction.hy_Action_ydxg)
                        {
                            sb.Append(sms_temp_0);
                            sb.Append(",");
                            sb.Append(msm_title);
                            sb.Append(sms_temp_1);
                            sb.Append(sms_temp_2);
                            sb.Append(sms_temp_3);
                            sb.Append(sms_temp_4);
                        }//预订修改
                        if (hyAction == common_file.common_hyAction.hy_Action_yddel)
                        {
                            sb.Append(sms_temp_0);
                            sb.Append("(" + qymc + ")");
                            sb.Append(sms_temp_1);
                            sb.Append("您当前预订单的入住时间为");
                            sb.Append(ddsj + "-" + lksj);
                            //sb.Append("  fx ");
                            sb.Append(sms_temp_2);
                            sb.Append(sms_temp_3);
                            sb.Append(sms_temp_4);
                        }//预订删除

                        //会员升级
                        if (hyAction == common_file_server.common_hyAction.hy_Action_promoteType)
                        {
                            sb.Append(sms_temp_0);
                            sb.Append("(" + qymc + ")");
                            sb.Append("您升级后的积分余额为");
                            sb.Append(msm_title + "。");
                            sb.Append(sms_temp_2);
                            sb.Append(sms_temp_3);
                            sb.Append(sms_temp_4);
                        }
                        if (hyAction == common_file.common_hyAction.hy_Action_hyqr)
                        {
                            sb.Append(sms_temp_0);
                            sb.Append(sms_temp_1);
                            sb.Append(sms_temp_2);
                            sb.Append(sms_temp_3);
                            sb.Append(sms_temp_4);
                        }
                    }
                    content = sb.ToString();
                    if (!time_SendMsm.Equals(""))
                    {
                        time_SendMsm = DateTime.Parse(time_SendMsm.ToString()).ToString("yyyyMMddHHmmss");
                    }
                    if (!content.Equals(""))
                    {
                        object resultCode = msm.sendSMS(serialNo, msm_key, time_SendMsm.ToString(), phoneStr, content, "", "GBK", 5);
                        if (resultCode != null && int.Parse(resultCode.ToString()) <= 0)
                        {
                            result = common_file.common_app.get_suc;
                        }
                    }
                }
                catch
                {
                    //return result;
                }
            }
            return(result);
        }