Ejemplo n.º 1
0
    public static DataTable SelectAll()
    {
        SqlConnection connection = MarriageData.GetConnection();
        string        selectStatement
            = "SELECT "
              + "     [User Name] = [Login].[User_Name] "
              + "    ,[Password] = [Login].[Password] "
              + "FROM "
              + "     [Login] "
              + "";
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        selectCommand.CommandType = CommandType.Text;
        DataTable dt = new DataTable();

        try
        {
            connection.Open();
            SqlDataReader reader = selectCommand.ExecuteReader();
            if (reader.HasRows)
            {
                dt.Load(reader);
            }
            reader.Close();
        }
        catch (SqlException)
        {
            return(dt);
        }
        finally
        {
            connection.Close();
        }
        return(dt);
    }
Ejemplo n.º 2
0
    public static List <MarriageRec_Dispensation_Type26> List()
    {
        List <MarriageRec_Dispensation_Type26> MarriageRec_Dispensation_TypeList = new List <MarriageRec_Dispensation_Type26>();
        SqlConnection connection = MarriageData.GetConnection();
        string        selectStatement
            = "SELECT "
              + "     [Dispensation_Type_ID] "
              + "FROM "
              + "     [Dispensation_Type] "
              + "";
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        try
        {
            connection.Open();
            SqlDataReader reader = selectCommand.ExecuteReader();
            MarriageRec_Dispensation_Type26 clsMarriageRec_Dispensation_Type = new MarriageRec_Dispensation_Type26();
            while (reader.Read())
            {
                clsMarriageRec_Dispensation_Type = new MarriageRec_Dispensation_Type26();
                clsMarriageRec_Dispensation_Type.Dispensation_Type_ID = System.Convert.ToInt16(reader["Dispensation_Type_ID"]);
                MarriageRec_Dispensation_TypeList.Add(clsMarriageRec_Dispensation_Type);
            }
            reader.Close();
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
        return(MarriageRec_Dispensation_TypeList);
    }
Ejemplo n.º 3
0
    public static List <MarriageRec_Catholic_Party29> List()
    {
        List <MarriageRec_Catholic_Party29> MarriageRec_Catholic_PartyList = new List <MarriageRec_Catholic_Party29>();
        SqlConnection connection = MarriageData.GetConnection();
        string        selectStatement
            = "SELECT "
              + "     [Catholic_Party_ID] "
              + "FROM "
              + "     [Catholic_Party] "
              + "";
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        try
        {
            connection.Open();
            SqlDataReader reader = selectCommand.ExecuteReader();
            MarriageRec_Catholic_Party29 clsMarriageRec_Catholic_Party = new MarriageRec_Catholic_Party29();
            while (reader.Read())
            {
                clsMarriageRec_Catholic_Party = new MarriageRec_Catholic_Party29();
                clsMarriageRec_Catholic_Party.Catholic_Party_ID = System.Convert.ToInt16(reader["Catholic_Party_ID"]);
                MarriageRec_Catholic_PartyList.Add(clsMarriageRec_Catholic_Party);
            }
            reader.Close();
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
        return(MarriageRec_Catholic_PartyList);
    }
Ejemplo n.º 4
0
    public static List <MarriageRec_Groom21> List()
    {
        List <MarriageRec_Groom21> MarriageRec_GroomList = new List <MarriageRec_Groom21>();
        SqlConnection connection = MarriageData.GetConnection();
        string        selectStatement
            = "SELECT "
              + "     [Groom_ID] "
              + "FROM "
              + "     [Groom] "
              + "";
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        try
        {
            connection.Open();
            SqlDataReader       reader = selectCommand.ExecuteReader();
            MarriageRec_Groom21 clsMarriageRec_Groom = new MarriageRec_Groom21();
            while (reader.Read())
            {
                clsMarriageRec_Groom          = new MarriageRec_Groom21();
                clsMarriageRec_Groom.Groom_ID = System.Convert.ToInt32(reader["Groom_ID"]);
                MarriageRec_GroomList.Add(clsMarriageRec_Groom);
            }
            reader.Close();
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
        return(MarriageRec_GroomList);
    }
Ejemplo n.º 5
0
    public static DataTable SelectAll()
    {
        SqlConnection connection = MarriageData.GetConnection();
        string        selectStatement
            = "SELECT "
              + "     [Catholic Party I D] = [Catholic_Party].[Catholic_Party_ID] "
              + "    ,[Catholic Party Category] = [Catholic_Party].[Catholic_Party_Category] "
              + "FROM "
              + "     [Catholic_Party] "
              + "";
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        selectCommand.CommandType = CommandType.Text;
        DataTable dt = new DataTable();

        try
        {
            connection.Open();
            SqlDataReader reader = selectCommand.ExecuteReader();
            if (reader.HasRows)
            {
                dt.Load(reader);
            }
            reader.Close();
        }
        catch (SqlException)
        {
            return(dt);
        }
        finally
        {
            connection.Close();
        }
        return(dt);
    }
Ejemplo n.º 6
0
 public static bool UpdateMarriageData2DB(int nRoleID, MarriageData updateMarriageData, GameClient self)
 {
     byte[] dataBytes = DataHelper.ObjectToBytes <MarriageData>(updateMarriageData);
     byte[] byRoleID  = BitConverter.GetBytes(nRoleID);
     byte[] sendBytes = new byte[dataBytes.Length + 4];
     Array.Copy(byRoleID, sendBytes, 4);
     Array.Copy(dataBytes, 0, sendBytes, 4, dataBytes.Length);
     return(Global.sendToDB <bool, byte[]>(10185, sendBytes, self.ServerId));
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 更新爱情宣言
        /// </summary>
        public MarryOtherResult ChangeMarriageMessage(GameClient client, string strMessage)
        {
            //看看是不是结婚了
            if (-1 == client.ClientData.MyMarriageData.byMarrytype)
            {
                return(MarryOtherResult.NotMarriaged);
            }

            //检查一下宣言长度 todo... 鼠标库表是varchar 128 所以最长就64吧
            if (strMessage.Length >= 64)
            {
                return(MarryOtherResult.MessageLimit);
            }

            //检查屏蔽字 todo...

            //把自己的爱情宣言更新
            client.ClientData.MyMarriageData.strLovemessage = strMessage;

            //保存数据我自己的爱情宣言
            MarryFuBenMgr.UpdateMarriageData2DB(client);

            SendMarriageDataToClient(client);

            //取出情侣
            GameClient Spouseclient = GameManager.ClientMgr.FindClient(client.ClientData.MyMarriageData.nSpouseID);

            if (null != Spouseclient)
            {
                //更新情侣的爱情宣言
                Spouseclient.ClientData.MyMarriageData.strLovemessage = strMessage;

                //保存数据配偶的爱情宣言
                MarryFuBenMgr.UpdateMarriageData2DB(Spouseclient);

                SendMarriageDataToClient(Spouseclient);
            }
            else
            {
                //从db查找配偶数据
                string       tcpstring          = string.Format("{0}", client.ClientData.MyMarriageData.nSpouseID);
                MarriageData SpouseMarriageData = Global.sendToDB <MarriageData, string>((int)TCPGameServerCmds.CMD_DB_GET_MARRY_DATA, tcpstring, client.ServerId);

                //没有数据? 或者出错?
                if (null == SpouseMarriageData ||
                    -1 == SpouseMarriageData.byMarrytype)
                {
                    return(MarryOtherResult.Error);
                }

                //更新配偶爱情宣言到数据库
                MarryFuBenMgr.UpdateMarriageData2DB(client.ClientData.MyMarriageData.nSpouseID, SpouseMarriageData, client);
            }
            return(MarryOtherResult.Success);
        }
Ejemplo n.º 8
0
 private void cbExport_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     using (new WaitCursor())
     {
         try
         {
             MarriageData clsMarriageData = new MarriageData();
             if (cbiPDF.IsSelected == true)
             {
                 if (tiGrid.IsSelected)
                 {
                     clsMarriageData.ExportToPdf("Many",
                                                 "Dbo. Dispensation", Grid, (DataRowView)Grid.CurrentItem, Row);
                 }
                 else if (tiDetail.IsSelected)
                 {
                     clsMarriageData.ExportToPdf("One",
                                                 "Dbo. Dispensation", Grid, (DataRowView)Grid.CurrentItem, Row);
                 }
             }
             else if (cbiExcel.IsSelected == true)
             {
                 if (tiGrid.IsSelected)
                 {
                     clsMarriageData.ExportToExcel("Many",
                                                   "Dbo. Dispensation", Grid, (DataRowView)Grid.CurrentItem, Row);
                 }
                 else if (tiDetail.IsSelected)
                 {
                     clsMarriageData.ExportToExcel("One",
                                                   "Dbo. Dispensation", Grid, (DataRowView)Grid.CurrentItem, Row);
                 }
             }
             else if (cbiWord.IsSelected == true)
             {
                 if (tiGrid.IsSelected)
                 {
                     clsMarriageData.ExportToWord("Many",
                                                  "Dbo. Dispensation", Grid, (DataRowView)Grid.CurrentItem, Row);
                 }
                 else if (tiDetail.IsSelected)
                 {
                     clsMarriageData.ExportToWord("One",
                                                  "Dbo. Dispensation", Grid, (DataRowView)Grid.CurrentItem, Row);
                 }
             }
             cbiExport.IsSelected = true;
         }
         catch
         {
         }
     }
 }
Ejemplo n.º 9
0
    public static bool Update(Bride oldBride,
                              Bride newBride)
    {
        SqlConnection connection = MarriageData.GetConnection();
        string        updateStatement
            = "UPDATE "
              + "     [Bride] "
              + "SET "
              + "     [Bride_First_Name] = @NewBride_First_Name "
              + "    ,[Bride_Middle_Int] = @NewBride_Middle_Int "
              + "    ,[Bride_Last_Name] = @NewBride_Last_Name "
              + "WHERE "
              + "     [Bride_ID] = @OldBride_ID "
              + " AND [Bride_First_Name] = @OldBride_First_Name "
              + " AND [Bride_Middle_Int] = @OldBride_Middle_Int "
              + " AND [Bride_Last_Name] = @OldBride_Last_Name "
              + "";
        SqlCommand updateCommand = new SqlCommand(updateStatement, connection);

        updateCommand.CommandType = CommandType.Text;
        updateCommand.Parameters.AddWithValue("@NewBride_First_Name", newBride.Bride_First_Name);
        updateCommand.Parameters.AddWithValue("@NewBride_Middle_Int", newBride.Bride_Middle_Int);
        updateCommand.Parameters.AddWithValue("@NewBride_Last_Name", newBride.Bride_Last_Name);
        updateCommand.Parameters.AddWithValue("@OldBride_ID", oldBride.Bride_ID);
        updateCommand.Parameters.AddWithValue("@OldBride_First_Name", oldBride.Bride_First_Name);
        updateCommand.Parameters.AddWithValue("@OldBride_Middle_Int", oldBride.Bride_Middle_Int);
        updateCommand.Parameters.AddWithValue("@OldBride_Last_Name", oldBride.Bride_Last_Name);
        try
        {
            connection.Open();
            int count = updateCommand.ExecuteNonQuery();
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
    }
Ejemplo n.º 10
0
    public static Bride Select_Record(Bride clsBridePara)
    {
        Bride         clsBride   = new Bride();
        SqlConnection connection = MarriageData.GetConnection();
        string        selectStatement
            = "SELECT "
              + "     [Bride_ID] "
              + "    ,[Bride_First_Name] "
              + "    ,[Bride_Middle_Int] "
              + "    ,[Bride_Last_Name] "
              + "FROM "
              + "     [Bride] "
              + "WHERE "
              + "     [Bride_ID] = @Bride_ID "
              + "";
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        selectCommand.CommandType = CommandType.Text;
        selectCommand.Parameters.AddWithValue("@Bride_ID", clsBridePara.Bride_ID);
        try
        {
            connection.Open();
            SqlDataReader reader
                = selectCommand.ExecuteReader(CommandBehavior.SingleRow);
            if (reader.Read())
            {
                clsBride.Bride_ID         = System.Convert.ToInt32(reader["Bride_ID"]);
                clsBride.Bride_First_Name = System.Convert.ToString(reader["Bride_First_Name"]);
                clsBride.Bride_Middle_Int = System.Convert.ToString(reader["Bride_Middle_Int"]);
                clsBride.Bride_Last_Name  = System.Convert.ToString(reader["Bride_Last_Name"]);
            }
            else
            {
                clsBride = null;
            }
            reader.Close();
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
        return(clsBride);
    }
Ejemplo n.º 11
0
    public static bool Add(Bride clsBride)
    {
        SqlConnection connection = MarriageData.GetConnection();
        string        insertStatement
            = "INSERT "
              + "     [Bride] "
              + "     ( "
              + "     [Bride_First_Name] "
              + "    ,[Bride_Middle_Int] "
              + "    ,[Bride_Last_Name] "
              + "     ) "
              + "VALUES "
              + "     ( "
              + "     @Bride_First_Name "
              + "    ,@Bride_Middle_Int "
              + "    ,@Bride_Last_Name "
              + "     ) "
              + "";
        SqlCommand insertCommand = new SqlCommand(insertStatement, connection);

        insertCommand.CommandType = CommandType.Text;
        insertCommand.Parameters.AddWithValue("@Bride_First_Name", clsBride.Bride_First_Name);
        insertCommand.Parameters.AddWithValue("@Bride_Middle_Int", clsBride.Bride_Middle_Int);
        insertCommand.Parameters.AddWithValue("@Bride_Last_Name", clsBride.Bride_Last_Name);
        try
        {
            connection.Open();
            int count = insertCommand.ExecuteNonQuery();
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
    }
Ejemplo n.º 12
0
    public static bool Update(Log oldLog,
                              Log newLog)
    {
        SqlConnection connection = MarriageData.GetConnection();
        string        updateStatement
            = "UPDATE "
              + "     [Log] "
              + "SET "
              + "     [User_Name] = @NewUser_Name "
              + "    ,[Note] = @NewNote "
              + "WHERE "
              + "     [Log_ID] = @OldLog_ID "
              + " AND [User_Name] = @OldUser_Name "
              + " AND [Note] = @OldNote "
              + "";
        SqlCommand updateCommand = new SqlCommand(updateStatement, connection);

        updateCommand.CommandType = CommandType.Text;
        updateCommand.Parameters.AddWithValue("@NewUser_Name", newLog.User_Name);
        updateCommand.Parameters.AddWithValue("@NewNote", newLog.Note);
        updateCommand.Parameters.AddWithValue("@OldLog_ID", oldLog.Log_ID);
        updateCommand.Parameters.AddWithValue("@OldUser_Name", oldLog.User_Name);
        updateCommand.Parameters.AddWithValue("@OldNote", oldLog.Note);
        try
        {
            connection.Open();
            int count = updateCommand.ExecuteNonQuery();
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
    }
Ejemplo n.º 13
0
    public static Log Select_Record(Log clsLogPara)
    {
        Log           clsLog     = new Log();
        SqlConnection connection = MarriageData.GetConnection();
        string        selectStatement
            = "SELECT "
              + "     [Log_ID] "
              + "    ,[User_Name] "
              + "    ,[Note] "
              + "FROM "
              + "     [Log] "
              + "WHERE "
              + "     [Log_ID] = @Log_ID "
              + "";
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        selectCommand.CommandType = CommandType.Text;
        selectCommand.Parameters.AddWithValue("@Log_ID", clsLogPara.Log_ID);
        try
        {
            connection.Open();
            SqlDataReader reader
                = selectCommand.ExecuteReader(CommandBehavior.SingleRow);
            if (reader.Read())
            {
                clsLog.Log_ID    = System.Convert.ToInt32(reader["Log_ID"]);
                clsLog.User_Name = System.Convert.ToString(reader["User_Name"]);
                clsLog.Note      = System.Convert.ToString(reader["Note"]);
            }
            else
            {
                clsLog = null;
            }
            reader.Close();
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
        return(clsLog);
    }
Ejemplo n.º 14
0
    public static Parish Select_Record(Parish clsParishPara)
    {
        Parish        clsParish  = new Parish();
        SqlConnection connection = MarriageData.GetConnection();
        string        selectStatement
            = "SELECT "
              + "     [Parish_ID] "
              + "    ,[ParishName] "
              + "    ,[KCSJDiocese] "
              + "FROM "
              + "     [Parish] "
              + "WHERE "
              + "     [Parish_ID] = @Parish_ID "
              + "";
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        selectCommand.CommandType = CommandType.Text;
        selectCommand.Parameters.AddWithValue("@Parish_ID", clsParishPara.Parish_ID);
        try
        {
            connection.Open();
            SqlDataReader reader
                = selectCommand.ExecuteReader(CommandBehavior.SingleRow);
            if (reader.Read())
            {
                clsParish.Parish_ID   = System.Convert.ToInt16(reader["Parish_ID"]);
                clsParish.ParishName  = System.Convert.ToString(reader["ParishName"]);
                clsParish.KCSJDiocese = System.Convert.ToBoolean(reader["KCSJDiocese"]);
            }
            else
            {
                clsParish = null;
            }
            reader.Close();
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
        return(clsParish);
    }
Ejemplo n.º 15
0
    public static bool Update(Parish oldParish,
                              Parish newParish)
    {
        SqlConnection connection = MarriageData.GetConnection();
        string        updateStatement
            = "UPDATE "
              + "     [Parish] "
              + "SET "
              + "     [ParishName] = @NewParishName "
              + "    ,[KCSJDiocese] = @NewKCSJDiocese "
              + "WHERE "
              + "     [Parish_ID] = @OldParish_ID "
              + " AND [ParishName] = @OldParishName "
              + " AND [KCSJDiocese] = @OldKCSJDiocese "
              + "";
        SqlCommand updateCommand = new SqlCommand(updateStatement, connection);

        updateCommand.CommandType = CommandType.Text;
        updateCommand.Parameters.AddWithValue("@NewParishName", newParish.ParishName);
        updateCommand.Parameters.AddWithValue("@NewKCSJDiocese", newParish.KCSJDiocese);
        updateCommand.Parameters.AddWithValue("@OldParish_ID", oldParish.Parish_ID);
        updateCommand.Parameters.AddWithValue("@OldParishName", oldParish.ParishName);
        updateCommand.Parameters.AddWithValue("@OldKCSJDiocese", oldParish.KCSJDiocese);
        try
        {
            connection.Open();
            int count = updateCommand.ExecuteNonQuery();
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
    }
Ejemplo n.º 16
0
    public static Dispensation Select_Record(Dispensation clsDispensationPara)
    {
        Dispensation  clsDispensation = new Dispensation();
        SqlConnection connection      = MarriageData.GetConnection();
        string        selectStatement
            = "SELECT "
              + "     [Dispensation_ID] "
              + "    ,[Dispensation_Category] "
              + "FROM "
              + "     [Dispensation] "
              + "WHERE "
              + "     [Dispensation_ID] = @Dispensation_ID "
              + "";
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        selectCommand.CommandType = CommandType.Text;
        selectCommand.Parameters.AddWithValue("@Dispensation_ID", clsDispensationPara.Dispensation_ID);
        try
        {
            connection.Open();
            SqlDataReader reader
                = selectCommand.ExecuteReader(CommandBehavior.SingleRow);
            if (reader.Read())
            {
                clsDispensation.Dispensation_ID       = System.Convert.ToInt32(reader["Dispensation_ID"]);
                clsDispensation.Dispensation_Category = System.Convert.ToString(reader["Dispensation_Category"]);
            }
            else
            {
                clsDispensation = null;
            }
            reader.Close();
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
        return(clsDispensation);
    }
Ejemplo n.º 17
0
    public static Catholic_Party Select_Record(Catholic_Party clsCatholic_PartyPara)
    {
        Catholic_Party clsCatholic_Party = new Catholic_Party();
        SqlConnection  connection        = MarriageData.GetConnection();
        string         selectStatement
            = "SELECT "
              + "     [Catholic_Party_ID] "
              + "    ,[Catholic_Party_Category] "
              + "FROM "
              + "     [Catholic_Party] "
              + "WHERE "
              + "     [Catholic_Party_ID] = @Catholic_Party_ID "
              + "";
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        selectCommand.CommandType = CommandType.Text;
        selectCommand.Parameters.AddWithValue("@Catholic_Party_ID", clsCatholic_PartyPara.Catholic_Party_ID);
        try
        {
            connection.Open();
            SqlDataReader reader
                = selectCommand.ExecuteReader(CommandBehavior.SingleRow);
            if (reader.Read())
            {
                clsCatholic_Party.Catholic_Party_ID       = System.Convert.ToInt16(reader["Catholic_Party_ID"]);
                clsCatholic_Party.Catholic_Party_Category = System.Convert.ToString(reader["Catholic_Party_Category"]);
            }
            else
            {
                clsCatholic_Party = null;
            }
            reader.Close();
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
        return(clsCatholic_Party);
    }
Ejemplo n.º 18
0
    public static Login Select_Record(Login clsLoginPara)
    {
        Login         clsLogin   = new Login();
        SqlConnection connection = MarriageData.GetConnection();
        string        selectStatement
            = "SELECT "
              + "     [User_Name] "
              + "    ,[Password] "
              + "FROM "
              + "     [Login] "
              + "WHERE "
              + "     [User_Name] = @User_Name "
              + "";
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        selectCommand.CommandType = CommandType.Text;
        selectCommand.Parameters.AddWithValue("@User_Name", clsLoginPara.User_Name);
        try
        {
            connection.Open();
            SqlDataReader reader
                = selectCommand.ExecuteReader(CommandBehavior.SingleRow);
            if (reader.Read())
            {
                clsLogin.User_Name = System.Convert.ToString(reader["User_Name"]);
                clsLogin.Password  = System.Convert.ToString(reader["Password"]);
            }
            else
            {
                clsLogin = null;
            }
            reader.Close();
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
        return(clsLogin);
    }
Ejemplo n.º 19
0
    public static bool Add(Log clsLog)
    {
        SqlConnection connection = MarriageData.GetConnection();
        string        insertStatement
            = "INSERT "
              + "     [Log] "
              + "     ( "
              + "     [User_Name] "
              + "    ,[Note] "
              + "     ) "
              + "VALUES "
              + "     ( "
              + "     @User_Name "
              + "    ,@Note "
              + "     ) "
              + "";
        SqlCommand insertCommand = new SqlCommand(insertStatement, connection);

        insertCommand.CommandType = CommandType.Text;
        insertCommand.Parameters.AddWithValue("@User_Name", clsLog.User_Name);
        insertCommand.Parameters.AddWithValue("@Note", clsLog.Note);
        try
        {
            connection.Open();
            int count = insertCommand.ExecuteNonQuery();
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
    }
Ejemplo n.º 20
0
    public static bool Delete(Bride clsBride)
    {
        SqlConnection connection = MarriageData.GetConnection();
        string        deleteStatement
            = "DELETE FROM "
              + "     [Bride] "
              + "WHERE "
              + "     [Bride_ID] = @OldBride_ID "
              + " AND [Bride_First_Name] = @OldBride_First_Name "
              + " AND [Bride_Middle_Int] = @OldBride_Middle_Int "
              + " AND [Bride_Last_Name] = @OldBride_Last_Name "
              + "";
        SqlCommand deleteCommand = new SqlCommand(deleteStatement, connection);

        deleteCommand.CommandType = CommandType.Text;
        deleteCommand.Parameters.AddWithValue("@OldBride_ID", clsBride.Bride_ID);
        deleteCommand.Parameters.AddWithValue("@OldBride_First_Name", clsBride.Bride_First_Name);
        deleteCommand.Parameters.AddWithValue("@OldBride_Middle_Int", clsBride.Bride_Middle_Int);
        deleteCommand.Parameters.AddWithValue("@OldBride_Last_Name", clsBride.Bride_Last_Name);
        try
        {
            connection.Open();
            int count = deleteCommand.ExecuteNonQuery();
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
    }
Ejemplo n.º 21
0
    public static bool Update(Catholic_Party oldCatholic_Party,
                              Catholic_Party newCatholic_Party)
    {
        SqlConnection connection = MarriageData.GetConnection();
        string        updateStatement
            = "UPDATE "
              + "     [Catholic_Party] "
              + "SET "
              + "     [Catholic_Party_Category] = @NewCatholic_Party_Category "
              + "WHERE "
              + "     [Catholic_Party_ID] = @OldCatholic_Party_ID "
              + " AND [Catholic_Party_Category] = @OldCatholic_Party_Category "
              + "";
        SqlCommand updateCommand = new SqlCommand(updateStatement, connection);

        updateCommand.CommandType = CommandType.Text;
        updateCommand.Parameters.AddWithValue("@NewCatholic_Party_Category", newCatholic_Party.Catholic_Party_Category);
        updateCommand.Parameters.AddWithValue("@OldCatholic_Party_ID", oldCatholic_Party.Catholic_Party_ID);
        updateCommand.Parameters.AddWithValue("@OldCatholic_Party_Category", oldCatholic_Party.Catholic_Party_Category);
        try
        {
            connection.Open();
            int count = updateCommand.ExecuteNonQuery();
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
    }
Ejemplo n.º 22
0
    public static bool Add(Catholic_Party clsCatholic_Party)
    {
        SqlConnection connection = MarriageData.GetConnection();
        string        insertStatement
            = "INSERT "
              + "     [Catholic_Party] "
              + "     ( "
              + "     [Catholic_Party_Category] "
              + "     ) "
              + "VALUES "
              + "     ( "
              + "     @Catholic_Party_Category "
              + "     ) "
              + "";
        SqlCommand insertCommand = new SqlCommand(insertStatement, connection);

        insertCommand.CommandType = CommandType.Text;
        insertCommand.Parameters.AddWithValue("@Catholic_Party_Category", clsCatholic_Party.Catholic_Party_Category);
        try
        {
            connection.Open();
            int count = insertCommand.ExecuteNonQuery();
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
    }
Ejemplo n.º 23
0
    public static bool Delete(Log clsLog)
    {
        SqlConnection connection = MarriageData.GetConnection();
        string        deleteStatement
            = "DELETE FROM "
              + "     [Log] "
              + "WHERE "
              + "     [Log_ID] = @OldLog_ID "
              + " AND [User_Name] = @OldUser_Name "
              + " AND [Note] = @OldNote "
              + "";
        SqlCommand deleteCommand = new SqlCommand(deleteStatement, connection);

        deleteCommand.CommandType = CommandType.Text;
        deleteCommand.Parameters.AddWithValue("@OldLog_ID", clsLog.Log_ID);
        deleteCommand.Parameters.AddWithValue("@OldUser_Name", clsLog.User_Name);
        deleteCommand.Parameters.AddWithValue("@OldNote", clsLog.Note);
        try
        {
            connection.Open();
            int count = deleteCommand.ExecuteNonQuery();
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
    }
Ejemplo n.º 24
0
    public static bool Delete(Parish clsParish)
    {
        SqlConnection connection = MarriageData.GetConnection();
        string        deleteStatement
            = "DELETE FROM "
              + "     [Parish] "
              + "WHERE "
              + "     [Parish_ID] = @OldParish_ID "
              + " AND [ParishName] = @OldParishName "
              + " AND [KCSJDiocese] = @OldKCSJDiocese "
              + "";
        SqlCommand deleteCommand = new SqlCommand(deleteStatement, connection);

        deleteCommand.CommandType = CommandType.Text;
        deleteCommand.Parameters.AddWithValue("@OldParish_ID", clsParish.Parish_ID);
        deleteCommand.Parameters.AddWithValue("@OldParishName", clsParish.ParishName);
        deleteCommand.Parameters.AddWithValue("@OldKCSJDiocese", clsParish.KCSJDiocese);
        try
        {
            connection.Open();
            int count = deleteCommand.ExecuteNonQuery();
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
    }
Ejemplo n.º 25
0
        public MarryOtherResult ChangeMarriageMessage(GameClient client, string strMessage)
        {
            MarryOtherResult result;

            if (-1 == client.ClientData.MyMarriageData.byMarrytype)
            {
                result = MarryOtherResult.NotMarriaged;
            }
            else if (strMessage.Length >= 64)
            {
                result = MarryOtherResult.MessageLimit;
            }
            else
            {
                client.ClientData.MyMarriageData.strLovemessage = strMessage;
                MarryFuBenMgr.UpdateMarriageData2DB(client);
                this.SendMarriageDataToClient(client, true);
                GameClient Spouseclient = GameManager.ClientMgr.FindClient(client.ClientData.MyMarriageData.nSpouseID);
                if (null != Spouseclient)
                {
                    Spouseclient.ClientData.MyMarriageData.strLovemessage = strMessage;
                    MarryFuBenMgr.UpdateMarriageData2DB(Spouseclient);
                    this.SendMarriageDataToClient(Spouseclient, true);
                }
                else
                {
                    string       tcpstring          = string.Format("{0}", client.ClientData.MyMarriageData.nSpouseID);
                    MarriageData SpouseMarriageData = Global.sendToDB <MarriageData, string>(10186, tcpstring, client.ServerId);
                    if (SpouseMarriageData == null || -1 == SpouseMarriageData.byMarrytype)
                    {
                        return(MarryOtherResult.Error);
                    }
                    MarryFuBenMgr.UpdateMarriageData2DB(client.ClientData.MyMarriageData.nSpouseID, SpouseMarriageData, client);
                }
                result = MarryOtherResult.Success;
            }
            return(result);
        }
Ejemplo n.º 26
0
    public static bool Delete(Catholic_Party clsCatholic_Party)
    {
        SqlConnection connection = MarriageData.GetConnection();
        string        deleteStatement
            = "DELETE FROM "
              + "     [Catholic_Party] "
              + "WHERE "
              + "     [Catholic_Party_ID] = @OldCatholic_Party_ID "
              + " AND [Catholic_Party_Category] = @OldCatholic_Party_Category "
              + "";
        SqlCommand deleteCommand = new SqlCommand(deleteStatement, connection);

        deleteCommand.CommandType = CommandType.Text;
        deleteCommand.Parameters.AddWithValue("@OldCatholic_Party_ID", clsCatholic_Party.Catholic_Party_ID);
        deleteCommand.Parameters.AddWithValue("@OldCatholic_Party_Category", clsCatholic_Party.Catholic_Party_Category);
        try
        {
            connection.Open();
            int count = deleteCommand.ExecuteNonQuery();
            if (count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        catch (SqlException ex)
        {
            throw ex;
        }
        finally
        {
            connection.Close();
        }
    }
Ejemplo n.º 27
0
    public static DataTable SelectAll()
    {
        SqlConnection connection = MarriageData.GetConnection();
        string        selectStatement
            = "SELECT "
              + "     [Bride I D] = [Bride].[Bride_ID] "
              + "    ,[Bride First Name] = [Bride].[Bride_First_Name] "
              + "    ,[Bride Middle Int] = [Bride].[Bride_Middle_Int] "
              + "    ,[Bride Last Name] = [Bride].[Bride_Last_Name] "
              + "FROM "
              + "     [Bride] "
              + "";
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        selectCommand.CommandType = CommandType.Text;
        DataTable dt = new DataTable();

        try
        {
            connection.Open();
            SqlDataReader reader = selectCommand.ExecuteReader();
            if (reader.HasRows)
            {
                dt.Load(reader);
            }
            reader.Close();
        }
        catch (SqlException)
        {
            return(dt);
        }
        finally
        {
            connection.Close();
        }
        return(dt);
    }
Ejemplo n.º 28
0
    public static DataTable Search(string sField, string sCondition, string sValue)
    {
        SqlConnection connection      = MarriageData.GetConnection();
        string        selectStatement = "";

        if (sCondition == "Contains")
        {
            selectStatement
                = "SELECT "
                  + "     [Log].[Log_ID] "
                  + "    ,[Log].[User_Name] "
                  + "    ,[Log].[Note] "
                  + "FROM "
                  + "     [Log] "
                  + "WHERE "
                  + "     (@Log_ID IS NULL OR @Log_ID = '' OR [Log].[Log_ID] LIKE '%' + LTRIM(RTRIM(@Log_ID)) + '%') "
                  + "AND   (@User_Name IS NULL OR @User_Name = '' OR [Log].[User_Name] LIKE '%' + LTRIM(RTRIM(@User_Name)) + '%') "
                  + "AND   (@Note IS NULL OR @Note = '' OR [Log].[Note] LIKE '%' + LTRIM(RTRIM(@Note)) + '%') "
                  + "";
        }
        else if (sCondition == "Equals")
        {
            selectStatement
                = "SELECT "
                  + "     [Log].[Log_ID] "
                  + "    ,[Log].[User_Name] "
                  + "    ,[Log].[Note] "
                  + "FROM "
                  + "     [Log] "
                  + "WHERE "
                  + "     (@Log_ID IS NULL OR @Log_ID = '' OR [Log].[Log_ID] = LTRIM(RTRIM(@Log_ID))) "
                  + "AND   (@User_Name IS NULL OR @User_Name = '' OR [Log].[User_Name] = LTRIM(RTRIM(@User_Name))) "
                  + "AND   (@Note IS NULL OR @Note = '' OR [Log].[Note] = LTRIM(RTRIM(@Note))) "
                  + "";
        }
        else if (sCondition == "Starts with...")
        {
            selectStatement
                = "SELECT "
                  + "     [Log].[Log_ID] "
                  + "    ,[Log].[User_Name] "
                  + "    ,[Log].[Note] "
                  + "FROM "
                  + "     [Log] "
                  + "WHERE "
                  + "     (@Log_ID IS NULL OR @Log_ID = '' OR [Log].[Log_ID] LIKE LTRIM(RTRIM(@Log_ID)) + '%') "
                  + "AND   (@User_Name IS NULL OR @User_Name = '' OR [Log].[User_Name] LIKE LTRIM(RTRIM(@User_Name)) + '%') "
                  + "AND   (@Note IS NULL OR @Note = '' OR [Log].[Note] LIKE LTRIM(RTRIM(@Note)) + '%') "
                  + "";
        }
        else if (sCondition == "More than...")
        {
            selectStatement
                = "SELECT "
                  + "     [Log].[Log_ID] "
                  + "    ,[Log].[User_Name] "
                  + "    ,[Log].[Note] "
                  + "FROM "
                  + "     [Log] "
                  + "WHERE "
                  + "     (@Log_ID IS NULL OR @Log_ID = '' OR [Log].[Log_ID] > LTRIM(RTRIM(@Log_ID))) "
                  + "AND   (@User_Name IS NULL OR @User_Name = '' OR [Log].[User_Name] > LTRIM(RTRIM(@User_Name))) "
                  + "AND   (@Note IS NULL OR @Note = '' OR [Log].[Note] > LTRIM(RTRIM(@Note))) "
                  + "";
        }
        else if (sCondition == "Less than...")
        {
            selectStatement
                = "SELECT "
                  + "     [Log].[Log_ID] "
                  + "    ,[Log].[User_Name] "
                  + "    ,[Log].[Note] "
                  + "FROM "
                  + "     [Log] "
                  + "WHERE "
                  + "     (@Log_ID IS NULL OR @Log_ID = '' OR [Log].[Log_ID] < LTRIM(RTRIM(@Log_ID))) "
                  + "AND   (@User_Name IS NULL OR @User_Name = '' OR [Log].[User_Name] < LTRIM(RTRIM(@User_Name))) "
                  + "AND   (@Note IS NULL OR @Note = '' OR [Log].[Note] < LTRIM(RTRIM(@Note))) "
                  + "";
        }
        else if (sCondition == "Equal or more than...")
        {
            selectStatement
                = "SELECT "
                  + "     [Log].[Log_ID] "
                  + "    ,[Log].[User_Name] "
                  + "    ,[Log].[Note] "
                  + "FROM "
                  + "     [Log] "
                  + "WHERE "
                  + "     (@Log_ID IS NULL OR @Log_ID = '' OR [Log].[Log_ID] >= LTRIM(RTRIM(@Log_ID))) "
                  + "AND   (@User_Name IS NULL OR @User_Name = '' OR [Log].[User_Name] >= LTRIM(RTRIM(@User_Name))) "
                  + "AND   (@Note IS NULL OR @Note = '' OR [Log].[Note] >= LTRIM(RTRIM(@Note))) "
                  + "";
        }
        else if (sCondition == "Equal or less than...")
        {
            selectStatement
                = "SELECT "
                  + "     [Log].[Log_ID] "
                  + "    ,[Log].[User_Name] "
                  + "    ,[Log].[Note] "
                  + "FROM "
                  + "     [Log] "
                  + "WHERE "
                  + "     (@Log_ID IS NULL OR @Log_ID = '' OR [Log].[Log_ID] <= LTRIM(RTRIM(@Log_ID))) "
                  + "AND   (@User_Name IS NULL OR @User_Name = '' OR [Log].[User_Name] <= LTRIM(RTRIM(@User_Name))) "
                  + "AND   (@Note IS NULL OR @Note = '' OR [Log].[Note] <= LTRIM(RTRIM(@Note))) "
                  + "";
        }
        SqlCommand selectCommand = new SqlCommand(selectStatement, connection);

        selectCommand.CommandType = CommandType.Text;
        if (sField == "Log I D")
        {
            selectCommand.Parameters.AddWithValue("@Log_ID", sValue);
        }
        else
        {
            selectCommand.Parameters.AddWithValue("@Log_ID", DBNull.Value);
        }
        if (sField == "User Name")
        {
            selectCommand.Parameters.AddWithValue("@User_Name", sValue);
        }
        else
        {
            selectCommand.Parameters.AddWithValue("@User_Name", DBNull.Value);
        }
        if (sField == "Note")
        {
            selectCommand.Parameters.AddWithValue("@Note", sValue);
        }
        else
        {
            selectCommand.Parameters.AddWithValue("@Note", DBNull.Value);
        }
        DataTable dt = new DataTable();

        try
        {
            connection.Open();
            SqlDataReader reader = selectCommand.ExecuteReader();
            if (reader.HasRows)
            {
                dt.Load(reader);
            }
            reader.Close();
        }
        catch (SqlException)
        {
            return(dt);
        }
        finally
        {
            connection.Close();
        }
        return(dt);
    }
Ejemplo n.º 29
0
        public MarryPartyResult MarryPartyCreate(GameClient client, int partyType, long startTime)
        {
            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                return(MarryPartyResult.NotOpen);
            }

            MarryPartyConfigData configData = GetMarryPartyConfigData(partyType);

            if (null == configData)
            {
                return(MarryPartyResult.InvalidParam);
            }

            MarriageData marryData = client.ClientData.MyMarriageData;

            if (marryData.nSpouseID < 0 || marryData.byMarrytype < 0)
            {
                return(MarryPartyResult.NotMarry);
            }

            int    husbandRoleID = 0;
            int    wifeRoleID    = 0;
            string husbandName   = "";
            string wifeName      = "";

            if (1 == marryData.byMarrytype)
            {
                husbandRoleID = client.ClientData.RoleID;
                husbandName   = client.ClientData.RoleName;
                wifeRoleID    = marryData.nSpouseID;
                wifeName      = MarryLogic.GetRoleName(marryData.nSpouseID);
            }
            else
            {
                husbandRoleID = marryData.nSpouseID;
                husbandName   = MarryLogic.GetRoleName(marryData.nSpouseID);
                wifeRoleID    = client.ClientData.RoleID;
                wifeName      = client.ClientData.RoleName;
            }

            // 必须先添加,以防夫妻重复举行婚宴。。。想不通为什么找我
            MarryPartyData partyData = m_MarryPartyDataCache.AddParty(client.ClientData.RoleID, partyType, startTime, husbandRoleID, wifeRoleID, husbandName, wifeName);

            if (partyData == null)
            {
                return(MarryPartyResult.AlreadyRequest);
            }

            MarryPartyResult result = MarryPartyResult.Success;

            byte[] byteData = null;
            TCPProcessCmdResults dbResult =
                Global.RequestToDBServer3(Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool,
                                          (int)TCPGameServerCmds.CMD_DB_MARRY_PARTY_ADD,
                                          string.Format("{0}:{1}:{2}:{3}:{4}:{5}:{6}", client.ClientData.RoleID, partyType, startTime, husbandRoleID, wifeRoleID, husbandName, wifeName),
                                          out byteData,
                                          client.ServerId
                                          );

            if (TCPProcessCmdResults.RESULT_FAILED == dbResult || null == byteData || byteData.Length <= 6)
            {
                result = MarryPartyResult.AlreadyRequest;
            }

            if (result == MarryPartyResult.Success)
            {
                // 检查举办所需金币是否足够
                if (configData.PartyCost > Global.GetTotalBindTongQianAndTongQianVal(client))
                {
                    result = MarryPartyResult.NotEnoughMoney;
                }
                if (configData.PartyCost > 0)
                {
                    // 扣除举办所需金币
                    if (Global.SubBindTongQianAndTongQian(client, configData.PartyCost, "举办婚宴") == false)
                    {
                        result = MarryPartyResult.NotEnoughMoney;
                    }
                }
            }

            if (result != MarryPartyResult.Success)
            {
                if (dbResult != TCPProcessCmdResults.RESULT_FAILED)
                {
                    try
                    {
                        Global.SendAndRecvData((int)TCPGameServerCmds.CMD_DB_MARRY_PARTY_REMOVE,
                                               string.Format("{0}", client.ClientData.RoleID),
                                               client.ServerId
                                               );
                    }
                    catch (Exception)
                    {
                    }
                }
                m_MarryPartyDataCache.RemoveParty(client.ClientData.RoleID);
                return(result);
            }

            Int32          length      = BitConverter.ToInt32(byteData, 0);
            MarryPartyData dbPartyData = DataHelper.BytesToObject <MarryPartyData>(byteData, 6, length - 2);

            m_MarryPartyDataCache.SetPartyTime(partyData, dbPartyData.StartTime);

            SendMarryPartyList(client, partyData);

            //lock (MarryPartyNPCShowMutex)
            //{
            //    if (MarryPartyNPCShow == false)
            //    {
            //        // TODO: add npc
            //        MarryPartyNPCShow = true;
            //    }
            //}

            return(result);
        }
Ejemplo n.º 30
0
        public static MarryResult MarryDivorce(GameClient client, MarryDivorceType divorceType)
        {
            MarryResult result;

            if (!MarryLogic.IsVersionSystemOpenOfMarriage())
            {
                result = MarryResult.NotOpen;
            }
            else if (0 >= client.ClientData.MyMarriageData.byMarrytype)
            {
                result = MarryResult.NotMarried;
            }
            else if (!SingletonTemplate <CoupleArenaManager> .Instance().IsNowCanDivorce(TimeUtil.NowDateTime()))
            {
                result = MarryResult.DeniedByCoupleAreanTime;
            }
            else
            {
                int        spouseID     = client.ClientData.MyMarriageData.nSpouseID;
                GameClient spouseClient = GameManager.ClientMgr.FindClient(spouseID);
                if (divorceType == MarryDivorceType.DivorceForce || divorceType == MarryDivorceType.DivorceFree || divorceType == MarryDivorceType.DivorceFreeAccept)
                {
                    if (client.ClientData.ExchangeID > 0 || client.ClientSocket.IsKuaFuLogin || client.ClientData.CopyMapID > 0)
                    {
                        return(MarryResult.SelfBusy);
                    }
                    if (-1 != client.ClientData.FuBenID && MapTypes.MarriageCopy == Global.GetMapType(client.ClientData.MapCode))
                    {
                        return(MarryResult.SelfBusy);
                    }
                    if (null != spouseClient)
                    {
                        if (-1 != spouseClient.ClientData.FuBenID && MapTypes.MarriageCopy == Global.GetMapType(spouseClient.ClientData.MapCode))
                        {
                            return(MarryResult.TargetBusy);
                        }
                    }
                    if (divorceType == MarryDivorceType.DivorceForce || divorceType == MarryDivorceType.DivorceFree)
                    {
                        if (MarryLogic.ApplyExist(client.ClientData.RoleID))
                        {
                            return(MarryResult.SelfBusy);
                        }
                    }
                }
                int _man  = client.ClientData.RoleID;
                int _wife = spouseID;
                if (client.ClientData.MyMarriageData.byMarrytype == 2)
                {
                    DataHelper2.Swap <int>(ref _man, ref _wife);
                }
                if (divorceType == MarryDivorceType.DivorceForce)
                {
                    if (client.ClientData.UserMoney < MarryLogic.DivorceForceCost)
                    {
                        return(MarryResult.MoneyNotEnough);
                    }
                    if (!SingletonTemplate <CoupleWishManager> .Instance().PreClearDivorceData(_man, _wife))
                    {
                        return(MarryResult.NotOpen);
                    }
                    if (!SingletonTemplate <CoupleArenaManager> .Instance().PreClearDivorceData(_man, _wife))
                    {
                        return(MarryResult.NotOpen);
                    }
                    if (!GameManager.ClientMgr.SubUserMoney(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, client, MarryLogic.DivorceForceCost, "强制离婚", false, true, false, DaiBiSySType.None))
                    {
                    }
                    client.ClientData.MyMarriageData.byMarrytype = -1;
                    client.ClientData.MyMarriageData.nSpouseID   = -1;
                    MarryFuBenMgr.UpdateMarriageData2DB(client);
                    MarriageOtherLogic.getInstance().ResetRingAttr(client);
                    if (null != spouseClient)
                    {
                        spouseClient.ClientData.MyMarriageData.nSpouseID   = -1;
                        spouseClient.ClientData.MyMarriageData.byMarrytype = -1;
                        MarryFuBenMgr.UpdateMarriageData2DB(spouseClient);
                        MarriageOtherLogic.getInstance().ResetRingAttr(spouseClient);
                        MarriageOtherLogic.getInstance().SendMarriageDataToClient(spouseClient, true);
                        if (spouseClient._IconStateMgr.CheckJieRiFanLi(spouseClient, ActivityTypes.JieriMarriage))
                        {
                            spouseClient._IconStateMgr.AddFlushIconState(14000, spouseClient._IconStateMgr.IsAnyJieRiTipActived());
                            spouseClient._IconStateMgr.SendIconStateToClient(spouseClient);
                        }
                    }
                    else
                    {
                        string       tcpstring          = string.Format("{0}", spouseID);
                        MarriageData spouseMarriageData = Global.sendToDB <MarriageData, string>(10186, tcpstring, client.ServerId);
                        if (spouseMarriageData != null && 0 < spouseMarriageData.byMarrytype)
                        {
                            spouseMarriageData.byMarrytype = -1;
                            spouseMarriageData.nSpouseID   = -1;
                            MarryFuBenMgr.UpdateMarriageData2DB(spouseID, spouseMarriageData, client);
                        }
                    }
                    MarryPartyLogic.getInstance().MarryPartyRemove(client.ClientData.RoleID, true, client);
                    MarryPartyLogic.getInstance().MarryPartyRemove(spouseID, true, client);
                    MarriageOtherLogic.getInstance().SendMarriageDataToClient(client, true);
                    if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriMarriage))
                    {
                        client._IconStateMgr.AddFlushIconState(14000, client._IconStateMgr.IsAnyJieRiTipActived());
                        client._IconStateMgr.SendIconStateToClient(client);
                    }
                    string msg = string.Format(GLang.GetLang(486, new object[0]), client.ClientData.RoleName);
                    MarryLogic.SendDivorceMail(spouseID, GLang.GetLang(487, new object[0]), msg, spouseClient, client.ServerId);
                    SingletonTemplate <CoupleArenaManager> .Instance().OnDivorce(client.ClientData.RoleID, spouseID);
                }
                else if (divorceType == MarryDivorceType.DivorceFree)
                {
                    if (null == spouseClient)
                    {
                        return(MarryResult.TargetOffline);
                    }
                    if (spouseClient.ClientData.ExchangeID > 0 || spouseClient.ClientSocket.IsKuaFuLogin || spouseClient.ClientData.CopyMapID > 0)
                    {
                        return(MarryResult.TargetBusy);
                    }
                    if (Global.GetTotalBindTongQianAndTongQianVal(client) < MarryLogic.DivorceCost)
                    {
                        return(MarryResult.MoneyNotEnough);
                    }
                    if (!Global.SubBindTongQianAndTongQian(client, MarryLogic.DivorceCost, "申请离婚"))
                    {
                        return(MarryResult.MoneyNotEnough);
                    }
                    MarryLogic.AddMarryApply(client.ClientData.RoleID, MarryApplyType.ApplyDivorce, spouseID);
                    string notifyData = string.Format("{0}:{1}", client.ClientData.RoleID, 1);
                    spouseClient.sendCmd(892, notifyData, false);
                    SingletonTemplate <CoupleArenaManager> .Instance().OnSpouseRequestDivorce(spouseClient, client);
                }
                else
                {
                    if (null == spouseClient)
                    {
                        return(MarryResult.TargetOffline);
                    }
                    if (!MarryLogic.RemoveMarryApply(spouseID, MarryApplyType.ApplyDivorce))
                    {
                        return(MarryResult.ApplyTimeout);
                    }
                    MarryLogic.RemoveMarryApply(spouseID, MarryApplyType.ApplyNull);
                    if (divorceType == MarryDivorceType.DivorceFreeAccept)
                    {
                        if (SingletonTemplate <CoupleWishManager> .Instance().PreClearDivorceData(_man, _wife) && SingletonTemplate <CoupleArenaManager> .Instance().PreClearDivorceData(_man, _wife))
                        {
                            client.ClientData.MyMarriageData.byMarrytype       = -1;
                            client.ClientData.MyMarriageData.nSpouseID         = -1;
                            spouseClient.ClientData.MyMarriageData.byMarrytype = -1;
                            spouseClient.ClientData.MyMarriageData.nSpouseID   = -1;
                            MarryFuBenMgr.UpdateMarriageData2DB(client);
                            MarryFuBenMgr.UpdateMarriageData2DB(spouseClient);
                            MarriageOtherLogic.getInstance().SendMarriageDataToClient(client, true);
                            MarriageOtherLogic.getInstance().SendMarriageDataToClient(spouseClient, true);
                            MarriageOtherLogic.getInstance().ResetRingAttr(client);
                            MarriageOtherLogic.getInstance().ResetRingAttr(spouseClient);
                            MarryPartyLogic.getInstance().MarryPartyRemove(client.ClientData.RoleID, true, client);
                            MarryPartyLogic.getInstance().MarryPartyRemove(spouseID, true, client);
                            if (client._IconStateMgr.CheckJieRiFanLi(client, ActivityTypes.JieriMarriage))
                            {
                                client._IconStateMgr.AddFlushIconState(14000, client._IconStateMgr.IsAnyJieRiTipActived());
                                client._IconStateMgr.SendIconStateToClient(client);
                            }
                            if (spouseClient._IconStateMgr.CheckJieRiFanLi(spouseClient, ActivityTypes.JieriMarriage))
                            {
                                spouseClient._IconStateMgr.AddFlushIconState(14000, spouseClient._IconStateMgr.IsAnyJieRiTipActived());
                                spouseClient._IconStateMgr.SendIconStateToClient(spouseClient);
                            }
                            SingletonTemplate <CoupleArenaManager> .Instance().OnDivorce(client.ClientData.RoleID, spouseID);
                        }
                        else
                        {
                            GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, spouseClient, MarryLogic.DivorceCost, "自由离婚拒绝返还绑金", false);
                            GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(488, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0);
                            GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, spouseClient, StringUtil.substitute(GLang.GetLang(488, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0);
                        }
                    }
                    else if (divorceType == MarryDivorceType.DivorceFreeReject)
                    {
                        GameManager.ClientMgr.AddMoney1(Global._TCPManager.MySocketListener, Global._TCPManager.tcpClientPool, Global._TCPManager.TcpOutPacketPool, spouseClient, MarryLogic.DivorceCost, "自由离婚拒绝返还绑金", false);
                        string notifyData = string.Format("{0}:{1}", client.ClientData.RoleID, 3);
                        spouseClient.sendCmd(892, notifyData, false);
                    }
                }
                result = MarryResult.Success;
            }
            return(result);
        }