Exemplo n.º 1
0
        /// <summary>
        ///  根据ID生成临时图片
        /// </summary>
        /// <param name="GraphicID"></param>
        public void GetGraphic(AstroMod mod)
        {
            if (mod.graphicID == "")
            {
                return;
            }
            string argument = mod.graphicID.Replace("_", " ").Replace(";", ":");

            FATE_AstroMod m_astro = FATE_AstroBll.GetInstance().GetModel(mod.graphicID);

            if (m_astro != null && m_astro.DR == (int)AppEnum.State.normal)
            {
                m_astro.LastTime = DateTime.Now;
                FATE_AstroBll.GetInstance().Update(m_astro);
                return;
            }
            string tmpname = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\" + CommonTools.GetRandomString(5);

            argument += " -Xbb -Xo " + tmpname;//输出
            argument += " -o0 " + AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"TextInfo\C" + DateTime.Now.ToString("yyyyMMddHHmmss") + CommonTools.GetRandomString(4);

            argument = argument.Replace("file1", mod.composeFile1);
            argument = argument.Replace("file2", mod.composeFile2);

            //try
            //{
            string[] args = argument.Split(new char[] { '$' });
            for (int i = 0; i < args.Length; i++)
            {
                RunAstrolog(args[i]);
            }
            //星盘信息加入数据库
            FATE_AstroMod new_astro = new FATE_AstroMod();

            new_astro.ID       = mod.graphicID;
            new_astro.LastTime = DateTime.Now;
            FATE_AstroBll.GetInstance().Add(new_astro);
            //while (!File.Exists(tmpname) || IsUsed(tmpname))
            //{ }

            //处理临时文件
            SetGraphicColor(mod.graphicID, tmpname);

            //删除排盘临时文件
            if (mod.composeFile1 != "")
            {
                File.Delete(mod.composeFile1);
            }
            if (mod.composeFile2 != "")
            {
                File.Delete(mod.composeFile2);
            }
            //}
            //catch (Exception ex)
            //{
            //    LogManagement.getInstance().WriteException(ex, "PPLive.Astro", "");
            //    return;
            //}
        }
Exemplo n.º 2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>

        public int Update(FATE_AstroMod model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update FATE_Astro set ");
            strSql.Append("LastTime=@LastTime,");
            strSql.Append("DR=@DR,");
            strSql.Append("TS=@TS");
            strSql.Append(" where ID=@ID ");
            SqlCommand cmd = new SqlCommand(strSql.ToString());

            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",       SqlDbType.VarChar,   200),
                new SqlParameter("@LastTime", SqlDbType.DateTime),
                new SqlParameter("@DR",       SqlDbType.Int,         4),
                new SqlParameter("@TS",       SqlDbType.DateTime)
            };
            if (model.ID != AppConst.StringNull)
            {
                parameters[0].Value = model.ID;
            }
            else
            {
                parameters[0].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[0]);
            if (model.LastTime != AppConst.DateTimeNull)
            {
                parameters[1].Value = model.LastTime;
            }
            else
            {
                parameters[1].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[1]);
            if (model.DR != AppConst.IntNull)
            {
                parameters[2].Value = model.DR;
            }
            else
            {
                parameters[2].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[2]);
            if (model.TS != AppConst.DateTimeNull)
            {
                parameters[3].Value = model.TS;
            }
            else
            {
                parameters[3].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[3]);
            return(SqlHelper.ExecuteNonQuery(cmd, parameters));
        }
Exemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>

        public void Add(FATE_AstroMod model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into FATE_Astro(");
            strSql.Append("ID,LastTime)");
            strSql.Append(" values (");
            strSql.Append("@ID,@LastTime)");
            SqlCommand cmd = new SqlCommand(strSql.ToString());

            SqlParameter[] parameters =
            {
                new SqlParameter("@ID",       SqlDbType.VarChar,   200),
                new SqlParameter("@LastTime", SqlDbType.DateTime),
                new SqlParameter("@DR",       SqlDbType.Int,         4),
                new SqlParameter("@TS",       SqlDbType.DateTime)
            };
            if (model.ID != AppConst.StringNull)
            {
                parameters[0].Value = model.ID;
            }
            else
            {
                parameters[0].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[0]);
            if (model.LastTime != AppConst.DateTimeNull)
            {
                parameters[1].Value = model.LastTime;
            }
            else
            {
                parameters[1].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[1]);
            if (model.DR != AppConst.IntNull)
            {
                parameters[2].Value = model.DR;
            }
            else
            {
                parameters[2].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[2]);
            if (model.TS != AppConst.DateTimeNull)
            {
                parameters[3].Value = model.TS;
            }
            else
            {
                parameters[3].Value = System.DBNull.Value;
            }
            cmd.Parameters.Add(parameters[3]);
            SqlHelper.ExecuteNonQuery(cmd, parameters);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>

        public FATE_AstroMod GetModel(string ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID, LastTime, DR, TS from FATE_Astro");
            strSql.Append(" where ID=@ID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@ID", SqlDbType.VarChar, 200)
            };
            parameters[0].Value = ID;
            FATE_AstroMod model = new FATE_AstroMod();
            DataSet       ds    = SqlHelper.ExecuteDataSet(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                model.ID = ds.Tables[0].Rows[0]["ID"].ToString();
                if (ds.Tables[0].Rows[0]["LastTime"].ToString() != "")
                {
                    model.LastTime = DateTime.Parse(ds.Tables[0].Rows[0]["LastTime"].ToString());
                }
                if (ds.Tables[0].Rows[0]["DR"].ToString() != "")
                {
                    model.DR = int.Parse(ds.Tables[0].Rows[0]["DR"].ToString());
                }
                if (ds.Tables[0].Rows[0]["TS"].ToString() != "")
                {
                    model.TS = DateTime.Parse(ds.Tables[0].Rows[0]["TS"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 5
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(FATE_AstroMod model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("insert into FATE_Astro(");
     strSql.Append("ID,LastTime)");
     strSql.Append(" values (");
     strSql.Append("@ID,@LastTime)");
     SqlCommand cmd = new SqlCommand(strSql.ToString());
     SqlParameter[] parameters = {
          new SqlParameter("@ID",SqlDbType.VarChar,200),
          new SqlParameter("@LastTime",SqlDbType.DateTime),
          new SqlParameter("@DR",SqlDbType.Int,4),
          new SqlParameter("@TS",SqlDbType.DateTime)
      };
     if (model.ID != AppConst.StringNull)
         parameters[0].Value = model.ID;
     else
         parameters[0].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[0]);
     if (model.LastTime != AppConst.DateTimeNull)
         parameters[1].Value = model.LastTime;
     else
         parameters[1].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[1]);
     if (model.DR != AppConst.IntNull)
         parameters[2].Value = model.DR;
     else
         parameters[2].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[2]);
     if (model.TS != AppConst.DateTimeNull)
         parameters[3].Value = model.TS;
     else
         parameters[3].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[3]);
     SqlHelper.ExecuteNonQuery(cmd,parameters);
 }
Exemplo n.º 6
0
        /// <summary>
        ///  根据ID生成临时图片
        /// </summary>
        /// <param name="GraphicID"></param>
        public void GetGraphic(AstroMod mod)
        {
            if (mod.graphicID == "")
            {
                return;
            }
            string argument = mod.graphicID.Replace("_", " ").Replace(";", ":");

            FATE_AstroMod m_astro = FATE_AstroBll.GetInstance().GetModel(mod.graphicID);
            if (m_astro != null && m_astro.DR == (int)AppEnum.State.normal)
            {
                m_astro.LastTime = DateTime.Now;
                FATE_AstroBll.GetInstance().Update(m_astro);
                return;
            }
            string tmpname = AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"Tmp\" + CommonTools.GetRandomString(5);
            argument += " -Xbb -Xo " + tmpname;//输出
            argument += " -o0 " + AppDomain.CurrentDomain.BaseDirectory + AppConfig.AstroGraphicPath() + @"TextInfo\C" + DateTime.Now.ToString("yyyyMMddHHmmss") + CommonTools.GetRandomString(4);

            argument = argument.Replace("file1", mod.composeFile1);
            argument = argument.Replace("file2", mod.composeFile2);

            //try
            //{
                string[] args = argument.Split(new char[] { '$' });
                for (int i = 0; i < args.Length; i++)
                {
                    RunAstrolog(args[i]);
                }
                //星盘信息加入数据库
                FATE_AstroMod new_astro = new FATE_AstroMod();
                new_astro.ID = mod.graphicID;
                new_astro.LastTime = DateTime.Now;
                FATE_AstroBll.GetInstance().Add(new_astro);
                //while (!File.Exists(tmpname) || IsUsed(tmpname))
                //{ }

                //处理临时文件
                SetGraphicColor(mod.graphicID, tmpname);

                //删除排盘临时文件
                if (mod.composeFile1 != "")
                {
                    File.Delete(mod.composeFile1);
                }
                if (mod.composeFile2 != "")
                {
                    File.Delete(mod.composeFile2);
                }
            //}
            //catch (Exception ex)
            //{
            //    LogManagement.getInstance().WriteException(ex, "PPLive.Astro", "");
            //    return;
            //}
        }
Exemplo n.º 7
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public int Update(FATE_AstroMod model)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("update FATE_Astro set ");
     strSql.Append("LastTime=@LastTime,");
     strSql.Append("DR=@DR,");
     strSql.Append("TS=@TS");
     strSql.Append(" where ID=@ID ");
     SqlCommand cmd = new SqlCommand(strSql.ToString());
     SqlParameter[] parameters = {
          new SqlParameter("@ID",SqlDbType.VarChar,200),
          new SqlParameter("@LastTime",SqlDbType.DateTime),
          new SqlParameter("@DR",SqlDbType.Int,4),
          new SqlParameter("@TS",SqlDbType.DateTime)
      };
     if (model.ID != AppConst.StringNull)
         parameters[0].Value = model.ID;
     else
         parameters[0].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[0]);
     if (model.LastTime != AppConst.DateTimeNull)
         parameters[1].Value = model.LastTime;
     else
         parameters[1].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[1]);
     if (model.DR != AppConst.IntNull)
         parameters[2].Value = model.DR;
     else
         parameters[2].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[2]);
     if (model.TS != AppConst.DateTimeNull)
         parameters[3].Value = model.TS;
     else
         parameters[3].Value = System.DBNull.Value;
     cmd.Parameters.Add(parameters[3]);
     return SqlHelper.ExecuteNonQuery(cmd,parameters);
 }
Exemplo n.º 8
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public FATE_AstroMod GetModel(string ID)
 {
     StringBuilder strSql = new StringBuilder();
     strSql.Append("select ID, LastTime, DR, TS from FATE_Astro");
     strSql.Append(" where ID=@ID");
     SqlParameter[] parameters = {
       new SqlParameter("@ID", SqlDbType.VarChar,200 )
      		};
     parameters[0].Value = ID;
     FATE_AstroMod model = new FATE_AstroMod();
     DataSet ds = SqlHelper.ExecuteDataSet(strSql.ToString(), parameters);
     if (ds.Tables[0].Rows.Count > 0)
     {
         model.ID = ds.Tables[0].Rows[0]["ID"].ToString();
         if (ds.Tables[0].Rows[0]["LastTime"].ToString() != "")
         {
             model.LastTime = DateTime.Parse(ds.Tables[0].Rows[0]["LastTime"].ToString());
         }
         if (ds.Tables[0].Rows[0]["DR"].ToString() != "")
         {
             model.DR = int.Parse(ds.Tables[0].Rows[0]["DR"].ToString());
         }
         if (ds.Tables[0].Rows[0]["TS"].ToString() != "")
         {
             model.TS = DateTime.Parse(ds.Tables[0].Rows[0]["TS"].ToString());
         }
         return model;
     }
     else
     {
         return null;
     }
 }
Exemplo n.º 9
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(FATE_AstroMod model)
 {
     dal.Update(model);
 }
Exemplo n.º 10
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public void Add(FATE_AstroMod model)
 {
     dal.Add(model);
 }
Exemplo n.º 11
0
        /// <summary>
        /// 更新一条数据
        /// </summary>

        public void Update(FATE_AstroMod model)
        {
            dal.Update(model);
        }
Exemplo n.º 12
0
        /// <summary>
        /// 增加一条数据
        /// </summary>

        public void Add(FATE_AstroMod model)
        {
            dal.Add(model);
        }